From clattner at apple.com Mon Jun 23 00:46:15 2008 From: clattner at apple.com (Chris Lattner) Date: Sun, 22 Jun 2008 22:46:15 -0700 Subject: [llvm-commits] [llvm] r51775 - in /llvm/trunk: Makefile.rules include/llvm/Analysis/AliasAnalysis.h include/llvm/Analysis/AliasSetTracker.h include/llvm/Analysis/CallGraph.h include/llvm/Analysis/LibCallSemantics.h include/llvm/Assembly/PrintModulePass.h include/llvm/CodeGen/MachineRelocation.h include/llvm/Support/CallSite.h include/llvm/Target/TargetMachineRegistry.h include/llvm/Transforms/IPO/InlinerPass.h include/llvm/Transforms/Utils/Cloning.h include/llvm/Transforms/Utils/InlineCost.h utils/GenLibDeps.pl In-Reply-To: <8097D09A-A635-4490-9BAE-BBFB007EF4ED@Sun.COM> References: <200805301716.m4UHGLmT030912@zion.cs.uiuc.edu> <82E7B7B4-42AA-4D68-9987-19060695E8C8@apple.com> <8097D09A-A635-4490-9BAE-BBFB007EF4ED@Sun.COM> Message-ID: On Jun 1, 2008, at 4:38 PM, Nathan Keynes wrote: > On 31/05/2008, at 6:21 AM, Chris Lattner wrote: >> On May 30, 2008, at 1:01 PM, Evan Cheng wrote: >> >>> Yeah, it's probably better to add a '_' after the names to avoid >>> name >>> clashing. If this bothers you, I can undo the patch. >>> >>> Nathan, can you try a different approach? >> >> I think this should be reverted for now. Nathan, is it possible to >> just sprinkle "#undef CS" etc in a few headers? > > Hi Chris, > > I don't really recommend changing system definitions in publicly > exported header files[0] (which these are of course), but if you'd > prefer to do it this way, patches are below (To be combined with 1+3 > from the previous series). In the alternative I'm happy to rename > them to something else (whatever the preference here is, CS_ ? > SomeRelevantPrefixCS?) Hey Nathan, sorry for the delay, I'm way behind on email. I strongly prefer to modify these definitions: if solaris was C compliant, it wouldn't be exporting symbols like this outside the system namespace. The problem with just changing all the LLVM code to avoid these names is that they will be reintroduced later. Is there any way to turn these macros off in the header that defines them (e.g. with a -D flag)? I'm not super thrilled with putting the #undef's in a bunch of random llvm header files. Which header is causing these to be pulled in? Are these definitions pulled in by DataTypes.h? If so, we could undef all of them in DataTypes.h and that would "fix" most higher-level .h files. Another option would be to make a special header that undef's these, and make the llvm build process "-include" this header when building for solaris. This would probably be the most robust way to go. -Chris From clattner at apple.com Mon Jun 23 00:56:42 2008 From: clattner at apple.com (Chris Lattner) Date: Sun, 22 Jun 2008 22:56:42 -0700 Subject: [llvm-commits] [llvm] r51934 - in /llvm/trunk: include/llvm/CodeGen/LiveInterval.h include/llvm/CodeGen/LiveStackAnalysis.h include/llvm/CodeGen/MachineFrameInfo.h include/llvm/CodeGen/Passes.h lib/CodeGen/LLVMTargetMachine.cpp lib/CodeGen/LiveInterval.cpp lib/CodeGen/LiveIntervalAnalysis.cpp lib/CodeGen/LiveStackAnalysis.cpp lib/CodeGen/RegAllocLinearScan.cpp lib/CodeGen/StackSlotColoring.cpp In-Reply-To: <200806040918.m549Ig4X026263@zion.cs.uiuc.edu> References: <200806040918.m549Ig4X026263@zion.cs.uiuc.edu> Message-ID: <12F3E4C4-098D-4E55-9F7F-9318060EBC5D@apple.com> On Jun 4, 2008, at 2:18 AM, Evan Cheng wrote: > URL: http://llvm.org/viewvc/llvm-project?rev=51934&view=rev > Log: > Add a stack slot coloring pass. Not yet enabled. Very nice Evan, > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/include/llvm/CodeGen/LiveInterval.h (original) > +++ llvm/trunk/include/llvm/CodeGen/LiveInterval.h Wed Jun 4 > 04:18:41 2008 > @@ -35,6 +35,7 @@ > /// merge point), it contains ~0u,x. If the value number is not in > use, it > /// contains ~1u,x to indicate that the value # is not used. > /// def - Instruction # of the definition. > + /// - or reg # of the definition if it's a stack slot > liveinterval. > /// copy - Copy iff val# is defined by a copy; zero otherwise. > /// hasPHIKill - One or more of the kills are PHI nodes. > /// kills - Instruction # of the kills. > @@ -100,15 +101,16 @@ > typedef SmallVector Ranges; > typedef SmallVector VNInfoList; > > - unsigned reg; // the register of this interval > + bool isSS; // True if this represents a stack slot > + unsigned reg; // the register or stack slot of this > interval isSS? Why do you need this? You're bloating all LiveInterval's for this flag. > +++ llvm/trunk/lib/CodeGen/StackSlotColoring.cpp Wed Jun 4 04:18:41 > 2008 > @@ -0,0 +1,271 @@ > +//===-- StackSlotColoring.cpp - Sinking for machine instructions > ----------===// Plz update comment. > +#define DEBUG_TYPE "stackcoloring" > +#include "llvm/CodeGen/LiveStackAnalysis.h" > +#include "llvm/CodeGen/MachineFrameInfo.h" > +#include "llvm/CodeGen/Passes.h" Passes.h is the primary header for this file, please include it first. > +static cl::opt > +DisableSharing("no-stack-slot-sharing", > + cl::init(false), cl::Hidden, > + cl::desc("Surpress slot sharing during stack > coloring")); > + > +static cl::opt > +DeleteLimit("slot-delete-limit", cl::init(-1), cl::Hidden, > + cl::desc("Stack coloring slot deletion limit")); What is DeleteLimit? Does DisableSharing disable the whole pass? > +/// Colorslots - Color all spill stack slots and rewrite all > frameindex machine > +/// operands in the function. > +bool StackSlotColoring::ColorSlots(MachineFunction &MF) { > + unsigned NumObjs = MFI->getObjectIndexEnd(); > + std::vector SlotMapping(NumObjs, -1); > + SlotMapping.resize(NumObjs, -1); Is the resize dead/redundant with the ctor? Overall, very nice. -Chris From resistor at mac.com Mon Jun 23 01:13:13 2008 From: resistor at mac.com (Owen Anderson) Date: Mon, 23 Jun 2008 06:13:13 -0000 Subject: [llvm-commits] [llvm] r52618 - /llvm/trunk/lib/Transforms/Scalar/ADCE.cpp Message-ID: <200806230613.m5N6DDGa011016@zion.cs.uiuc.edu> Author: resistor Date: Mon Jun 23 01:13:12 2008 New Revision: 52618 URL: http://llvm.org/viewvc/llvm-project?rev=52618&view=rev Log: At Chris' suggestion, move the liveness and worklist datastructures into instance variables so they can be allocated just once, and reuse the worklist as the dead list as well. Modified: llvm/trunk/lib/Transforms/Scalar/ADCE.cpp Modified: llvm/trunk/lib/Transforms/Scalar/ADCE.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/ADCE.cpp?rev=52618&r1=52617&r2=52618&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/ADCE.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/ADCE.cpp Mon Jun 23 01:13:12 2008 @@ -22,6 +22,7 @@ #include "llvm/Support/InstIterator.h" #include "llvm/ADT/Statistic.h" #include "llvm/ADT/SmallPtrSet.h" +#include "llvm/ADT/SmallVector.h" using namespace llvm; @@ -32,6 +33,9 @@ static char ID; // Pass identification, replacement for typeid ADCE() : FunctionPass((intptr_t)&ID) {} + SmallPtrSet alive; + SmallVector worklist; + virtual bool runOnFunction(Function& F); virtual void getAnalysisUsage(AnalysisUsage& AU) const { @@ -45,8 +49,8 @@ static RegisterPass X("adce", "Aggressive Dead Code Elimination"); bool ADCE::runOnFunction(Function& F) { - SmallPtrSet alive; - std::vector worklist; + alive.clear(); + worklist.clear(); // Collect the set of "root" instructions that are known live. for (inst_iterator I = inst_begin(F), E = inst_end(F); I != E; ++I) @@ -71,20 +75,20 @@ // The inverse of the live set is the dead set. These are those instructions // which have no side effects and do not influence the control flow or return // value of the function, and may therefore be deleted safely. - SmallPtrSet dead; + // NOTE: We reuse the worklist vector here for memory efficiency. for (inst_iterator I = inst_begin(F), E = inst_end(F); I != E; ++I) if (!alive.count(I.getInstructionIterator())) { - dead.insert(I.getInstructionIterator()); + worklist.push_back(I.getInstructionIterator()); I->dropAllReferences(); } - for (SmallPtrSet::iterator I = dead.begin(), - E = dead.end(); I != E; ++I) { + for (SmallVector::iterator I = worklist.begin(), + E = worklist.end(); I != E; ++I) { NumRemoved++; (*I)->eraseFromParent(); } - return !dead.empty(); + return !worklist.empty(); } FunctionPass *llvm::createAggressiveDCEPass() { From isanbard at gmail.com Mon Jun 23 01:16:31 2008 From: isanbard at gmail.com (Bill Wendling) Date: Mon, 23 Jun 2008 06:16:31 -0000 Subject: [llvm-commits] [llvm] r52619 - /llvm/trunk/test/CodeGen/X86/2008-06-13-VolatileLoadStore.ll Message-ID: <200806230616.m5N6GV2s011160@zion.cs.uiuc.edu> Author: void Date: Mon Jun 23 01:16:31 2008 New Revision: 52619 URL: http://llvm.org/viewvc/llvm-project?rev=52619&view=rev Log: Make test work on non-x86 machines (like my G4 PPC). Modified: llvm/trunk/test/CodeGen/X86/2008-06-13-VolatileLoadStore.ll Modified: llvm/trunk/test/CodeGen/X86/2008-06-13-VolatileLoadStore.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/2008-06-13-VolatileLoadStore.ll?rev=52619&r1=52618&r2=52619&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/X86/2008-06-13-VolatileLoadStore.ll (original) +++ llvm/trunk/test/CodeGen/X86/2008-06-13-VolatileLoadStore.ll Mon Jun 23 01:16:31 2008 @@ -1,5 +1,5 @@ -; RUN: llvm-as < %s | llc -march=x86 | grep movsd | count 5 -; RUN: llvm-as < %s | llc -march=x86 | grep movl | count 2 +; RUN: llvm-as < %s | llc -march=x86 -mattr=+sse2 | grep movsd | count 5 +; RUN: llvm-as < %s | llc -march=x86 -mattr=+sse2 | grep movl | count 2 @atomic = global double 0.000000e+00 ; [#uses=1] @atomic2 = global double 0.000000e+00 ; [#uses=1] From anton at korobeynikov.info Mon Jun 23 09:11:46 2008 From: anton at korobeynikov.info (Anton Korobeynikov) Date: Mon, 23 Jun 2008 18:11:46 +0400 Subject: [llvm-commits] [llvm] r51775 - in /llvm/trunk: Makefile.rules include/llvm/Analysis/AliasAnalysis.h include/llvm/Analysis/AliasSetTracker.h include/llvm/Analysis/CallGraph.h include/llvm/Analysis/LibCallSemantics.h include/llvm/Assembly/PrintModu Message-ID: Hi, Everyone Just my 5 cents: On Mon, Jun 23, 2008 at 9:46 AM, Chris Lattner wrote: > On Jun 1, 2008, at 4:38 PM, Nathan Keynes wrote: > Another option would be to make a special header that undef's these, > and make the llvm build process "-include" this header when building > for solaris. This would probably be the most robust way to go. I'd strongly prefer this way -- With best regards, Anton Korobeynikov Faculty of Mathematics and Mechanics, Saint Petersburg State University From baldrick at free.fr Mon Jun 23 09:19:46 2008 From: baldrick at free.fr (Duncan Sands) Date: Mon, 23 Jun 2008 14:19:46 -0000 Subject: [llvm-commits] [llvm] r52620 - in /llvm/trunk/lib/CodeGen/SelectionDAG: LegalizeFloatTypes.cpp LegalizeIntegerTypes.cpp LegalizeTypes.h LegalizeTypesGeneric.cpp LegalizeVectorTypes.cpp Message-ID: <200806231419.m5NEJkCH007046@zion.cs.uiuc.edu> Author: baldrick Date: Mon Jun 23 09:19:45 2008 New Revision: 52620 URL: http://llvm.org/viewvc/llvm-project?rev=52620&view=rev Log: Cleanup up LegalizeTypes handling of loads and stores. Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeFloatTypes.cpp llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.h llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypesGeneric.cpp llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeFloatTypes.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeFloatTypes.cpp?rev=52620&r1=52619&r2=52620&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeFloatTypes.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeFloatTypes.cpp Mon Jun 23 09:19:45 2008 @@ -415,8 +415,8 @@ void DAGTypeLegalizer::ExpandFloatRes_LOAD(SDNode *N, SDOperand &Lo, SDOperand &Hi) { - if (ISD::isNON_EXTLoad(N)) { - ExpandRes_NON_EXTLOAD(N, Lo, Hi); + if (ISD::isNormalLoad(N)) { + ExpandRes_NormalLoad(N, Lo, Hi); return; } @@ -502,8 +502,8 @@ } SDOperand DAGTypeLegalizer::ExpandFloatOp_STORE(SDNode *N, unsigned OpNo) { - if (ISD::isNON_TRUNCStore(N)) - return ExpandOp_NON_TRUNCStore(N, OpNo); + if (ISD::isNormalStore(N)) + return ExpandOp_NormalStore(N, OpNo); assert(ISD::isUNINDEXEDStore(N) && "Indexed store during type legalization!"); assert(OpNo == 1 && "Can only expand the stored value so far"); Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp?rev=52620&r1=52619&r2=52620&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp Mon Jun 23 09:19:45 2008 @@ -192,7 +192,7 @@ } SDOperand DAGTypeLegalizer::PromoteIntRes_LOAD(LoadSDNode *N) { - // FIXME: Add support for indexed loads. + assert(ISD::isUNINDEXEDLoad(N) && "Indexed load during type legalization!"); MVT NVT = TLI.getTypeToTransformTo(N->getValueType(0)); ISD::LoadExtType ExtType = ISD::isNON_EXTLoad(N) ? ISD::EXTLOAD : N->getExtensionType(); @@ -636,7 +636,7 @@ } SDOperand DAGTypeLegalizer::PromoteIntOp_STORE(StoreSDNode *N, unsigned OpNo){ - // FIXME: Add support for indexed stores. + assert(ISD::isUNINDEXEDStore(N) && "Indexed store during type legalization!"); SDOperand Ch = N->getChain(), Ptr = N->getBasePtr(); int SVOffset = N->getSrcValueOffset(); unsigned Alignment = N->getAlignment(); @@ -1000,8 +1000,8 @@ void DAGTypeLegalizer::ExpandIntRes_LOAD(LoadSDNode *N, SDOperand &Lo, SDOperand &Hi) { - if (ISD::isNON_EXTLoad(N)) { - ExpandRes_NON_EXTLOAD(N, Lo, Hi); + if (ISD::isNormalLoad(N)) { + ExpandRes_NormalLoad(N, Lo, Hi); return; } @@ -1860,8 +1860,8 @@ } SDOperand DAGTypeLegalizer::ExpandIntOp_STORE(StoreSDNode *N, unsigned OpNo) { - if (ISD::isNON_TRUNCStore(N)) - return ExpandOp_NON_TRUNCStore(N, OpNo); + if (ISD::isNormalStore(N)) + return ExpandOp_NormalStore(N, OpNo); assert(ISD::isUNINDEXEDStore(N) && "Indexed store during type legalization!"); assert(OpNo == 1 && "Can only expand the stored value so far"); Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.h?rev=52620&r1=52619&r2=52620&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.h (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.h Mon Jun 23 09:19:45 2008 @@ -465,13 +465,13 @@ void ExpandRes_BIT_CONVERT (SDNode *N, SDOperand &Lo, SDOperand &Hi); void ExpandRes_BUILD_PAIR (SDNode *N, SDOperand &Lo, SDOperand &Hi); void ExpandRes_EXTRACT_VECTOR_ELT(SDNode *N, SDOperand &Lo, SDOperand &Hi); - void ExpandRes_NON_EXTLOAD (SDNode *N, SDOperand &Lo, SDOperand &Hi); + void ExpandRes_NormalLoad (SDNode *N, SDOperand &Lo, SDOperand &Hi); // Generic Operand Expansion. SDOperand ExpandOp_BIT_CONVERT (SDNode *N); SDOperand ExpandOp_BUILD_VECTOR (SDNode *N); SDOperand ExpandOp_EXTRACT_ELEMENT(SDNode *N); - SDOperand ExpandOp_NON_TRUNCStore (SDNode *N, unsigned OpNo); + SDOperand ExpandOp_NormalStore (SDNode *N, unsigned OpNo); }; Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypesGeneric.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypesGeneric.cpp?rev=52620&r1=52619&r2=52620&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypesGeneric.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypesGeneric.cpp Mon Jun 23 09:19:45 2008 @@ -75,7 +75,7 @@ // Lower the bit-convert to a store/load from the stack, then expand the load. SDOperand Op = CreateStackStoreLoad(InOp, N->getValueType(0)); - ExpandRes_NON_EXTLOAD(Op.Val, Lo, Hi); + ExpandRes_NormalLoad(Op.Val, Lo, Hi); } void DAGTypeLegalizer::ExpandRes_BUILD_PAIR(SDNode *N, @@ -118,10 +118,9 @@ std::swap(Lo, Hi); } -void DAGTypeLegalizer::ExpandRes_NON_EXTLOAD(SDNode *N, SDOperand &Lo, - SDOperand &Hi) { - assert(ISD::isNON_EXTLoad(N) && "This routine is not for extending loads!"); - assert(ISD::isUNINDEXEDLoad(N) && "Indexed load during type legalization!"); +void DAGTypeLegalizer::ExpandRes_NormalLoad(SDNode *N, SDOperand &Lo, + SDOperand &Hi) { + assert(ISD::isNormalLoad(N) && "This routine only for normal loads!"); LoadSDNode *LD = cast(N); MVT NVT = TLI.getTypeToTransformTo(LD->getValueType(0)); @@ -222,9 +221,8 @@ return cast(N->getOperand(1))->getValue() ? Hi : Lo; } -SDOperand DAGTypeLegalizer::ExpandOp_NON_TRUNCStore(SDNode *N, unsigned OpNo) { - assert(ISD::isNON_TRUNCStore(N) && "This routine not for truncating stores!"); - assert(ISD::isUNINDEXEDStore(N) && "Indexed store during type legalization!"); +SDOperand DAGTypeLegalizer::ExpandOp_NormalStore(SDNode *N, unsigned OpNo) { + assert(ISD::isNormalStore(N) && "This routine only for normal stores!"); assert(OpNo == 1 && "Can only expand the stored value so far"); StoreSDNode *St = cast(N); Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp?rev=52620&r1=52619&r2=52620&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp Mon Jun 23 09:19:45 2008 @@ -100,7 +100,7 @@ } SDOperand DAGTypeLegalizer::ScalarizeVecRes_LOAD(LoadSDNode *N) { - // FIXME: Add support for indexed loads. + assert(ISD::isUNINDEXEDLoad(N) && "Indexed load during type legalization!"); SDOperand Result = DAG.getLoad(N->getValueType(0).getVectorElementType(), N->getChain(), N->getBasePtr(), N->getSrcValue(), N->getSrcValueOffset(), @@ -232,7 +232,7 @@ /// ScalarizeVecOp_STORE - If the value to store is a vector that needs to be /// scalarized, it must be <1 x ty>. Just store the element. SDOperand DAGTypeLegalizer::ScalarizeVecOp_STORE(StoreSDNode *N, unsigned OpNo){ - // FIXME: Add support for indexed stores. + assert(ISD::isUNINDEXEDStore(N) && "Indexed store during type legalization!"); assert(OpNo == 1 && "Do not know how to scalarize this operand!"); return DAG.getStore(N->getChain(), GetScalarizedVector(N->getOperand(1)), N->getBasePtr(), N->getSrcValue(), N->getSrcValueOffset(), @@ -328,7 +328,7 @@ void DAGTypeLegalizer::SplitVecRes_LOAD(LoadSDNode *LD, SDOperand &Lo, SDOperand &Hi) { - // FIXME: Add support for indexed loads. + assert(ISD::isUNINDEXEDLoad(LD) && "Indexed load during type legalization!"); MVT LoVT, HiVT; GetSplitDestVTs(LD->getValueType(0), LoVT, HiVT); @@ -622,7 +622,7 @@ } SDOperand DAGTypeLegalizer::SplitVecOp_STORE(StoreSDNode *N, unsigned OpNo) { - // FIXME: Add support for indexed stores. + assert(ISD::isUNINDEXEDStore(N) && "Indexed store during type legalization!"); assert(OpNo == 1 && "Can only split the stored value"); SDOperand Ch = N->getChain(); From baldrick at free.fr Mon Jun 23 10:08:15 2008 From: baldrick at free.fr (Duncan Sands) Date: Mon, 23 Jun 2008 15:08:15 -0000 Subject: [llvm-commits] [llvm] r52621 - in /llvm/trunk/lib/CodeGen/SelectionDAG: LegalizeFloatTypes.cpp LegalizeIntegerTypes.cpp LegalizeTypes.h LegalizeTypesGeneric.cpp Message-ID: <200806231508.m5NF8FB4008678@zion.cs.uiuc.edu> Author: baldrick Date: Mon Jun 23 10:08:15 2008 New Revision: 52621 URL: http://llvm.org/viewvc/llvm-project?rev=52621&view=rev Log: Support for expanding the result of EXTRACT_ELEMENT. Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeFloatTypes.cpp llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.h llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypesGeneric.cpp Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeFloatTypes.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeFloatTypes.cpp?rev=52621&r1=52620&r2=52621&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeFloatTypes.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeFloatTypes.cpp Mon Jun 23 10:08:15 2008 @@ -403,6 +403,7 @@ case ISD::BIT_CONVERT: ExpandRes_BIT_CONVERT(N, Lo, Hi); break; case ISD::BUILD_PAIR: ExpandRes_BUILD_PAIR(N, Lo, Hi); break; + case ISD::EXTRACT_ELEMENT: ExpandRes_EXTRACT_ELEMENT(N, Lo, Hi); break; case ISD::EXTRACT_VECTOR_ELT: ExpandRes_EXTRACT_VECTOR_ELT(N, Lo, Hi); break; case ISD::LOAD: ExpandFloatRes_LOAD(N, Lo, Hi); break; Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp?rev=52621&r1=52620&r2=52621&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp Mon Jun 23 10:08:15 2008 @@ -763,6 +763,7 @@ case ISD::BIT_CONVERT: ExpandRes_BIT_CONVERT(N, Lo, Hi); break; case ISD::BUILD_PAIR: ExpandRes_BUILD_PAIR(N, Lo, Hi); break; + case ISD::EXTRACT_ELEMENT: ExpandRes_EXTRACT_ELEMENT(N, Lo, Hi); break; case ISD::EXTRACT_VECTOR_ELT: ExpandRes_EXTRACT_VECTOR_ELT(N, Lo, Hi); break; case ISD::Constant: ExpandIntRes_Constant(N, Lo, Hi); break; Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.h?rev=52621&r1=52620&r2=52621&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.h (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.h Mon Jun 23 10:08:15 2008 @@ -280,10 +280,10 @@ void ExpandIntRes_FP_TO_UINT (SDNode *N, SDOperand &Lo, SDOperand &Hi); void ExpandIntRes_Logical (SDNode *N, SDOperand &Lo, SDOperand &Hi); - void ExpandIntRes_BSWAP (SDNode *N, SDOperand &Lo, SDOperand &Hi); void ExpandIntRes_ADDSUB (SDNode *N, SDOperand &Lo, SDOperand &Hi); void ExpandIntRes_ADDSUBC (SDNode *N, SDOperand &Lo, SDOperand &Hi); void ExpandIntRes_ADDSUBE (SDNode *N, SDOperand &Lo, SDOperand &Hi); + void ExpandIntRes_BSWAP (SDNode *N, SDOperand &Lo, SDOperand &Hi); void ExpandIntRes_MUL (SDNode *N, SDOperand &Lo, SDOperand &Hi); void ExpandIntRes_SDIV (SDNode *N, SDOperand &Lo, SDOperand &Hi); void ExpandIntRes_SREM (SDNode *N, SDOperand &Lo, SDOperand &Hi); @@ -464,6 +464,7 @@ // Generic Result Expansion. void ExpandRes_BIT_CONVERT (SDNode *N, SDOperand &Lo, SDOperand &Hi); void ExpandRes_BUILD_PAIR (SDNode *N, SDOperand &Lo, SDOperand &Hi); + void ExpandRes_EXTRACT_ELEMENT (SDNode *N, SDOperand &Lo, SDOperand &Hi); void ExpandRes_EXTRACT_VECTOR_ELT(SDNode *N, SDOperand &Lo, SDOperand &Hi); void ExpandRes_NormalLoad (SDNode *N, SDOperand &Lo, SDOperand &Hi); Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypesGeneric.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypesGeneric.cpp?rev=52621&r1=52620&r2=52621&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypesGeneric.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypesGeneric.cpp Mon Jun 23 10:08:15 2008 @@ -28,8 +28,8 @@ // little/big-endian machines, followed by the Hi/Lo part. This means that // they cannot be used as is on vectors, for which Lo is always stored first. -void DAGTypeLegalizer::ExpandRes_BIT_CONVERT(SDNode *N, - SDOperand &Lo, SDOperand &Hi) { +void DAGTypeLegalizer::ExpandRes_BIT_CONVERT(SDNode *N, SDOperand &Lo, + SDOperand &Hi) { MVT NVT = TLI.getTypeToTransformTo(N->getValueType(0)); SDOperand InOp = N->getOperand(0); MVT InVT = InOp.getValueType(); @@ -78,15 +78,29 @@ ExpandRes_NormalLoad(Op.Val, Lo, Hi); } -void DAGTypeLegalizer::ExpandRes_BUILD_PAIR(SDNode *N, - SDOperand &Lo, SDOperand &Hi) { +void DAGTypeLegalizer::ExpandRes_BUILD_PAIR(SDNode *N, SDOperand &Lo, + SDOperand &Hi) { // Return the operands. Lo = N->getOperand(0); Hi = N->getOperand(1); } -void DAGTypeLegalizer::ExpandRes_EXTRACT_VECTOR_ELT(SDNode *N, - SDOperand &Lo, +void DAGTypeLegalizer::ExpandRes_EXTRACT_ELEMENT(SDNode *N, SDOperand &Lo, + SDOperand &Hi) { + GetExpandedOp(N->getOperand(0), Lo, Hi); + SDOperand Part = cast(N->getOperand(1))->getValue() ? Hi : Lo; + + assert(Part.getValueType() == N->getValueType(0) && + "Type twice as big as expanded type not itself expanded!"); + MVT NVT = TLI.getTypeToTransformTo(N->getValueType(0)); + + Lo = DAG.getNode(ISD::EXTRACT_ELEMENT, NVT, Part, + DAG.getConstant(0, TLI.getPointerTy())); + Hi = DAG.getNode(ISD::EXTRACT_ELEMENT, NVT, Part, + DAG.getConstant(1, TLI.getPointerTy())); +} + +void DAGTypeLegalizer::ExpandRes_EXTRACT_VECTOR_ELT(SDNode *N, SDOperand &Lo, SDOperand &Hi) { SDOperand OldVec = N->getOperand(0); unsigned OldElts = OldVec.getValueType().getVectorNumElements(); From baldrick at free.fr Mon Jun 23 10:15:44 2008 From: baldrick at free.fr (Duncan Sands) Date: Mon, 23 Jun 2008 15:15:44 -0000 Subject: [llvm-commits] [llvm] r52622 - /llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp Message-ID: <200806231515.m5NFFiML008903@zion.cs.uiuc.edu> Author: baldrick Date: Mon Jun 23 10:15:44 2008 New Revision: 52622 URL: http://llvm.org/viewvc/llvm-project?rev=52622&view=rev Log: Port some integer multiplication fixes from LegalizeDAG. Bail out with an error if there is no libcall available for the given size of integer. Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp?rev=52622&r1=52621&r2=52622&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp Mon Jun 23 10:15:44 2008 @@ -1203,14 +1203,13 @@ GetExpandedInteger(N->getOperand(0), LL, LH); GetExpandedInteger(N->getOperand(1), RL, RH); unsigned OuterBitSize = VT.getSizeInBits(); - unsigned BitSize = NVT.getSizeInBits(); + unsigned InnerBitSize = NVT.getSizeInBits(); unsigned LHSSB = DAG.ComputeNumSignBits(N->getOperand(0)); unsigned RHSSB = DAG.ComputeNumSignBits(N->getOperand(1)); - if (DAG.MaskedValueIsZero(N->getOperand(0), - APInt::getHighBitsSet(OuterBitSize, LHSSB)) && - DAG.MaskedValueIsZero(N->getOperand(1), - APInt::getHighBitsSet(OuterBitSize, RHSSB))) { + APInt HighMask = APInt::getHighBitsSet(OuterBitSize, InnerBitSize); + if (DAG.MaskedValueIsZero(N->getOperand(0), HighMask) && + DAG.MaskedValueIsZero(N->getOperand(1), HighMask)) { // The inputs are both zero-extended. if (HasUMUL_LOHI) { // We can emit a umul_lohi. @@ -1225,7 +1224,7 @@ return; } } - if (LHSSB > BitSize && RHSSB > BitSize) { + if (LHSSB > InnerBitSize && RHSSB > InnerBitSize) { // The input values are both sign-extended. if (HasSMUL_LOHI) { // We can emit a smul_lohi. @@ -1252,12 +1251,29 @@ Hi = DAG.getNode(ISD::ADD, NVT, Hi, LH); return; } + if (HasMULHU) { + Lo = DAG.getNode(ISD::MUL, NVT, LL, RL); + Hi = DAG.getNode(ISD::MULHU, NVT, LL, RL); + RH = DAG.getNode(ISD::MUL, NVT, LL, RH); + LH = DAG.getNode(ISD::MUL, NVT, LH, RL); + Hi = DAG.getNode(ISD::ADD, NVT, Hi, RH); + Hi = DAG.getNode(ISD::ADD, NVT, Hi, LH); + return; + } } // If nothing else, we can make a libcall. + RTLIB::Libcall LC; + switch (VT.getSimpleVT()) { + default: + assert(false && "Unsupported MUL!"); + case MVT::i64: + LC = RTLIB::MUL_I64; + break; + } + SDOperand Ops[2] = { N->getOperand(0), N->getOperand(1) }; - SplitInteger(MakeLibCall(RTLIB::MUL_I64, VT, Ops, 2, true/*sign irrelevant*/), - Lo, Hi); + SplitInteger(MakeLibCall(LC, VT, Ops, 2, true/*sign irrelevant*/), Lo, Hi); } void DAGTypeLegalizer::ExpandIntRes_SDIV(SDNode *N, From gohman at apple.com Mon Jun 23 10:26:38 2008 From: gohman at apple.com (Dan Gohman) Date: Mon, 23 Jun 2008 15:26:38 -0000 Subject: [llvm-commits] [llvm] r52623 - /llvm/trunk/docs/LangRef.html Message-ID: <200806231526.m5NFQcb3009322@zion.cs.uiuc.edu> Author: djg Date: Mon Jun 23 10:26:37 2008 New Revision: 52623 URL: http://llvm.org/viewvc/llvm-project?rev=52623&view=rev Log: Fix the syntax of insertvalue in the example. Modified: llvm/trunk/docs/LangRef.html Modified: llvm/trunk/docs/LangRef.html URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/LangRef.html?rev=52623&r1=52622&r2=52623&view=diff ============================================================================== --- llvm/trunk/docs/LangRef.html (original) +++ llvm/trunk/docs/LangRef.html Mon Jun 23 10:26:37 2008 @@ -2981,7 +2981,7 @@
Example:
-  %result = insertvalue {i32, float} %agg, 1, 0    ; yields {i32, float}
+  %result = insertvalue {i32, float} %agg, i32 1, 0    ; yields {i32, float}
 
From gohman at apple.com Mon Jun 23 10:29:14 2008 From: gohman at apple.com (Dan Gohman) Date: Mon, 23 Jun 2008 15:29:14 -0000 Subject: [llvm-commits] [llvm] r52624 - /llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Message-ID: <200806231529.m5NFTEuP009407@zion.cs.uiuc.edu> Author: djg Date: Mon Jun 23 10:29:14 2008 New Revision: 52624 URL: http://llvm.org/viewvc/llvm-project?rev=52624&view=rev Log: Duncan pointed out this code could be tidied. Modified: llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Modified: llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp?rev=52624&r1=52623&r2=52624&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Mon Jun 23 10:29:14 2008 @@ -1057,9 +1057,8 @@ DAG.getNode(ISD::CARRY_FALSE, MVT::Flag)); // canonicalize constant to RHS. - if (N0C && !N1C) { + if (N0C && !N1C) return DAG.getNode(ISD::ADDC, N->getVTList(), N1, N0); - } // fold (addc x, 0) -> x + no carry out if (N1C && N1C->isNullValue()) @@ -1093,14 +1092,12 @@ //MVT VT = N0.getValueType(); // canonicalize constant to RHS - if (N0C && !N1C) { + if (N0C && !N1C) return DAG.getNode(ISD::ADDE, N->getVTList(), N1, N0, CarryIn); - } // fold (adde x, y, false) -> (addc x, y) - if (CarryIn.getOpcode() == ISD::CARRY_FALSE) { + if (CarryIn.getOpcode() == ISD::CARRY_FALSE) return DAG.getNode(ISD::ADDC, N->getVTList(), N1, N0); - } return SDOperand(); } From matthijs at stdin.nl Mon Jun 23 11:04:57 2008 From: matthijs at stdin.nl (Matthijs Kooijman) Date: Mon, 23 Jun 2008 18:04:57 +0200 Subject: [llvm-commits] [llvm] r52532 - in /llvm/trunk: lib/Transforms/IPO/DeadArgumentElimination.cpp test/Transforms/DeadArgElim/multdeadretval.ll In-Reply-To: <0E696BD0-C25F-48E3-811D-E8C6745961AA@apple.com> References: <200806200936.m5K9aIZR010499@zion.cs.uiuc.edu> <0E696BD0-C25F-48E3-811D-E8C6745961AA@apple.com> Message-ID: <20080623160457.GT3816@katherina.student.utwente.nl> Hi Evan, > This breaks llvm-gcc bootstrapping. Looks like it miscompiles gcc driver: I've spent the day debugging this (never imagined how much fun a bootstrap build was :-p) and I think I nailed it down. The problem here was that DAE was removing a return value that wasn't really dead. The return value of for_each_path was used as the return value of find_a_file, and thus marked MaybeAlive. However, for_each_path was also used in some other places, in which the return value was not used, causing it to be marked as Dead (overwriting the previous MaybeAlive marking). In this particular case, this resulted in the path lookup function failing, so cc1 can't be found. I've solved this by completely removing the distinction between Dead and MaybeLive. Everything is MaybeLive until proven Live and anything not Live in the end is removed. I've attached the diff, perhaps you could check if it works for you? Here, it managed to compile past the point where it was failing into stage3. It's not finished yet, but my work day is over, but I expect it to compile the last of stage3 just fine. Gr. Matthijs -------------- next part -------------- A non-text attachment was scrubbed... Name: deadarg.diff Type: text/x-diff Size: 46153 bytes Desc: not available Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20080623/41b8c3b7/attachment.bin -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: Digital signature Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20080623/41b8c3b7/attachment-0001.bin From gohman at apple.com Mon Jun 23 11:12:06 2008 From: gohman at apple.com (Dan Gohman) Date: Mon, 23 Jun 2008 09:12:06 -0700 (PDT) Subject: [llvm-commits] [llvm] r52604 - /llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp In-Reply-To: <200806220930.11349.baldrick@free.fr> References: <200806212206.m5LM67t0007485@zion.cs.uiuc.edu> <200806220930.11349.baldrick@free.fr> Message-ID: <55598.76.220.41.203.1214237526.squirrel@webmail.apple.com> On Sun, June 22, 2008 12:30 am, Duncan Sands wrote: > Hi Dan, > >> if (N0C && !N1C) { >> - SDOperand Ops[] = { N1, N0 }; >> - return DAG.getNode(ISD::ADDC, N->getVTList(), Ops, 2); >> + return DAG.getNode(ISD::ADDC, N->getVTList(), N1, N0); >> } > > you could drop the braces now that this is only one line. > Likewise for the others. Ok, done. Dan From gohman at apple.com Mon Jun 23 11:38:10 2008 From: gohman at apple.com (Dan Gohman) Date: Mon, 23 Jun 2008 16:38:10 -0000 Subject: [llvm-commits] [llvm] r52626 - /llvm/trunk/include/llvm/Instructions.h Message-ID: <200806231638.m5NGcATF012113@zion.cs.uiuc.edu> Author: djg Date: Mon Jun 23 11:38:10 2008 New Revision: 52626 URL: http://llvm.org/viewvc/llvm-project?rev=52626&view=rev Log: Remove an unnecessary cast. Modified: llvm/trunk/include/llvm/Instructions.h Modified: llvm/trunk/include/llvm/Instructions.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Instructions.h?rev=52626&r1=52625&r2=52626&view=diff ============================================================================== --- llvm/trunk/include/llvm/Instructions.h (original) +++ llvm/trunk/include/llvm/Instructions.h Mon Jun 23 11:38:10 2008 @@ -1501,7 +1501,7 @@ if (NumIdx > 0) // This requires that the iterator points to contiguous memory. - return getIndexedType(Ptr, (const unsigned *)&*IdxBegin, NumIdx); + return getIndexedType(Ptr, &*IdxBegin, NumIdx); else return getIndexedType(Ptr, (const unsigned *)0, NumIdx); } From gohman at apple.com Mon Jun 23 11:39:44 2008 From: gohman at apple.com (Dan Gohman) Date: Mon, 23 Jun 2008 16:39:44 -0000 Subject: [llvm-commits] [llvm] r52627 - /llvm/trunk/lib/VMCore/Constants.cpp Message-ID: <200806231639.m5NGdjT7012168@zion.cs.uiuc.edu> Author: djg Date: Mon Jun 23 11:39:44 2008 New Revision: 52627 URL: http://llvm.org/viewvc/llvm-project?rev=52627&view=rev Log: More changes from Chris' review: simplify getIndices and avoid copying its return value. Modified: llvm/trunk/lib/VMCore/Constants.cpp Modified: llvm/trunk/lib/VMCore/Constants.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Constants.cpp?rev=52627&r1=52626&r2=52627&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/Constants.cpp (original) +++ llvm/trunk/lib/VMCore/Constants.cpp Mon Jun 23 11:39:44 2008 @@ -712,10 +712,8 @@ if (const ExtractValueConstantExpr *EVCE = dyn_cast(this)) return EVCE->Indices; - if (const InsertValueConstantExpr *IVCE = - dyn_cast(this)) - return IVCE->Indices; - assert(0 && "ConstantExpr does not have indices!"); + + return cast(this)->Indices; } /// ConstantExpr::get* - Return some common constants without having to @@ -829,7 +827,7 @@ Op2 = (OpNo == 2) ? Op : getOperand(2); return ConstantExpr::getShuffleVector(Op0, Op1, Op2); case Instruction::InsertValue: { - const SmallVector Indices = getIndices(); + const SmallVector &Indices = getIndices(); Op0 = (OpNo == 0) ? Op : getOperand(0); Op1 = (OpNo == 1) ? Op : getOperand(1); return ConstantExpr::getInsertValue(Op0, Op1, @@ -837,7 +835,7 @@ } case Instruction::ExtractValue: { assert(OpNo == 0 && "ExtractaValue has only one operand!"); - const SmallVector Indices = getIndices(); + const SmallVector &Indices = getIndices(); return ConstantExpr::getExtractValue(Op, &Indices[0], Indices.size()); } @@ -897,12 +895,12 @@ case Instruction::ShuffleVector: return ConstantExpr::getShuffleVector(Ops[0], Ops[1], Ops[2]); case Instruction::InsertValue: { - const SmallVector Indices = getIndices(); + const SmallVector &Indices = getIndices(); return ConstantExpr::getInsertValue(Ops[0], Ops[1], &Indices[0], Indices.size()); } case Instruction::ExtractValue: { - const SmallVector Indices = getIndices(); + const SmallVector &Indices = getIndices(); return ConstantExpr::getExtractValue(Ops[0], &Indices[0], Indices.size()); } From gohman at apple.com Mon Jun 23 11:45:24 2008 From: gohman at apple.com (Dan Gohman) Date: Mon, 23 Jun 2008 16:45:24 -0000 Subject: [llvm-commits] [llvm] r52628 - /llvm/trunk/lib/VMCore/Instructions.cpp Message-ID: <200806231645.m5NGjPkk012388@zion.cs.uiuc.edu> Author: djg Date: Mon Jun 23 11:45:24 2008 New Revision: 52628 URL: http://llvm.org/viewvc/llvm-project?rev=52628&view=rev Log: Use std::copy instead of a loop. Modified: llvm/trunk/lib/VMCore/Instructions.cpp Modified: llvm/trunk/lib/VMCore/Instructions.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Instructions.cpp?rev=52628&r1=52627&r2=52628&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/Instructions.cpp (original) +++ llvm/trunk/lib/VMCore/Instructions.cpp Mon Jun 23 11:45:24 2008 @@ -190,9 +190,7 @@ ReservedSpace = NumOps; Use *OldOps = OperandList; Use *NewOps = allocHungoffUses(NumOps); - for (unsigned i = 0; i != e; ++i) { - NewOps[i] = OldOps[i]; - } + std::copy(OldOps, OldOps + e, NewOps); OperandList = NewOps; if (OldOps) Use::zap(OldOps, OldOps + e, true); } From gohman at apple.com Mon Jun 23 11:48:17 2008 From: gohman at apple.com (Dan Gohman) Date: Mon, 23 Jun 2008 16:48:17 -0000 Subject: [llvm-commits] [llvm] r52629 - in /llvm/trunk: include/llvm/Instructions.h lib/VMCore/Instructions.cpp Message-ID: <200806231648.m5NGmI3B012505@zion.cs.uiuc.edu> Author: djg Date: Mon Jun 23 11:48:17 2008 New Revision: 52629 URL: http://llvm.org/viewvc/llvm-project?rev=52629&view=rev Log: Remove two convenience constructors because they're now private, and the private implementation doesn't really need the convenience. Modified: llvm/trunk/include/llvm/Instructions.h llvm/trunk/lib/VMCore/Instructions.cpp Modified: llvm/trunk/include/llvm/Instructions.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Instructions.h?rev=52629&r1=52628&r2=52629&view=diff ============================================================================== --- llvm/trunk/include/llvm/Instructions.h (original) +++ llvm/trunk/include/llvm/Instructions.h Mon Jun 23 11:48:17 2008 @@ -1520,13 +1520,6 @@ InputIterator IdxBegin, InputIterator IdxEnd, const std::string &Name, BasicBlock *InsertAtEnd); - /// Constructors - These two constructors are convenience methods because one - /// and two index extractvalue instructions are so common. - ExtractValueInst(Value *Agg, unsigned Idx, const std::string &Name = "", - Instruction *InsertBefore = 0); - ExtractValueInst(Value *Agg, unsigned Idx, - const std::string &Name, BasicBlock *InsertAtEnd); - // allocate space for exactly one operand void *operator new(size_t s) { return User::operator new(s, 1); @@ -1555,12 +1548,14 @@ static ExtractValueInst *Create(Value *Agg, unsigned Idx, const std::string &Name = "", Instruction *InsertBefore = 0) { - return new ExtractValueInst(Agg, Idx, Name, InsertBefore); + unsigned Idxs[1] = { Idx }; + return new ExtractValueInst(Agg, Idxs, Idxs + 1, Name, InsertBefore); } static ExtractValueInst *Create(Value *Agg, unsigned Idx, const std::string &Name, BasicBlock *InsertAtEnd) { - return new ExtractValueInst(Agg, Idx, Name, InsertAtEnd); + unsigned Idxs[1] = { Idx }; + return new ExtractValueInst(Agg, Idxs, Idxs + 1, Name, InsertAtEnd); } virtual ExtractValueInst *clone() const; Modified: llvm/trunk/lib/VMCore/Instructions.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Instructions.cpp?rev=52629&r1=52628&r2=52629&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/Instructions.cpp (original) +++ llvm/trunk/lib/VMCore/Instructions.cpp Mon Jun 23 11:48:17 2008 @@ -1465,24 +1465,6 @@ return getIndexedType(Agg, &Idx, 1); } -ExtractValueInst::ExtractValueInst(Value *Agg, - unsigned Idx, - const std::string &Name, - BasicBlock *InsertAtEnd) - : UnaryInstruction(checkType(getIndexedType(Agg->getType(), &Idx, 1)), - ExtractValue, Agg, InsertAtEnd) { - init(Idx, Name); -} - -ExtractValueInst::ExtractValueInst(Value *Agg, - unsigned Idx, - const std::string &Name, - Instruction *InsertBefore) - : UnaryInstruction(checkType(getIndexedType(Agg->getType(), &Idx, 1)), - ExtractValue, Agg, InsertBefore) { - init(Idx, Name); -} - //===----------------------------------------------------------------------===// // BinaryOperator Class //===----------------------------------------------------------------------===// From gohman at apple.com Mon Jun 23 11:48:57 2008 From: gohman at apple.com (Dan Gohman) Date: Mon, 23 Jun 2008 09:48:57 -0700 (PDT) Subject: [llvm-commits] [llvm] r51806 - in /llvm/trunk: docs/LangRef.html include/llvm/Constants.h include/llvm/DerivedTypes.h include/llvm/Instructions.h lib/AsmParser/llvmAsmParser.cpp.cvs lib/AsmParser/llvmAsmParser.h.cvs lib/AsmParser/llvmAsmParser.y lib/AsmParser/llvmAsmParser.y.cvs lib/Bitcode/Reader/BitcodeReader.cpp lib/Bitcode/Writer/BitcodeWriter.cpp lib/VMCore/Constants.cpp lib/VMCore/Instructions.cpp lib/VMCore/Type.cpp test/Assembler/insertextractvalue.ll In-Reply-To: References: <200805310058.m4V0wNwU011642@zion.cs.uiuc.edu> Message-ID: <56681.76.220.41.203.1214239737.squirrel@webmail.apple.com> On Sun, June 22, 2008 11:00 am, Chris Lattner wrote: > On May 30, 2008, at 5:58 PM, Dan Gohman wrote: >> URL: http://llvm.org/viewvc/llvm-project?rev=51806&view=rev >> Log: >> IR, bitcode reader, bitcode writer, and asmparser changes to >> insertvalue and extractvalue to use constant indices instead of >> Value* indices. And begin updating LangRef.html. > > You guys are making awesome progress, some thoughts: > > > Are insertvalue/extractvalue valid as constant expressions? If so, > langref should be updated and it would be good to see that they encode > into the bc file correctly. If we can *guarantee* that they are > always folded away by the constant folding, then I'm fine with saying > that they are not allowed as constant exprs. Currently we should be folding all such constant expressions. One case where we might not want to is a huge zeroinitializer with a few non-zero values inserted into it. It's a real situation, though I don't know if it's enough of a concern to justify here. > > In the insertvalue section, you have this syntax: > > = insertvalue , , ; > yields > > but this example: > %result = insertvalue {i32, float} %agg, 1, 0 > should the example be: > %result = insertvalue {i32, float} %agg, i32 1, 0 Oops, fixed. >> @@ -1518,9 +1519,11 @@ >> /// element value from an aggregate value. >> /// >> class ExtractValueInst : public Instruction { >> + SmallVector Indices; > > The indices of an instruction are fixed when the instruction is > created. Would it be reasonable to just make this be a new > unsigned[]'d array instead of a smallvector? SmallVector is a convenient way to co-allocate the indices with the instruction in the common cases. We can certainly look at doing custom allocation strategies to allocate the indices after the end of the ExtractValueInst though. > >> @@ -1563,9 +1567,9 @@ >> >> if (NumIdx > 0) >> // This requires that the iterator points to contiguous memory. >> - return getIndexedType(Ptr, (Value *const *)&*IdxBegin, NumIdx); >> + return getIndexedType(Ptr, (const unsigned *)&*IdxBegin, >> NumIdx); > > Is this cast needed? It seems that it could paper over serious bugs. Nope, fixed. > >> @@ -1575,55 +1579,53 @@ >> /// Constructors - These two constructors are convenience methods >> because one >> /// and two index extractvalue instructions are so common. >> - ExtractValueInst(Value *Agg, Value *Idx, const std::string &Name >> = "", >> + ExtractValueInst(Value *Agg, unsigned Idx, const std::string >> &Name = "", >> Instruction *InsertBefore = 0); >> - ExtractValueInst(Value *Agg, Value *Idx, >> + ExtractValueInst(Value *Agg, unsigned Idx, >> const std::string &Name, BasicBlock *InsertAtEnd); > > Since the ctors are private, who are they a convenience for? It seems > that the ::Create methods are the things that should exist, but extra > constructors aren't need. fixed. > >> public: >> + // allocate space for exactly two operands >> + void *operator new(size_t s) { >> + return User::operator new(s, 1); >> + } > > Plz update comment. That was fixed already :-). >> + >> +const SmallVector &ConstantExpr::getIndices() const { >> + if (const ExtractValueConstantExpr *EVCE = >> + dyn_cast(this)) >> + return EVCE->Indices; >> + if (const InsertValueConstantExpr *IVCE = >> + dyn_cast(this)) >> + return IVCE->Indices; >> + assert(0 && "ConstantExpr does not have indices!"); >> +} > > Eliminating them also allows these methods to go away. If you choose > to keep them, please change getindices to be: > > .. >> + return cast(this)->Indices; > > > eliminating the assert(0) fixed. >> >> + assert(OpNo == 0 && "ExtractaValue has only one operand!"); >> + const SmallVector Indices = getIndices(); > > No need to copy the vector here. fixed. >> >> + return >> + ConstantExpr::getExtractValue(Op, &Indices[0], Indices.size()); >> } >> + case Instruction::InsertValue: { >> + const SmallVector Indices = getIndices(); > > likewise. fixed. > >> >> + return ConstantExpr::getInsertValue(Ops[0], Ops[1], >> + &Indices[0], Indices.size()); >> + } >> + case Instruction::ExtractValue: { >> + const SmallVector Indices = getIndices(); > > likewise. fixed. Dan From clattner at apple.com Mon Jun 23 12:02:05 2008 From: clattner at apple.com (Chris Lattner) Date: Mon, 23 Jun 2008 10:02:05 -0700 Subject: [llvm-commits] [llvm] r51806 - in /llvm/trunk: docs/LangRef.html include/llvm/Constants.h include/llvm/DerivedTypes.h include/llvm/Instructions.h lib/AsmParser/llvmAsmParser.cpp.cvs lib/AsmParser/llvmAsmParser.h.cvs lib/AsmParser/llvmAsmParser.y lib/AsmParser/llvmAsmParser.y.cvs lib/Bitcode/Reader/BitcodeReader.cpp lib/Bitcode/Writer/BitcodeWriter.cpp lib/VMCore/Constants.cpp lib/VMCore/Instructions.cpp lib/VMCore/Type.cpp test/Assembler/insertextractvalue.ll In-Reply-To: <56681.76.220.41.203.1214239737.squirrel@webmail.apple.com> References: <200805310058.m4V0wNwU011642@zion.cs.uiuc.edu> <56681.76.220.41.203.1214239737.squirrel@webmail.apple.com> Message-ID: On Jun 23, 2008, at 9:48 AM, Dan Gohman wrote: >> Are insertvalue/extractvalue valid as constant expressions? If so, >> langref should be updated and it would be good to see that they >> encode >> into the bc file correctly. If we can *guarantee* that they are >> always folded away by the constant folding, then I'm fine with saying >> that they are not allowed as constant exprs. > > Currently we should be folding all such constant expressions. > > One case where we might not want to is a huge zeroinitializer with a > few non-zero values inserted into it. It's a real situation, though I > don't know if it's enough of a concern to justify here. That is a really interesting case actually. It is bad that: int x[10000]; and: int x[10000] = { 1 }; take hugely different amounts of memory to represent. However, we already have this problem, and it could be solved in other ways (e.g. have some new 'SparseConstantArray' or something). I tend to think that eliminating the constantexprs would be a net win, because we don't need to handle them everywhere (e.g. in the asmprinter logic for emitting global var initializers etc). What do you think? >>> @@ -1518,9 +1519,11 @@ >>> /// element value from an aggregate value. >>> /// >>> class ExtractValueInst : public Instruction { >>> + SmallVector Indices; >> >> The indices of an instruction are fixed when the instruction is >> created. Would it be reasonable to just make this be a new >> unsigned[]'d array instead of a smallvector? > > SmallVector is a convenient way to co-allocate the indices with > the instruction in the common cases. We can certainly look at > doing custom allocation strategies to allocate the indices after > the end of the ExtractValueInst though. True, but in practice, these (insert/extractvalue insts) will be rare (so it doesn't really matter one way or the other) and will almost always have one index. How about SmallVector<1>? Thanks Dan! -Chris From gohman at apple.com Mon Jun 23 12:06:24 2008 From: gohman at apple.com (Dan Gohman) Date: Mon, 23 Jun 2008 10:06:24 -0700 (PDT) Subject: [llvm-commits] [llvm] r52520 - /llvm/trunk/lib/Transforms/Scalar/SCCP.cpp In-Reply-To: <20080620075750.GC3816@katherina.student.utwente.nl> References: <200806200115.m5K1FjhV016990@zion.cs.uiuc.edu> <20080620075750.GC3816@katherina.student.utwente.nl> Message-ID: <46775.76.220.41.203.1214240784.squirrel@webmail.apple.com> On Fri, June 20, 2008 12:57 am, Matthijs Kooijman wrote: > Yet, isn't the handling it does now (mainly tracking return values) a > duplicate effort with IPConstProp? Or does SCCP do other things that make > it > more useful than IPCP for this stuff? Yes, and yes :-). > >> +void SCCPSolver::visitExtractValueInst(ExtractValueInst &EVI) { >> + Value *Aggr = EVI.getOperand(0); > You'd better use getAggregateOperand() for that? fixed. > > >> + >> + // If the operand to the getresult is an undef, the result is undef. >> + if (isa(Aggr)) >> + return; >> + >> + // Currently only handle single-index extractvalues. >> + if (EVI.getNumIndices() != 1) { >> + markOverdefined(&EVI); >> + return; >> + } >> + >> + Function *F = 0; >> + if (CallInst *CI = dyn_cast(Aggr)) >> + F = CI->getCalledFunction(); >> + else if (InvokeInst *II = dyn_cast(Aggr)) >> + F = II->getCalledFunction(); >> + >> + // TODO: If IPSCCP resolves the callee of this function, we could >> propagate a >> + // result back! > What do you mean by this? Are you considering the case where you visit the > extractvalue instruction on the result before the insertvalue instruction > for > the return value? Theoretically IPSCCP could determine the callee of an indirect call in some cases, and either convert it into a direct call or handle it as a direct call for the purpose of propagating constants. > >> +void SCCPSolver::visitInsertValueInst(InsertValueInst &IVI) { >> + Value *Aggr = IVI.getOperand(0); > Again, you should use getAggregateOperand(). >> + Value *Val = IVI.getOperand(1); > And getInsertedValueOperand() here. > >> + // If the operand to the getresult is an undef, the result is undef. > That should be insertvalue, not getresult? fixed. > >> + if (isa(Aggr)) >> + return; >> + >> + // Currently only handle single-index insertvalues. >> + if (IVI.getNumIndices() != 1) { >> + markOverdefined(&IVI); >> + return; >> + } >> + >> + // See if we are tracking the result of the callee. >> + Function *F = IVI.getParent()->getParent(); >> + std::map, LatticeVal>::iterator >> + It = TrackedMultipleRetVals.find(std::make_pair(F, >> *IVI.idx_begin())); >> + >> + // Merge in the inserted member value. >> + if (It != TrackedMultipleRetVals.end()) >> + mergeInValue(It->second, F, getValueState(Val)); >> + >> + // Mark the aggregate result of the IVI overdefined; any tracking >> that we do will >> + // be done on the individual member values. >> + markOverdefined(&IVI); >> +} > From looking at this code, it seems that you are assuming that all > insertvalue > instructions are used to build return values. From the looks of it, I > could > fool SCCP into propagting the wrong constant, though I don't really know > how > SCPP works. You're right, good catch. I believe I've fixed this now. > >> + // The aggregate value is used in a way not handled here. Assume >> nothing. >> + markOverdefined(*UI); > Shouldn't that be return value isntead of aggregate value? No, it's saying the aggregate value returned by the function has users that aren't getresult or single-index extractvalue, which SCCP doesn't attempt to handle. Dan From clattner at apple.com Mon Jun 23 12:08:18 2008 From: clattner at apple.com (Chris Lattner) Date: Mon, 23 Jun 2008 10:08:18 -0700 Subject: [llvm-commits] value range analysis based on scalar-evolutions In-Reply-To: <48436EF1.8020203@mxc.ca> References: <48436EF1.8020203@mxc.ca> Message-ID: <28C820CC-1764-40E6-BC66-8DA0139AB51D@apple.com> On Jun 1, 2008, at 8:54 PM, Nick Lewycky wrote: > I've implemented an analysis pass that uses SCEV to determine value > ranges of integer-typed registers. > > Currently it maintains a map of Value* to ConstantRange*, which is > rather inelegant. I was thinking we could have one analysis which > would do that and others that would update the central analysis. > > I also implemented an optz'n pass based on it, but it hardly > optimized anything and as such is not included in this patch. Hey Nick, Are you still working on this? It looks like a really interesting approach. As Dan says, it would be best if it were lazy (computing ranges when queried instead of in runOnFunction), but otherwise it would be nice to go in the tree. -Chris From sabre at nondot.org Mon Jun 23 12:11:23 2008 From: sabre at nondot.org (Chris Lattner) Date: Mon, 23 Jun 2008 17:11:23 -0000 Subject: [llvm-commits] [llvm] r52630 - /llvm/trunk/lib/Transforms/Scalar/ScalarReplAggregates.cpp Message-ID: <200806231711.m5NHBNXJ013311@zion.cs.uiuc.edu> Author: lattner Date: Mon Jun 23 12:11:23 2008 New Revision: 52630 URL: http://llvm.org/viewvc/llvm-project?rev=52630&view=rev Log: minor tidying of comments. Modified: llvm/trunk/lib/Transforms/Scalar/ScalarReplAggregates.cpp Modified: llvm/trunk/lib/Transforms/Scalar/ScalarReplAggregates.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/ScalarReplAggregates.cpp?rev=52630&r1=52629&r2=52630&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/ScalarReplAggregates.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/ScalarReplAggregates.cpp Mon Jun 23 12:11:23 2008 @@ -313,12 +313,13 @@ continue; } - // Replace %res = load { i32, i32 }* %alloc - // by - // %load.0 = load i32* %alloc.0 - // %insert.0 insertvalue { i32, i32 } zeroinitializer, i32 %load.0, 0 - // %load.1 = load i32* %alloc.1 - // %insert = insertvalue { i32, i32 } %insert.0, i32 %load.1, 1 + // Replace: + // %res = load { i32, i32 }* %alloc + // with: + // %load.0 = load i32* %alloc.0 + // %insert.0 insertvalue { i32, i32 } zeroinitializer, i32 %load.0, 0 + // %load.1 = load i32* %alloc.1 + // %insert = insertvalue { i32, i32 } %insert.0, i32 %load.1, 1 // (Also works for arrays instead of structs) if (LoadInst *LI = dyn_cast(User)) { Value *Insert = UndefValue::get(LI->getType()); @@ -331,12 +332,13 @@ continue; } - // Replace store { i32, i32 } %val, { i32, i32 }* %alloc - // by - // %val.0 = extractvalue { i32, i32 } %val, 0 - // store i32 %val.0, i32* %alloc.0 - // %val.1 = extractvalue { i32, i32 } %val, 1 - // store i32 %val.1, i32* %alloc.1 + // Replace: + // store { i32, i32 } %val, { i32, i32 }* %alloc + // with: + // %val.0 = extractvalue { i32, i32 } %val, 0 + // store i32 %val.0, i32* %alloc.0 + // %val.1 = extractvalue { i32, i32 } %val, 1 + // store i32 %val.1, i32* %alloc.1 // (Also works for arrays instead of structs) if (StoreInst *SI = dyn_cast(User)) { Value *Val = SI->getOperand(0); From clattner at apple.com Mon Jun 23 12:18:53 2008 From: clattner at apple.com (Chris Lattner) Date: Mon, 23 Jun 2008 10:18:53 -0700 Subject: [llvm-commits] [llvm] r52149 - in /llvm/trunk: lib/AsmParser/llvmAsmParser.cpp.cvs lib/AsmParser/llvmAsmParser.h.cvs lib/AsmParser/llvmAsmParser.y lib/AsmParser/llvmAsmParser.y.cvs utils/llvm.grm In-Reply-To: <200806091445.m59Ej2BZ019742@zion.cs.uiuc.edu> References: <200806091445.m59Ej2BZ019742@zion.cs.uiuc.edu> Message-ID: <21C65B8A-9821-4763-BEA5-FCA0E2D91FAF@apple.com> On Jun 9, 2008, at 7:45 AM, Dan Gohman wrote: > Author: djg > Date: Mon Jun 9 09:45:02 2008 > New Revision: 52149 > > URL: http://llvm.org/viewvc/llvm-project?rev=52149&view=rev > Log: > AsmParser support for immediate constant aggregate values. Hey Dan, General comment: please commit the change of .y file separate from the .cvs files. They are large and noisy. > > +++ llvm/trunk/lib/AsmParser/llvmAsmParser.y Mon Jun 9 09:45:02 2008 > @@ -2505,6 +2499,80 @@ > delete PTy; delete $2; > CHECK_FOR_ERROR > } > + | '[' ConstVector ']' { // Nonempty unsized arr > + const Type *ETy = (*$2)[0]->getType(); > + int NumElements = $2->size(); Please use uint64_t for NumElements. > > + ArrayType *ATy = ArrayType::get(ETy, NumElements); > + PATypeHolder* PTy = new PATypeHolder(HandleUpRefs(ATy)); > + > + // Verify all elements are correct type! > + for (unsigned i = 0; i < $2->size(); i++) { Here too. > + | '[' ']' { > + $$ = ValID::createUndef(); > + CHECK_FOR_ERROR > + } This should make an empty array not an undef. I'm not sure if it make a difference in practice though. > > + | 'c' STRINGCONSTANT { > + int NumElements = $2->length(); Please use size_t or uint64_t. Thanks Dan, -Chris From dalej at apple.com Mon Jun 23 12:18:58 2008 From: dalej at apple.com (Dale Johannesen) Date: Mon, 23 Jun 2008 10:18:58 -0700 Subject: [llvm-commits] [llvm] r51806 - in /llvm/trunk: docs/LangRef.html include/llvm/Constants.h include/llvm/DerivedTypes.h include/llvm/Instructions.h lib/AsmParser/llvmAsmParser.cpp.cvs lib/AsmParser/llvmAsmParser.h.cvs lib/AsmParser/llvmAsmParser.y lib/AsmParser/llvmAsmParser.y.cvs lib/Bitcode/Reader/BitcodeReader.cpp lib/Bitcode/Writer/BitcodeWriter.cpp lib/VMCore/Constants.cpp lib/VMCore/Instructions.cpp lib/VMCore/Type.cpp test/Assembler/insertextractvalue.ll In-Reply-To: References: <200805310058.m4V0wNwU011642@zion.cs.uiuc.edu> <56681.76.220.41.203.1214239737.squirrel@webmail.apple.com> Message-ID: <8DC2434C-FC24-47EF-A00A-74C5F06D54E4@apple.com> On Jun 23, 2008, at 10:02 AMPDT, Chris Lattner wrote: > On Jun 23, 2008, at 9:48 AM, Dan Gohman wrote: >>> Are insertvalue/extractvalue valid as constant expressions? If so, >>> langref should be updated and it would be good to see that they >>> encode >>> into the bc file correctly. If we can *guarantee* that they are >>> always folded away by the constant folding, then I'm fine with >>> saying >>> that they are not allowed as constant exprs. >> >> Currently we should be folding all such constant expressions. >> >> One case where we might not want to is a huge zeroinitializer with a >> few non-zero values inserted into it. It's a real situation, though I >> don't know if it's enough of a concern to justify here. > > That is a really interesting case actually. It is bad that: > > int x[10000]; > > and: > > int x[10000] = { 1 }; > > take hugely different amounts of memory to represent. The representation in the .s files is also hugely different, and much bigger than gcc's. I think that could be fixed in the routines that write it out, but a more compact representation upstream should make that unnecessary. The .bc and .ll files are also big. Something like Fortran's repeated initializer notation might work well: @y = global [10000 x i32] [ i32 1, 9999 * i32 0], align 32 yadda yadda > However, we > already have this problem, and it could be solved in other ways (e.g. > have some new 'SparseConstantArray' or something). I tend to think > that eliminating the constantexprs would be a net win, because we > don't need to handle them everywhere (e.g. in the asmprinter logic for > emitting global var initializers etc). > > What do you think? > >>>> @@ -1518,9 +1519,11 @@ >>>> /// element value from an aggregate value. >>>> /// >>>> class ExtractValueInst : public Instruction { >>>> + SmallVector Indices; >>> >>> The indices of an instruction are fixed when the instruction is >>> created. Would it be reasonable to just make this be a new >>> unsigned[]'d array instead of a smallvector? >> >> SmallVector is a convenient way to co-allocate the indices with >> the instruction in the common cases. We can certainly look at >> doing custom allocation strategies to allocate the indices after >> the end of the ExtractValueInst though. > > True, but in practice, these (insert/extractvalue insts) will be rare > (so it doesn't really matter one way or the other) and will almost > always have one index. How about SmallVector<1>? > > Thanks Dan! > > -Chris > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From clattner at apple.com Mon Jun 23 12:23:15 2008 From: clattner at apple.com (Chris Lattner) Date: Mon, 23 Jun 2008 10:23:15 -0700 Subject: [llvm-commits] [llvm] r52184 - in /llvm/trunk/test/Transforms/InstCombine: 2008-01-06-BitCastAttributes.ll call.ll In-Reply-To: <200806101613.m5AGDc2Y019024@zion.cs.uiuc.edu> References: <200806101613.m5AGDc2Y019024@zion.cs.uiuc.edu> Message-ID: <0C17A648-63D5-4BFA-AFFA-CC1005480FC3@apple.com> On Jun 10, 2008, at 9:13 AM, Matthijs Kooijman wrote: > Author: matthijs > Date: Tue Jun 10 11:13:38 2008 > New Revision: 52184 > > URL: http://llvm.org/viewvc/llvm-project?rev=52184&view=rev > Log: > Ignore stderr for some more tests that expect warnings there. Okay, I see why you changed the harness to consider stderr output to be an error. I agree this is a definite improvement, thanks for making it happen! -Chris From dalej at apple.com Mon Jun 23 12:27:09 2008 From: dalej at apple.com (Dale Johannesen) Date: Mon, 23 Jun 2008 10:27:09 -0700 Subject: [llvm-commits] [llvm] r52528 - /llvm/trunk/test/FrontendC/2007-09-05-ConstCtor.c In-Reply-To: <200806200531.m5K5V5eL024302@zion.cs.uiuc.edu> References: <200806200531.m5K5V5eL024302@zion.cs.uiuc.edu> Message-ID: I'm not very happy about this one. 'vcgt' is implementation-defined and gcc properly warns about it; but for historical reasons it's widely used inside Apple (widely enough that the warning is suppressed), so there really should be tests that exercise it. Obviously the best thing is to fix the test harness so it tolerates warnings. On Jun 19, 2008, at 10:31 PMPDT, Chris Lattner wrote: > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/test/FrontendC/2007-09-05-ConstCtor.c (original) > +++ llvm/trunk/test/FrontendC/2007-09-05-ConstCtor.c Fri Jun 20 > 00:31:04 2008 > @@ -1,7 +1,5 @@ > // RUN: %llvmgcc -xc -Os -c %s -o /dev/null > // PR1641 > -// XFAIL: * > -// See PR2452 > > struct A { > unsigned long l; > @@ -10,7 +8,7 @@ > void bar(struct A *a); > > void bork() { > - const unsigned long vcgt = 'vcgt'; > + const unsigned long vcgt = 1234; > struct A a = { vcgt }; > bar(&a); > } From clattner at apple.com Mon Jun 23 12:35:45 2008 From: clattner at apple.com (Chris Lattner) Date: Mon, 23 Jun 2008 10:35:45 -0700 Subject: [llvm-commits] [llvm] r51806 - in /llvm/trunk: docs/LangRef.html include/llvm/Constants.h include/llvm/DerivedTypes.h include/llvm/Instructions.h lib/AsmParser/llvmAsmParser.cpp.cvs lib/AsmParser/llvmAsmParser.h.cvs lib/AsmParser/llvmAsmParser.y lib/AsmParser/llvmAsmParser.y.cvs lib/Bitcode/Reader/BitcodeReader.cpp lib/Bitcode/Writer/BitcodeWriter.cpp lib/VMCore/Constants.cpp lib/VMCore/Instructions.cpp lib/VMCore/Type.cpp test/Assembler/insertextractvalue.ll In-Reply-To: <8DC2434C-FC24-47EF-A00A-74C5F06D54E4@apple.com> References: <200805310058.m4V0wNwU011642@zion.cs.uiuc.edu> <56681.76.220.41.203.1214239737.squirrel@webmail.apple.com> <8DC2434C-FC24-47EF-A00A-74C5F06D54E4@apple.com> Message-ID: <29EC40E9-0590-4008-A4F3-E58F198DC93E@apple.com> On Jun 23, 2008, at 10:18 AM, Dale Johannesen wrote: >> That is a really interesting case actually. It is bad that: >> >> int x[10000]; >> >> and: >> >> int x[10000] = { 1 }; >> >> take hugely different amounts of memory to represent. > > The representation in the .s files is also hugely different, and much > bigger than gcc's. I think that could be fixed in the routines that > write it out, > but a more compact representation upstream should make that > unnecessary. > > The .bc and .ll files are also big. Something like Fortran's repeated > initializer > notation might work well: > > @y = global [10000 x i32] [ i32 1, 9999 * i32 0], align 32 yadda yadda Right, there are many possibilities. We just need to introduce a new SparseConstantArray or some other similar class for it. This isn't even particularly hard. -Chris From clattner at apple.com Mon Jun 23 12:36:23 2008 From: clattner at apple.com (Chris Lattner) Date: Mon, 23 Jun 2008 10:36:23 -0700 Subject: [llvm-commits] [llvm] r52528 - /llvm/trunk/test/FrontendC/2007-09-05-ConstCtor.c In-Reply-To: References: <200806200531.m5K5V5eL024302@zion.cs.uiuc.edu> Message-ID: On Jun 23, 2008, at 10:27 AM, Dale Johannesen wrote: > I'm not very happy about this one. 'vcgt' is implementation-defined > and gcc properly warns about it; > but for historical reasons it's widely used inside Apple (widely > enough that the warning is suppressed), > so there really should be tests that exercise it. > > Obviously the best thing is to fix the test harness so it tolerates > warnings. The test didn't care about the use of the apple literal character thing, it cared about struct layout. -Chris > > > On Jun 19, 2008, at 10:31 PMPDT, Chris Lattner wrote: >> = >> = >> = >> = >> = >> = >> = >> = >> = >> ===================================================================== >> --- llvm/trunk/test/FrontendC/2007-09-05-ConstCtor.c (original) >> +++ llvm/trunk/test/FrontendC/2007-09-05-ConstCtor.c Fri Jun 20 >> 00:31:04 2008 >> @@ -1,7 +1,5 @@ >> // RUN: %llvmgcc -xc -Os -c %s -o /dev/null >> // PR1641 >> -// XFAIL: * >> -// See PR2452 >> >> struct A { >> unsigned long l; >> @@ -10,7 +8,7 @@ >> void bar(struct A *a); >> >> void bork() { >> - const unsigned long vcgt = 'vcgt'; >> + const unsigned long vcgt = 1234; >> struct A a = { vcgt }; >> bar(&a); >> } > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From dalej at apple.com Mon Jun 23 12:39:43 2008 From: dalej at apple.com (Dale Johannesen) Date: Mon, 23 Jun 2008 10:39:43 -0700 Subject: [llvm-commits] [llvm] r52528 - /llvm/trunk/test/FrontendC/2007-09-05-ConstCtor.c In-Reply-To: References: <200806200531.m5K5V5eL024302@zion.cs.uiuc.edu> Message-ID: On Jun 23, 2008, at 10:36 AMPDT, Chris Lattner wrote: > > On Jun 23, 2008, at 10:27 AM, Dale Johannesen wrote: > >> I'm not very happy about this one. 'vcgt' is implementation-defined >> and gcc properly warns about it; >> but for historical reasons it's widely used inside Apple (widely >> enough that the warning is suppressed), >> so there really should be tests that exercise it. >> >> Obviously the best thing is to fix the test harness so it tolerates >> warnings. > > The test didn't care about the use of the apple literal character > thing, it cared about struct layout. I know, that's not the point. Regression test failures are caused by something that has nothing to do with the original point of the test at least half the time IME. We shouldn't be barred from using this construct in test cases. >> On Jun 19, 2008, at 10:31 PMPDT, Chris Lattner wrote: >>> = >>> = >>> = >>> = >>> = >>> = >>> = >>> = >>> = >>> = >>> ==================================================================== >>> --- llvm/trunk/test/FrontendC/2007-09-05-ConstCtor.c (original) >>> +++ llvm/trunk/test/FrontendC/2007-09-05-ConstCtor.c Fri Jun 20 >>> 00:31:04 2008 >>> @@ -1,7 +1,5 @@ >>> // RUN: %llvmgcc -xc -Os -c %s -o /dev/null >>> // PR1641 >>> -// XFAIL: * >>> -// See PR2452 >>> >>> struct A { >>> unsigned long l; >>> @@ -10,7 +8,7 @@ >>> void bar(struct A *a); >>> >>> void bork() { >>> - const unsigned long vcgt = 'vcgt'; >>> + const unsigned long vcgt = 1234; >>> struct A a = { vcgt }; >>> bar(&a); >>> } >> >> _______________________________________________ >> 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 clattner at apple.com Mon Jun 23 12:44:11 2008 From: clattner at apple.com (Chris Lattner) Date: Mon, 23 Jun 2008 10:44:11 -0700 Subject: [llvm-commits] [llvm] r52217 - in /llvm/trunk: lib/Transforms/Scalar/InstructionCombining.cpp test/Transforms/InstCombine/extractvalue.ll In-Reply-To: <200806111405.m5BE55rj002564@zion.cs.uiuc.edu> References: <200806111405.m5BE55rj002564@zion.cs.uiuc.edu> Message-ID: On Jun 11, 2008, at 7:05 AM, Matthijs Kooijman wrote: > Author: matthijs > Date: Wed Jun 11 09:05:05 2008 > New Revision: 52217 > > URL: http://llvm.org/viewvc/llvm-project?rev=52217&view=rev > Log: > Teach instruction combining about the extractvalue. It can > succesfully fold > useless insert-extract chains, similar to how it folds them for > vectors. Hi Matthijs, Thank you for working on this, but I think this implementation is major overkill :). The issue with vectors is that it is extremely inefficient for vectors to make transformations like: from: a = { x, y, z} // three inserts. b = shuffle a, v1 c = shuffle b, v2 output = extract c, 1 to: a = { x, y, z} // three inserts. b = shuffle a, v1 c = shuffle b, v2 output = extract b, 3 (assuming c and b have multiple other uses). Because of this, the vector code has to try hard to look through all these operations and only transform the code if it ends up able to change an extract into some input scalar that was inserted. First-class aggregates don't have this problem. Because of this, I think this code can be replaced with a very simple implementation that basically does: visitExtractValueInst(I) { op = I.getOperand(0); if (isa(op)) use new zero; else if (insertvalueinst) { if (index is the thing inserted) use inserted value else use new extract value inst of aggregate input ... } The thing that makes this really simple is that it is perfectly okay to transform: A = insertvalue B, C, 14 T = extractvalue A, 13 into: A = insertvalue B, C, 14 T = extractvalue B, 13 and rely on the iterative nature of instcombine to simplify the new extractvalue away. Does this make sense? I think it will result in a lot less code and a faster implementation in common cases. -Chris From resistor at mac.com Mon Jun 23 12:49:45 2008 From: resistor at mac.com (Owen Anderson) Date: Mon, 23 Jun 2008 17:49:45 -0000 Subject: [llvm-commits] [llvm] r52631 - /llvm/trunk/lib/Transforms/Scalar/GVN.cpp Message-ID: <200806231749.m5NHnjSe014981@zion.cs.uiuc.edu> Author: resistor Date: Mon Jun 23 12:49:45 2008 New Revision: 52631 URL: http://llvm.org/viewvc/llvm-project?rev=52631&view=rev Log: Tighten the conditions under which we do PRE, remove some unneeded code, and correct our preserved analyses list, since we do now change the CFG by splitting critical edges during PRE. Modified: llvm/trunk/lib/Transforms/Scalar/GVN.cpp Modified: llvm/trunk/lib/Transforms/Scalar/GVN.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/GVN.cpp?rev=52631&r1=52630&r2=52631&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/GVN.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/GVN.cpp Mon Jun 23 12:49:45 2008 @@ -719,10 +719,11 @@ // This transformation requires dominator postdominator info virtual void getAnalysisUsage(AnalysisUsage &AU) const { - AU.setPreservesCFG(); AU.addRequired(); AU.addRequired(); AU.addRequired(); + + AU.addPreserved(); AU.addPreserved(); AU.addPreserved(); } @@ -1019,7 +1020,11 @@ } Value* GVN::lookupNumber(BasicBlock* BB, uint32_t num) { - ValueNumberScope* locals = localAvail[BB]; + DenseMap::iterator I = localAvail.find(BB); + if (I == localAvail.end()) + return 0; + + ValueNumberScope* locals = I->second; while (locals) { DenseMap::iterator I = locals->table.find(num); @@ -1167,9 +1172,9 @@ for (BasicBlock::iterator BI = CurrentBlock->begin(), BE = CurrentBlock->end(); BI != BE; ) { - if (isa(BI) || isa(BI) || - isa(BI) || isa(BI) || - isa(BI) || isa(BI)) { + if (isa(BI) || isa(BI) || + isa(BI) || BI->mayReadFromMemory() || + BI->mayWriteToMemory()) { BI++; continue; } @@ -1282,13 +1287,6 @@ Phi->addIncoming(predMap[*PI], *PI); VN.add(Phi, valno); - - // The newly created PHI completely replaces the old instruction, - // so we need to update the maps to reflect this. - DomTreeNode* DTN = getAnalysis()[CurrentBlock]; - for (DomTreeNode::iterator UI = DTN->begin(), UE = DTN->end(); - UI != UE; ++UI) - localAvail[(*UI)->getBlock()]->table[valno] = Phi; localAvail[CurrentBlock]->table[valno] = Phi; BI->replaceAllUsesWith(Phi); From baldrick at free.fr Mon Jun 23 12:54:53 2008 From: baldrick at free.fr (Duncan Sands) Date: Mon, 23 Jun 2008 19:54:53 +0200 Subject: [llvm-commits] [llvm] r52528 - /llvm/trunk/test/FrontendC/2007-09-05-ConstCtor.c In-Reply-To: References: <200806200531.m5K5V5eL024302@zion.cs.uiuc.edu> Message-ID: <200806231954.54183.baldrick@free.fr> > Obviously the best thing is to fix the test harness so it tolerates > warnings. I already did, but after this change. Ciao, Duncan. From clattner at apple.com Mon Jun 23 13:10:03 2008 From: clattner at apple.com (Chris Lattner) Date: Mon, 23 Jun 2008 11:10:03 -0700 Subject: [llvm-commits] [llvm] r52315 - in /llvm/trunk: include/llvm/Analysis/ValueTracking.h lib/Analysis/ValueTracking.cpp lib/Transforms/Scalar/InstructionCombining.cpp In-Reply-To: <200806161248.m5GCmM01015536@zion.cs.uiuc.edu> References: <200806161248.m5GCmM01015536@zion.cs.uiuc.edu> Message-ID: <3A364BBB-5B94-468F-8D53-39395F910FD4@apple.com> On Jun 16, 2008, at 5:48 AM, Matthijs Kooijman wrote: > Author: matthijs > Date: Mon Jun 16 07:48:21 2008 > New Revision: 52315 > > URL: http://llvm.org/viewvc/llvm-project?rev=52315&view=rev > Log: > Move FindScalarValue from InstructionCombining.cpp to > ValueTracking.cpp. While > I'm at it, rename it to FindInsertedValue. > > The only functional change is that newly created instructions are no > longer > added to instcombine's worklist, but that is not really necessary > anyway (and > I'll commit some improvements next that will completely remove the > need). Can't passes just insert a new ExtractValueInst and expect instcombine to simplify stuff away? -Chris From clattner at apple.com Mon Jun 23 13:12:59 2008 From: clattner at apple.com (Chris Lattner) Date: Mon, 23 Jun 2008 11:12:59 -0700 Subject: [llvm-commits] Regression with -ipconstprop In-Reply-To: <20080619093021.GV16202@katherina.student.utwente.nl> References: <4800F036-0318-4459-88EB-3F2DBAA9D58D@apple.com> <20080619093021.GV16202@katherina.student.utwente.nl> Message-ID: On Jun 19, 2008, at 2:30 AM, Matthijs Kooijman wrote: > Hi Chris, > >> ipconstprop is crashing when compiling 447.dealII. Matthijs, can you >> please investigate? > I fixed this problem. Turns out the label operands of an invoke > instruction > come before the function arguments (which makes sense coming to > think about > it, but is a bit unexpected and inconsistent with the assembly > notation). > > I'm now using a CallSite to abstract from this. I've also changed a > few tests > to test invoke as well as call. Thanks Matthijs! I really appreciate everything you're doing in this area! -Chris From kremenek at apple.com Mon Jun 23 13:23:56 2008 From: kremenek at apple.com (Ted Kremenek) Date: Mon, 23 Jun 2008 18:23:56 -0000 Subject: [llvm-commits] [llvm] r52633 - /llvm/tags/checker/checker-44/ Message-ID: <200806231823.m5NINuOg016460@zion.cs.uiuc.edu> Author: kremenek Date: Mon Jun 23 13:23:55 2008 New Revision: 52633 URL: http://llvm.org/viewvc/llvm-project?rev=52633&view=rev Log: Tagging checker-44. Added: llvm/tags/checker/checker-44/ - copied from r52632, llvm/trunk/ From gohman at apple.com Mon Jun 23 13:40:28 2008 From: gohman at apple.com (Dan Gohman) Date: Mon, 23 Jun 2008 18:40:28 -0000 Subject: [llvm-commits] [llvm] r52636 - /llvm/trunk/lib/AsmParser/llvmAsmParser.y Message-ID: <200806231840.m5NIeTYF017017@zion.cs.uiuc.edu> Author: djg Date: Mon Jun 23 13:40:28 2008 New Revision: 52636 URL: http://llvm.org/viewvc/llvm-project?rev=52636&view=rev Log: Fix the types for NumElements variables, and add a comment explaining why empty array constants use ValID::createUndef(). Modified: llvm/trunk/lib/AsmParser/llvmAsmParser.y Modified: llvm/trunk/lib/AsmParser/llvmAsmParser.y URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/AsmParser/llvmAsmParser.y?rev=52636&r1=52635&r2=52636&view=diff ============================================================================== --- llvm/trunk/lib/AsmParser/llvmAsmParser.y (original) +++ llvm/trunk/lib/AsmParser/llvmAsmParser.y Mon Jun 23 13:40:28 2008 @@ -1535,7 +1535,7 @@ GEN_ERROR("Cannot make array constant with type: '" + (*$1)->getDescription() + "'"); const Type *ETy = ATy->getElementType(); - int NumElements = ATy->getNumElements(); + uint64_t NumElements = ATy->getNumElements(); // Verify that we have the correct size... if (NumElements != -1 && NumElements != (int)$3->size()) @@ -1563,7 +1563,7 @@ GEN_ERROR("Cannot make array constant with type: '" + (*$1)->getDescription() + "'"); - int NumElements = ATy->getNumElements(); + uint64_t NumElements = ATy->getNumElements(); if (NumElements != -1 && NumElements != 0) GEN_ERROR("Type mismatch: constant sized array initialized with 0" " arguments, but has size of " + itostr(NumElements) +""); @@ -1579,7 +1579,7 @@ GEN_ERROR("Cannot make array constant with type: '" + (*$1)->getDescription() + "'"); - int NumElements = ATy->getNumElements(); + uint64_t NumElements = ATy->getNumElements(); const Type *ETy = ATy->getElementType(); if (NumElements != -1 && NumElements != int($3->length())) GEN_ERROR("Can't build string constant of size " + @@ -1606,7 +1606,7 @@ GEN_ERROR("Cannot make packed constant with type: '" + (*$1)->getDescription() + "'"); const Type *ETy = PTy->getElementType(); - int NumElements = PTy->getNumElements(); + unsigned NumElements = PTy->getNumElements(); // Verify that we have the correct size... if (NumElements != -1 && NumElements != (int)$3->size()) @@ -2479,7 +2479,7 @@ } | '<' ConstVector '>' { // Nonempty unsized packed vector const Type *ETy = (*$2)[0]->getType(); - int NumElements = $2->size(); + unsigned NumElements = $2->size(); if (!ETy->isInteger() && !ETy->isFloatingPoint()) GEN_ERROR("Invalid vector element type: " + ETy->getDescription()); @@ -2501,7 +2501,7 @@ } | '[' ConstVector ']' { // Nonempty unsized arr const Type *ETy = (*$2)[0]->getType(); - int NumElements = $2->size(); + uint64_t NumElements = $2->size(); if (!ETy->isFirstClassType()) GEN_ERROR("Invalid array element type: " + ETy->getDescription()); @@ -2522,11 +2522,13 @@ CHECK_FOR_ERROR } | '[' ']' { + // Use undef instead of an array because it's inconvenient to determine + // the element type at this point, there being no elements to examine. $$ = ValID::createUndef(); CHECK_FOR_ERROR } | 'c' STRINGCONSTANT { - int NumElements = $2->length(); + uint64_t NumElements = $2->length(); const Type *ETy = Type::Int8Ty; ArrayType *ATy = ArrayType::get(ETy, NumElements); From gohman at apple.com Mon Jun 23 13:43:26 2008 From: gohman at apple.com (Dan Gohman) Date: Mon, 23 Jun 2008 18:43:26 -0000 Subject: [llvm-commits] [llvm] r52637 - in /llvm/trunk/lib/AsmParser: llvmAsmParser.cpp.cvs llvmAsmParser.h.cvs llvmAsmParser.y.cvs Message-ID: <200806231843.m5NIhQaP017104@zion.cs.uiuc.edu> Author: djg Date: Mon Jun 23 13:43:26 2008 New Revision: 52637 URL: http://llvm.org/viewvc/llvm-project?rev=52637&view=rev Log: Update the .cvs files. Modified: llvm/trunk/lib/AsmParser/llvmAsmParser.cpp.cvs llvm/trunk/lib/AsmParser/llvmAsmParser.h.cvs llvm/trunk/lib/AsmParser/llvmAsmParser.y.cvs Modified: llvm/trunk/lib/AsmParser/llvmAsmParser.cpp.cvs URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/AsmParser/llvmAsmParser.cpp.cvs?rev=52637&r1=52636&r2=52637&view=diff ============================================================================== --- llvm/trunk/lib/AsmParser/llvmAsmParser.cpp.cvs (original) +++ llvm/trunk/lib/AsmParser/llvmAsmParser.cpp.cvs Mon Jun 23 13:43:26 2008 @@ -1396,7 +1396,7 @@ llvm::ICmpInst::Predicate IPredicate; llvm::FCmpInst::Predicate FPredicate; } -/* Line 187 of yacc.c. */ +/* Line 193 of yacc.c. */ #line 1401 "llvmAsmParser.tab.c" YYSTYPE; # define yystype YYSTYPE /* obsolescent; will be withdrawn */ @@ -1460,7 +1460,7 @@ #define YYSIZE_MAXIMUM ((YYSIZE_T) -1) #ifndef YY_ -# if YYENABLE_NLS +# if defined YYENABLE_NLS && YYENABLE_NLS # if ENABLE_NLS # include /* INFRINGES ON USER NAME SPACE */ # define YY_(msgid) dgettext ("bison-runtime", msgid) @@ -1877,15 +1877,15 @@ 2183, 2186, 2192, 2202, 2206, 2211, 2213, 2218, 2223, 2232, 2242, 2253, 2257, 2266, 2275, 2280, 2409, 2409, 2411, 2420, 2420, 2422, 2427, 2439, 2443, 2448, 2452, 2456, 2460, 2464, - 2468, 2472, 2476, 2480, 2502, 2524, 2528, 2541, 2553, 2558, - 2570, 2576, 2580, 2590, 2594, 2598, 2603, 2610, 2610, 2616, - 2625, 2630, 2635, 2639, 2648, 2657, 2666, 2670, 2678, 2685, - 2689, 2694, 2705, 2724, 2733, 2819, 2823, 2830, 2841, 2854, - 2864, 2875, 2885, 2896, 2904, 2914, 2921, 2924, 2925, 2933, - 2939, 2948, 2952, 2957, 2973, 2990, 3004, 3018, 3032, 3046, - 3058, 3066, 3073, 3079, 3085, 3091, 3106, 3196, 3201, 3205, - 3212, 3219, 3229, 3236, 3246, 3254, 3268, 3285, 3293, 3308, - 3323 + 2468, 2472, 2476, 2480, 2502, 2524, 2530, 2543, 2555, 2560, + 2572, 2578, 2582, 2592, 2596, 2600, 2605, 2612, 2612, 2618, + 2627, 2632, 2637, 2641, 2650, 2659, 2668, 2672, 2680, 2687, + 2691, 2696, 2707, 2726, 2735, 2821, 2825, 2832, 2843, 2856, + 2866, 2877, 2887, 2898, 2906, 2916, 2923, 2926, 2927, 2935, + 2941, 2950, 2954, 2959, 2975, 2992, 3006, 3020, 3034, 3048, + 3060, 3068, 3075, 3081, 3087, 3093, 3108, 3198, 3203, 3207, + 3214, 3221, 3231, 3238, 3248, 3256, 3270, 3287, 3295, 3310, + 3325 }; #endif @@ -2857,7 +2857,7 @@ we won't break user code: when these are the locations we know. */ #ifndef YY_LOCATION_PRINT -# if YYLTYPE_IS_TRIVIAL +# if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL # define YY_LOCATION_PRINT(File, Loc) \ fprintf (File, "%d.%d-%d.%d", \ (Loc).first_line, (Loc).first_column, \ @@ -4411,7 +4411,7 @@ GEN_ERROR("Cannot make array constant with type: '" + (*(yyvsp[(1) - (4)].TypeVal))->getDescription() + "'"); const Type *ETy = ATy->getElementType(); - int NumElements = ATy->getNumElements(); + uint64_t NumElements = ATy->getNumElements(); // Verify that we have the correct size... if (NumElements != -1 && NumElements != (int)(yyvsp[(3) - (4)].ConstVector)->size()) @@ -4443,7 +4443,7 @@ GEN_ERROR("Cannot make array constant with type: '" + (*(yyvsp[(1) - (3)].TypeVal))->getDescription() + "'"); - int NumElements = ATy->getNumElements(); + uint64_t NumElements = ATy->getNumElements(); if (NumElements != -1 && NumElements != 0) GEN_ERROR("Type mismatch: constant sized array initialized with 0" " arguments, but has size of " + itostr(NumElements) +""); @@ -4463,7 +4463,7 @@ GEN_ERROR("Cannot make array constant with type: '" + (*(yyvsp[(1) - (3)].TypeVal))->getDescription() + "'"); - int NumElements = ATy->getNumElements(); + uint64_t NumElements = ATy->getNumElements(); const Type *ETy = ATy->getElementType(); if (NumElements != -1 && NumElements != int((yyvsp[(3) - (3)].StrVal)->length())) GEN_ERROR("Can't build string constant of size " + @@ -4494,7 +4494,7 @@ GEN_ERROR("Cannot make packed constant with type: '" + (*(yyvsp[(1) - (4)].TypeVal))->getDescription() + "'"); const Type *ETy = PTy->getElementType(); - int NumElements = PTy->getNumElements(); + unsigned NumElements = PTy->getNumElements(); // Verify that we have the correct size... if (NumElements != -1 && NumElements != (int)(yyvsp[(3) - (4)].ConstVector)->size()) @@ -5645,7 +5645,7 @@ #line 2480 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { // Nonempty unsized packed vector const Type *ETy = (*(yyvsp[(2) - (3)].ConstVector))[0]->getType(); - int NumElements = (yyvsp[(2) - (3)].ConstVector)->size(); + unsigned NumElements = (yyvsp[(2) - (3)].ConstVector)->size(); if (!ETy->isInteger() && !ETy->isFloatingPoint()) GEN_ERROR("Invalid vector element type: " + ETy->getDescription()); @@ -5671,7 +5671,7 @@ #line 2502 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { // Nonempty unsized arr const Type *ETy = (*(yyvsp[(2) - (3)].ConstVector))[0]->getType(); - int NumElements = (yyvsp[(2) - (3)].ConstVector)->size(); + uint64_t NumElements = (yyvsp[(2) - (3)].ConstVector)->size(); if (!ETy->isFirstClassType()) GEN_ERROR("Invalid array element type: " + ETy->getDescription()); @@ -5696,15 +5696,17 @@ case 265: #line 2524 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { + // Use undef instead of an array because it's inconvenient to determine + // the element type at this point, there being no elements to examine. (yyval.ValIDVal) = ValID::createUndef(); CHECK_FOR_ERROR ;} break; case 266: -#line 2528 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2530 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { - int NumElements = (yyvsp[(2) - (2)].StrVal)->length(); + uint64_t NumElements = (yyvsp[(2) - (2)].StrVal)->length(); const Type *ETy = Type::Int8Ty; ArrayType *ATy = ArrayType::get(ETy, NumElements); @@ -5719,7 +5721,7 @@ break; case 267: -#line 2541 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2543 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { std::vector Elements((yyvsp[(2) - (3)].ConstVector)->size()); for (unsigned i = 0, e = (yyvsp[(2) - (3)].ConstVector)->size(); i != e; ++i) @@ -5735,7 +5737,7 @@ break; case 268: -#line 2553 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2555 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { const StructType *STy = StructType::get(std::vector()); (yyval.ValIDVal) = ValID::create(ConstantStruct::get(STy, std::vector())); @@ -5744,7 +5746,7 @@ break; case 269: -#line 2558 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2560 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { std::vector Elements((yyvsp[(3) - (5)].ConstVector)->size()); for (unsigned i = 0, e = (yyvsp[(3) - (5)].ConstVector)->size(); i != e; ++i) @@ -5760,7 +5762,7 @@ break; case 270: -#line 2570 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2572 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { const StructType *STy = StructType::get(std::vector(), /*isPacked=*/true); @@ -5770,7 +5772,7 @@ break; case 271: -#line 2576 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2578 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ValIDVal) = ValID::create((yyvsp[(1) - (1)].ConstVal)); CHECK_FOR_ERROR @@ -5778,7 +5780,7 @@ break; case 272: -#line 2580 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2582 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ValIDVal) = ValID::createInlineAsm(*(yyvsp[(3) - (5)].StrVal), *(yyvsp[(5) - (5)].StrVal), (yyvsp[(2) - (5)].BoolVal)); delete (yyvsp[(3) - (5)].StrVal); @@ -5788,7 +5790,7 @@ break; case 273: -#line 2590 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2592 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { // Is it an integer reference...? (yyval.ValIDVal) = ValID::createLocalID((yyvsp[(1) - (1)].UIntVal)); CHECK_FOR_ERROR @@ -5796,7 +5798,7 @@ break; case 274: -#line 2594 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2596 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ValIDVal) = ValID::createGlobalID((yyvsp[(1) - (1)].UIntVal)); CHECK_FOR_ERROR @@ -5804,7 +5806,7 @@ break; case 275: -#line 2598 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2600 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { // Is it a named reference...? (yyval.ValIDVal) = ValID::createLocalName(*(yyvsp[(1) - (1)].StrVal)); delete (yyvsp[(1) - (1)].StrVal); @@ -5813,7 +5815,7 @@ break; case 276: -#line 2603 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2605 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { // Is it a named reference...? (yyval.ValIDVal) = ValID::createGlobalName(*(yyvsp[(1) - (1)].StrVal)); delete (yyvsp[(1) - (1)].StrVal); @@ -5822,7 +5824,7 @@ break; case 279: -#line 2616 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2618 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription()); @@ -5833,7 +5835,7 @@ break; case 280: -#line 2625 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2627 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ValueList) = new std::vector(); (yyval.ValueList)->push_back((yyvsp[(1) - (1)].ValueVal)); @@ -5842,7 +5844,7 @@ break; case 281: -#line 2630 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2632 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { ((yyval.ValueList)=(yyvsp[(1) - (3)].ValueList))->push_back((yyvsp[(3) - (3)].ValueVal)); CHECK_FOR_ERROR @@ -5850,7 +5852,7 @@ break; case 282: -#line 2635 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2637 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.FunctionVal) = (yyvsp[(1) - (2)].FunctionVal); CHECK_FOR_ERROR @@ -5858,7 +5860,7 @@ break; case 283: -#line 2639 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2641 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { // Do not allow functions with 0 basic blocks (yyval.FunctionVal) = (yyvsp[(1) - (2)].FunctionVal); CHECK_FOR_ERROR @@ -5866,7 +5868,7 @@ break; case 284: -#line 2648 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2650 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { setValueName((yyvsp[(3) - (3)].TermInstVal), (yyvsp[(2) - (3)].StrVal)); CHECK_FOR_ERROR @@ -5878,7 +5880,7 @@ break; case 285: -#line 2657 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2659 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { if (CastInst *CI1 = dyn_cast((yyvsp[(2) - (2)].InstVal))) if (CastInst *CI2 = dyn_cast(CI1->getOperand(0))) @@ -5891,7 +5893,7 @@ break; case 286: -#line 2666 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2668 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { // Empty space between instruction lists (yyval.BasicBlockVal) = defineBBVal(ValID::createLocalID(CurFun.NextValNum)); CHECK_FOR_ERROR @@ -5899,7 +5901,7 @@ break; case 287: -#line 2670 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2672 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { // Labelled (named) basic block (yyval.BasicBlockVal) = defineBBVal(ValID::createLocalName(*(yyvsp[(1) - (1)].StrVal))); delete (yyvsp[(1) - (1)].StrVal); @@ -5909,7 +5911,7 @@ break; case 288: -#line 2678 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2680 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { // Return with a result... ValueList &VL = *(yyvsp[(2) - (2)].ValueList); assert(!VL.empty() && "Invalid ret operands!"); @@ -5920,7 +5922,7 @@ break; case 289: -#line 2685 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2687 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { // Return with no result... (yyval.TermInstVal) = ReturnInst::Create(); CHECK_FOR_ERROR @@ -5928,7 +5930,7 @@ break; case 290: -#line 2689 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2691 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { // Unconditional Branch... BasicBlock* tmpBB = getBBVal((yyvsp[(3) - (3)].ValIDVal)); CHECK_FOR_ERROR @@ -5937,7 +5939,7 @@ break; case 291: -#line 2694 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2696 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { if (cast((yyvsp[(2) - (9)].PrimType))->getBitWidth() != 1) GEN_ERROR("Branch condition must have type i1"); @@ -5952,7 +5954,7 @@ break; case 292: -#line 2705 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2707 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { Value* tmpVal = getVal((yyvsp[(2) - (9)].PrimType), (yyvsp[(3) - (9)].ValIDVal)); CHECK_FOR_ERROR @@ -5975,7 +5977,7 @@ break; case 293: -#line 2724 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2726 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { Value* tmpVal = getVal((yyvsp[(2) - (8)].PrimType), (yyvsp[(3) - (8)].ValIDVal)); CHECK_FOR_ERROR @@ -5988,7 +5990,7 @@ break; case 294: -#line 2734 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2736 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { // Handle the short syntax @@ -6077,7 +6079,7 @@ break; case 295: -#line 2819 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2821 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.TermInstVal) = new UnwindInst(); CHECK_FOR_ERROR @@ -6085,7 +6087,7 @@ break; case 296: -#line 2823 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2825 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.TermInstVal) = new UnreachableInst(); CHECK_FOR_ERROR @@ -6093,7 +6095,7 @@ break; case 297: -#line 2830 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2832 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.JumpTable) = (yyvsp[(1) - (6)].JumpTable); Constant *V = cast(getExistingVal((yyvsp[(2) - (6)].PrimType), (yyvsp[(3) - (6)].ValIDVal))); @@ -6108,7 +6110,7 @@ break; case 298: -#line 2841 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2843 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.JumpTable) = new std::vector >(); Constant *V = cast(getExistingVal((yyvsp[(1) - (5)].PrimType), (yyvsp[(2) - (5)].ValIDVal))); @@ -6124,7 +6126,7 @@ break; case 299: -#line 2854 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2856 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { // Is this definition named?? if so, assign the name... setValueName((yyvsp[(2) - (2)].InstVal), (yyvsp[(1) - (2)].StrVal)); @@ -6136,7 +6138,7 @@ break; case 300: -#line 2864 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2866 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { // Used for PHI nodes if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (6)].TypeVal))->getDescription()); @@ -6151,7 +6153,7 @@ break; case 301: -#line 2875 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2877 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.PHIList) = (yyvsp[(1) - (7)].PHIList); Value* tmpVal = getVal((yyvsp[(1) - (7)].PHIList)->front().first->getType(), (yyvsp[(4) - (7)].ValIDVal)); @@ -6163,7 +6165,7 @@ break; case 302: -#line 2885 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2887 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { // FIXME: Remove trailing OptParamAttrs in LLVM 3.0, it was a mistake in 2.0 if (!UpRefs.empty()) @@ -6178,7 +6180,7 @@ break; case 303: -#line 2896 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2898 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { // FIXME: Remove trailing OptParamAttrs in LLVM 3.0, it was a mistake in 2.0 // Labels are only valid in ASMs @@ -6190,7 +6192,7 @@ break; case 304: -#line 2904 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2906 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { // FIXME: Remove trailing OptParamAttrs in LLVM 3.0, it was a mistake in 2.0 if (!UpRefs.empty()) @@ -6204,7 +6206,7 @@ break; case 305: -#line 2914 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2916 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { // FIXME: Remove trailing OptParamAttrs in LLVM 3.0, it was a mistake in 2.0 (yyval.ParamList) = (yyvsp[(1) - (6)].ParamList); @@ -6215,17 +6217,17 @@ break; case 306: -#line 2921 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2923 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ParamList) = new ParamList(); ;} break; case 307: -#line 2924 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2926 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ValueList) = new std::vector(); ;} break; case 308: -#line 2925 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2927 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ValueList) = (yyvsp[(1) - (3)].ValueList); (yyval.ValueList)->push_back((yyvsp[(3) - (3)].ValueVal)); @@ -6234,7 +6236,7 @@ break; case 309: -#line 2933 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2935 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ConstantList) = new std::vector(); if ((unsigned)(yyvsp[(2) - (2)].UInt64Val) != (yyvsp[(2) - (2)].UInt64Val)) @@ -6244,7 +6246,7 @@ break; case 310: -#line 2939 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2941 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ConstantList) = (yyvsp[(1) - (3)].ConstantList); if ((unsigned)(yyvsp[(3) - (3)].UInt64Val) != (yyvsp[(3) - (3)].UInt64Val)) @@ -6255,7 +6257,7 @@ break; case 311: -#line 2948 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2950 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.BoolVal) = true; CHECK_FOR_ERROR @@ -6263,7 +6265,7 @@ break; case 312: -#line 2952 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2954 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.BoolVal) = false; CHECK_FOR_ERROR @@ -6271,7 +6273,7 @@ break; case 313: -#line 2957 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2959 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (5)].TypeVal))->getDescription()); @@ -6291,7 +6293,7 @@ break; case 314: -#line 2973 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2975 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (5)].TypeVal))->getDescription()); @@ -6312,7 +6314,7 @@ break; case 315: -#line 2990 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2992 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (6)].TypeVal))->getDescription()); @@ -6330,7 +6332,7 @@ break; case 316: -#line 3004 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 3006 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (6)].TypeVal))->getDescription()); @@ -6348,7 +6350,7 @@ break; case 317: -#line 3018 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 3020 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (6)].TypeVal))->getDescription()); @@ -6366,7 +6368,7 @@ break; case 318: -#line 3032 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 3034 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (6)].TypeVal))->getDescription()); @@ -6384,7 +6386,7 @@ break; case 319: -#line 3046 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 3048 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(4) - (4)].TypeVal))->getDescription()); @@ -6400,7 +6402,7 @@ break; case 320: -#line 3058 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 3060 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { if ((yyvsp[(2) - (6)].ValueVal)->getType() != Type::Int1Ty) GEN_ERROR("select condition must be boolean"); @@ -6412,7 +6414,7 @@ break; case 321: -#line 3066 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 3068 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(4) - (4)].TypeVal))->getDescription()); @@ -6423,7 +6425,7 @@ break; case 322: -#line 3073 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 3075 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { if (!ExtractElementInst::isValidOperands((yyvsp[(2) - (4)].ValueVal), (yyvsp[(4) - (4)].ValueVal))) GEN_ERROR("Invalid extractelement operands"); @@ -6433,7 +6435,7 @@ break; case 323: -#line 3079 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 3081 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { if (!InsertElementInst::isValidOperands((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal))) GEN_ERROR("Invalid insertelement operands"); @@ -6443,7 +6445,7 @@ break; case 324: -#line 3085 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 3087 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { if (!ShuffleVectorInst::isValidOperands((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal))) GEN_ERROR("Invalid shufflevector operands"); @@ -6453,7 +6455,7 @@ break; case 325: -#line 3091 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 3093 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { const Type *Ty = (yyvsp[(2) - (2)].PHIList)->front().first->getType(); if (!Ty->isFirstClassType()) @@ -6472,7 +6474,7 @@ break; case 326: -#line 3107 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 3109 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { // Handle the short syntax @@ -6565,7 +6567,7 @@ break; case 327: -#line 3196 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 3198 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.InstVal) = (yyvsp[(1) - (1)].InstVal); CHECK_FOR_ERROR @@ -6573,7 +6575,7 @@ break; case 328: -#line 3201 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 3203 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.BoolVal) = true; CHECK_FOR_ERROR @@ -6581,7 +6583,7 @@ break; case 329: -#line 3205 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 3207 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.BoolVal) = false; CHECK_FOR_ERROR @@ -6589,7 +6591,7 @@ break; case 330: -#line 3212 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 3214 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (3)].TypeVal))->getDescription()); @@ -6600,7 +6602,7 @@ break; case 331: -#line 3219 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 3221 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (6)].TypeVal))->getDescription()); @@ -6614,7 +6616,7 @@ break; case 332: -#line 3229 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 3231 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (3)].TypeVal))->getDescription()); @@ -6625,7 +6627,7 @@ break; case 333: -#line 3236 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 3238 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (6)].TypeVal))->getDescription()); @@ -6639,7 +6641,7 @@ break; case 334: -#line 3246 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 3248 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { if (!isa((yyvsp[(2) - (2)].ValueVal)->getType())) GEN_ERROR("Trying to free nonpointer type " + @@ -6650,7 +6652,7 @@ break; case 335: -#line 3254 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 3256 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (5)].TypeVal))->getDescription()); @@ -6668,7 +6670,7 @@ break; case 336: -#line 3268 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 3270 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(5) - (7)].TypeVal))->getDescription()); @@ -6689,7 +6691,7 @@ break; case 337: -#line 3285 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 3287 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { Value *TmpVal = getVal((yyvsp[(2) - (5)].TypeVal)->get(), (yyvsp[(3) - (5)].ValIDVal)); if (!GetResultInst::isValidOperands(TmpVal, (yyvsp[(5) - (5)].UInt64Val))) @@ -6701,7 +6703,7 @@ break; case 338: -#line 3293 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 3295 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (4)].TypeVal))->getDescription()); @@ -6720,7 +6722,7 @@ break; case 339: -#line 3308 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 3310 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (4)].TypeVal))->getDescription()); @@ -6739,7 +6741,7 @@ break; case 340: -#line 3323 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 3325 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (7)].TypeVal))->getDescription()); @@ -6761,7 +6763,7 @@ /* Line 1267 of yacc.c. */ -#line 6765 "llvmAsmParser.tab.c" +#line 6767 "llvmAsmParser.tab.c" default: break; } YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); @@ -6975,7 +6977,7 @@ } -#line 3342 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 3344 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" // common code from the two 'RunVMAsmParser' functions Modified: llvm/trunk/lib/AsmParser/llvmAsmParser.h.cvs URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/AsmParser/llvmAsmParser.h.cvs?rev=52637&r1=52636&r2=52637&view=diff ============================================================================== --- llvm/trunk/lib/AsmParser/llvmAsmParser.h.cvs (original) +++ llvm/trunk/lib/AsmParser/llvmAsmParser.h.cvs Mon Jun 23 13:43:26 2008 @@ -402,7 +402,7 @@ llvm::ICmpInst::Predicate IPredicate; llvm::FCmpInst::Predicate FPredicate; } -/* Line 1489 of yacc.c. */ +/* Line 1529 of yacc.c. */ #line 407 "llvmAsmParser.tab.h" YYSTYPE; # define yystype YYSTYPE /* obsolescent; will be withdrawn */ Modified: llvm/trunk/lib/AsmParser/llvmAsmParser.y.cvs URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/AsmParser/llvmAsmParser.y.cvs?rev=52637&r1=52636&r2=52637&view=diff ============================================================================== --- llvm/trunk/lib/AsmParser/llvmAsmParser.y.cvs (original) +++ llvm/trunk/lib/AsmParser/llvmAsmParser.y.cvs Mon Jun 23 13:43:26 2008 @@ -1535,7 +1535,7 @@ GEN_ERROR("Cannot make array constant with type: '" + (*$1)->getDescription() + "'"); const Type *ETy = ATy->getElementType(); - int NumElements = ATy->getNumElements(); + uint64_t NumElements = ATy->getNumElements(); // Verify that we have the correct size... if (NumElements != -1 && NumElements != (int)$3->size()) @@ -1563,7 +1563,7 @@ GEN_ERROR("Cannot make array constant with type: '" + (*$1)->getDescription() + "'"); - int NumElements = ATy->getNumElements(); + uint64_t NumElements = ATy->getNumElements(); if (NumElements != -1 && NumElements != 0) GEN_ERROR("Type mismatch: constant sized array initialized with 0" " arguments, but has size of " + itostr(NumElements) +""); @@ -1579,7 +1579,7 @@ GEN_ERROR("Cannot make array constant with type: '" + (*$1)->getDescription() + "'"); - int NumElements = ATy->getNumElements(); + uint64_t NumElements = ATy->getNumElements(); const Type *ETy = ATy->getElementType(); if (NumElements != -1 && NumElements != int($3->length())) GEN_ERROR("Can't build string constant of size " + @@ -1606,7 +1606,7 @@ GEN_ERROR("Cannot make packed constant with type: '" + (*$1)->getDescription() + "'"); const Type *ETy = PTy->getElementType(); - int NumElements = PTy->getNumElements(); + unsigned NumElements = PTy->getNumElements(); // Verify that we have the correct size... if (NumElements != -1 && NumElements != (int)$3->size()) @@ -2479,7 +2479,7 @@ } | '<' ConstVector '>' { // Nonempty unsized packed vector const Type *ETy = (*$2)[0]->getType(); - int NumElements = $2->size(); + unsigned NumElements = $2->size(); if (!ETy->isInteger() && !ETy->isFloatingPoint()) GEN_ERROR("Invalid vector element type: " + ETy->getDescription()); @@ -2501,7 +2501,7 @@ } | '[' ConstVector ']' { // Nonempty unsized arr const Type *ETy = (*$2)[0]->getType(); - int NumElements = $2->size(); + uint64_t NumElements = $2->size(); if (!ETy->isFirstClassType()) GEN_ERROR("Invalid array element type: " + ETy->getDescription()); @@ -2522,11 +2522,13 @@ CHECK_FOR_ERROR } | '[' ']' { + // Use undef instead of an array because it's inconvenient to determine + // the element type at this point, there being no elements to examine. $$ = ValID::createUndef(); CHECK_FOR_ERROR } | 'c' STRINGCONSTANT { - int NumElements = $2->length(); + uint64_t NumElements = $2->length(); const Type *ETy = Type::Int8Ty; ArrayType *ATy = ArrayType::get(ETy, NumElements); From gohman at apple.com Mon Jun 23 13:43:41 2008 From: gohman at apple.com (Dan Gohman) Date: Mon, 23 Jun 2008 11:43:41 -0700 Subject: [llvm-commits] [llvm] r52149 - in /llvm/trunk: lib/AsmParser/llvmAsmParser.cpp.cvs lib/AsmParser/llvmAsmParser.h.cvs lib/AsmParser/llvmAsmParser.y lib/AsmParser/llvmAsmParser.y.cvs utils/llvm.grm In-Reply-To: <21C65B8A-9821-4763-BEA5-FCA0E2D91FAF@apple.com> References: <200806091445.m59Ej2BZ019742@zion.cs.uiuc.edu> <21C65B8A-9821-4763-BEA5-FCA0E2D91FAF@apple.com> Message-ID: On Jun 23, 2008, at 10:18 AM, Chris Lattner wrote: > On Jun 9, 2008, at 7:45 AM, Dan Gohman wrote: >> Author: djg >> Date: Mon Jun 9 09:45:02 2008 >> New Revision: 52149 >> >> URL: http://llvm.org/viewvc/llvm-project?rev=52149&view=rev >> Log: >> AsmParser support for immediate constant aggregate values. > > Hey Dan, > > General comment: please commit the change of .y file separate from > the .cvs files. They are large and noisy. Ok. > > >> >> +++ llvm/trunk/lib/AsmParser/llvmAsmParser.y Mon Jun 9 09:45:02 2008 >> @@ -2505,6 +2499,80 @@ >> delete PTy; delete $2; >> CHECK_FOR_ERROR >> } >> + | '[' ConstVector ']' { // Nonempty unsized arr >> + const Type *ETy = (*$2)[0]->getType(); >> + int NumElements = $2->size(); > > Please use uint64_t for NumElements. fixed. > > >> >> + ArrayType *ATy = ArrayType::get(ETy, NumElements); >> + PATypeHolder* PTy = new PATypeHolder(HandleUpRefs(ATy)); >> + >> + // Verify all elements are correct type! >> + for (unsigned i = 0; i < $2->size(); i++) { > > Here too. fixed. > > >> + | '[' ']' { >> + $$ = ValID::createUndef(); >> + CHECK_FOR_ERROR >> + } > > This should make an empty array not an undef. I'm not sure if it make > a difference in practice though. The problem is that this bit of code doesn't know the element type. ValID::createUndef lets the array type be inferred later. I judged it not important enough to justify a significantly more elaborate solution. I added a comment to explain it now. > > >> >> + | 'c' STRINGCONSTANT { >> + int NumElements = $2->length(); > > Please use size_t or uint64_t. fixed. Thanks, Dan From wmatyjewicz at fastmail.fm Mon Jun 23 14:39:51 2008 From: wmatyjewicz at fastmail.fm (Wojciech Matyjewicz) Date: Mon, 23 Jun 2008 19:39:51 -0000 Subject: [llvm-commits] [llvm] r52638 - in /llvm/trunk: include/llvm/ADT/APInt.h lib/Support/APInt.cpp Message-ID: <200806231939.m5NJdpeV019682@zion.cs.uiuc.edu> Author: wmat Date: Mon Jun 23 14:39:50 2008 New Revision: 52638 URL: http://llvm.org/viewvc/llvm-project?rev=52638&view=rev Log: First step to fix PR2088. Implement routine to compute the multiplicative inverse of a given number. Modify udivrem to allow input and output pairs of arguments to overlap. Patch is based on the work by Chandler Carruth. Modified: llvm/trunk/include/llvm/ADT/APInt.h llvm/trunk/lib/Support/APInt.cpp Modified: llvm/trunk/include/llvm/ADT/APInt.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/APInt.h?rev=52638&r1=52637&r2=52638&view=diff ============================================================================== --- llvm/trunk/include/llvm/ADT/APInt.h (original) +++ llvm/trunk/include/llvm/ADT/APInt.h Mon Jun 23 14:39:50 2008 @@ -668,9 +668,11 @@ return this->urem(RHS); } - /// Sometimes it is convenient to divide two APInt values and obtain both - /// the quotient and remainder. This function does both operations in the - /// same computation making it a little more efficient. + /// Sometimes it is convenient to divide two APInt values and obtain both the + /// quotient and remainder. This function does both operations in the same + /// computation making it a little more efficient. The pair of input arguments + /// may overlap with the pair of output arguments. It is safe to call + /// udivrem(X, Y, X, Y), for example. /// @brief Dual division/remainder interface. static void udivrem(const APInt &LHS, const APInt &RHS, APInt &Quotient, APInt &Remainder); @@ -1107,6 +1109,9 @@ return *this; } + /// @returns the multiplicative inverse for a given modulo. + APInt multiplicativeInverse(const APInt& modulo) const; + /// @} /// @name Building-block Operations for APInt and APFloat /// @{ @@ -1301,7 +1306,7 @@ } /// GreatestCommonDivisor - This function returns the greatest common -/// divisor of the two APInt values using Enclid's algorithm. +/// divisor of the two APInt values using Euclid's algorithm. /// @returns the greatest common divisor of Val1 and Val2 /// @brief Compute GCD of two APInt values. APInt GreatestCommonDivisor(const APInt& Val1, const APInt& Val2); Modified: llvm/trunk/lib/Support/APInt.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/APInt.cpp?rev=52638&r1=52637&r2=52638&view=diff ============================================================================== --- llvm/trunk/lib/Support/APInt.cpp (original) +++ llvm/trunk/lib/Support/APInt.cpp Mon Jun 23 14:39:50 2008 @@ -1426,6 +1426,50 @@ return x_old + 1; } +/// Computes the multiplicative inverse of this APInt for a given modulo. The +/// iterative extended Euclidean algorithm is used to solve for this value, +/// however we simplify it to speed up calculating only the inverse, and take +/// advantage of div+rem calculations. We also use some tricks to avoid copying +/// (potentially large) APInts around. +APInt APInt::multiplicativeInverse(const APInt& modulo) const { + assert(ult(modulo) && "This APInt must be smaller than the modulo"); + + // Using the properties listed at the following web page (accessed 06/21/08): + // http://www.numbertheory.org/php/euclid.html + // (especially the properties numbered 3, 4 and 9) it can be proved that + // BitWidth bits suffice for all the computations in the algorithm implemented + // below. More precisely, this number of bits suffice if the multiplicative + // inverse exists, but may not suffice for the general extended Euclidean + // algorithm. + + APInt r[2] = { modulo, *this }; + APInt t[2] = { APInt(BitWidth, 0), APInt(BitWidth, 1) }; + APInt q(BitWidth, 0); + + unsigned i; + for (i = 0; r[i^1] != 0; i ^= 1) { + // An overview of the math without the confusing bit-flipping: + // q = r[i-2] / r[i-1] + // r[i] = r[i-2] % r[i-1] + // t[i] = t[i-2] - t[i-1] * q + udivrem(r[i], r[i^1], q, r[i]); + t[i] -= t[i^1] * q; + } + + // If this APInt and the modulo are not coprime, there is no multiplicative + // inverse, so return 0. We check this by looking at the next-to-last + // remainder, which is the gcd(*this,modulo) as calculated by the Euclidean + // algorithm. + if (r[i] != 1) + return APInt(BitWidth, 0); + + // The next-to-last t is the multiplicative inverse. However, we are + // interested in a positive inverse. Calcuate a positive one from a negative + // one if necessary. A simple addition of the modulo suffices because + // abs(t[i]) is known to less than *this/2 (see the link above). + return t[i].isNegative() ? t[i] + modulo : t[i]; +} + /// Implementation of Knuth's Algorithm D (Division of nonnegative integers) /// from "Art of Computer Programming, Volume 2", section 4.3.1, p. 272. The /// variables here have the same names as in the algorithm. Comments explain @@ -1882,13 +1926,10 @@ if (lhsWords == 1 && rhsWords == 1) { // There is only one word to consider so use the native versions. - if (LHS.isSingleWord()) { - Quotient = APInt(LHS.getBitWidth(), LHS.VAL / RHS.VAL); - Remainder = APInt(LHS.getBitWidth(), LHS.VAL % RHS.VAL); - } else { - Quotient = APInt(LHS.getBitWidth(), LHS.pVal[0] / RHS.pVal[0]); - Remainder = APInt(LHS.getBitWidth(), LHS.pVal[0] % RHS.pVal[0]); - } + uint64_t lhsValue = LHS.isSingleWord() ? LHS.VAL : LHS.pVal[0]; + uint64_t rhsValue = RHS.isSingleWord() ? RHS.VAL : RHS.pVal[0]; + Quotient = APInt(LHS.getBitWidth(), lhsValue / rhsValue); + Remainder = APInt(LHS.getBitWidth(), lhsValue % rhsValue); return; } From wmatyjewicz at fastmail.fm Mon Jun 23 14:53:16 2008 From: wmatyjewicz at fastmail.fm (Wojciech Matyjewicz) Date: Mon, 23 Jun 2008 21:53:16 +0200 Subject: [llvm-commits] [llvm] r52638 - in /llvm/trunk: include/llvm/ADT/APInt.h lib/Support/APInt.cpp In-Reply-To: <200806231939.m5NJdpeV019682@zion.cs.uiuc.edu> References: <200806231939.m5NJdpeV019682@zion.cs.uiuc.edu> Message-ID: <485FFF2C.7030300@fastmail.fm> > Author: wmat > Date: Mon Jun 23 14:39:50 2008 > New Revision: 52638 > > URL: http://llvm.org/viewvc/llvm-project?rev=52638&view=rev > Log: > First step to fix PR2088. Implement routine to compute the > multiplicative inverse of a given number. Modify udivrem to allow input and > output pairs of arguments to overlap. Patch is based on the work by Chandler > Carruth. The next step is to implement the solver of linear modulo equations. Two questions. a*x = b (mod n) Do we need a general solver (arbitrary n) or only a special one that solves "linear equations with overflow" (n = 2^BitWidth)? The second version should be simpler. Also, I cannot think of any use for the first one... Where to put it? APInt.cpp? ScalarEvolution.cpp? -Wojtek From evan.cheng at apple.com Mon Jun 23 16:03:19 2008 From: evan.cheng at apple.com (Evan Cheng) Date: Mon, 23 Jun 2008 21:03:19 -0000 Subject: [llvm-commits] [llvm] r52639 - in /llvm/trunk: include/llvm/CodeGen/LiveInterval.h lib/CodeGen/LiveInterval.cpp lib/CodeGen/StackSlotColoring.cpp Message-ID: <200806232103.m5NL3J5u023256@zion.cs.uiuc.edu> Author: evancheng Date: Mon Jun 23 16:03:19 2008 New Revision: 52639 URL: http://llvm.org/viewvc/llvm-project?rev=52639&view=rev Log: Instead of adding an isSS field to LiveInterval to denote stack slot. Use top bit of 'reg' instead. If the top bit is set, than the LiveInterval represents a stack slot live interval. Modified: llvm/trunk/include/llvm/CodeGen/LiveInterval.h llvm/trunk/lib/CodeGen/LiveInterval.cpp llvm/trunk/lib/CodeGen/StackSlotColoring.cpp Modified: llvm/trunk/include/llvm/CodeGen/LiveInterval.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/LiveInterval.h?rev=52639&r1=52638&r2=52639&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/LiveInterval.h (original) +++ llvm/trunk/include/llvm/CodeGen/LiveInterval.h Mon Jun 23 16:03:19 2008 @@ -101,8 +101,8 @@ typedef SmallVector Ranges; typedef SmallVector VNInfoList; - bool isSS; // True if this represents a stack slot unsigned reg; // the register or stack slot of this interval + // if the top bits is set, it represents a stack slot. unsigned preference; // preferred register to allocate for this interval float weight; // weight of this interval Ranges ranges; // the ranges in which this register is live @@ -110,7 +110,9 @@ public: LiveInterval(unsigned Reg, float Weight, bool IsSS = false) - : isSS(IsSS), reg(Reg), preference(0), weight(Weight) { + : reg(Reg), preference(0), weight(Weight) { + if (IsSS) + reg = reg | (1U << (sizeof(unsigned)*8-1)); } typedef Ranges::iterator iterator; @@ -143,13 +145,15 @@ /// isStackSlot - Return true if this is a stack slot interval. /// - bool isStackSlot() const { return isSS; } + bool isStackSlot() const { + return reg & (1U << (sizeof(unsigned)*8-1)); + } /// getStackSlotIndex - Return stack slot index if this is a stack slot /// interval. int getStackSlotIndex() const { assert(isStackSlot() && "Interval is not a stack slot interval!"); - return reg; + return reg & ~(1U << (sizeof(unsigned)*8-1)); } bool containsOneValue() const { return valnos.size() == 1; } Modified: llvm/trunk/lib/CodeGen/LiveInterval.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/LiveInterval.cpp?rev=52639&r1=52638&r2=52639&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/LiveInterval.cpp (original) +++ llvm/trunk/lib/CodeGen/LiveInterval.cpp Mon Jun 23 16:03:19 2008 @@ -678,8 +678,8 @@ void LiveInterval::print(std::ostream &OS, const TargetRegisterInfo *TRI) const { - if (isSS) - OS << "SS#" << reg; + if (isStackSlot()) + OS << "SS#" << getStackSlotIndex(); else if (TRI && TargetRegisterInfo::isPhysicalRegister(reg)) OS << TRI->getName(reg); else Modified: llvm/trunk/lib/CodeGen/StackSlotColoring.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/StackSlotColoring.cpp?rev=52639&r1=52638&r2=52639&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/StackSlotColoring.cpp (original) +++ llvm/trunk/lib/CodeGen/StackSlotColoring.cpp Mon Jun 23 16:03:19 2008 @@ -1,4 +1,4 @@ -//===-- StackSlotColoring.cpp - Sinking for machine instructions ----------===// +//===-- StackSlotColoring.cpp - Stack slot coloring pass. -----------------===// // // The LLVM Compiler Infrastructure // @@ -12,9 +12,9 @@ //===----------------------------------------------------------------------===// #define DEBUG_TYPE "stackcoloring" +#include "llvm/CodeGen/Passes.h" #include "llvm/CodeGen/LiveStackAnalysis.h" #include "llvm/CodeGen/MachineFrameInfo.h" -#include "llvm/CodeGen/Passes.h" #include "llvm/Support/CommandLine.h" #include "llvm/Support/Compiler.h" #include "llvm/Support/Debug.h" @@ -201,7 +201,6 @@ bool StackSlotColoring::ColorSlots(MachineFunction &MF) { unsigned NumObjs = MFI->getObjectIndexEnd(); std::vector SlotMapping(NumObjs, -1); - SlotMapping.resize(NumObjs, -1); bool Changed = false; for (unsigned i = 0, e = SSIntervals.size(); i != e; ++i) { From evan.cheng at apple.com Mon Jun 23 16:06:29 2008 From: evan.cheng at apple.com (Evan Cheng) Date: Mon, 23 Jun 2008 14:06:29 -0700 Subject: [llvm-commits] [llvm] r51934 - in /llvm/trunk: include/llvm/CodeGen/LiveInterval.h include/llvm/CodeGen/LiveStackAnalysis.h include/llvm/CodeGen/MachineFrameInfo.h include/llvm/CodeGen/Passes.h lib/CodeGen/LLVMTargetMachine.cpp lib/CodeGen/LiveInterval.cpp lib/CodeGen/LiveIntervalAnalysis.cpp lib/CodeGen/LiveStackAnalysis.cpp lib/CodeGen/RegAllocLinearScan.cpp lib/CodeGen/StackSlotColoring.cpp In-Reply-To: <12F3E4C4-098D-4E55-9F7F-9318060EBC5D@apple.com> References: <200806040918.m549Ig4X026263@zion.cs.uiuc.edu> <12F3E4C4-098D-4E55-9F7F-9318060EBC5D@apple.com> Message-ID: <0CF4F6C2-A13F-4B82-B1CD-609B818F7A06@apple.com> On Jun 22, 2008, at 10:56 PM, Chris Lattner wrote: > On Jun 4, 2008, at 2:18 AM, Evan Cheng wrote: >> URL: http://llvm.org/viewvc/llvm-project?rev=51934&view=rev >> Log: >> Add a stack slot coloring pass. Not yet enabled. > > Very nice Evan, > >> = >> = >> = >> = >> = >> = >> = >> = >> = >> ===================================================================== >> --- llvm/trunk/include/llvm/CodeGen/LiveInterval.h (original) >> +++ llvm/trunk/include/llvm/CodeGen/LiveInterval.h Wed Jun 4 >> 04:18:41 2008 >> @@ -35,6 +35,7 @@ >> /// merge point), it contains ~0u,x. If the value number is not in >> use, it >> /// contains ~1u,x to indicate that the value # is not used. >> /// def - Instruction # of the definition. >> + /// - or reg # of the definition if it's a stack slot >> liveinterval. >> /// copy - Copy iff val# is defined by a copy; zero otherwise. >> /// hasPHIKill - One or more of the kills are PHI nodes. >> /// kills - Instruction # of the kills. >> @@ -100,15 +101,16 @@ >> typedef SmallVector Ranges; >> typedef SmallVector VNInfoList; >> >> - unsigned reg; // the register of this interval >> + bool isSS; // True if this represents a stack slot >> + unsigned reg; // the register or stack slot of this >> interval > > isSS? Why do you need this? You're bloating all LiveInterval's for > this flag. This is used in debugging dump. I have changed this to use the top bit of "reg" instead. > > >> +++ llvm/trunk/lib/CodeGen/StackSlotColoring.cpp Wed Jun 4 >> 04:18:41 2008 >> @@ -0,0 +1,271 @@ >> +//===-- StackSlotColoring.cpp - Sinking for machine instructions >> ----------===// > > Plz update comment. > >> +#define DEBUG_TYPE "stackcoloring" >> +#include "llvm/CodeGen/LiveStackAnalysis.h" >> +#include "llvm/CodeGen/MachineFrameInfo.h" >> +#include "llvm/CodeGen/Passes.h" > > Passes.h is the primary header for this file, please include it first. > >> +static cl::opt >> +DisableSharing("no-stack-slot-sharing", >> + cl::init(false), cl::Hidden, >> + cl::desc("Surpress slot sharing during stack >> coloring")); >> + >> +static cl::opt >> +DeleteLimit("slot-delete-limit", cl::init(-1), cl::Hidden, >> + cl::desc("Stack coloring slot deletion limit")); > > What is DeleteLimit? Does DisableSharing disable the whole pass? This option is used to debug coloring. Once the limit is reached, the rest of the slots are not colored. Evan > > >> +/// Colorslots - Color all spill stack slots and rewrite all >> frameindex machine >> +/// operands in the function. >> +bool StackSlotColoring::ColorSlots(MachineFunction &MF) { >> + unsigned NumObjs = MFI->getObjectIndexEnd(); >> + std::vector SlotMapping(NumObjs, -1); >> + SlotMapping.resize(NumObjs, -1); > > Is the resize dead/redundant with the ctor? > > Overall, very nice. > > -Chris From gohman at apple.com Mon Jun 23 16:07:03 2008 From: gohman at apple.com (Dan Gohman) Date: Mon, 23 Jun 2008 21:07:03 -0000 Subject: [llvm-commits] [llvm] r52640 - /llvm/trunk/include/llvm/ADT/StringMap.h Message-ID: <200806232107.m5NL73Pg023392@zion.cs.uiuc.edu> Author: djg Date: Mon Jun 23 16:07:03 2008 New Revision: 52640 URL: http://llvm.org/viewvc/llvm-project?rev=52640&view=rev Log: Add methods to StringMap to erase entries by key. Modified: llvm/trunk/include/llvm/ADT/StringMap.h Modified: llvm/trunk/include/llvm/ADT/StringMap.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/StringMap.h?rev=52640&r1=52639&r2=52640&view=diff ============================================================================== --- llvm/trunk/include/llvm/ADT/StringMap.h (original) +++ llvm/trunk/include/llvm/ADT/StringMap.h Mon Jun 23 16:07:03 2008 @@ -377,6 +377,20 @@ V.Destroy(Allocator); } + bool erase(const char *Key) { + iterator I = find(Key); + if (I == end()) return false; + erase(I); + return true; + } + + bool erase(std::string Key) { + iterator I = find(Key); + if (I == end()) return false; + erase(I); + return true; + } + ~StringMap() { for (ItemBucket *I = TheTable, *E = TheTable+NumBuckets; I != E; ++I) { if (I->Item && I->Item != getTombstoneVal()) From gohman at apple.com Mon Jun 23 16:08:32 2008 From: gohman at apple.com (Dan Gohman) Date: Mon, 23 Jun 2008 21:08:32 -0000 Subject: [llvm-commits] [llvm] r52641 - /llvm/trunk/include/llvm/CodeGen/SelectionDAG.h Message-ID: <200806232108.m5NL8WOx023471@zion.cs.uiuc.edu> Author: djg Date: Mon Jun 23 16:08:32 2008 New Revision: 52641 URL: http://llvm.org/viewvc/llvm-project?rev=52641&view=rev Log: Use StringMap instead of std::map. Modified: llvm/trunk/include/llvm/CodeGen/SelectionDAG.h Modified: llvm/trunk/include/llvm/CodeGen/SelectionDAG.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/SelectionDAG.h?rev=52641&r1=52640&r2=52641&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/SelectionDAG.h (original) +++ llvm/trunk/include/llvm/CodeGen/SelectionDAG.h Mon Jun 23 16:08:32 2008 @@ -16,6 +16,7 @@ #define LLVM_CODEGEN_SELECTIONDAG_H #include "llvm/ADT/FoldingSet.h" +#include "llvm/ADT/StringMap.h" #include "llvm/ADT/ilist.h" #include "llvm/CodeGen/SelectionDAGNodes.h" @@ -621,9 +622,9 @@ std::vector ValueTypeNodes; std::map ExtendedValueTypeNodes; - std::map ExternalSymbols; - std::map TargetExternalSymbols; - std::map StringNodes; + StringMap ExternalSymbols; + StringMap TargetExternalSymbols; + StringMap StringNodes; }; template <> struct GraphTraits : public GraphTraits { From gohman at apple.com Mon Jun 23 16:15:00 2008 From: gohman at apple.com (Dan Gohman) Date: Mon, 23 Jun 2008 21:15:00 -0000 Subject: [llvm-commits] [llvm] r52642 - /llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp Message-ID: <200806232115.m5NLF0eJ023877@zion.cs.uiuc.edu> Author: djg Date: Mon Jun 23 16:15:00 2008 New Revision: 52642 URL: http://llvm.org/viewvc/llvm-project?rev=52642&view=rev Log: Move a DenseMap's declaration outside of a loop, and just call clear() on each iteration. This avoids allocating and deallocating all of DenseMap's memory on each iteration. Modified: llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp Modified: llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp?rev=52642&r1=52641&r2=52642&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp Mon Jun 23 16:15:00 2008 @@ -953,10 +953,11 @@ // While Available queue is not empty, grab the node with the highest // priority. If it is not ready put it back. Schedule the node. SmallVector NotReady; + DenseMap > LRegsMap; Sequence.reserve(SUnits.size()); while (!AvailableQueue->empty()) { bool Delayed = false; - DenseMap > LRegsMap; + LRegsMap.clear(); SUnit *CurSU = AvailableQueue->pop(); while (CurSU) { if (CurSU->CycleBound <= CurCycle) { From evan.cheng at apple.com Mon Jun 23 16:22:35 2008 From: evan.cheng at apple.com (Evan Cheng) Date: Mon, 23 Jun 2008 21:22:35 -0000 Subject: [llvm-commits] [llvm] r52643 - /llvm/trunk/lib/Transforms/Scalar/GVN.cpp Message-ID: <200806232122.m5NLMZT9024204@zion.cs.uiuc.edu> Author: evancheng Date: Mon Jun 23 16:22:35 2008 New Revision: 52643 URL: http://llvm.org/viewvc/llvm-project?rev=52643&view=rev Log: Disable PRE. It's breaking bootstrapping. Modified: llvm/trunk/lib/Transforms/Scalar/GVN.cpp Modified: llvm/trunk/lib/Transforms/Scalar/GVN.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/GVN.cpp?rev=52643&r1=52642&r2=52643&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/GVN.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/GVN.cpp Mon Jun 23 16:22:35 2008 @@ -43,7 +43,7 @@ STATISTIC(NumGVNPRE, "Number of instructions PRE'd"); static cl::opt EnablePRE("enable-pre", - cl::init(true), cl::Hidden); + cl::init(false), cl::Hidden); //===----------------------------------------------------------------------===// // ValueTable Class From evan.cheng at apple.com Mon Jun 23 16:24:32 2008 From: evan.cheng at apple.com (Evan Cheng) Date: Mon, 23 Jun 2008 21:24:32 -0000 Subject: [llvm-commits] [llvm] r52644 - /llvm/trunk/lib/CodeGen/StackSlotColoring.cpp Message-ID: <200806232124.m5NLOWbP024284@zion.cs.uiuc.edu> Author: evancheng Date: Mon Jun 23 16:24:32 2008 New Revision: 52644 URL: http://llvm.org/viewvc/llvm-project?rev=52644&view=rev Log: Remove option used to debug stack coloring bugs. It's no longer needed since stack coloring is now bug free. Modified: llvm/trunk/lib/CodeGen/StackSlotColoring.cpp Modified: llvm/trunk/lib/CodeGen/StackSlotColoring.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/StackSlotColoring.cpp?rev=52644&r1=52643&r2=52644&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/StackSlotColoring.cpp (original) +++ llvm/trunk/lib/CodeGen/StackSlotColoring.cpp Mon Jun 23 16:24:32 2008 @@ -29,10 +29,6 @@ cl::init(false), cl::Hidden, cl::desc("Surpress slot sharing during stack coloring")); -static cl::opt -DeleteLimit("slot-delete-limit", cl::init(-1), cl::Hidden, - cl::desc("Stack coloring slot deletion limit")); - STATISTIC(NumEliminated, "Number of stack slots eliminated due to coloring"); namespace { @@ -156,8 +152,7 @@ int StackSlotColoring::ColorSlot(LiveInterval *li) { int Color = -1; bool Share = false; - if (!DisableSharing && - (DeleteLimit == -1 || (int)NumEliminated < DeleteLimit)) { + if (!DisableSharing) { // Check if it's possible to reuse any of the used colors. Color = UsedColors.find_first(); while (Color != -1) { From gohman at apple.com Mon Jun 23 16:29:42 2008 From: gohman at apple.com (Dan Gohman) Date: Mon, 23 Jun 2008 21:29:42 -0000 Subject: [llvm-commits] [llvm] r52645 - in /llvm/trunk: lib/Transforms/Utils/UnrollLoop.cpp test/Transforms/LoopUnroll/multiple-phis.ll test/Transforms/LoopUnroll/pr2253.ll Message-ID: <200806232129.m5NLTgiZ024439@zion.cs.uiuc.edu> Author: djg Date: Mon Jun 23 16:29:41 2008 New Revision: 52645 URL: http://llvm.org/viewvc/llvm-project?rev=52645&view=rev Log: Revamp the loop unroller, extending it to correctly update PHI nodes in the presence of out-of-loop users of in-loop values and the trip count is not a known multiple of the unroll count, and to be a bit simpler overall. This fixes PR2253. Added: llvm/trunk/test/Transforms/LoopUnroll/multiple-phis.ll llvm/trunk/test/Transforms/LoopUnroll/pr2253.ll Modified: llvm/trunk/lib/Transforms/Utils/UnrollLoop.cpp Modified: llvm/trunk/lib/Transforms/Utils/UnrollLoop.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/UnrollLoop.cpp?rev=52645&r1=52644&r2=52645&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Utils/UnrollLoop.cpp (original) +++ llvm/trunk/lib/Transforms/Utils/UnrollLoop.cpp Mon Jun 23 16:29:41 2008 @@ -22,6 +22,7 @@ #include "llvm/Transforms/Utils/UnrollLoop.h" #include "llvm/BasicBlock.h" #include "llvm/ADT/Statistic.h" +#include "llvm/ADT/STLExtras.h" #include "llvm/Analysis/ConstantFolding.h" #include "llvm/Analysis/LoopPass.h" #include "llvm/Support/Debug.h" @@ -106,13 +107,17 @@ /// /// If a LoopPassManager is passed in, and the loop is fully removed, it will be /// removed from the LoopPassManager as well. LPM can also be NULL. -bool llvm::UnrollLoop(Loop *L, unsigned Count, LoopInfo* LI, LPPassManager* LPM) { +bool llvm::UnrollLoop(Loop *L, unsigned Count, LoopInfo* LI, + LPPassManager* LPM) { assert(L->isLCSSAForm()); BasicBlock *Header = L->getHeader(); BasicBlock *LatchBlock = L->getLoopLatch(); BranchInst *BI = dyn_cast(LatchBlock->getTerminator()); - + + Function *Func = Header->getParent(); + Function::iterator BBInsertPt = next(Function::iterator(LatchBlock)); + if (!BI || BI->isUnconditional()) { // The loop-rotate pass can be helpful to avoid this in many cases. DOUT << " Can't unroll; loop not terminated by a conditional branch.\n"; @@ -168,162 +173,148 @@ DOUT << "!\n"; } + // Make a copy of the original LoopBlocks list so we can keep referring + // to it while hacking on the loop. std::vector LoopBlocks = L->getBlocks(); - bool ContinueOnTrue = L->contains(BI->getSuccessor(0)); + bool ContinueOnTrue = BI->getSuccessor(0) == Header; BasicBlock *LoopExit = BI->getSuccessor(ContinueOnTrue); // For the first iteration of the loop, we should use the precloned values for // PHI nodes. Insert associations now. typedef DenseMap ValueMapTy; ValueMapTy LastValueMap; - std::vector OrigPHINode; for (BasicBlock::iterator I = Header->begin(); isa(I); ++I) { PHINode *PN = cast(I); - OrigPHINode.push_back(PN); if (Instruction *I = dyn_cast(PN->getIncomingValueForBlock(LatchBlock))) if (L->contains(I->getParent())) LastValueMap[I] = I; } + // Keep track of all the headers and latches that we create. These are + // needed by the logic that inserts the branches to connect all the + // new blocks. std::vector Headers; std::vector Latches; + Headers.reserve(Count); + Latches.reserve(Count); Headers.push_back(Header); Latches.push_back(LatchBlock); + // Iterate through all but the first iterations, cloning blocks from + // the first iteration to populate the subsequent iterations. for (unsigned It = 1; It != Count; ++It) { char SuffixBuffer[100]; sprintf(SuffixBuffer, ".%d", It); std::vector NewBlocks; + NewBlocks.reserve(LoopBlocks.size()); - for (std::vector::iterator BB = LoopBlocks.begin(), - E = LoopBlocks.end(); BB != E; ++BB) { + // Iterate through all the blocks in the original loop. + for (std::vector::const_iterator BBI = LoopBlocks.begin(), + E = LoopBlocks.end(); BBI != E; ++BBI) { + bool SuppressExitEdges = false; + BasicBlock *BB = *BBI; ValueMapTy ValueMap; - BasicBlock *New = CloneBasicBlock(*BB, ValueMap, SuffixBuffer); - Header->getParent()->getBasicBlockList().push_back(New); + BasicBlock *New = CloneBasicBlock(BB, ValueMap, SuffixBuffer); + NewBlocks.push_back(New); + Func->getBasicBlockList().insert(BBInsertPt, New); + L->addBasicBlockToLoop(New, LI->getBase()); - // Loop over all of the PHI nodes in the block, changing them to use the - // incoming values from the previous block. - if (*BB == Header) - for (unsigned i = 0, e = OrigPHINode.size(); i != e; ++i) { - PHINode *NewPHI = cast(ValueMap[OrigPHINode[i]]); + // Special handling for the loop header block. + if (BB == Header) { + // Keep track of new headers as we create them, so that we can insert + // the proper branches later. + Headers[It] = New; + + // Loop over all of the PHI nodes in the block, changing them to use + // the incoming values from the previous block. + for (BasicBlock::iterator I = Header->begin(); isa(I); ++I) { + PHINode *NewPHI = cast(ValueMap[I]); Value *InVal = NewPHI->getIncomingValueForBlock(LatchBlock); if (Instruction *InValI = dyn_cast(InVal)) if (It > 1 && L->contains(InValI->getParent())) InVal = LastValueMap[InValI]; - ValueMap[OrigPHINode[i]] = InVal; + ValueMap[I] = InVal; New->getInstList().erase(NewPHI); } + } + + // Special handling for the loop latch block. + if (BB == LatchBlock) { + // Keep track of new latches as we create them, so that we can insert + // the proper branches later. + Latches[It] = New; + + // If knowledge of the trip count and/or multiple will allow us + // to emit unconditional branches in some of the new latch blocks, + // those blocks shouldn't be referenced by PHIs that reference + // the original latch. + unsigned NextIt = (It + 1) % Count; + SuppressExitEdges = + NextIt != BreakoutTrip && + (TripMultiple == 0 || NextIt % TripMultiple != 0); + } // Update our running map of newest clones - LastValueMap[*BB] = New; + LastValueMap[BB] = New; for (ValueMapTy::iterator VI = ValueMap.begin(), VE = ValueMap.end(); VI != VE; ++VI) LastValueMap[VI->first] = VI->second; - L->addBasicBlockToLoop(New, LI->getBase()); - - // Add phi entries for newly created values to all exit blocks except - // the successor of the latch block. The successor of the exit block will - // be updated specially after unrolling all the way. - if (*BB != LatchBlock) - for (Value::use_iterator UI = (*BB)->use_begin(), UE = (*BB)->use_end(); - UI != UE;) { - Instruction *UseInst = cast(*UI); - ++UI; - if (isa(UseInst) && !L->contains(UseInst->getParent())) { - PHINode *phi = cast(UseInst); - Value *Incoming = phi->getIncomingValueForBlock(*BB); - phi->addIncoming(Incoming, New); - } + // Add incoming values to phi nodes that reference this block. The last + // latch block may need to be referenced by the first header, and any + // block with an exit edge may be referenced from outside the loop. + for (Value::use_iterator UI = BB->use_begin(), UE = BB->use_end(); + UI != UE; ) { + PHINode *PN = dyn_cast(*UI++); + if (PN && + ((BB == LatchBlock && It == Count - 1 && !CompletelyUnroll) || + (!SuppressExitEdges && !L->contains(PN->getParent())))) { + Value *InVal = PN->getIncomingValueForBlock(BB); + // If this value was defined in the loop, take the value defined + // by the last iteration of the loop. + ValueMapTy::iterator VI = LastValueMap.find(InVal); + if (VI != LastValueMap.end()) + InVal = VI->second; + PN->addIncoming(InVal, New); } - - // Keep track of new headers and latches as we create them, so that - // we can insert the proper branches later. - if (*BB == Header) - Headers.push_back(New); - if (*BB == LatchBlock) { - Latches.push_back(New); - - // Also, clear out the new latch's back edge so that it doesn't look - // like a new loop, so that it's amenable to being merged with adjacent - // blocks later on. - TerminatorInst *Term = New->getTerminator(); - assert(L->contains(Term->getSuccessor(!ContinueOnTrue))); - assert(Term->getSuccessor(ContinueOnTrue) == LoopExit); - Term->setSuccessor(!ContinueOnTrue, NULL); } - - NewBlocks.push_back(New); } // Remap all instructions in the most recent iteration - for (unsigned i = 0; i < NewBlocks.size(); ++i) + for (unsigned i = 0, e = NewBlocks.size(); i != e; ++i) for (BasicBlock::iterator I = NewBlocks[i]->begin(), E = NewBlocks[i]->end(); I != E; ++I) RemapInstruction(I, LastValueMap); } - - // The latch block exits the loop. If there are any PHI nodes in the - // successor blocks, update them to use the appropriate values computed as the - // last iteration of the loop. - if (Count != 1) { - SmallPtrSet Users; - for (Value::use_iterator UI = LatchBlock->use_begin(), - UE = LatchBlock->use_end(); UI != UE; ++UI) - if (PHINode *phi = dyn_cast(*UI)) - Users.insert(phi); - - BasicBlock *LastIterationBB = cast(LastValueMap[LatchBlock]); - for (SmallPtrSet::iterator SI = Users.begin(), SE = Users.end(); - SI != SE; ++SI) { - PHINode *PN = *SI; - Value *InVal = PN->removeIncomingValue(LatchBlock, false); - // If this value was defined in the loop, take the value defined by the - // last iteration of the loop. - if (Instruction *InValI = dyn_cast(InVal)) { - if (L->contains(InValI->getParent())) - InVal = LastValueMap[InVal]; - } - PN->addIncoming(InVal, LastIterationBB); - } - } - - // Now, if we're doing complete unrolling, loop over the PHI nodes in the - // original block, setting them to their incoming values. - if (CompletelyUnroll) { - BasicBlock *Preheader = L->getLoopPreheader(); - for (unsigned i = 0, e = OrigPHINode.size(); i != e; ++i) { - PHINode *PN = OrigPHINode[i]; - PN->replaceAllUsesWith(PN->getIncomingValueForBlock(Preheader)); - Header->getInstList().erase(PN); - } - } // Now that all the basic blocks for the unrolled iterations are in place, // set up the branches to connect them. - for (unsigned i = 0, e = Latches.size(); i != e; ++i) { + for (unsigned It = 0; It != Count; ++It) { // The original branch was replicated in each unrolled iteration. - BranchInst *Term = cast(Latches[i]->getTerminator()); + BranchInst *Term = cast(Latches[It]->getTerminator()); // The branch destination. - unsigned j = (i + 1) % e; - BasicBlock *Dest = Headers[j]; + unsigned NextIt = (It + 1) % Count; + BasicBlock *Dest = Headers[NextIt]; bool NeedConditional = true; + bool HasExit = true; - // For a complete unroll, make the last iteration end with a branch - // to the exit block. - if (CompletelyUnroll && j == 0) { + // For a complete unroll, make the last iteration end with an + // unconditional branch to the exit block. + if (CompletelyUnroll && NextIt == 0) { Dest = LoopExit; NeedConditional = false; } // If we know the trip count or a multiple of it, we can safely use an // unconditional branch for some iterations. - if (j != BreakoutTrip && (TripMultiple == 0 || j % TripMultiple != 0)) { + if (NextIt != BreakoutTrip && + (TripMultiple == 0 || NextIt % TripMultiple != 0)) { NeedConditional = false; + HasExit = false; } if (NeedConditional) { @@ -338,24 +329,50 @@ std::replace(Headers.begin(), Headers.end(), Dest, Fold); } } + + // Special handling for the first iteration. If the first latch is + // now unconditionally branching to the second header, then it is + // no longer an exit node. Delete PHI references to it both from + // the first header and from outsie the loop. + if (It == 0) + for (Value::use_iterator UI = LatchBlock->use_begin(), + UE = LatchBlock->use_end(); UI != UE; ) { + PHINode *PN = dyn_cast(*UI++); + if (PN && (PN->getParent() == Header ? Count > 1 : !HasExit)) + PN->removeIncomingValue(LatchBlock); + } } - // At this point, the code is well formed. We now do a quick sweep over the - // inserted code, doing constant propagation and dead code elimination as we - // go. - const std::vector &NewLoopBlocks = L->getBlocks(); - for (std::vector::const_iterator BB = NewLoopBlocks.begin(), - BBE = NewLoopBlocks.end(); BB != BBE; ++BB) - for (BasicBlock::iterator I = (*BB)->begin(), E = (*BB)->end(); I != E; ) { + // At this point, unrolling is complete and the code is well formed. + // Now, do some simplifications. + + // If we're doing complete unrolling, loop over the PHI nodes in the + // original block, setting them to their incoming values. + if (CompletelyUnroll) { + BasicBlock *Preheader = L->getLoopPreheader(); + for (BasicBlock::iterator I = Header->begin(); isa(I); ) { + PHINode *PN = cast(I++); + PN->replaceAllUsesWith(PN->getIncomingValueForBlock(Preheader)); + Header->getInstList().erase(PN); + } + } + + // We now do a quick sweep over the inserted code, doing constant + // propagation and dead code elimination as we go. + for (Loop::block_iterator BI = L->block_begin(), BBE = L->block_end(); + BI != BBE; ++BI) { + BasicBlock *BB = *BI; + for (BasicBlock::iterator I = BB->begin(), E = BB->end(); I != E; ) { Instruction *Inst = I++; if (isInstructionTriviallyDead(Inst)) - (*BB)->getInstList().erase(Inst); + BB->getInstList().erase(Inst); else if (Constant *C = ConstantFoldInstruction(Inst)) { Inst->replaceAllUsesWith(C); - (*BB)->getInstList().erase(Inst); + BB->getInstList().erase(Inst); } } + } NumCompletelyUnrolled += CompletelyUnroll; ++NumUnrolled; Added: llvm/trunk/test/Transforms/LoopUnroll/multiple-phis.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/LoopUnroll/multiple-phis.ll?rev=52645&view=auto ============================================================================== --- llvm/trunk/test/Transforms/LoopUnroll/multiple-phis.ll (added) +++ llvm/trunk/test/Transforms/LoopUnroll/multiple-phis.ll Mon Jun 23 16:29:41 2008 @@ -0,0 +1,51 @@ +; RUN: llvm-as < %s | opt -loop-unroll -unroll-count 6 -unroll-threshold 300 | llvm-dis > %t +; RUN: grep {br label \%bbe} %t | count 12 +; RUN: grep {br i1 \%z} %t | count 3 +; RUN: grep {br i1 \%q} %t | count 6 +; RUN: grep call %t | count 12 +; RUN: grep urem %t | count 6 +; RUN: grep store %t | count 6 +; RUN: grep phi %t | count 11 +; RUN: grep {lcssa = phi} %t | count 2 + +; This testcase uses +; - an unknown tripcount, but a known trip multiple of 2. +; - an unroll count of 6, so we should get 3 conditional branches +; in the loop. +; - values defined inside the loop and used outside, by phis that +; also use values defined elsewhere outside the loop. +; - a phi inside the loop that only uses values defined +; inside the loop and is only used inside the loop. + +declare i32 @foo() +declare i32 @bar() + +define i32 @fib(i32 %n, i1 %a, i32* %p) nounwind { +entry: + %n2 = mul i32 %n, 2 + br i1 %a, label %bb, label %return + +bb: ; loop header block + %t0 = phi i32 [ 0, %entry ], [ %t1, %bbe ] + %td = urem i32 %t0, 7 + %q = trunc i32 %td to i1 + br i1 %q, label %bbt, label %bbf +bbt: + %bbtv = call i32 @foo() + br label %bbe +bbf: + %bbfv = call i32 @bar() + br label %bbe +bbe: ; loop latch block + %bbpv = phi i32 [ %bbtv, %bbt ], [ %bbfv, %bbf ] + store i32 %bbpv, i32* %p + %t1 = add i32 %t0, 1 + %z = icmp ne i32 %t1, %n2 + br i1 %z, label %bb, label %return + +return: + %f = phi i32 [ -2, %entry ], [ %t0, %bbe ] + %g = phi i32 [ -3, %entry ], [ %t1, %bbe ] + %h = mul i32 %f, %g + ret i32 %h +} Added: llvm/trunk/test/Transforms/LoopUnroll/pr2253.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/LoopUnroll/pr2253.ll?rev=52645&view=auto ============================================================================== --- llvm/trunk/test/Transforms/LoopUnroll/pr2253.ll (added) +++ llvm/trunk/test/Transforms/LoopUnroll/pr2253.ll Mon Jun 23 16:29:41 2008 @@ -0,0 +1,21 @@ +; RUN: llvm-as < %s | opt -loop-unroll -unroll-count 2 | llvm-dis | grep add | count 2 +; PR2253 + +; There's a use outside the loop, and the PHI needs an incoming edge for +; each unrolled iteration, since the trip count is unknown and any iteration +; could exit. + +define i32 @fib(i32 %n) nounwind { +entry: + br i1 false, label %bb, label %return + +bb: + %t0 = phi i32 [ 0, %entry ], [ %t1, %bb ] + %t1 = add i32 %t0, 1 + %c = icmp ne i32 %t0, %n + br i1 %c, label %bb, label %return + +return: + %f2.0.lcssa = phi i32 [ -1, %entry ], [ %t0, %bb ] + ret i32 %f2.0.lcssa +} From gohman at apple.com Mon Jun 23 16:46:21 2008 From: gohman at apple.com (Dan Gohman) Date: Mon, 23 Jun 2008 21:46:21 -0000 Subject: [llvm-commits] [llvm] r52646 - /llvm/trunk/include/llvm/ADT/PriorityQueue.h Message-ID: <200806232146.m5NLkLFp025349@zion.cs.uiuc.edu> Author: djg Date: Mon Jun 23 16:46:21 2008 New Revision: 52646 URL: http://llvm.org/viewvc/llvm-project?rev=52646&view=rev Log: Simplify erase_one slightly. It's not necessary to preserve the value of the element to be erased while the heap is being updated. Modified: llvm/trunk/include/llvm/ADT/PriorityQueue.h Modified: llvm/trunk/include/llvm/ADT/PriorityQueue.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/PriorityQueue.h?rev=52646&r1=52645&r2=52646&view=diff ============================================================================== --- llvm/trunk/include/llvm/ADT/PriorityQueue.h (original) +++ llvm/trunk/include/llvm/ADT/PriorityQueue.h Mon Jun 23 16:46:21 2008 @@ -51,7 +51,7 @@ // Logarithmic-time heap bubble-up. while (i != 0) { typename Sequence::size_type parent = (i - 1) / 2; - std::swap(this->c[i], this->c[parent]); + this->c[i] = this->c[parent]; i = parent; } From isanbard at gmail.com Mon Jun 23 17:08:30 2008 From: isanbard at gmail.com (Bill Wendling) Date: Mon, 23 Jun 2008 22:08:30 -0000 Subject: [llvm-commits] [llvm] r52647 - /llvm/trunk/utils/buildit/build_llvm Message-ID: <200806232208.m5NM8U7L026261@zion.cs.uiuc.edu> Author: void Date: Mon Jun 23 17:08:30 2008 New Revision: 52647 URL: http://llvm.org/viewvc/llvm-project?rev=52647&view=rev Log: Extract the x86_64 part for the executables. Modified: llvm/trunk/utils/buildit/build_llvm Modified: llvm/trunk/utils/buildit/build_llvm URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/buildit/build_llvm?rev=52647&r1=52646&r2=52647&view=diff ============================================================================== --- llvm/trunk/utils/buildit/build_llvm (original) +++ llvm/trunk/utils/buildit/build_llvm Mon Jun 23 17:08:30 2008 @@ -173,21 +173,19 @@ # Remove PPC64 fat slices. cd $DEST_DIR$DEST_ROOT/bin - if [ $MACOSX_DEPLOYMENT_TARGET = "10.4" ]; then find . -perm 755 -type f -exec lipo -extract ppc -extract i386 {} -output {} \; -else +elif [ $MACOSX_DEPLOYMENT_TARGET = "10.5" ]; then find . -perm 755 -type f -exec lipo -extract ppc7400 -extract i386 {} -output {} \; +else + find . -perm 755 -type f -exec lipo -extract ppc7400 -extract i386 -extract x86_64 {} -output {} \; fi cd $DEST_DIR$DEST_ROOT - mkdir -p $DT_HOME/lib mv lib/libLTO.dylib $DT_HOME/lib/libLTO.dylib rm -f lib/libLTO.a lib/libLTO.la - - ################################################################################ # Create SYM_DIR with information required for debugging. From gohman at apple.com Mon Jun 23 17:11:52 2008 From: gohman at apple.com (Dan Gohman) Date: Mon, 23 Jun 2008 22:11:52 -0000 Subject: [llvm-commits] [llvm] r52648 - /llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp Message-ID: <200806232211.m5NMBqwN026429@zion.cs.uiuc.edu> Author: djg Date: Mon Jun 23 17:11:52 2008 New Revision: 52648 URL: http://llvm.org/viewvc/llvm-project?rev=52648&view=rev Log: Fix spelling and grammar in a comment. Modified: llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp Modified: llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp?rev=52648&r1=52647&r2=52648&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp Mon Jun 23 17:11:52 2008 @@ -1118,8 +1118,8 @@ } // CollectIVUsers - Transform our list of users and offsets to a bit more -// complex table. In this new vector, each 'BasedUser' contains 'Base' the base -// of the strided accessas well as the old information from Uses. We +// complex table. In this new vector, each 'BasedUser' contains 'Base', the base +// of the strided accesses, as well as the old information from Uses. We // progressively move information from the Base field to the Imm field, until // we eventually have the full access expression to rewrite the use. SCEVHandle LoopStrengthReduce::CollectIVUsers(const SCEVHandle &Stride, From resistor at mac.com Mon Jun 23 17:12:24 2008 From: resistor at mac.com (Owen Anderson) Date: Mon, 23 Jun 2008 22:12:24 -0000 Subject: [llvm-commits] [llvm] r52649 - /llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp Message-ID: <200806232212.m5NMCOaT026454@zion.cs.uiuc.edu> Author: resistor Date: Mon Jun 23 17:12:23 2008 New Revision: 52649 URL: http://llvm.org/viewvc/llvm-project?rev=52649&view=rev Log: Use getMBBEndIdx rather than assuming that the end is right after the last instruction in the block. Modified: llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp Modified: llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp?rev=52649&r1=52648&r2=52649&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp (original) +++ llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp Mon Jun 23 17:12:23 2008 @@ -443,7 +443,7 @@ LI.FindLiveRangeContaining(li_->getDefIndex(DefIdx)); if (DstLR == LI.end()) return false; - unsigned KillIdx = li_->getInstructionIndex(&MBB->back()) + InstrSlots::NUM; + unsigned KillIdx = li_->getMBBEndIdx(MBB) + 1; if (DstLR->valno->kills.size() == 1 && DstLR->valno->kills[0] == KillIdx && DstLR->valno->hasPHIKill) return true; From gohman at apple.com Mon Jun 23 18:23:49 2008 From: gohman at apple.com (Dan Gohman) Date: Mon, 23 Jun 2008 23:23:49 -0000 Subject: [llvm-commits] [llvm] r52651 - /llvm/trunk/lib/Transforms/Scalar/LoopDeletion.cpp Message-ID: <200806232323.m5NNNnkQ029281@zion.cs.uiuc.edu> Author: djg Date: Mon Jun 23 18:23:49 2008 New Revision: 52651 URL: http://llvm.org/viewvc/llvm-project?rev=52651&view=rev Log: Use use_empty() instead of getNumUses(), avoiding a use list traversal. Modified: llvm/trunk/lib/Transforms/Scalar/LoopDeletion.cpp Modified: llvm/trunk/lib/Transforms/Scalar/LoopDeletion.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/LoopDeletion.cpp?rev=52651&r1=52650&r2=52651&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/LoopDeletion.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/LoopDeletion.cpp Mon Jun 23 18:23:49 2008 @@ -209,7 +209,7 @@ for (BasicBlock::iterator BI = (*LI)->begin(), BE = (*LI)->end(); BI != BE; ) { Instruction* I = BI++; - if (I->getNumUses() > 0 && IsLoopInvariantInst(I, L)) + if (!I->use_empty() && IsLoopInvariantInst(I, L)) I->moveBefore(preheader->getTerminator()); } From resistor at mac.com Mon Jun 23 18:25:37 2008 From: resistor at mac.com (Owen Anderson) Date: Mon, 23 Jun 2008 23:25:37 -0000 Subject: [llvm-commits] [llvm] r52652 - /llvm/trunk/include/llvm/CodeGen/LiveIntervalAnalysis.h Message-ID: <200806232325.m5NNPb1k029342@zion.cs.uiuc.edu> Author: resistor Date: Mon Jun 23 18:25:37 2008 New Revision: 52652 URL: http://llvm.org/viewvc/llvm-project?rev=52652&view=rev Log: Add getScaledIntervalSize, which gives a measure of the size of an interval that is independent of the scaling of the function due to empty index slots. This is suitable for use in backend heuristics that need to reason about the density of an interval. Modified: llvm/trunk/include/llvm/CodeGen/LiveIntervalAnalysis.h Modified: llvm/trunk/include/llvm/CodeGen/LiveIntervalAnalysis.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/LiveIntervalAnalysis.h?rev=52652&r1=52651&r2=52652&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/LiveIntervalAnalysis.h (original) +++ llvm/trunk/include/llvm/CodeGen/LiveIntervalAnalysis.h Mon Jun 23 18:25:37 2008 @@ -169,6 +169,15 @@ return MBB2IdxMap[MBBNo].second; } + /// getIntervalSize - get the size of an interval in "units," + /// where every function is composed of one thousand units. This + /// measure scales properly with empty index slots in the function. + unsigned getScaledIntervalSize(LiveInterval& I) { + // Factor of 250 comes from 1000 units per function divided + // by four slots per instruction. + return (250 * I.getSize()) / i2miMap_.size(); + } + /// getMBBFromIndex - given an index in any instruction of an /// MBB return a pointer the MBB MachineBasicBlock* getMBBFromIndex(unsigned index) const { From gohman at apple.com Mon Jun 23 18:40:09 2008 From: gohman at apple.com (Dan Gohman) Date: Mon, 23 Jun 2008 23:40:09 -0000 Subject: [llvm-commits] [llvm] r52654 - /llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGList.cpp Message-ID: <200806232340.m5NNe9ip029824@zion.cs.uiuc.edu> Author: djg Date: Mon Jun 23 18:40:09 2008 New Revision: 52654 URL: http://llvm.org/viewvc/llvm-project?rev=52654&view=rev Log: Use the new PriorityQueue in ScheduleDAGList too, which also needs arbitrary-element removal. Modified: llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGList.cpp Modified: llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGList.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGList.cpp?rev=52654&r1=52653&r2=52654&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGList.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGList.cpp Mon Jun 23 18:40:09 2008 @@ -28,9 +28,9 @@ #include "llvm/Target/TargetInstrInfo.h" #include "llvm/Support/Debug.h" #include "llvm/Support/Compiler.h" +#include "llvm/ADT/PriorityQueue.h" #include "llvm/ADT/Statistic.h" #include -#include using namespace llvm; STATISTIC(NumNoops , "Number of noops inserted"); @@ -315,7 +315,7 @@ /// mobility. std::vector NumNodesSolelyBlocking; - std::priority_queue, latency_sort> Queue; + PriorityQueue, latency_sort> Queue; public: LatencyPriorityQueue() : Queue(latency_sort(this)) { } @@ -373,25 +373,9 @@ return V; } - /// remove - This is a really inefficient way to remove a node from a - /// priority queue. We should roll our own heap to make this better or - /// something. void remove(SUnit *SU) { - std::vector Temp; - assert(!Queue.empty() && "Not in queue!"); - while (Queue.top() != SU) { - Temp.push_back(Queue.top()); - Queue.pop(); - assert(!Queue.empty() && "Not in queue!"); - } - - // Remove the node from the PQ. - Queue.pop(); - - // Add all the other nodes back. - for (unsigned i = 0, e = Temp.size(); i != e; ++i) - Queue.push(Temp[i]); + Queue.erase_one(SU); } // ScheduledNode - As nodes are scheduled, we look to see if there are any From isanbard at gmail.com Mon Jun 23 18:41:14 2008 From: isanbard at gmail.com (Bill Wendling) Date: Mon, 23 Jun 2008 23:41:14 -0000 Subject: [llvm-commits] [llvm] r52655 - in /llvm/trunk: lib/CodeGen/LiveVariables.cpp test/CodeGen/PowerPC/2008-06-23-LiveVariablesCrash.ll Message-ID: <200806232341.m5NNfEge029877@zion.cs.uiuc.edu> Author: void Date: Mon Jun 23 18:41:14 2008 New Revision: 52655 URL: http://llvm.org/viewvc/llvm-project?rev=52655&view=rev Log: This situation can occur: ,------. | | | v | t2 = phi ... t1 ... | | | v | t1 = ... | ... = ... t1 ... | | `------' where there is a use in a PHI node that's a predecessor to the defining block. We don't want to mark all predecessors as having the value "alive" in this case. Also, the assert was too restrictive and didn't handle this case. Added: llvm/trunk/test/CodeGen/PowerPC/2008-06-23-LiveVariablesCrash.ll Modified: llvm/trunk/lib/CodeGen/LiveVariables.cpp Modified: llvm/trunk/lib/CodeGen/LiveVariables.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/LiveVariables.cpp?rev=52655&r1=52654&r2=52655&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/LiveVariables.cpp (original) +++ llvm/trunk/lib/CodeGen/LiveVariables.cpp Mon Jun 23 18:41:14 2008 @@ -139,8 +139,23 @@ assert(VRInfo.Kills[i]->getParent() != MBB && "entry should be at end!"); #endif - assert(MBB != MRI->getVRegDef(reg)->getParent() && - "Should have kill for defblock!"); + // This situation can occur: + // + // ,------. + // | | + // | v + // | t2 = phi ... t1 ... + // | | + // | v + // | t1 = ... + // | ... = ... t1 ... + // | | + // `------' + // + // where there is a use in a PHI node that's a predecessor to the defining + // block. We don't want to mark all predecessors as having the value "alive" + // in this case. + if (MBB == MRI->getVRegDef(reg)->getParent()) return; // Add a new kill entry for this basic block. If this virtual register is // already marked as alive in this basic block, that means it is alive in at Added: llvm/trunk/test/CodeGen/PowerPC/2008-06-23-LiveVariablesCrash.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/PowerPC/2008-06-23-LiveVariablesCrash.ll?rev=52655&view=auto ============================================================================== --- llvm/trunk/test/CodeGen/PowerPC/2008-06-23-LiveVariablesCrash.ll (added) +++ llvm/trunk/test/CodeGen/PowerPC/2008-06-23-LiveVariablesCrash.ll Mon Jun 23 18:41:14 2008 @@ -0,0 +1,25 @@ +; RUN: llvm-as < %s | llc -march=ppc32 +; + +define i32 @bork() nounwind { +entry: + br i1 true, label %bb1, label %bb3 + +bb1: + %tmp1 = load i8* null, align 1 + %tmp2 = icmp eq i8 %tmp1, 0 + br label %bb2 + +bb2: + %val1 = phi i32 [ 0, %bb1 ], [ %val2, %bb2 ] + %val2 = select i1 %tmp2, i32 -1, i32 %val1 + switch i32 %val2, label %bb2 [ + i32 -1, label %bb3 + i32 0, label %bb1 + i32 1, label %bb3 + i32 2, label %bb1 + ] + +bb3: + ret i32 -1 +} From gohman at apple.com Mon Jun 23 18:47:46 2008 From: gohman at apple.com (Dan Gohman) Date: Mon, 23 Jun 2008 23:47:46 -0000 Subject: [llvm-commits] [llvm] r52656 - /llvm/trunk/include/llvm/ADT/PriorityQueue.h Message-ID: <200806232347.m5NNlkAM030055@zion.cs.uiuc.edu> Author: djg Date: Mon Jun 23 18:47:46 2008 New Revision: 52656 URL: http://llvm.org/viewvc/llvm-project?rev=52656&view=rev Log: Add a clear() method to PriorityQueue. Modified: llvm/trunk/include/llvm/ADT/PriorityQueue.h Modified: llvm/trunk/include/llvm/ADT/PriorityQueue.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/PriorityQueue.h?rev=52656&r1=52655&r2=52656&view=diff ============================================================================== --- llvm/trunk/include/llvm/ADT/PriorityQueue.h (original) +++ llvm/trunk/include/llvm/ADT/PriorityQueue.h Mon Jun 23 18:47:46 2008 @@ -70,6 +70,12 @@ void reheapify() { std::make_heap(this->c.begin(), this->c.end(), this->comp); } + + /// clear - Erase all elements from the queue. + /// + void clear() { + this->c.clear(); + } }; } // End llvm namespace From gohman at apple.com Mon Jun 23 18:51:16 2008 From: gohman at apple.com (Dan Gohman) Date: Mon, 23 Jun 2008 23:51:16 -0000 Subject: [llvm-commits] [llvm] r52657 - /llvm/trunk/lib/CodeGen/RegAllocLinearScan.cpp Message-ID: <200806232351.m5NNpG7T030166@zion.cs.uiuc.edu> Author: djg Date: Mon Jun 23 18:51:16 2008 New Revision: 52657 URL: http://llvm.org/viewvc/llvm-project?rev=52657&view=rev Log: A brief survey of priority_queue usage in the tree turned this up as a questionable case, but the code isn't actually needed. Modified: llvm/trunk/lib/CodeGen/RegAllocLinearScan.cpp Modified: llvm/trunk/lib/CodeGen/RegAllocLinearScan.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/RegAllocLinearScan.cpp?rev=52657&r1=52656&r2=52657&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/RegAllocLinearScan.cpp (original) +++ llvm/trunk/lib/CodeGen/RegAllocLinearScan.cpp Mon Jun 23 18:51:16 2008 @@ -305,7 +305,7 @@ spiller_->runOnMachineFunction(*mf_, *vrm_); vrm_.reset(); // Free the VirtRegMap - while (!unhandled_.empty()) unhandled_.pop(); + assert(unhandled_.empty() && "Unhandled live intervals remain!"); fixed_.clear(); active_.clear(); inactive_.clear(); From evan.cheng at apple.com Mon Jun 23 18:58:01 2008 From: evan.cheng at apple.com (Evan Cheng) Date: Mon, 23 Jun 2008 16:58:01 -0700 Subject: [llvm-commits] [llvm] r52652 - /llvm/trunk/include/llvm/CodeGen/LiveIntervalAnalysis.h In-Reply-To: <200806232325.m5NNPb1k029342@zion.cs.uiuc.edu> References: <200806232325.m5NNPb1k029342@zion.cs.uiuc.edu> Message-ID: <81A16660-98DB-496D-8656-CCE216674331@apple.com> Please use 1000 / InstrSlots::NUM instead of 250. Also, please mark the function "const". Evan On Jun 23, 2008, at 4:25 PM, Owen Anderson wrote: > Author: resistor > Date: Mon Jun 23 18:25:37 2008 > New Revision: 52652 > > URL: http://llvm.org/viewvc/llvm-project?rev=52652&view=rev > Log: > Add getScaledIntervalSize, which gives a measure of the size of an > interval that is independent of the scaling of > the function due to empty index slots. This is suitable for use in > backend heuristics that need to reason about the density > of an interval. > > Modified: > llvm/trunk/include/llvm/CodeGen/LiveIntervalAnalysis.h > > Modified: llvm/trunk/include/llvm/CodeGen/LiveIntervalAnalysis.h > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/LiveIntervalAnalysis.h?rev=52652&r1=52651&r2=52652&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/include/llvm/CodeGen/LiveIntervalAnalysis.h (original) > +++ llvm/trunk/include/llvm/CodeGen/LiveIntervalAnalysis.h Mon Jun > 23 18:25:37 2008 > @@ -169,6 +169,15 @@ > return MBB2IdxMap[MBBNo].second; > } > > + /// getIntervalSize - get the size of an interval in "units," > + /// where every function is composed of one thousand units. This > + /// measure scales properly with empty index slots in the > function. > + unsigned getScaledIntervalSize(LiveInterval& I) { > + // Factor of 250 comes from 1000 units per function divided > + // by four slots per instruction. > + return (250 * I.getSize()) / i2miMap_.size(); > + } > + > /// getMBBFromIndex - given an index in any instruction of an > /// MBB return a pointer the MBB > MachineBasicBlock* getMBBFromIndex(unsigned index) const { > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From gohman at apple.com Mon Jun 23 19:02:45 2008 From: gohman at apple.com (Dan Gohman) Date: Tue, 24 Jun 2008 00:02:45 -0000 Subject: [llvm-commits] [llvm] r52658 - /llvm/trunk/include/llvm/CodeGen/ScheduleDAG.h Message-ID: <200806240002.m5O02jnY030499@zion.cs.uiuc.edu> Author: djg Date: Mon Jun 23 19:02:44 2008 New Revision: 52658 URL: http://llvm.org/viewvc/llvm-project?rev=52658&view=rev Log: Comment fixes, and make Schedule() pure virtual. Modified: llvm/trunk/include/llvm/CodeGen/ScheduleDAG.h Modified: llvm/trunk/include/llvm/CodeGen/ScheduleDAG.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/ScheduleDAG.h?rev=52658&r1=52657&r2=52658&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/ScheduleDAG.h (original) +++ llvm/trunk/include/llvm/CodeGen/ScheduleDAG.h Mon Jun 23 19:02:44 2008 @@ -229,8 +229,9 @@ virtual void remove(SUnit *SU) = 0; /// ScheduledNode - As each node is scheduled, this method is invoked. This - /// allows the priority function to adjust the priority of node that have - /// already been emitted. + /// allows the priority function to adjust the priority of related + /// unscheduled nodes, for example. + /// virtual void ScheduledNode(SUnit *) {} virtual void UnscheduledNode(SUnit *) {} @@ -339,9 +340,10 @@ void dumpSchedule() const; - /// Schedule - Order nodes according to selected style. + /// Schedule - Order nodes according to selected style, filling + /// in the Sequence member. /// - virtual void Schedule() {} + virtual void Schedule() = 0; private: /// EmitSubregNode - Generate machine code for subreg nodes. From resistor at mac.com Mon Jun 23 19:08:35 2008 From: resistor at mac.com (Owen Anderson) Date: Tue, 24 Jun 2008 00:08:35 -0000 Subject: [llvm-commits] [llvm] r52659 - /llvm/trunk/include/llvm/CodeGen/LiveIntervalAnalysis.h Message-ID: <200806240008.m5O08ZBx030706@zion.cs.uiuc.edu> Author: resistor Date: Mon Jun 23 19:08:35 2008 New Revision: 52659 URL: http://llvm.org/viewvc/llvm-project?rev=52659&view=rev Log: Use InstrSlots::NUM rather than pre-dividing by four. Also, mark this const. Modified: llvm/trunk/include/llvm/CodeGen/LiveIntervalAnalysis.h Modified: llvm/trunk/include/llvm/CodeGen/LiveIntervalAnalysis.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/LiveIntervalAnalysis.h?rev=52659&r1=52658&r2=52659&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/LiveIntervalAnalysis.h (original) +++ llvm/trunk/include/llvm/CodeGen/LiveIntervalAnalysis.h Mon Jun 23 19:08:35 2008 @@ -172,10 +172,10 @@ /// getIntervalSize - get the size of an interval in "units," /// where every function is composed of one thousand units. This /// measure scales properly with empty index slots in the function. - unsigned getScaledIntervalSize(LiveInterval& I) { + unsigned getScaledIntervalSize(LiveInterval& I) const { // Factor of 250 comes from 1000 units per function divided // by four slots per instruction. - return (250 * I.getSize()) / i2miMap_.size(); + return (1000 / InstrSlots::NUM * I.getSize()) / i2miMap_.size(); } /// getMBBFromIndex - given an index in any instruction of an From echristo at apple.com Mon Jun 23 19:10:21 2008 From: echristo at apple.com (Eric Christopher) Date: Mon, 23 Jun 2008 17:10:21 -0700 Subject: [llvm-commits] [llvm] r52659 - /llvm/trunk/include/llvm/CodeGen/LiveIntervalAnalysis.h In-Reply-To: <200806240008.m5O08ZBx030706@zion.cs.uiuc.edu> References: <200806240008.m5O08ZBx030706@zion.cs.uiuc.edu> Message-ID: <1DF12885-9DB9-4FAF-8E7C-A79D782DFC42@apple.com> On Jun 23, 2008, at 5:08 PM, Owen Anderson wrote: > // Factor of 250 comes from 1000 units per function divided > // by four slots per instruction. > - return (250 * I.getSize()) / i2miMap_.size(); > + return (1000 / InstrSlots::NUM * I.getSize()) / > i2miMap_.size(); Should update the comment :) -eric From resistor at mac.com Mon Jun 23 19:15:10 2008 From: resistor at mac.com (Owen Anderson) Date: Tue, 24 Jun 2008 00:15:10 -0000 Subject: [llvm-commits] [llvm] r52660 - /llvm/trunk/include/llvm/CodeGen/LiveIntervalAnalysis.h Message-ID: <200806240015.m5O0FAGP030918@zion.cs.uiuc.edu> Author: resistor Date: Mon Jun 23 19:15:10 2008 New Revision: 52660 URL: http://llvm.org/viewvc/llvm-project?rev=52660&view=rev Log: Remove an incorrect comment. Modified: llvm/trunk/include/llvm/CodeGen/LiveIntervalAnalysis.h Modified: llvm/trunk/include/llvm/CodeGen/LiveIntervalAnalysis.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/LiveIntervalAnalysis.h?rev=52660&r1=52659&r2=52660&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/LiveIntervalAnalysis.h (original) +++ llvm/trunk/include/llvm/CodeGen/LiveIntervalAnalysis.h Mon Jun 23 19:15:10 2008 @@ -173,8 +173,6 @@ /// where every function is composed of one thousand units. This /// measure scales properly with empty index slots in the function. unsigned getScaledIntervalSize(LiveInterval& I) const { - // Factor of 250 comes from 1000 units per function divided - // by four slots per instruction. return (1000 / InstrSlots::NUM * I.getSize()) / i2miMap_.size(); } From dalej at apple.com Mon Jun 23 19:32:25 2008 From: dalej at apple.com (Dale Johannesen) Date: Tue, 24 Jun 2008 00:32:25 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r52661 - /llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386.cpp Message-ID: <200806240032.m5O0WPnZ031629@zion.cs.uiuc.edu> Author: johannes Date: Mon Jun 23 19:32:25 2008 New Revision: 52661 URL: http://llvm.org/viewvc/llvm-project?rev=52661&view=rev Log: x86-64 ABI (this is just a bug though). The structs constructed for multiple return values should never be packed. Packedness was already taken into account in classify_argument. Modified: llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386.cpp Modified: llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386.cpp URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386.cpp?rev=52661&r1=52660&r2=52661&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386.cpp (original) +++ llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386.cpp Mon Jun 23 19:32:25 2008 @@ -1191,8 +1191,7 @@ std::vector GCCElts; llvm_x86_64_get_multiple_return_reg_classes(type, Ty, GCCElts); - return StructType::get(GCCElts, STy->isPacked()); - + return StructType::get(GCCElts, false); } // llvm_x86_extract_mrv_array_element - Helper function that help extract From gohman at apple.com Mon Jun 23 19:50:01 2008 From: gohman at apple.com (Dan Gohman) Date: Tue, 24 Jun 2008 00:50:01 -0000 Subject: [llvm-commits] [llvm] r52662 - /llvm/trunk/lib/Target/X86/X86JITInfo.cpp Message-ID: <200806240050.m5O0o1J4032308@zion.cs.uiuc.edu> Author: djg Date: Mon Jun 23 19:50:01 2008 New Revision: 52662 URL: http://llvm.org/viewvc/llvm-project?rev=52662&view=rev Log: Fixes for being compiled PIC on Linux. This isn't the most general solution possible, but it's a fairly simple one. Based on a patch from the OpenGTL project! Modified: llvm/trunk/lib/Target/X86/X86JITInfo.cpp Modified: llvm/trunk/lib/Target/X86/X86JITInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86JITInfo.cpp?rev=52662&r1=52661&r2=52662&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86JITInfo.cpp (original) +++ llvm/trunk/lib/Target/X86/X86JITInfo.cpp Mon Jun 23 19:50:01 2008 @@ -51,6 +51,13 @@ #define GETASMPREFIX(X) GETASMPREFIX2(X) #define ASMPREFIX GETASMPREFIX(__USER_LABEL_PREFIX__) +// Check if building with -fPIC +#if defined(__PIC__) && __PIC__ && defined(__linux__) +#define ASMCALLSUFFIX "@PLT" +#else +#define ASMCALLSUFFIX +#endif + // Provide a convenient way for disabling usage of CFI directives. // This is needed for old/broken assemblers (for example, gas on // Darwin is pretty old and doesn't support these directives) @@ -112,7 +119,7 @@ // JIT callee "movq %rbp, %rdi\n" // Pass prev frame and return address "movq 8(%rbp), %rsi\n" - "call " ASMPREFIX "X86CompilationCallback2\n" + "call " ASMPREFIX "X86CompilationCallback2" ASMCALLSUFFIX "\n" // Restore all XMM arg registers "movaps 112(%rsp), %xmm7\n" "movaps 96(%rsp), %xmm6\n" @@ -186,7 +193,7 @@ "movl 4(%ebp), %eax\n" // Pass prev frame and return address "movl %eax, 4(%esp)\n" "movl %ebp, (%esp)\n" - "call " ASMPREFIX "X86CompilationCallback2\n" + "call " ASMPREFIX "X86CompilationCallback2" ASMCALLSUFFIX "\n" "movl %ebp, %esp\n" // Restore ESP CFI(".cfi_def_cfa_register %esp\n") "subl $12, %esp\n" @@ -240,7 +247,7 @@ "movl 4(%ebp), %eax\n" // Pass prev frame and return address "movl %eax, 4(%esp)\n" "movl %ebp, (%esp)\n" - "call " ASMPREFIX "X86CompilationCallback2\n" + "call " ASMPREFIX "X86CompilationCallback2" ASMCALLSUFFIX "\n" "addl $16, %esp\n" "movaps 48(%esp), %xmm3\n" CFI(".cfi_restore %xmm3\n") From gohman at apple.com Mon Jun 23 19:53:07 2008 From: gohman at apple.com (Dan Gohman) Date: Tue, 24 Jun 2008 00:53:07 -0000 Subject: [llvm-commits] [llvm] r52663 - /llvm/trunk/lib/Target/X86/README.txt Message-ID: <200806240053.m5O0r7u3032398@zion.cs.uiuc.edu> Author: djg Date: Mon Jun 23 19:53:07 2008 New Revision: 52663 URL: http://llvm.org/viewvc/llvm-project?rev=52663&view=rev Log: Add a note about a potential PIC optimization. Modified: llvm/trunk/lib/Target/X86/README.txt Modified: llvm/trunk/lib/Target/X86/README.txt URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/README.txt?rev=52663&r1=52662&r2=52663&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/README.txt (original) +++ llvm/trunk/lib/Target/X86/README.txt Mon Jun 23 19:53:07 2008 @@ -1709,3 +1709,10 @@ it would be better to codegen as: x+~y (notl+addl) //===---------------------------------------------------------------------===// + +We should consider using __i686.get_pc_thunk.bx for MOVPC32r (used for PIC) +on targets that support it, such as Linux and similar targets, in place of +the call-a-label trick. It's said to be friendlier to branch-prediction +hardware because it pairs a ret with the call. + +//===---------------------------------------------------------------------===// From monping at apple.com Mon Jun 23 20:04:33 2008 From: monping at apple.com (Mon P Wang) Date: Mon, 23 Jun 2008 18:04:33 -0700 Subject: [llvm-commits] [llvm] r52149 - in /llvm/trunk: lib/AsmParser/llvmAsmParser.cpp.cvs lib/AsmParser/llvmAsmParser.h.cvs lib/AsmParser/llvmAsmParser.y lib/AsmParser/llvmAsmParser.y.cvs utils/llvm.grm In-Reply-To: References: <200806091445.m59Ej2BZ019742@zion.cs.uiuc.edu> <21C65B8A-9821-4763-BEA5-FCA0E2D91FAF@apple.com> Message-ID: <52848031-93B9-4034-86D7-069A8F3AC8B0@apple.com> Hi, On Jun 23, 2008, at 11:43 AM, Dan Gohman wrote: > On Jun 23, 2008, at 10:18 AM, Chris Lattner wrote: >> [Text Deleted] >>> +++ llvm/trunk/lib/AsmParser/llvmAsmParser.y Mon Jun 9 09:45:02 >>> 2008 >>> @@ -2505,6 +2499,80 @@ >>> delete PTy; delete $2; >>> CHECK_FOR_ERROR >>> } >>> + | '[' ConstVector ']' { // Nonempty unsized arr >>> + const Type *ETy = (*$2)[0]->getType(); >>> + int NumElements = $2->size(); >> >> Please use uint64_t for NumElements. > > fixed. >> Quick question about the change. When the NumElements changed to uint64_t, we started to have code that looks like uint64_t NumElements = ATy->getNumElements(); // Verify that we have the correct size... if (NumElements != -1 && NumElements != (int)$3->size()) The code doesn't look quite right (though it is functionally correct) with int64_t with a value cast to int and a negative number. The compiler will also generating a warning because we are comparing signed and unsigned. Should we get rid of this warning by explicitly casting to uint64_t instead? -- Mon Ping -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20080623/eb88d1a8/attachment.html From gohman at apple.com Mon Jun 23 20:17:53 2008 From: gohman at apple.com (Dan Gohman) Date: Tue, 24 Jun 2008 01:17:53 -0000 Subject: [llvm-commits] [llvm] r52664 - /llvm/trunk/lib/AsmParser/llvmAsmParser.y Message-ID: <200806240117.m5O1Hr3S000714@zion.cs.uiuc.edu> Author: djg Date: Mon Jun 23 20:17:52 2008 New Revision: 52664 URL: http://llvm.org/viewvc/llvm-project?rev=52664&view=rev Log: Fix some signed vs. unsigned issues in array and vector handling. Modified: llvm/trunk/lib/AsmParser/llvmAsmParser.y Modified: llvm/trunk/lib/AsmParser/llvmAsmParser.y URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/AsmParser/llvmAsmParser.y?rev=52664&r1=52663&r2=52664&view=diff ============================================================================== --- llvm/trunk/lib/AsmParser/llvmAsmParser.y (original) +++ llvm/trunk/lib/AsmParser/llvmAsmParser.y Mon Jun 23 20:17:52 2008 @@ -1538,10 +1538,10 @@ uint64_t NumElements = ATy->getNumElements(); // Verify that we have the correct size... - if (NumElements != -1 && NumElements != (int)$3->size()) + if (NumElements != uint64_t(-1) && NumElements != $3->size()) GEN_ERROR("Type mismatch: constant sized array initialized with " + utostr($3->size()) + " arguments, but has size of " + - itostr(NumElements) + ""); + utostr(NumElements) + ""); // Verify all elements are correct type! for (unsigned i = 0; i < $3->size(); i++) { @@ -1564,9 +1564,9 @@ (*$1)->getDescription() + "'"); uint64_t NumElements = ATy->getNumElements(); - if (NumElements != -1 && NumElements != 0) + if (NumElements != uint64_t(-1) && NumElements != 0) GEN_ERROR("Type mismatch: constant sized array initialized with 0" - " arguments, but has size of " + itostr(NumElements) +""); + " arguments, but has size of " + utostr(NumElements) +""); $$ = ConstantArray::get(ATy, std::vector()); delete $1; CHECK_FOR_ERROR @@ -1581,13 +1581,13 @@ uint64_t NumElements = ATy->getNumElements(); const Type *ETy = ATy->getElementType(); - if (NumElements != -1 && NumElements != int($3->length())) + if (NumElements != uint64_t(-1) && NumElements != $3->length()) GEN_ERROR("Can't build string constant of size " + - itostr((int)($3->length())) + - " when array has size " + itostr(NumElements) + ""); + utostr($3->length()) + + " when array has size " + utostr(NumElements) + ""); std::vector Vals; if (ETy == Type::Int8Ty) { - for (unsigned i = 0; i < $3->length(); ++i) + for (uint64_t i = 0; i < $3->length(); ++i) Vals.push_back(ConstantInt::get(ETy, (*$3)[i])); } else { delete $3; @@ -1609,10 +1609,10 @@ unsigned NumElements = PTy->getNumElements(); // Verify that we have the correct size... - if (NumElements != -1 && NumElements != (int)$3->size()) + if (NumElements != unsigned(-1) && NumElements != (unsigned)$3->size()) GEN_ERROR("Type mismatch: constant sized packed initialized with " + utostr($3->size()) + " arguments, but has size of " + - itostr(NumElements) + ""); + utostr(NumElements) + ""); // Verify all elements are correct type! for (unsigned i = 0; i < $3->size(); i++) { From gohman at apple.com Mon Jun 23 20:19:36 2008 From: gohman at apple.com (Dan Gohman) Date: Mon, 23 Jun 2008 18:19:36 -0700 Subject: [llvm-commits] [llvm] r52149 - in /llvm/trunk: lib/AsmParser/llvmAsmParser.cpp.cvs lib/AsmParser/llvmAsmParser.h.cvs lib/AsmParser/llvmAsmParser.y lib/AsmParser/llvmAsmParser.y.cvs utils/llvm.grm In-Reply-To: <52848031-93B9-4034-86D7-069A8F3AC8B0@apple.com> References: <200806091445.m59Ej2BZ019742@zion.cs.uiuc.edu> <21C65B8A-9821-4763-BEA5-FCA0E2D91FAF@apple.com> <52848031-93B9-4034-86D7-069A8F3AC8B0@apple.com> Message-ID: On Jun 23, 2008, at 6:04 PM, Mon P Wang wrote: > Hi, > > On Jun 23, 2008, at 11:43 AM, Dan Gohman wrote: > >> On Jun 23, 2008, at 10:18 AM, Chris Lattner wrote: >>> [Text Deleted] >>>> +++ llvm/trunk/lib/AsmParser/llvmAsmParser.y Mon Jun 9 09:45:02 >>>> 2008 >>>> @@ -2505,6 +2499,80 @@ >>>> delete PTy; delete $2; >>>> CHECK_FOR_ERROR >>>> } >>>> + | '[' ConstVector ']' { // Nonempty unsized arr >>>> + const Type *ETy = (*$2)[0]->getType(); >>>> + int NumElements = $2->size(); >>> >>> Please use uint64_t for NumElements. >> >> fixed. >>> > > Quick question about the change. When the NumElements changed to > uint64_t, we started > to have code that looks like > uint64_t NumElements = ATy->getNumElements(); > // Verify that we have the correct size... > if (NumElements != -1 && NumElements != (int)$3->size()) > > The code doesn't look quite right (though it is functionally > correct) with int64_t with a value cast to int and a negative > number. The compiler will also generating a warning because we are > comparing signed and unsigned. Should we get rid of this warning by > explicitly casting to uint64_t instead? Hi Mon Ping, I agree; thanks for pointing this out. I submitted r52664, which I believe fixes some minor problems, as well as the compiler warnings. Dan From dalej at apple.com Mon Jun 23 22:47:15 2008 From: dalej at apple.com (Dale Johannesen) Date: Tue, 24 Jun 2008 03:47:15 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r52666 - in /llvm-gcc-4.2/trunk/gcc/config/i386: llvm-i386-target.h llvm-i386.cpp Message-ID: <200806240347.m5O3lFjj005863@zion.cs.uiuc.edu> Author: johannes Date: Mon Jun 23 22:47:15 2008 New Revision: 52666 URL: http://llvm.org/viewvc/llvm-project?rev=52666&view=rev Log: X86-64 ABI: return 64-bit (MMX) vectors in the right place. Changed for darwin only, but probably applicable to Linux but not Win64; somebody on those targets should look. Modified: llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386-target.h llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386.cpp Modified: llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386-target.h URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386-target.h?rev=52666&r1=52665&r2=52666&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386-target.h (original) +++ llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386-target.h Mon Jun 23 22:47:15 2008 @@ -146,7 +146,9 @@ /* The MMX vector v1i64 is returned in EAX and EDX on Darwin. Communicate this by returning i64 here. Likewise, (generic) vectors such as v2i16 - are returned in EAX. */ + are returned in EAX. + On Darwin x86-64, MMX vectors are returned in XMM0. Communicate this by + returning f64. */ #define LLVM_SHOULD_RETURN_VECTOR_AS_SCALAR(X,isBuiltin)\ llvm_x86_should_return_vector_as_scalar((X), (isBuiltin)) Modified: llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386.cpp URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386.cpp?rev=52666&r1=52665&r2=52666&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386.cpp (original) +++ llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386.cpp Mon Jun 23 22:47:15 2008 @@ -862,7 +862,10 @@ /* The MMX vector v1i64 is returned in EAX and EDX on Darwin. Communicate this by returning i64 here. Likewise, (generic) vectors such as v2i16 - are returned in EAX. */ + are returned in EAX. + On Darwin x86-64, v1i64 is returned in RAX and other MMX vectors are + returned in XMM0. Judging from comments, this would not be right for + Win64. Don't know about Linux. */ tree llvm_x86_should_return_vector_as_scalar(tree type, bool isBuiltin) { if (TARGET_MACHO && !isBuiltin && @@ -872,6 +875,8 @@ if (TREE_INT_CST_LOW(TYPE_SIZE(type))==64 && TYPE_VECTOR_SUBPARTS(type)==1) return uint64_type_node; + if (TARGET_64BIT && TREE_INT_CST_LOW(TYPE_SIZE(type))==64) + return double_type_node; if (TREE_INT_CST_LOW(TYPE_SIZE(type))==32) return uint32_type_node; } From nicholas at mxc.ca Mon Jun 23 23:50:14 2008 From: nicholas at mxc.ca (Nick Lewycky) Date: Mon, 23 Jun 2008 21:50:14 -0700 Subject: [llvm-commits] value range analysis based on scalar-evolutions In-Reply-To: <28C820CC-1764-40E6-BC66-8DA0139AB51D@apple.com> References: <48436EF1.8020203@mxc.ca> <28C820CC-1764-40E6-BC66-8DA0139AB51D@apple.com> Message-ID: <48607D06.1030203@mxc.ca> Chris Lattner wrote: > On Jun 1, 2008, at 8:54 PM, Nick Lewycky wrote: > > >> I've implemented an analysis pass that uses SCEV to determine value >> ranges of integer-typed registers. >> >> Currently it maintains a map of Value* to ConstantRange*, which is >> rather inelegant. I was thinking we could have one analysis which >> would do that and others that would update the central analysis. >> >> I also implemented an optz'n pass based on it, but it hardly >> optimized anything and as such is not included in this patch. >> > Hey Nick, > > Are you still working on this? It looks like a really interesting > approach. As Dan says, it would be best if it were lazy (computing > ranges when queried instead of in runOnFunction), but otherwise it > would be nice to go in the tree. > > Yes, it's still in my pending queue. I'm on vacation and away from my desktop so I don't have committing powers, or a tree I can run llvm-test on. I'd be more than happy for anyone else to commit it. Either way, I'll make the changes in response to review once I return home. Nick From clattner at apple.com Tue Jun 24 00:10:58 2008 From: clattner at apple.com (Chris Lattner) Date: Mon, 23 Jun 2008 22:10:58 -0700 Subject: [llvm-commits] [llvm] r52149 - in /llvm/trunk: lib/AsmParser/llvmAsmParser.cpp.cvs lib/AsmParser/llvmAsmParser.h.cvs lib/AsmParser/llvmAsmParser.y lib/AsmParser/llvmAsmParser.y.cvs utils/llvm.grm In-Reply-To: References: <200806091445.m59Ej2BZ019742@zion.cs.uiuc.edu> <21C65B8A-9821-4763-BEA5-FCA0E2D91FAF@apple.com> Message-ID: <69A7DDAA-D047-46B2-9261-2350CC5CF0A6@apple.com> On Jun 23, 2008, at 11:43 AM, Dan Gohman wrote: >> >> >>> + | '[' ']' { >>> + $$ = ValID::createUndef(); >>> + CHECK_FOR_ERROR >>> + } >> >> This should make an empty array not an undef. I'm not sure if it >> make >> a difference in practice though. > > The problem is that this bit of code doesn't know the element type. > ValID::createUndef lets the array type be inferred later. I judged it > not important enough to justify a significantly more elaborate > solution. I added a comment to explain it now. > > Ah cute. Excellent, thanks Dan! -Chris From clattner at apple.com Tue Jun 24 00:13:45 2008 From: clattner at apple.com (Chris Lattner) Date: Mon, 23 Jun 2008 22:13:45 -0700 Subject: [llvm-commits] [llvm] r51934 - in /llvm/trunk: include/llvm/CodeGen/LiveInterval.h include/llvm/CodeGen/LiveStackAnalysis.h include/llvm/CodeGen/MachineFrameInfo.h include/llvm/CodeGen/Passes.h lib/CodeGen/LLVMTargetMachine.cpp lib/CodeGen/LiveInterval.cpp lib/CodeGen/LiveIntervalAnalysis.cpp lib/CodeGen/LiveStackAnalysis.cpp lib/CodeGen/RegAllocLinearScan.cpp lib/CodeGen/StackSlotColoring.cpp In-Reply-To: <0CF4F6C2-A13F-4B82-B1CD-609B818F7A06@apple.com> References: <200806040918.m549Ig4X026263@zion.cs.uiuc.edu> <12F3E4C4-098D-4E55-9F7F-9318060EBC5D@apple.com> <0CF4F6C2-A13F-4B82-B1CD-609B818F7A06@apple.com> Message-ID: <8A05AF50-C3DE-4C98-A3F1-07EA45276F68@apple.com> On Jun 23, 2008, at 2:06 PM, Evan Cheng wrote: >> >> isSS? Why do you need this? You're bloating all LiveInterval's >> for this flag. > > This is used in debugging dump. I have changed this to use the top > bit of "reg" instead. Ok, it would be nice to add a comment saying that it is only to make the debugging dump prettier. >>> +static cl::opt >>> +DeleteLimit("slot-delete-limit", cl::init(-1), cl::Hidden, >>> + cl::desc("Stack coloring slot deletion limit")); >> >> What is DeleteLimit? Does DisableSharing disable the whole pass? > > This option is used to debug coloring. Once the limit is reached, > the rest of the slots are not colored. Ok, so it's similar to cutting off instcombine at some point. It would be nice to teach the passmgr how to do this somehow so bugpoint could drive it. In the meantime, could you add a comment explaining more of what it is for? ... or deleteing it is fine also. :) -Chris From clattner at apple.com Tue Jun 24 00:14:31 2008 From: clattner at apple.com (Chris Lattner) Date: Mon, 23 Jun 2008 22:14:31 -0700 Subject: [llvm-commits] [llvm] r52640 - /llvm/trunk/include/llvm/ADT/StringMap.h In-Reply-To: <200806232107.m5NL73Pg023392@zion.cs.uiuc.edu> References: <200806232107.m5NL73Pg023392@zion.cs.uiuc.edu> Message-ID: <0B7AAD30-5137-4CC1-BA01-E505169C6148@apple.com> On Jun 23, 2008, at 2:07 PM, Dan Gohman wrote: > URL: http://llvm.org/viewvc/llvm-project?rev=52640&view=rev > Log: > Add methods to StringMap to erase entries by key. Ok > + bool erase(std::string Key) { Please pass by const & -Chris From clattner at apple.com Tue Jun 24 00:15:20 2008 From: clattner at apple.com (Chris Lattner) Date: Mon, 23 Jun 2008 22:15:20 -0700 Subject: [llvm-commits] [llvm] r52644 - /llvm/trunk/lib/CodeGen/StackSlotColoring.cpp In-Reply-To: <200806232124.m5NLOWbP024284@zion.cs.uiuc.edu> References: <200806232124.m5NLOWbP024284@zion.cs.uiuc.edu> Message-ID: <2CDE724D-0C7D-43CF-B1DA-C52AB7CEE672@apple.com> On Jun 23, 2008, at 2:24 PM, Evan Cheng wrote: > Author: evancheng > Date: Mon Jun 23 16:24:32 2008 > New Revision: 52644 > > URL: http://llvm.org/viewvc/llvm-project?rev=52644&view=rev > Log: > Remove option used to debug stack coloring bugs. > It's no longer needed since stack coloring is now bug free. Bold claim ;-) -Chris From clattner at apple.com Tue Jun 24 00:28:15 2008 From: clattner at apple.com (Chris Lattner) Date: Mon, 23 Jun 2008 22:28:15 -0700 Subject: [llvm-commits] [llvm] r52638 - in /llvm/trunk: include/llvm/ADT/APInt.h lib/Support/APInt.cpp In-Reply-To: <485FFF2C.7030300@fastmail.fm> References: <200806231939.m5NJdpeV019682@zion.cs.uiuc.edu> <485FFF2C.7030300@fastmail.fm> Message-ID: On Jun 23, 2008, at 12:53 PM, Wojciech Matyjewicz wrote: >> Author: wmat >> Date: Mon Jun 23 14:39:50 2008 >> New Revision: 52638 >> >> URL: http://llvm.org/viewvc/llvm-project?rev=52638&view=rev >> Log: >> First step to fix PR2088. Implement routine to compute the >> multiplicative inverse of a given number. Modify udivrem to allow >> input and >> output pairs of arguments to overlap. Patch is based on the work by >> Chandler >> Carruth. > > The next step is to implement the solver of linear modulo equations. > Two > questions. > > a*x = b (mod n) > > Do we need a general solver (arbitrary n) or only a special one that > solves "linear equations with overflow" (n = 2^BitWidth)? The second > version should be simpler. Also, I cannot think of any use for the > first > one... > > Where to put it? APInt.cpp? ScalarEvolution.cpp? I'd put it in ScalarEvolution.cpp to start with - we can move it somewhere common when the second client wants it. -Chris From evan.cheng at apple.com Tue Jun 24 01:49:56 2008 From: evan.cheng at apple.com (Evan Cheng) Date: Mon, 23 Jun 2008 23:49:56 -0700 Subject: [llvm-commits] [llvm] r52649 - /llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp In-Reply-To: <200806232212.m5NMCOaT026454@zion.cs.uiuc.edu> References: <200806232212.m5NMCOaT026454@zion.cs.uiuc.edu> Message-ID: <2155EEA3-40BA-4866-BC4D-22A05DF77E0D@apple.com> Hi Owen, What does this mean? There might be empty slots after the last instruction in a MBB? I am not sure that's useful. The gaps are generally useful for inserting instructions before existing instructions, not after them. Besides, I am not sure this is the only place that makes this assumption. Evan On Jun 23, 2008, at 3:12 PM, Owen Anderson wrote: > Author: resistor > Date: Mon Jun 23 17:12:23 2008 > New Revision: 52649 > > URL: http://llvm.org/viewvc/llvm-project?rev=52649&view=rev > Log: > Use getMBBEndIdx rather than assuming that the end is right after > the last instruction in the block. > > Modified: > llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp > > Modified: llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp?rev=52649&r1=52648&r2=52649&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp (original) > +++ llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp Mon Jun 23 > 17:12:23 2008 > @@ -443,7 +443,7 @@ > LI.FindLiveRangeContaining(li_->getDefIndex(DefIdx)); > if (DstLR == LI.end()) > return false; > - unsigned KillIdx = li_->getInstructionIndex(&MBB->back()) + > InstrSlots::NUM; > + unsigned KillIdx = li_->getMBBEndIdx(MBB) + 1; > if (DstLR->valno->kills.size() == 1 && > DstLR->valno->kills[0] == KillIdx && DstLR->valno->hasPHIKill) > return true; > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From resistor at mac.com Tue Jun 24 01:53:32 2008 From: resistor at mac.com (Owen Anderson) Date: Mon, 23 Jun 2008 23:53:32 -0700 Subject: [llvm-commits] [llvm] r52649 - /llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp In-Reply-To: <2155EEA3-40BA-4866-BC4D-22A05DF77E0D@apple.com> References: <200806232212.m5NMCOaT026454@zion.cs.uiuc.edu> <2155EEA3-40BA-4866-BC4D-22A05DF77E0D@apple.com> Message-ID: Using getMBBEndIdx() is also better for handling empty BB's as well. It's just general all around because using it prevents clients of LIA from making too many assumptions about the underlying representation. And yes, there are many other instances of this, most within LIA itself. I have out-of-tree patches that address most of them that will go in once we get the necessary heuristic changes done. --Owen On Jun 23, 2008, at 11:49 PM, Evan Cheng wrote: > Hi Owen, > > What does this mean? There might be empty slots after the last > instruction in a MBB? I am not sure that's useful. The gaps are > generally useful for inserting instructions before existing > instructions, not after them. Besides, I am not sure this is the only > place that makes this assumption. > > Evan > > On Jun 23, 2008, at 3:12 PM, Owen Anderson wrote: > >> Author: resistor >> Date: Mon Jun 23 17:12:23 2008 >> New Revision: 52649 >> >> URL: http://llvm.org/viewvc/llvm-project?rev=52649&view=rev >> Log: >> Use getMBBEndIdx rather than assuming that the end is right after >> the last instruction in the block. >> >> Modified: >> llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp >> >> Modified: llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp?rev=52649&r1=52648&r2=52649&view=diff >> >> = >> = >> = >> = >> = >> = >> = >> = >> = >> ===================================================================== >> --- llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp (original) >> +++ llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp Mon Jun 23 >> 17:12:23 2008 >> @@ -443,7 +443,7 @@ >> LI.FindLiveRangeContaining(li_->getDefIndex(DefIdx)); >> if (DstLR == LI.end()) >> return false; >> - unsigned KillIdx = li_->getInstructionIndex(&MBB->back()) + >> InstrSlots::NUM; >> + unsigned KillIdx = li_->getMBBEndIdx(MBB) + 1; >> if (DstLR->valno->kills.size() == 1 && >> DstLR->valno->kills[0] == KillIdx && DstLR->valno->hasPHIKill) >> return true; >> >> >> _______________________________________________ >> llvm-commits mailing list >> llvm-commits at cs.uiuc.edu >> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/pkcs7-signature Size: 4260 bytes Desc: not available Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20080623/592d7181/attachment.bin From evan.cheng at apple.com Tue Jun 24 02:10:51 2008 From: evan.cheng at apple.com (Evan Cheng) Date: Tue, 24 Jun 2008 07:10:51 -0000 Subject: [llvm-commits] [llvm] r52670 - in /llvm/trunk: lib/Target/X86/X86InstrInfo.cpp test/CodeGen/X86/remat-mov0.ll Message-ID: <200806240710.m5O7ApK2012365@zion.cs.uiuc.edu> Author: evancheng Date: Tue Jun 24 02:10:51 2008 New Revision: 52670 URL: http://llvm.org/viewvc/llvm-project?rev=52670&view=rev Log: If it's determined safe, remat MOV32r0 (i.e. xor r, r) and others as it is instead of using the longer MOV32ri instruction. Added: llvm/trunk/test/CodeGen/X86/remat-mov0.ll Modified: llvm/trunk/lib/Target/X86/X86InstrInfo.cpp Modified: llvm/trunk/lib/Target/X86/X86InstrInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86InstrInfo.cpp?rev=52670&r1=52669&r2=52670&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86InstrInfo.cpp (original) +++ llvm/trunk/lib/Target/X86/X86InstrInfo.cpp Tue Jun 24 02:10:51 2008 @@ -832,6 +832,40 @@ return true; } +/// isSafeToClobberEFLAGS - Return true if it's safe insert an instruction that +/// would clobber the EFLAGS condition register. Note the result may be +/// conservative. If it cannot definitely determine the safety after visiting +/// two instructions it assumes it's not safe. +static bool isSafeToClobberEFLAGS(MachineBasicBlock &MBB, + MachineBasicBlock::iterator I) { + // For compile time consideration, if we are not able to determine the + // safety after visiting 2 instructions, we will assume it's not safe. + for (unsigned i = 0; i < 2; ++i) { + if (I == MBB.end()) + // Reached end of block, it's safe. + return true; + bool SeenDef = false; + for (unsigned j = 0, e = I->getNumOperands(); j != e; ++j) { + MachineOperand &MO = I->getOperand(j); + if (!MO.isRegister()) + continue; + if (MO.getReg() == X86::EFLAGS) { + if (MO.isUse()) + return false; + SeenDef = true; + } + } + + if (SeenDef) + // This instruction defines EFLAGS, no need to look any further. + return true; + ++I; + } + + // Conservative answer. + return false; +} + void X86InstrInfo::reMaterialize(MachineBasicBlock &MBB, MachineBasicBlock::iterator I, unsigned DestReg, @@ -846,25 +880,33 @@ // MOV32r0 etc. are implemented with xor which clobbers condition code. // Re-materialize them as movri instructions to avoid side effects. + bool Emitted = false; switch (Orig->getOpcode()) { + default: break; case X86::MOV8r0: - BuildMI(MBB, I, get(X86::MOV8ri), DestReg).addImm(0); - break; case X86::MOV16r0: - BuildMI(MBB, I, get(X86::MOV16ri), DestReg).addImm(0); - break; case X86::MOV32r0: - BuildMI(MBB, I, get(X86::MOV32ri), DestReg).addImm(0); - break; - case X86::MOV64r0: - BuildMI(MBB, I, get(X86::MOV64ri32), DestReg).addImm(0); + case X86::MOV64r0: { + if (!isSafeToClobberEFLAGS(MBB, I)) { + unsigned Opc = 0; + switch (Orig->getOpcode()) { + default: break; + case X86::MOV8r0: Opc = X86::MOV8ri; break; + case X86::MOV16r0: Opc = X86::MOV16ri; break; + case X86::MOV32r0: Opc = X86::MOV32ri; break; + case X86::MOV64r0: Opc = X86::MOV64ri32; break; + } + BuildMI(MBB, I, get(Opc), DestReg).addImm(0); + Emitted = true; + } break; - default: { + } + } + + if (!Emitted) { MachineInstr *MI = Orig->clone(); MI->getOperand(0).setReg(DestReg); MBB.insert(I, MI); - break; - } } if (ChangeSubIdx) { Added: llvm/trunk/test/CodeGen/X86/remat-mov0.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/remat-mov0.ll?rev=52670&view=auto ============================================================================== --- llvm/trunk/test/CodeGen/X86/remat-mov0.ll (added) +++ llvm/trunk/test/CodeGen/X86/remat-mov0.ll Tue Jun 24 02:10:51 2008 @@ -0,0 +1,45 @@ +; RUN: llvm-as < %s | llc -march=x86 | grep xor | count 3 + + %struct.FILE = type { i8*, i32, i32, i16, i16, %struct.__sbuf, i32, i8*, i32 (i8*)*, i32 (i8*, i8*, i32)*, i64 (i8*, i64, i32)*, i32 (i8*, i8*, i32)*, %struct.__sbuf, %struct.__sFILEX*, i32, [3 x i8], [1 x i8], %struct.__sbuf, i32, i64 } + %struct.ImgT = type { i8, i8*, i8*, %struct.FILE*, i32, i32, i32, i32, i8*, double*, float*, float*, float*, i32*, double, double, i32*, double*, i32*, i32* } + %struct._CompT = type { i32, i32, i32, i32, i32, i32, i32, i32, i32, float, float, i8, %struct._PixT*, %struct._CompT*, i8, %struct._CompT* } + %struct._PixT = type { i32, i32, %struct._PixT* } + %struct.__sFILEX = type opaque + %struct.__sbuf = type { i8*, i32 } + +declare fastcc void @MergeComponents(%struct._CompT*, %struct._CompT*, %struct._CompT*, %struct._CompT**, %struct.ImgT*) nounwind + +define fastcc void @MergeToLeft(%struct._CompT* %comp, %struct._CompT** %head, %struct.ImgT* %img) nounwind { +entry: + br label %bb208 + +bb105: ; preds = %bb200 + br i1 false, label %bb197, label %bb149 + +bb149: ; preds = %bb105 + %tmp151 = getelementptr %struct._CompT* null, i32 0, i32 0 ; [#uses=1] + br i1 false, label %bb184, label %bb193 + +bb184: ; preds = %bb149 + tail call fastcc void @MergeComponents( %struct._CompT* %comp, %struct._CompT* null, %struct._CompT* null, %struct._CompT** %head, %struct.ImgT* %img ) nounwind + tail call fastcc void @MergeToLeft( %struct._CompT* %comp, %struct._CompT** %head, %struct.ImgT* %img ) nounwind + br label %bb193 + +bb193: ; preds = %bb184, %bb149 + %tmp196 = load i32* %tmp151, align 4 ; [#uses=1] + br label %bb197 + +bb197: ; preds = %bb193, %bb105 + %last_comp.0 = phi i32 [ %tmp196, %bb193 ], [ 0, %bb105 ] ; [#uses=0] + %indvar.next = add i32 %indvar, 1 ; [#uses=1] + br label %bb200 + +bb200: ; preds = %bb208, %bb197 + %indvar = phi i32 [ 0, %bb208 ], [ %indvar.next, %bb197 ] ; [#uses=2] + %xm.0 = sub i32 %indvar, 0 ; [#uses=1] + %tmp202 = icmp slt i32 %xm.0, 1 ; [#uses=1] + br i1 %tmp202, label %bb105, label %bb208 + +bb208: ; preds = %bb200, %entry + br label %bb200 +} From matthijs at stdin.nl Tue Jun 24 02:57:54 2008 From: matthijs at stdin.nl (Matthijs Kooijman) Date: Tue, 24 Jun 2008 09:57:54 +0200 Subject: [llvm-commits] [llvm] r52315 - in /llvm/trunk: include/llvm/Analysis/ValueTracking.h lib/Analysis/ValueTracking.cpp lib/Transforms/Scalar/InstructionCombining.cpp In-Reply-To: <3A364BBB-5B94-468F-8D53-39395F910FD4@apple.com> References: <200806161248.m5GCmM01015536@zion.cs.uiuc.edu> <3A364BBB-5B94-468F-8D53-39395F910FD4@apple.com> Message-ID: <20080624075754.GV3816@katherina.student.utwente.nl> Hi Chris, > Can't passes just insert a new ExtractValueInst and expect instcombine > to simplify stuff away? Currently, this method is only used by SCCP, IPConstProp and InstCombine itself. The first two use it to propagate constants or known values out of functions (ie, propage known return values). This means they really have to try to find the actual value instead of just inserting extractvalue. We could probably reduce this to only look at the first level of inserts or something, but that would require always running instcombine before these passes (which ends up being slower, I would expect) and causes some simplifications to be left out. So, I don't think changing this is the way to go. Gr. Matthijs -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: Digital signature Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20080624/aad06897/attachment.bin From matthijs at stdin.nl Tue Jun 24 03:33:05 2008 From: matthijs at stdin.nl (Matthijs Kooijman) Date: Tue, 24 Jun 2008 10:33:05 +0200 Subject: [llvm-commits] [llvm] r52217 - in /llvm/trunk: lib/Transforms/Scalar/InstructionCombining.cpp test/Transforms/InstCombine/extractvalue.ll In-Reply-To: References: <200806111405.m5BE55rj002564@zion.cs.uiuc.edu> Message-ID: <20080624083305.GX3816@katherina.student.utwente.nl> Hi Chris, > visitExtractValueInst(I) { > op = I.getOperand(0); > if (isa(op)) > use new zero; > else if (insertvalueinst) { > if (index is the thing inserted) > use inserted value > else > use new extract value inst of aggregate input > ... > } That actually sounds like a sane idea. In the existing implementation however, there is also some handling of some more complex cases. I'll just give examples, to see if the new approach handles them as well. A = insertvalue undef, X, 0 ; {X, _} B = insertvalue undef, A, 0 ; { {X, _}, _} C = extractvalue B, 0, 0 ; X Trivially implementing your above suggestions would turn this into C = extractvalue undef, 0, 0 since the indices of the extractvalue (0, 0) don't match those of the insert (0). So, we will need to support partial matches as well, which should be translated to: C = extractvalue A, 0; i.e., use the partially matching insertvalue's inserted value and remove the partially matching indices from the extractvalue. A = insertvalue undef, X, 0, 0 ; { {X, _}, _} B = insertvalue A, Y, 0, 1 ; { {X, Y}, _} C = extractvalue B, 0 ; {X, Y} This can be simplified to A = insertvalue undef, X, 0 ; {X, _} C = insertvalue A, Y, 1 ; {X, Y} This is currently being done by iterating all the elements in C and looking up known values for each of them (or, for nested structs, also for sub structs if not all individual elements are known). This could probably be handled by iterating of the elements of C (only the first level), inserting extractvalue B, 0, i (ie, the partially matching indices plus the element index) and insertvalues for each of them (in effect rebuilding the request struct. For the above example, this would give: A = insertvalue undef, X, 0, 0 ; { {X, _}, _} B = insertvalue A, Y, 0, 1 ; { {X, Y}, _} Xp = extractvalue B, 0, 0 D = insertvalue undef, Xp, 0 Yp = extractvalue B, 0, 1 C = insertvalue D, Yp, 1 The inserted extractvalues can be folded in the next iteration, resulting in the wanted: D = insertvalue undef, X, 0 ; {X, _} C = insertvalue A, Y, 1 ; {X, Y} So, it seems that this approach is indeed simpler and would work in all cases I can think of just now. Any other thoughts? Gr. Matthijs -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: Digital signature Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20080624/82ee5a5f/attachment.bin From matthijs at stdin.nl Tue Jun 24 04:14:10 2008 From: matthijs at stdin.nl (Matthijs Kooijman) Date: Tue, 24 Jun 2008 09:14:10 -0000 Subject: [llvm-commits] [llvm] r52672 - in /llvm/trunk: include/llvm/Transforms/IPO.h lib/Transforms/IPO/Internalize.cpp Message-ID: <200806240914.m5O9EAaY026976@zion.cs.uiuc.edu> Author: matthijs Date: Tue Jun 24 04:14:10 2008 New Revision: 52672 URL: http://llvm.org/viewvc/llvm-project?rev=52672&view=rev Log: Rename a few variables to be more consistent. Modified: llvm/trunk/include/llvm/Transforms/IPO.h llvm/trunk/lib/Transforms/IPO/Internalize.cpp Modified: llvm/trunk/include/llvm/Transforms/IPO.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Transforms/IPO.h?rev=52672&r1=52671&r2=52672&view=diff ============================================================================== --- llvm/trunk/include/llvm/Transforms/IPO.h (original) +++ llvm/trunk/include/llvm/Transforms/IPO.h Tue Jun 24 04:14:10 2008 @@ -108,7 +108,7 @@ /// internalized and all others are. Otherwise if AllButMain is set and the /// main function is found, all other globals are marked as internal. /// -ModulePass *createInternalizePass(bool InternalizeEverything); +ModulePass *createInternalizePass(bool AllButMain); /// createInternalizePass - This pass loops over all of the functions in the /// input module, internalizing all globals (functions and variables) not in the Modified: llvm/trunk/lib/Transforms/IPO/Internalize.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/Internalize.cpp?rev=52672&r1=52671&r2=52672&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/IPO/Internalize.cpp (original) +++ llvm/trunk/lib/Transforms/IPO/Internalize.cpp Tue Jun 24 04:14:10 2008 @@ -48,7 +48,7 @@ bool AllButMain; public: static char ID; // Pass identification, replacement for typeid - explicit InternalizePass(bool InternalizeEverything = true); + explicit InternalizePass(bool AllButMain = true); explicit InternalizePass(const std::vector & exportList); void LoadFile(const char *Filename); virtual bool runOnModule(Module &M); @@ -150,8 +150,8 @@ return Changed; } -ModulePass *llvm::createInternalizePass(bool InternalizeEverything) { - return new InternalizePass(InternalizeEverything); +ModulePass *llvm::createInternalizePass(bool AllButMain) { + return new InternalizePass(AllButMain); } ModulePass *llvm::createInternalizePass(const std::vector &el) { From matthijs at stdin.nl Tue Jun 24 07:58:33 2008 From: matthijs at stdin.nl (Matthijs Kooijman) Date: Tue, 24 Jun 2008 12:58:33 -0000 Subject: [llvm-commits] [llvm] r52674 - /llvm/trunk/docs/TestingGuide.html Message-ID: <200806241258.m5OCwX7c001626@zion.cs.uiuc.edu> Author: matthijs Date: Tue Jun 24 07:58:31 2008 New Revision: 52674 URL: http://llvm.org/viewvc/llvm-project?rev=52674&view=rev Log: Update testing documentation with more consistent terminology. All of LLVM's testing features are now referred to as the "Testing infrastructure", the DejaGNU tests are just that, and the whole program tests are referred to as the "test suite". Modified: llvm/trunk/docs/TestingGuide.html Modified: llvm/trunk/docs/TestingGuide.html URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/TestingGuide.html?rev=52674&r1=52673&r2=52674&view=diff ============================================================================== --- llvm/trunk/docs/TestingGuide.html (original) +++ llvm/trunk/docs/TestingGuide.html Tue Jun 24 07:58:31 2008 @@ -2,44 +2,44 @@ "http://www.w3.org/TR/html4/strict.dtd"> - LLVM Test Suite Guide + LLVM Testing Infrastructure Guide
- LLVM Test Suite Guide + LLVM Testing Infrastructure Guide
  1. Overview
  2. -
  3. Requirements
  4. -
  5. LLVM Test Suite Organization +
  6. Requirements
  7. +
  8. LLVM testing infrastructure organization
  9. -
  10. Quick Start +
  11. Quick start
  12. -
  13. DejaGNU Structure +
  14. DejaGNU structure
  15. -
  16. llvm-test Structure
  17. -
  18. Running the LLVM Tests +
  19. Test suite structure
  20. +
  21. Running the test suite
  22. Running the nightly tester
  23. @@ -56,19 +56,19 @@
    -

    This document is the reference manual for the LLVM test suite. It documents -the structure of the LLVM test suite, the tools needed to use it, and how to add -and run tests.

    +

    This document is the reference manual for the LLVM testing infrastructure. It documents +the structure of the LLVM testing infrastructure, the tools needed to use it, +and how to add and run tests.

    - +
    -

    In order to use the LLVM test suite, you will need all of the software +

    In order to use the LLVM testing infrastructure, you will need all of the software required to build LLVM, plus the following:

    @@ -114,21 +114,22 @@
    - +
    -

    The LLVM test suite contains two major categories of tests: code -fragments and whole programs. Code fragments are in the llvm module -under the llvm/test directory. The whole programs -test suite is in the llvm-test module under the main directory.

    +

    The LLVM testing infrastructure contains two major categories of tests: code +fragments and whole programs. Code fragments are referred to as the "DejaGNU +tests" and are in the llvm module in subversion under the +llvm/test directory. The whole programs tests are referred to as the +"Test suite" and are in the test-suite module in subversion. +

    - +
    @@ -154,13 +155,12 @@
    - +
    -

    The llvm-test suite contains whole programs, which are pieces of +

    The test suite contains whole programs, which are pieces of code which can be compiled and linked into a stand-alone program that can be executed. These programs are generally written in high level languages such as C or C++, but sometimes they are written straight in LLVM assembly.

    @@ -175,27 +175,26 @@ programs generated as well as the speed with which LLVM compiles, optimizes, and generates code.

    -

    All "whole program" tests are located in the test-suite Subversion -module.

    +

    The test-suite is located in the test-suite Subversion module.

    - +
    -

    The tests are located in two separate Subversion modules. The code fragment +

    The tests are located in two separate Subversion modules. The DejaGNU tests are in the main "llvm" module under the directory llvm/test (so you get these tests for free with the main llvm tree). - The more comprehensive llvm-test suite that includes whole -programs in C and C++ is in the test-suite module. This module should -be checked out to the llvm/projects directory as llvm-test (don't use -another name, for then the test suite will be run every time you run -make in the main llvm directory). + The more comprehensive test suite that includes whole +programs in C and C++ is in the test-suite module. This module should +be checked out to the llvm/projects directory (don't use another name +then the default "test-suite", for then the test suite will be run every time +you run make in the main llvm directory). When you configure the llvm module, -the llvm-test directory will be automatically configured. +the test-suite directory will be automatically configured. Alternatively, you can configure the test-suite module manually.

    @@ -218,8 +217,8 @@
    -

    To run only a subdirectory of tests in llvm/test using DejaGNU (ie. -Regression/Transforms), just set the TESTSUITE variable to the path of the +

    To run only a subdirectory of tests in llvm/test using DejaGNU (ie. +Transforms), just set the TESTSUITE variable to the path of the subdirectory (relative to llvm/test):

    @@ -232,8 +231,8 @@ must have run the complete testsuite before you can specify a subdirectory.

    -

    To run only a single test, set TESTONE to its path (relative to -llvm/test) and make the check-one target:

    +

    To run only a single test, set TESTONE to its path (relative to +llvm/test) and make the check-one target:

    @@ -242,7 +241,7 @@
     
    - +

    To run the comprehensive test suite (tests that compile and execute whole @@ -251,7 +250,7 @@

     % cd llvm/projects
    -% svn co http://llvm.org/svn/llvm-project/test-suite/trunk llvm-test
    +% svn co http://llvm.org/svn/llvm-project/test-suite/trunk test-suite
     % cd ..
     % ./configure --with-llvmgccdir=$LLVM_GCC_DIR
     
    @@ -259,12 +258,12 @@ llvm-gcc, not it's src or obj dir.

    -

    Then, run the entire test suite by running make in the llvm-test +

    Then, run the entire test suite by running make in the test-suite directory:

    -% cd projects/llvm-test
    +% cd projects/test-suite
     % gmake
     
    @@ -274,19 +273,19 @@
    -% cd projects/llvm-test
    +% cd projects/test-suite
     % gmake TEST=nightly report report.html
     

    Any of the above commands can also be run in a subdirectory of -projects/llvm-test to run the specified test only on the programs in +projects/test-suite to run the specified test only on the programs in that subdirectory.

    - +

    The LLVM DejaGNU tests are driven by DejaGNU together with GNU Make and are @@ -313,7 +312,7 @@

    - +

    The DejaGNU structure is very simple, but does require some information to @@ -624,7 +623,7 @@

    -
    llvm-test + @@ -684,7 +683,7 @@ the result for such tests will be XFAIL (eXpected FAILure). In this way, you can tell the difference between an expected and unexpected failure.

    -

    The tests in llvm-test have no such feature at this time. If the +

    The tests in the test suite have no such feature at this time. If the test passes, only warnings and other miscellaneous output will be generated. If a test fails, a large <program> FAILED message will be displayed. This will help you separate benign warnings from actual test failures.

    @@ -692,7 +691,7 @@
    - +
    @@ -701,7 +700,7 @@ are not executed inside of the LLVM source tree. This is because the test suite creates temporary files during execution.

    -

    To run the llvm-test suite, you need to use the following steps:

    +

    To run the test suite, you need to use the following steps:

    1. cd into the llvm/projects directory
    2. @@ -710,15 +709,15 @@
      -% svn co http://llvm.org/svn/llvm-project/test-suite/trunk llvm-test
      +% svn co http://llvm.org/svn/llvm-project/test-suite/trunk test-suite
       

      This will get the test suite into llvm/projects/llvm-test

      -
    3. Configure the test suite using llvm configure. This will automatically configure llvm-test. - You must do it from the top level otherwise llvm-gcc will not be set which is required to - run llvm-test:

      +
    4. Configure the test suite using llvm configure. This will automatically + configure test-suite. You must do it from the top level otherwise llvm-gcc + will not be set which is required to run llvm-test:

       % cd $LLVM_OBJ_ROOT ; $LLVM_SRC_ROOT/configure --with-llvmgccdir=$LLVM_GCC_DIR
      @@ -728,7 +727,7 @@
           installed llvm-gcc, not its src or obj directory.

    5. -
    6. Change back to the llvm/projects/llvm-test directory you created before +

    7. Change back to the llvm/projects/test-suite directory you created before and run gmake (or just "make" on systems where GNU make is the default, such as linux.

    @@ -738,11 +737,11 @@ +Configuring external tests
    -

    Note, when configuring the llvm-test module, you might want to +

    Note, when configuring the test-suite module, you might want to specify the following configuration options:

    --enable-spec2000 @@ -774,12 +773,12 @@ +Running different tests
    -

    In addition to the regular "whole program" tests, the llvm-test +

    In addition to the regular "whole program" tests, the test-suite module also provides a mechanism for compiling the programs in different ways. -If the variable TEST is defined on the gmake command line, the test system will +If the variable TEST is defined on the gmake command line, the test system will include a Makefile named TEST.<value of TEST variable>.Makefile. This Makefile can modify build rules to yield different results.

    @@ -797,7 +796,7 @@ +Generating test output

    There are a number of ways to run the tests and generate output. The most @@ -828,12 +827,12 @@

    +Writing custom tests for the test suite
    -

    Assuming you can run llvm-test, (e.g. "gmake TEST=nightly report" +

    Assuming you can run the test suite, (e.g. "gmake TEST=nightly report" should work), it is really easy to run optimizations or code generator components against every program in the tree, collecting statistics or running custom checks for correctness. At base, this is how the nightly tester works, @@ -846,10 +845,10 @@

    Following this, you can set up a test and a report that collects these and formats them for easy viewing. This consists of two files, an -"llvm-test/TEST.XXX.Makefile" fragment (where XXX is the name of your +"test-suite/TEST.XXX.Makefile" fragment (where XXX is the name of your test) and an "llvm-test/TEST.XXX.report" file that indicates how to format the output into a table. There are many example reports of various -levels of sophistication included with llvm-test, and the framework is very +levels of sophistication included with the test suite, and the framework is very general.

    If you are interested in testing an optimization pass, check out the @@ -857,7 +856,7 @@

    -% cd llvm/projects/llvm-test/MultiSource/Benchmarks  # or some other level
    +% cd llvm/projects/test-suite/MultiSource/Benchmarks  # or some other level
     % make TEST=libcalls report
     
    @@ -888,7 +887,7 @@ You can also use the "TEST=libcalls report.html" target to get the table in HTML form, similarly for report.csv and report.tex.

    -

    The source for this is in llvm-test/TEST.libcalls.*. The format is pretty +

    The source for this is in test-suite/TEST.libcalls.*. The format is pretty simple: the Makefile indicates how to run the test (in this case, "opt -simplify-libcalls -stats"), and the report contains one line for each column of the output. The first value is the header for the column and the From matthijs at stdin.nl Tue Jun 24 08:01:58 2008 From: matthijs at stdin.nl (Matthijs Kooijman) Date: Tue, 24 Jun 2008 13:01:58 -0000 Subject: [llvm-commits] [llvm] r52675 - in /llvm/trunk: autoconf/configure.ac configure projects/Makefile Message-ID: <200806241301.m5OD1w3G001748@zion.cs.uiuc.edu> Author: matthijs Date: Tue Jun 24 08:01:57 2008 New Revision: 52675 URL: http://llvm.org/viewvc/llvm-project?rev=52675&view=rev Log: Allow the test suite to be checked out into projects/test-suite. We will keep the old projects/llvm-test working for existing installs. The changes to configure are made manually, since I lack autoconf-2.6. Someone might want to run AutoGen.sh to see if that changes anything. Modified: llvm/trunk/autoconf/configure.ac llvm/trunk/configure llvm/trunk/projects/Makefile Modified: llvm/trunk/autoconf/configure.ac URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/autoconf/configure.ac?rev=52675&r1=52674&r2=52675&view=diff ============================================================================== --- llvm/trunk/autoconf/configure.ac (original) +++ llvm/trunk/autoconf/configure.ac Tue Jun 24 08:01:57 2008 @@ -70,7 +70,10 @@ sample) AC_CONFIG_SUBDIRS([projects/sample]) ;; privbracket) AC_CONFIG_SUBDIRS([projects/privbracket]) ;; llvm-stacker) AC_CONFIG_SUBDIRS([projects/llvm-stacker]) ;; + # llvm-test is the old name of the test-suite, kept here for backwards + # compatibility llvm-test) AC_CONFIG_SUBDIRS([projects/llvm-test]) ;; + test-suite) AC_CONFIG_SUBDIRS([projects/test-suite]) ;; llvm-reopt) AC_CONFIG_SUBDIRS([projects/llvm-reopt]);; llvm-gcc) AC_CONFIG_SUBDIRS([projects/llvm-gcc]) ;; llvm-java) AC_CONFIG_SUBDIRS([projects/llvm-java]) ;; Modified: llvm/trunk/configure URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/configure?rev=52675&r1=52674&r2=52675&view=diff ============================================================================== --- llvm/trunk/configure (original) +++ llvm/trunk/configure Tue Jun 24 08:01:57 2008 @@ -951,6 +951,7 @@ projects/privbracket projects/llvm-stacker projects/llvm-test +projects/test-suite projects/llvm-reopt projects/llvm-gcc projects/llvm-java @@ -2091,6 +2092,8 @@ ;; llvm-test) subdirs="$subdirs projects/llvm-test" ;; + test-suite) subdirs="$subdirs projects/test-suite" + ;; llvm-reopt) subdirs="$subdirs projects/llvm-reopt" ;; llvm-gcc) subdirs="$subdirs projects/llvm-gcc" Modified: llvm/trunk/projects/Makefile URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/projects/Makefile?rev=52675&r1=52674&r2=52675&view=diff ============================================================================== --- llvm/trunk/projects/Makefile (original) +++ llvm/trunk/projects/Makefile Tue Jun 24 08:01:57 2008 @@ -10,7 +10,9 @@ include $(LEVEL)/Makefile.config -DIRS:= $(filter-out llvm-test,$(patsubst $(PROJ_SRC_DIR)/%/Makefile,%,$(wildcard $(PROJ_SRC_DIR)/*/Makefile))) +# Compile all subdirs, except for the test suite, which lives in test-suite. +# Before 2008.06.24 it lived in llvm-test, so exclude that as well for now. +DIRS:= $(filter-out llvm-test test-suite,$(patsubst $(PROJ_SRC_DIR)/%/Makefile,%,$(wildcard $(PROJ_SRC_DIR)/*/Makefile))) # Sparc cannot link shared libraries (libtool problem?) ifeq ($(ARCH), Sparc) From matthijs at stdin.nl Tue Jun 24 08:39:28 2008 From: matthijs at stdin.nl (Matthijs Kooijman) Date: Tue, 24 Jun 2008 15:39:28 +0200 Subject: [llvm-commits] [llvm] r52532 - in /llvm/trunk: lib/Transforms/IPO/DeadArgumentElimination.cpp test/Transforms/DeadArgElim/multdeadretval.ll In-Reply-To: <20080623160457.GT3816@katherina.student.utwente.nl> References: <200806200936.m5K9aIZR010499@zion.cs.uiuc.edu> <0E696BD0-C25F-48E3-811D-E8C6745961AA@apple.com> <20080623160457.GT3816@katherina.student.utwente.nl> Message-ID: <20080624133928.GB438@katherina.student.utwente.nl> Hi Evan, > I've attached the diff, perhaps you could check if it works for you? Here, it > managed to compile past the point where it was failing into stage3. It's not > finished yet, but my work day is over, but I expect it to compile the last of > stage3 just fine. Right, after updating my working copy, it manages to bootstrap just fine (I guess your disable PRE patch fixed the last problem I was having). I'm currently running the test-suite for a last time (after succesfully screwing up my previous run by recompiling llvm halfway through :-). Gr. Matthijs -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: Digital signature Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20080624/3c838036/attachment.bin From matthijs at stdin.nl Tue Jun 24 11:30:27 2008 From: matthijs at stdin.nl (Matthijs Kooijman) Date: Tue, 24 Jun 2008 16:30:27 -0000 Subject: [llvm-commits] [llvm] r52677 - in /llvm/trunk: lib/Transforms/IPO/DeadArgumentElimination.cpp test/Transforms/DeadArgElim/2008-06-23-DeadAfterLive.ll test/Transforms/DeadArgElim/deadretval2.ll test/Transforms/DeadArgElim/multdeadretval.ll Message-ID: <200806241630.m5OGUROm009102@zion.cs.uiuc.edu> Author: matthijs Date: Tue Jun 24 11:30:26 2008 New Revision: 52677 URL: http://llvm.org/viewvc/llvm-project?rev=52677&view=rev Log: Commit the new DeadArgElim pass again, this time with the gcc bootstrap failures fixed. Also add a testcase to reproduce the gcc bootstrap failure in very much reduced form. Added: llvm/trunk/test/Transforms/DeadArgElim/2008-06-23-DeadAfterLive.ll llvm/trunk/test/Transforms/DeadArgElim/multdeadretval.ll - copied, changed from r52595, llvm/trunk/test/Transforms/DeadArgElim/multdeadretval.ll Modified: llvm/trunk/lib/Transforms/IPO/DeadArgumentElimination.cpp llvm/trunk/test/Transforms/DeadArgElim/deadretval2.ll Modified: llvm/trunk/lib/Transforms/IPO/DeadArgumentElimination.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/DeadArgumentElimination.cpp?rev=52677&r1=52676&r2=52677&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/IPO/DeadArgumentElimination.cpp (original) +++ llvm/trunk/lib/Transforms/IPO/DeadArgumentElimination.cpp Tue Jun 24 11:30:26 2008 @@ -10,10 +10,10 @@ // This pass deletes dead arguments from internal functions. Dead argument // elimination removes arguments which are directly dead, as well as arguments // only passed into function calls as dead arguments of other functions. This -// pass also deletes dead arguments in a similar way. +// pass also deletes dead return values in a similar way. // // This pass is often useful as a cleanup pass to run after aggressive -// interprocedural passes, which add possibly-dead arguments. +// interprocedural passes, which add possibly-dead arguments or return values. // //===----------------------------------------------------------------------===// @@ -42,40 +42,72 @@ /// DAE - The dead argument elimination pass. /// class VISIBILITY_HIDDEN DAE : public ModulePass { + public: + + /// Struct that represent either a (part of a) return value or a function + /// argument. Used so that arguments and return values can be used + /// interchangably. + struct RetOrArg { + RetOrArg(const Function* F, unsigned Idx, bool IsArg) : F(F), Idx(Idx), + IsArg(IsArg) {} + const Function *F; + unsigned Idx; + bool IsArg; + + /// Make RetOrArg comparable, so we can put it into a map + bool operator<(const RetOrArg &O) const { + if (F != O.F) + return F < O.F; + else if (Idx != O.Idx) + return Idx < O.Idx; + else + return IsArg < O.IsArg; + } + + /// Make RetOrArg comparable, so we can easily iterate the multimap + bool operator==(const RetOrArg &O) const { + return F == O.F && Idx == O.Idx && IsArg == O.IsArg; + } + }; + /// Liveness enum - During our initial pass over the program, we determine - /// that things are either definately alive, definately dead, or in need of - /// interprocedural analysis (MaybeLive). - /// - enum Liveness { Live, MaybeLive, Dead }; - - /// LiveArguments, MaybeLiveArguments, DeadArguments - These sets contain - /// all of the arguments in the program. The Dead set contains arguments - /// which are completely dead (never used in the function). The MaybeLive - /// set contains arguments which are only passed into other function calls, - /// thus may be live and may be dead. The Live set contains arguments which - /// are known to be alive. - /// - std::set DeadArguments, MaybeLiveArguments, LiveArguments; - - /// DeadRetVal, MaybeLiveRetVal, LifeRetVal - These sets contain all of the - /// functions in the program. The Dead set contains functions whose return - /// value is known to be dead. The MaybeLive set contains functions whose - /// return values are only used by return instructions, and the Live set - /// contains functions whose return values are used, functions that are - /// external, and functions that already return void. - /// - std::set DeadRetVal, MaybeLiveRetVal, LiveRetVal; - - /// InstructionsToInspect - As we mark arguments and return values - /// MaybeLive, we keep track of which instructions could make the values - /// live here. Once the entire program has had the return value and - /// arguments analyzed, this set is scanned to promote the MaybeLive objects - /// to be Live if they really are used. - std::vector InstructionsToInspect; - - /// CallSites - Keep track of the call sites of functions that have - /// MaybeLive arguments or return values. - std::multimap CallSites; + /// that things are either alive or maybe alive. We don't mark anything + /// explicitely dead (even if we know they are), since anything not alive + /// with no registered uses (in Uses) will never be marked alive and will + /// thus become dead in the end. + enum Liveness { Live, MaybeLive }; + + /// Convenience wrapper + RetOrArg CreateRet(const Function *F, unsigned Idx) { + return RetOrArg(F, Idx, false); + } + /// Convenience wrapper + RetOrArg CreateArg(const Function *F, unsigned Idx) { + return RetOrArg(F, Idx, true); + } + + typedef std::multimap UseMap; + /// This map maps a return value or argument to all return values or + /// arguments it uses. + /// For example (indices are left out for clarity): + /// - Uses[ret F] = ret G + /// This means that F calls G, and F returns the value returned by G. + /// - Uses[arg F] = ret G + /// This means that some function calls G and passes its result as an + /// argument to F. + /// - Uses[ret F] = arg F + /// This means that F returns one of its own arguments. + /// - Uses[arg F] = arg G + /// This means that G calls F and passes one of its own (G's) arguments + /// directly to F. + UseMap Uses; + + typedef std::set LiveSet; + + /// This set contains all values that have been determined to be live + LiveSet LiveValues; + + typedef SmallVector UseVector; public: static char ID; // Pass identification, replacement for typeid @@ -85,20 +117,21 @@ virtual bool ShouldHackArguments() const { return false; } private: - Liveness getArgumentLiveness(const Argument &A); - bool isMaybeLiveArgumentNowLive(Argument *Arg); - + Liveness IsMaybeLive(RetOrArg Use, UseVector &MaybeLiveUses); + Liveness SurveyUse(Value::use_iterator U, UseVector &MaybeLiveUses, + unsigned RetValNum = 0); + Liveness SurveyUses(Value *V, UseVector &MaybeLiveUses); + + void SurveyFunction(Function &F); + void MarkValue(const RetOrArg &RA, Liveness L, + const UseVector &MaybeLiveUses); + void MarkLive(RetOrArg RA); + bool RemoveDeadStuffFromFunction(Function *F); bool DeleteDeadVarargs(Function &Fn); - void SurveyFunction(Function &Fn); - - void MarkArgumentLive(Argument *Arg); - void MarkRetValLive(Function *F); - void MarkReturnInstArgumentLive(ReturnInst *RI); - - void RemoveDeadArgumentsFromFunction(Function *F); }; } + char DAE::ID = 0; static RegisterPass X("deadargelim", "Dead Argument Elimination"); @@ -155,7 +188,7 @@ // remove the "..." and adjust all the calls. // Start by computing a new prototype for the function, which is the same as - // the old function, but has fewer arguments. + // the old function, but doesn't have isVarArg set. const FunctionType *FTy = Fn.getFunctionType(); std::vector Params(FTy->param_begin(), FTy->param_end()); FunctionType *NFTy = FunctionType::get(FTy->getReturnType(), Params, false); @@ -233,74 +266,154 @@ return true; } +/// Convenience function that returns the number of return values. It returns 0 +/// for void functions and 1 for functions not returning a struct. It returns +/// the number of struct elements for functions returning a struct. +static unsigned NumRetVals(const Function *F) { + if (F->getReturnType() == Type::VoidTy) + return 0; + else if (const StructType *STy = dyn_cast(F->getReturnType())) + return STy->getNumElements(); + else + return 1; +} -static inline bool CallPassesValueThoughVararg(Instruction *Call, - const Value *Arg) { - CallSite CS = CallSite::get(Call); - const Type *CalledValueTy = CS.getCalledValue()->getType(); - const Type *FTy = cast(CalledValueTy)->getElementType(); - unsigned NumFixedArgs = cast(FTy)->getNumParams(); - for (CallSite::arg_iterator AI = CS.arg_begin()+NumFixedArgs; - AI != CS.arg_end(); ++AI) - if (AI->get() == Arg) - return true; - return false; -} - -// getArgumentLiveness - Inspect an argument, determining if is known Live -// (used in a computation), MaybeLive (only passed as an argument to a call), or -// Dead (not used). -DAE::Liveness DAE::getArgumentLiveness(const Argument &A) { - const Function *F = A.getParent(); - - // If this is the return value of a struct function, it's not really dead. - if (F->hasStructRetAttr() && &*(F->arg_begin()) == &A) +/// IsMaybeAlive - This checks Use for liveness. If Use is live, returns Live, +/// else returns MaybeLive. Also, adds Use to MaybeLiveUses in the latter case. +DAE::Liveness DAE::IsMaybeLive(RetOrArg Use, UseVector &MaybeLiveUses) { + // We're live if our use is already marked as live + if (LiveValues.count(Use)) return Live; - - if (A.use_empty()) // First check, directly dead? - return Dead; - - // Scan through all of the uses, looking for non-argument passing uses. - for (Value::use_const_iterator I = A.use_begin(), E = A.use_end(); I!=E;++I) { - // Return instructions do not immediately effect liveness. - if (isa(*I)) - continue; - - CallSite CS = CallSite::get(const_cast(*I)); - if (!CS.getInstruction()) { - // If its used by something that is not a call or invoke, it's alive! - return Live; - } - // If it's an indirect call, mark it alive... - Function *Callee = CS.getCalledFunction(); - if (!Callee) return Live; - - // Check to see if it's passed through a va_arg area: if so, we cannot - // remove it. - if (CallPassesValueThoughVararg(CS.getInstruction(), &A)) - return Live; // If passed through va_arg area, we cannot remove it - } - return MaybeLive; // It must be used, but only as argument to a function + // We're maybe live otherwise, but remember that we must become live if + // Use becomes live. + MaybeLiveUses.push_back(Use); + return MaybeLive; } +/// SurveyUse - This looks at a single use of an argument or return value +/// and determines if it should be alive or not. Adds this use to MaybeLiveUses +/// if it causes the used value to become MaybeAlive. +/// +/// RetValNum is the return value number to use when this use is used in a +/// return instruction. This is used in the recursion, you should always leave +/// it at 0. +DAE::Liveness DAE::SurveyUse(Value::use_iterator U, UseVector &MaybeLiveUses, + unsigned RetValNum) { + Value *V = *U; + if (ReturnInst *RI = dyn_cast(V)) { + // The value is returned from another function. It's only live when the + // caller's return value is live + RetOrArg Use = CreateRet(RI->getParent()->getParent(), RetValNum); + // We might be live, depending on the liveness of Use + return IsMaybeLive(Use, MaybeLiveUses); + } + if (InsertValueInst *IV = dyn_cast(V)) { + if (U.getOperandNo() != InsertValueInst::getAggregateOperandIndex() + && IV->hasIndices()) + // The use we are examining is inserted into an aggregate. Our liveness + // depends on all uses of that aggregate, but if it is used as a return + // value, only index at which we were inserted counts. + RetValNum = *IV->idx_begin(); + + // Note that if we are used as the aggregate operand to the insertvalue, + // we don't change RetValNum, but do survey all our uses. + + Liveness Result = MaybeLive; + for (Value::use_iterator I = IV->use_begin(), + E = V->use_end(); I != E; ++I) { + Result = SurveyUse(I, MaybeLiveUses, RetValNum); + if (Result == Live) + break; + } + return Result; + } + CallSite CS = CallSite::get(V); + if (CS.getInstruction()) { + Function *F = CS.getCalledFunction(); + if (F) { + // Used in a direct call + + // Check for vararg. Do - 1 to skip the first operand to call (the + // function itself). + if (U.getOperandNo() - 1 >= F->getFunctionType()->getNumParams()) + // The value is passed in through a vararg! Must be live. + return Live; + + // Value passed to a normal call. It's only live when the corresponding + // argument (operand number - 1 to skip the function pointer operand) to + // the called function turns out live + RetOrArg Use = CreateArg(F, U.getOperandNo() - 1); + return IsMaybeLive(Use, MaybeLiveUses); + } else { + // Used in any other way? Value must be live. + return Live; + } + } + // Used in any other way? Value must be live. + return Live; +} + +/// SurveyUses - This looks at all the uses of the given return value +/// (possibly a partial return value from a function returning a struct). +/// Returns the Liveness deduced from the uses of this value. +/// +/// Adds all uses that cause the result to be MaybeLive to MaybeLiveRetUses. +DAE::Liveness DAE::SurveyUses(Value *V, UseVector &MaybeLiveUses) { + // Assume it's dead (which will only hold if there are no uses at all..) + Liveness Result = MaybeLive; + // Check each use + for (Value::use_iterator I = V->use_begin(), + E = V->use_end(); I != E; ++I) { + Result = SurveyUse(I, MaybeLiveUses); + if (Result == Live) + break; + } + return Result; +} + // SurveyFunction - This performs the initial survey of the specified function, // checking out whether or not it uses any of its incoming arguments or whether // any callers use the return value. This fills in the -// (Dead|MaybeLive|Live)(Arguments|RetVal) sets. +// LiveValues set and Uses map. // // We consider arguments of non-internal functions to be intrinsically alive as // well as arguments to functions which have their "address taken". // void DAE::SurveyFunction(Function &F) { bool FunctionIntrinsicallyLive = false; - Liveness RetValLiveness = F.getReturnType() == Type::VoidTy ? Live : Dead; + unsigned RetCount = NumRetVals(&F); + // Assume all return values are dead + typedef SmallVector RetVals; + RetVals RetValLiveness(RetCount, MaybeLive); + + // These vectors maps each return value to the uses that make it MaybeLive, so + // we can add those to the MaybeLiveRetVals list if the return value + // really turns out to be MaybeLive. Initializes to RetCount empty vectors + typedef SmallVector RetUses; + // Intialized to a list of RetCount empty lists + RetUses MaybeLiveRetUses(RetCount); - if (!F.hasInternalLinkage() && - (!ShouldHackArguments() || F.isIntrinsic())) + for (Function::iterator BB = F.begin(), E = F.end(); BB != E; ++BB) + if (ReturnInst *RI = dyn_cast(BB->getTerminator())) + if (RI->getNumOperands() != 0 && RI->getOperand(0)->getType() + != F.getFunctionType()->getReturnType()) { + // We don't support old style multiple return values + FunctionIntrinsicallyLive = true; + break; + } + + if (!F.hasInternalLinkage() && (!ShouldHackArguments() || F.isIntrinsic())) FunctionIntrinsicallyLive = true; - else + + if (!FunctionIntrinsicallyLive) { + DOUT << "DAE - Inspecting callers for fn: " << F.getName() << "\n"; + // Keep track of the number of live retvals, so we can skip checks once all + // of them turn out to be live. + unsigned NumLiveRetVals = 0; + const Type *STy = dyn_cast(F.getReturnType()); + // Loop all uses of the function for (Value::use_iterator I = F.use_begin(), E = F.use_end(); I != E; ++I) { // If the function is PASSED IN as an argument, its address has been taken if (I.getOperandNo() != 0) { @@ -316,190 +429,142 @@ break; } - // Check to see if the return value is used... - if (RetValLiveness != Live) - for (Value::use_iterator I = TheCall->use_begin(), - E = TheCall->use_end(); I != E; ++I) - if (isa(cast(*I))) { - RetValLiveness = MaybeLive; - } else if (isa(cast(*I)) || - isa(cast(*I))) { - if (CallPassesValueThoughVararg(cast(*I), TheCall) || - !CallSite::get(cast(*I)).getCalledFunction()) { - RetValLiveness = Live; - break; + // If we end up here, we are looking at a direct call to our function. + + // Now, check how our return value(s) is/are used in this caller. Don't + // bother checking return values if all of them are live already + if (NumLiveRetVals != RetCount) { + if (STy) { + // Check all uses of the return value + for (Value::use_iterator I = TheCall->use_begin(), + E = TheCall->use_end(); I != E; ++I) { + ExtractValueInst *Ext = dyn_cast(*I); + if (Ext && Ext->hasIndices()) { + // This use uses a part of our return value, survey the uses of + // that part and store the results for this index only. + unsigned Idx = *Ext->idx_begin(); + if (RetValLiveness[Idx] != Live) { + RetValLiveness[Idx] = SurveyUses(Ext, MaybeLiveRetUses[Idx]); + if (RetValLiveness[Idx] == Live) + NumLiveRetVals++; + } } else { - RetValLiveness = MaybeLive; + // Used by something else than extractvalue. Mark all + // return values as live. + for (unsigned i = 0; i != RetCount; ++i ) + RetValLiveness[i] = Live; + NumLiveRetVals = RetCount; + break; } - } else { - RetValLiveness = Live; - break; } + } else { + // Single return value + RetValLiveness[0] = SurveyUses(TheCall, MaybeLiveRetUses[0]); + if (RetValLiveness[0] == Live) + NumLiveRetVals = RetCount; + } + } } - + } if (FunctionIntrinsicallyLive) { - DOUT << " Intrinsically live fn: " << F.getName() << "\n"; + DOUT << "DAE - Intrinsically live fn: " << F.getName() << "\n"; + // Mark all arguments as live + unsigned i = 0; for (Function::arg_iterator AI = F.arg_begin(), E = F.arg_end(); - AI != E; ++AI) - LiveArguments.insert(AI); - LiveRetVal.insert(&F); + AI != E; ++AI, ++i) + MarkLive(CreateArg(&F, i)); + // Mark all return values as live + i = 0; + for (unsigned i = 0, e = RetValLiveness.size(); i != e; ++i) + MarkLive(CreateRet(&F, i)); return; } - switch (RetValLiveness) { - case Live: LiveRetVal.insert(&F); break; - case MaybeLive: MaybeLiveRetVal.insert(&F); break; - case Dead: DeadRetVal.insert(&F); break; + // Now we've inspected all callers, record the liveness of our return values. + for (unsigned i = 0, e = RetValLiveness.size(); i != e; ++i) { + RetOrArg Ret = CreateRet(&F, i); + // Mark the result down + MarkValue(Ret, RetValLiveness[i], MaybeLiveRetUses[i]); + } + DOUT << "DAE - Inspecting args for fn: " << F.getName() << "\n"; + + // Now, check all of our arguments + unsigned i = 0; + UseVector MaybeLiveArgUses; + for (Function::arg_iterator AI = F.arg_begin(), + E = F.arg_end(); AI != E; ++AI, ++i) { + // See what the effect of this use is (recording any uses that cause + // MaybeLive in MaybeLiveArgUses) + Liveness Result = SurveyUses(AI, MaybeLiveArgUses); + RetOrArg Arg = CreateArg(&F, i); + // Mark the result down + MarkValue(Arg, Result, MaybeLiveArgUses); + // Clear the vector again for the next iteration + MaybeLiveArgUses.clear(); } +} - DOUT << " Inspecting args for fn: " << F.getName() << "\n"; - - // If it is not intrinsically alive, we know that all users of the - // function are call sites. Mark all of the arguments live which are - // directly used, and keep track of all of the call sites of this function - // if there are any arguments we assume that are dead. - // - bool AnyMaybeLiveArgs = false; - for (Function::arg_iterator AI = F.arg_begin(), E = F.arg_end(); - AI != E; ++AI) - switch (getArgumentLiveness(*AI)) { - case Live: - DOUT << " Arg live by use: " << AI->getName() << "\n"; - LiveArguments.insert(AI); - break; - case Dead: - DOUT << " Arg definitely dead: " << AI->getName() <<"\n"; - DeadArguments.insert(AI); - break; +/// MarkValue - This function marks the liveness of RA depending on L. If L is +/// MaybeLive, it also records any uses in MaybeLiveUses such that RA will be +/// marked live if any use in MaybeLiveUses gets marked live later on. +void DAE::MarkValue(const RetOrArg &RA, Liveness L, + const UseVector &MaybeLiveUses) { + switch (L) { + case Live: MarkLive(RA); break; case MaybeLive: - DOUT << " Arg only passed to calls: " << AI->getName() << "\n"; - AnyMaybeLiveArgs = true; - MaybeLiveArguments.insert(AI); + { + // Note any uses of this value, so this return value can be + // marked live whenever one of the uses becomes live. + UseMap::iterator Where = Uses.begin(); + for (UseVector::const_iterator UI = MaybeLiveUses.begin(), + UE = MaybeLiveUses.end(); UI != UE; ++UI) + Where = Uses.insert(Where, UseMap::value_type(*UI, RA)); break; } - - // If there are any "MaybeLive" arguments, we need to check callees of - // this function when/if they become alive. Record which functions are - // callees... - if (AnyMaybeLiveArgs || RetValLiveness == MaybeLive) - for (Value::use_iterator I = F.use_begin(), E = F.use_end(); - I != E; ++I) { - if (AnyMaybeLiveArgs) - CallSites.insert(std::make_pair(&F, CallSite::get(*I))); - - if (RetValLiveness == MaybeLive) - for (Value::use_iterator UI = I->use_begin(), E = I->use_end(); - UI != E; ++UI) - InstructionsToInspect.push_back(cast(*UI)); - } -} - -// isMaybeLiveArgumentNowLive - Check to see if Arg is alive. At this point, we -// know that the only uses of Arg are to be passed in as an argument to a -// function call or return. Check to see if the formal argument passed in is in -// the LiveArguments set. If so, return true. -// -bool DAE::isMaybeLiveArgumentNowLive(Argument *Arg) { - for (Value::use_iterator I = Arg->use_begin(), E = Arg->use_end(); I!=E; ++I){ - if (isa(*I)) { - if (LiveRetVal.count(Arg->getParent())) return true; - continue; - } - - CallSite CS = CallSite::get(*I); - - // We know that this can only be used for direct calls... - Function *Callee = CS.getCalledFunction(); - - // Loop over all of the arguments (because Arg may be passed into the call - // multiple times) and check to see if any are now alive... - CallSite::arg_iterator CSAI = CS.arg_begin(); - for (Function::arg_iterator AI = Callee->arg_begin(), E = Callee->arg_end(); - AI != E; ++AI, ++CSAI) - // If this is the argument we are looking for, check to see if it's alive - if (*CSAI == Arg && LiveArguments.count(AI)) - return true; - } - return false; -} - -/// MarkArgumentLive - The MaybeLive argument 'Arg' is now known to be alive. -/// Mark it live in the specified sets and recursively mark arguments in callers -/// live that are needed to pass in a value. -/// -void DAE::MarkArgumentLive(Argument *Arg) { - std::set::iterator It = MaybeLiveArguments.lower_bound(Arg); - if (It == MaybeLiveArguments.end() || *It != Arg) return; - - DOUT << " MaybeLive argument now live: " << Arg->getName() <<"\n"; - MaybeLiveArguments.erase(It); - LiveArguments.insert(Arg); - - // Loop over all of the call sites of the function, making any arguments - // passed in to provide a value for this argument live as necessary. - // - Function *Fn = Arg->getParent(); - unsigned ArgNo = std::distance(Fn->arg_begin(), Function::arg_iterator(Arg)); - - std::multimap::iterator I = CallSites.lower_bound(Fn); - for (; I != CallSites.end() && I->first == Fn; ++I) { - CallSite CS = I->second; - Value *ArgVal = *(CS.arg_begin()+ArgNo); - if (Argument *ActualArg = dyn_cast(ArgVal)) { - MarkArgumentLive(ActualArg); - } else { - // If the value passed in at this call site is a return value computed by - // some other call site, make sure to mark the return value at the other - // call site as being needed. - CallSite ArgCS = CallSite::get(ArgVal); - if (ArgCS.getInstruction()) - if (Function *Fn = ArgCS.getCalledFunction()) - MarkRetValLive(Fn); - } } } -/// MarkArgumentLive - The MaybeLive return value for the specified function is -/// now known to be alive. Propagate this fact to the return instructions which -/// produce it. -void DAE::MarkRetValLive(Function *F) { - assert(F && "Shame shame, we can't have null pointers here!"); - - // Check to see if we already knew it was live - std::set::iterator I = MaybeLiveRetVal.lower_bound(F); - if (I == MaybeLiveRetVal.end() || *I != F) return; // It's already alive! - - DOUT << " MaybeLive retval now live: " << F->getName() << "\n"; - - MaybeLiveRetVal.erase(I); - LiveRetVal.insert(F); // It is now known to be live! - - // Loop over all of the functions, noticing that the return value is now live. - for (Function::iterator BB = F->begin(), E = F->end(); BB != E; ++BB) - if (ReturnInst *RI = dyn_cast(BB->getTerminator())) - MarkReturnInstArgumentLive(RI); -} - -void DAE::MarkReturnInstArgumentLive(ReturnInst *RI) { - Value *Op = RI->getOperand(0); - if (Argument *A = dyn_cast(Op)) { - MarkArgumentLive(A); - } else if (CallInst *CI = dyn_cast(Op)) { - if (Function *F = CI->getCalledFunction()) - MarkRetValLive(F); - } else if (InvokeInst *II = dyn_cast(Op)) { - if (Function *F = II->getCalledFunction()) - MarkRetValLive(F); - } -} +/// MarkLive - Mark the given return value or argument as live. Additionally, +/// mark any values that are used by this value (according to Uses) live as +/// well. +void DAE::MarkLive(RetOrArg RA) { + if (!LiveValues.insert(RA).second) + return; // We were already marked Live + + if (RA.IsArg) + DOUT << "DAE - Marking argument " << RA.Idx << " to function " + << RA.F->getNameStart() << " live\n"; + else + DOUT << "DAE - Marking return value " << RA.Idx << " of function " + << RA.F->getNameStart() << " live\n"; -// RemoveDeadArgumentsFromFunction - We know that F has dead arguments, as + // We don't use upper_bound (or equal_range) here, because our recursive call + // to ourselves is likely to mark the upper_bound (which is the first value + // not belonging to RA) to become erased and the iterator invalidated. + UseMap::iterator Begin = Uses.lower_bound(RA); + UseMap::iterator E = Uses.end(); + UseMap::iterator I; + for (I = Begin; I != E && I->first == RA; ++I) + MarkLive(I->second); + + // Erase RA from the Uses map (from the lower bound to wherever we ended up + // after the loop). + Uses.erase(Begin, I); +} + +// RemoveDeadStuffFromFunction - Remove any arguments and return values from F +// that are not in LiveValues. This function is a noop for any Function created +// by this function before, or any function that was not inspected for liveness. // specified by the DeadArguments list. Transform the function and all of the // callees of the function to not have these arguments. // -void DAE::RemoveDeadArgumentsFromFunction(Function *F) { +bool DAE::RemoveDeadStuffFromFunction(Function *F) { + // Quick exit path for external functions + if (!F->hasInternalLinkage() && (!ShouldHackArguments() || F->isIntrinsic())) + return false; + // Start by computing a new prototype for the function, which is the same as - // the old function, but has fewer arguments. + // the old function, but has fewer arguments and a different return type. const FunctionType *FTy = F->getFunctionType(); std::vector Params; @@ -510,28 +575,92 @@ // The existing function return attributes. ParameterAttributes RAttrs = PAL.getParamAttrs(0); - // Make the function return void if the return value is dead. + + // Find out the new return value + const Type *RetTy = FTy->getReturnType(); - if (DeadRetVal.count(F)) { - RetTy = Type::VoidTy; - RAttrs &= ~ParamAttr::typeIncompatible(RetTy); - DeadRetVal.erase(F); + const Type *NRetTy; + unsigned RetCount = NumRetVals(F); + // Explicitely track if anything changed, for debugging + bool Changed = false; + // -1 means unused, other numbers are the new index + SmallVector NewRetIdxs(RetCount, -1); + std::vector RetTypes; + if (RetTy != Type::VoidTy) { + const StructType *STy = dyn_cast(RetTy); + if (STy) + // Look at each of the original return values individually + for (unsigned i = 0; i != RetCount; ++i) { + RetOrArg Ret = CreateRet(F, i); + if (LiveValues.erase(Ret)) { + RetTypes.push_back(STy->getElementType(i)); + NewRetIdxs[i] = RetTypes.size() - 1; + } else { + ++NumRetValsEliminated; + DOUT << "DAE - Removing return value " << i << " from " + << F->getNameStart() << "\n"; + Changed = true; + } + } + else + // We used to return a single value + if (LiveValues.erase(CreateRet(F, 0))) { + RetTypes.push_back(RetTy); + NewRetIdxs[0] = 0; + } else { + DOUT << "DAE - Removing return value from " << F->getNameStart() + << "\n"; + ++NumRetValsEliminated; + Changed = true; + } + if (RetTypes.size() > 1 || STy && STy->getNumElements() == RetTypes.size()) + // More than one return type? Return a struct with them. Also, if we used + // to return a struct and didn't change the number of return values, + // return a struct again. This prevents chaning {something} into something + // and {} into void. + // Make the new struct packed if we used to return a packed struct + // already. + NRetTy = StructType::get(RetTypes, STy->isPacked()); + else if (RetTypes.size() == 1) + // One return type? Just a simple value then, but only if we didn't use to + // return a struct with that simple value before. + NRetTy = RetTypes.front(); + else if (RetTypes.size() == 0) + // No return types? Make it void, but only if we didn't use to return {} + NRetTy = Type::VoidTy; + } else { + NRetTy = Type::VoidTy; } + // Remove any incompatible attributes + RAttrs &= ~ParamAttr::typeIncompatible(NRetTy); if (RAttrs) ParamAttrsVec.push_back(ParamAttrsWithIndex::get(0, RAttrs)); + // Remember which arguments are still alive + SmallVector ArgAlive(FTy->getNumParams(), false); // Construct the new parameter list from non-dead arguments. Also construct - // a new set of parameter attributes to correspond. - unsigned index = 1; - for (Function::arg_iterator I = F->arg_begin(), E = F->arg_end(); I != E; - ++I, ++index) - if (!DeadArguments.count(I)) { + // a new set of parameter attributes to correspond. Skip the first parameter + // attribute, since that belongs to the return value. + unsigned i = 0; + for (Function::arg_iterator I = F->arg_begin(), E = F->arg_end(); + I != E; ++I, ++i) { + RetOrArg Arg = CreateArg(F, i); + if (LiveValues.erase(Arg)) { Params.push_back(I->getType()); - - if (ParameterAttributes Attrs = PAL.getParamAttrs(index)) + ArgAlive[i] = true; + + // Get the original parameter attributes (skipping the first one, that is + // for the return value + if (ParameterAttributes Attrs = PAL.getParamAttrs(i + 1)) ParamAttrsVec.push_back(ParamAttrsWithIndex::get(Params.size(), Attrs)); + } else { + ++NumArgumentsEliminated; + DOUT << "DAE - Removing argument " << i << " (" << I->getNameStart() + << ") from " << F->getNameStart() << "\n"; + Changed = true; } + } // Reconstruct the ParamAttrsList based on the vector we constructed. PAListPtr NewPAL = PAListPtr::get(ParamAttrsVec.begin(), ParamAttrsVec.end()); @@ -539,19 +668,33 @@ // Work around LLVM bug PR56: the CWriter cannot emit varargs functions which // have zero fixed arguments. // + // Not that we apply this hack for a vararg fuction that does not have any + // arguments anymore, but did have them before (so don't bother fixing + // functions that were already broken wrt CWriter). bool ExtraArgHack = false; - if (Params.empty() && FTy->isVarArg()) { + if (Params.empty() && FTy->isVarArg() && FTy->getNumParams() != 0) { ExtraArgHack = true; Params.push_back(Type::Int32Ty); } // Create the new function type based on the recomputed parameters. - FunctionType *NFTy = FunctionType::get(RetTy, Params, FTy->isVarArg()); + FunctionType *NFTy = FunctionType::get(NRetTy, Params, FTy->isVarArg()); + + // No change? + if (NFTy == FTy) + return false; + + // The function type is only allowed to be different if we actually left out + // an argument or return value + assert(Changed && "Function type changed while no arguments or retrurn values" + "were removed!"); // Create the new function body and insert it into the module... Function *NF = Function::Create(NFTy, F->getLinkage()); NF->copyAttributesFrom(F); NF->setParamAttrs(NewPAL); + // Insert the new function before the old function, so we won't be processing + // it again F->getParent()->getFunctionList().insert(F, NF); NF->takeName(F); @@ -562,6 +705,7 @@ while (!F->use_empty()) { CallSite CS = CallSite::get(F->use_back()); Instruction *Call = CS.getInstruction(); + ParamAttrsVec.clear(); const PAListPtr &CallPAL = CS.getParamAttrs(); @@ -572,14 +716,17 @@ if (RAttrs) ParamAttrsVec.push_back(ParamAttrsWithIndex::get(0, RAttrs)); - // Loop over the operands, deleting dead ones... - CallSite::arg_iterator AI = CS.arg_begin(); - index = 1; - for (Function::arg_iterator I = F->arg_begin(), E = F->arg_end(); - I != E; ++I, ++AI, ++index) - if (!DeadArguments.count(I)) { // Remove operands for dead arguments - Args.push_back(*AI); - if (ParameterAttributes Attrs = CallPAL.getParamAttrs(index)) + // Declare these outside of the loops, so we can reuse them for the second + // loop, which loops the varargs + CallSite::arg_iterator I = CS.arg_begin(); + unsigned i = 0; + // Loop over those operands, corresponding to the normal arguments to the + // original function, and add those that are still alive. + for (unsigned e = FTy->getNumParams(); i != e; ++I, ++i) + if (ArgAlive[i]) { + Args.push_back(*I); + // Get original parameter attributes, but skip return attributes + if (ParameterAttributes Attrs = CallPAL.getParamAttrs(i + 1)) ParamAttrsVec.push_back(ParamAttrsWithIndex::get(Args.size(), Attrs)); } @@ -587,9 +734,9 @@ Args.push_back(UndefValue::get(Type::Int32Ty)); // Push any varargs arguments on the list. Don't forget their attributes. - for (; AI != CS.arg_end(); ++AI) { - Args.push_back(*AI); - if (ParameterAttributes Attrs = CallPAL.getParamAttrs(index++)) + for (CallSite::arg_iterator E = CS.arg_end(); I != E; ++I, ++i) { + Args.push_back(*I); + if (ParameterAttributes Attrs = CallPAL.getParamAttrs(i + 1)) ParamAttrsVec.push_back(ParamAttrsWithIndex::get(Args.size(), Attrs)); } @@ -613,11 +760,55 @@ Args.clear(); if (!Call->use_empty()) { - if (New->getType() == Type::VoidTy) - Call->replaceAllUsesWith(Constant::getNullValue(Call->getType())); - else { + if (New->getType() == Call->getType()) { + // Return type not changed? Just replace users then Call->replaceAllUsesWith(New); New->takeName(Call); + } else if (New->getType() == Type::VoidTy) { + // Our return value has uses, but they will get removed later on. + // Replace by null for now. + Call->replaceAllUsesWith(Constant::getNullValue(Call->getType())); + } else { + assert(isa(RetTy) && "Return type changed, but not into a" + "void. The old return type must have" + "been a struct!"); + // The original return value was a struct, update all uses (which are + // all extractvalue instructions). + for (Value::use_iterator I = Call->use_begin(), E = Call->use_end(); + I != E;) { + assert(isa(*I) && "Return value not only used by" + "extractvalue?"); + ExtractValueInst *EV = cast(*I); + // Increment now, since we're about to throw away this use. + ++I; + assert(EV->hasIndices() && "Return value used by extractvalue without" + "indices?"); + unsigned Idx = *EV->idx_begin(); + if (NewRetIdxs[Idx] != -1) { + if (RetTypes.size() > 1) { + // We're still returning a struct, create a new extractvalue + // instruction with the first index updated + std::vector NewIdxs(EV->idx_begin(), EV->idx_end()); + NewIdxs[0] = NewRetIdxs[Idx]; + Value *NEV = ExtractValueInst::Create(New, NewIdxs.begin(), + NewIdxs.end(), "retval", + EV); + EV->replaceAllUsesWith(NEV); + EV->eraseFromParent(); + } else { + // We are now only returning a simple value, remove the + // extractvalue + EV->replaceAllUsesWith(New); + EV->eraseFromParent(); + } + } else { + // Value unused, replace uses by null for now, they will get removed + // later on + EV->replaceAllUsesWith(Constant::getNullValue(EV->getType())); + EV->eraseFromParent(); + } + } + New->takeName(Call); } } @@ -632,13 +823,11 @@ NF->getBasicBlockList().splice(NF->begin(), F->getBasicBlockList()); // Loop over the argument list, transfering uses of the old arguments over to - // the new arguments, also transfering over the names as well. While we're at - // it, remove the dead arguments from the DeadArguments list. - // + // the new arguments, also transfering over the names as well. + i = 0; for (Function::arg_iterator I = F->arg_begin(), E = F->arg_end(), - I2 = NF->arg_begin(); - I != E; ++I) - if (!DeadArguments.count(I)) { + I2 = NF->arg_begin(); I != E; ++I, ++i) + if (ArgAlive[i]) { // If this is a live argument, move the name and users over to the new // version. I->replaceAllUsesWith(I2); @@ -646,10 +835,8 @@ ++I2; } else { // If this argument is dead, replace any uses of it with null constants - // (these are guaranteed to only be operands to call instructions which - // will later be simplified). + // (these are guaranteed to become unused later on) I->replaceAllUsesWith(Constant::getNullValue(I->getType())); - DeadArguments.erase(I); } // If we change the return value of the function we must rewrite any return @@ -657,12 +844,47 @@ if (F->getReturnType() != NF->getReturnType()) for (Function::iterator BB = NF->begin(), E = NF->end(); BB != E; ++BB) if (ReturnInst *RI = dyn_cast(BB->getTerminator())) { - ReturnInst::Create(0, RI); + Value *RetVal; + + if (NFTy->getReturnType() == Type::VoidTy) { + RetVal = 0; + } else { + assert (isa(RetTy)); + // The original return value was a struct, insert + // extractvalue/insertvalue chains to extract only the values we need + // to return and insert them into our new result. + // This does generate messy code, but we'll let it to instcombine to + // clean that up + Value *OldRet = RI->getOperand(0); + // Start out building up our return value from undef + RetVal = llvm::UndefValue::get(NRetTy); + for (unsigned i = 0; i != RetCount; ++i) + if (NewRetIdxs[i] != -1) { + ExtractValueInst *EV = ExtractValueInst::Create(OldRet, i, + "newret", RI); + if (RetTypes.size() > 1) { + // We're still returning a struct, so reinsert the value into + // our new return value at the new index + + RetVal = InsertValueInst::Create(RetVal, EV, NewRetIdxs[i], + "oldret"); + } else { + // We are now only returning a simple value, so just return the + // extracted value + RetVal = EV; + } + } + } + // Replace the return instruction with one returning the new return + // value (possibly 0 if we became void). + ReturnInst::Create(RetVal, RI); BB->getInstList().erase(RI); } // Now that the old function is dead, delete it. F->eraseFromParent(); + + return true; } bool DAE::runOnModule(Module &M) { @@ -677,7 +899,7 @@ if (F.getFunctionType()->isVarArg()) Changed |= DeleteDeadVarargs(F); } - + // Second phase:loop through the module, determining which arguments are live. // We assume all arguments are dead unless proven otherwise (allowing us to // determine that dead arguments passed into recursive functions are dead). @@ -686,85 +908,14 @@ for (Module::iterator I = M.begin(), E = M.end(); I != E; ++I) SurveyFunction(*I); - // Loop over the instructions to inspect, propagating liveness among arguments - // and return values which are MaybeLive. - while (!InstructionsToInspect.empty()) { - Instruction *I = InstructionsToInspect.back(); - InstructionsToInspect.pop_back(); - - if (ReturnInst *RI = dyn_cast(I)) { - // For return instructions, we just have to check to see if the return - // value for the current function is known now to be alive. If so, any - // arguments used by it are now alive, and any call instruction return - // value is alive as well. - if (LiveRetVal.count(RI->getParent()->getParent())) - MarkReturnInstArgumentLive(RI); - - } else { - CallSite CS = CallSite::get(I); - assert(CS.getInstruction() && "Unknown instruction for the I2I list!"); - - Function *Callee = CS.getCalledFunction(); - - // If we found a call or invoke instruction on this list, that means that - // an argument of the function is a call instruction. If the argument is - // live, then the return value of the called instruction is now live. - // - CallSite::arg_iterator AI = CS.arg_begin(); // ActualIterator - for (Function::arg_iterator FI = Callee->arg_begin(), - E = Callee->arg_end(); FI != E; ++AI, ++FI) { - // If this argument is another call... - CallSite ArgCS = CallSite::get(*AI); - if (ArgCS.getInstruction() && LiveArguments.count(FI)) - if (Function *Callee = ArgCS.getCalledFunction()) - MarkRetValLive(Callee); - } - } + // Now, remove all dead arguments and return values from each function in + // turn + for (Module::iterator I = M.begin(), E = M.end(); I != E; ) { + // Increment now, because the function will probably get removed (ie + // replaced by a new one) + Function *F = I++; + Changed |= RemoveDeadStuffFromFunction(F); } - // Now we loop over all of the MaybeLive arguments, promoting them to be live - // arguments if one of the calls that uses the arguments to the calls they are - // passed into requires them to be live. Of course this could make other - // arguments live, so process callers recursively. - // - // Because elements can be removed from the MaybeLiveArguments set, copy it to - // a temporary vector. - // - std::vector TmpArgList(MaybeLiveArguments.begin(), - MaybeLiveArguments.end()); - for (unsigned i = 0, e = TmpArgList.size(); i != e; ++i) { - Argument *MLA = TmpArgList[i]; - if (MaybeLiveArguments.count(MLA) && - isMaybeLiveArgumentNowLive(MLA)) - MarkArgumentLive(MLA); - } - - // Recover memory early... - CallSites.clear(); - - // At this point, we know that all arguments in DeadArguments and - // MaybeLiveArguments are dead. If the two sets are empty, there is nothing - // to do. - if (MaybeLiveArguments.empty() && DeadArguments.empty() && - MaybeLiveRetVal.empty() && DeadRetVal.empty()) - return Changed; - - // Otherwise, compact into one set, and start eliminating the arguments from - // the functions. - DeadArguments.insert(MaybeLiveArguments.begin(), MaybeLiveArguments.end()); - MaybeLiveArguments.clear(); - DeadRetVal.insert(MaybeLiveRetVal.begin(), MaybeLiveRetVal.end()); - MaybeLiveRetVal.clear(); - - LiveArguments.clear(); - LiveRetVal.clear(); - - NumArgumentsEliminated += DeadArguments.size(); - NumRetValsEliminated += DeadRetVal.size(); - while (!DeadArguments.empty()) - RemoveDeadArgumentsFromFunction((*DeadArguments.begin())->getParent()); - - while (!DeadRetVal.empty()) - RemoveDeadArgumentsFromFunction(*DeadRetVal.begin()); - return true; + return Changed; } Added: llvm/trunk/test/Transforms/DeadArgElim/2008-06-23-DeadAfterLive.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/DeadArgElim/2008-06-23-DeadAfterLive.ll?rev=52677&view=auto ============================================================================== --- llvm/trunk/test/Transforms/DeadArgElim/2008-06-23-DeadAfterLive.ll (added) +++ llvm/trunk/test/Transforms/DeadArgElim/2008-06-23-DeadAfterLive.ll Tue Jun 24 11:30:26 2008 @@ -0,0 +1,23 @@ +; RUN: llvm-as < %s | opt -deadargelim -die | llvm-dis > %t +; RUN: cat %t | grep 123 + +; This test tries to catch wrongful removal of return values for a specific case +; that was break llvm-gcc builds. + +; This function has a live return value, it is used by @alive. +define internal i32 @test5() { + ret i32 123 +} + +; This function doesn't use the return value @test5 and tries to lure DAE into +; marking @test5's return value dead because only this call is unused. +define i32 @dead() { + %DEAD = call i32 @test5() + ret i32 0 +} + +; This function ensures the retval of @test5 is live. +define i32 @alive() { + %LIVE = call i32 @test5() + ret i32 %LIVE +} Modified: llvm/trunk/test/Transforms/DeadArgElim/deadretval2.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/DeadArgElim/deadretval2.ll?rev=52677&r1=52676&r2=52677&view=diff ============================================================================== --- llvm/trunk/test/Transforms/DeadArgElim/deadretval2.ll (original) +++ llvm/trunk/test/Transforms/DeadArgElim/deadretval2.ll Tue Jun 24 11:30:26 2008 @@ -1,4 +1,6 @@ -; RUN: llvm-as < %s | opt -deadargelim -die | llvm-dis | not grep DEAD +; RUN: llvm-as < %s | opt -deadargelim -die | llvm-dis > %t +; RUN: cat %t | not grep DEAD +; RUN: cat %t | grep LIVE | count 4 @P = external global i32 ; [#uses=1] @@ -31,3 +33,27 @@ %DEAD2 = call i32 @id( i32 %DEAD ) ; [#uses=0] ret void } + +; These test if returning another functions return value properly marks that +; other function's return value as live. We do this twice, with the functions in +; different orders (ie, first the caller, than the callee and first the callee +; and then the caller) since DAE processes functions one by one and handles +; these cases slightly different. + +define internal i32 @test5() { + ret i32 123 +} + +define i32 @test6() { + %LIVE = call i32 @test5() + ret i32 %LIVE +} + +define i32 @test7() { + %LIVE = call i32 @test8() + ret i32 %LIVE +} + +define internal i32 @test8() { + ret i32 124 +} Copied: llvm/trunk/test/Transforms/DeadArgElim/multdeadretval.ll (from r52595, llvm/trunk/test/Transforms/DeadArgElim/multdeadretval.ll) URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/DeadArgElim/multdeadretval.ll?p2=llvm/trunk/test/Transforms/DeadArgElim/multdeadretval.ll&p1=llvm/trunk/test/Transforms/DeadArgElim/multdeadretval.ll&r1=52595&r2=52677&rev=52677&view=diff ============================================================================== --- llvm/trunk/test/Transforms/DeadArgElim/multdeadretval.ll (original) +++ llvm/trunk/test/Transforms/DeadArgElim/multdeadretval.ll Tue Jun 24 11:30:26 2008 @@ -0,0 +1,39 @@ +; This test sees if return values (and arguments) are properly removed when they +; are unused. All unused values are typed i16, so we can easily check. We also +; run instcombine to fold insert/extractvalue chains and we run dce to clean up +; any remaining dead stuff. +; RUN: llvm-as < %s | opt -deadargelim -instcombine -dce | llvm-dis | not grep i16 + +define internal {i16, i32} @test(i16 %DEADARG) { + %A = insertvalue {i16,i32} undef, i16 1, 0 + %B = insertvalue {i16,i32} %A, i32 1001, 1 + ret {i16,i32} %B +} + +define internal {i32, i16} @test2() { + %DEAD = call i16 @test4() + %A = insertvalue {i32,i16} undef, i32 1, 0 + %B = insertvalue {i32,i16} %A, i16 %DEAD, 1 + ret {i32,i16} %B +} + +define internal i32 @test3(i16 %A) { + %ret = call {i16, i32} @test( i16 %A ) ; [#uses=0] + %DEAD = extractvalue {i16, i32} %ret, 0 + %LIVE = extractvalue {i16, i32} %ret, 1 + ret i32 %LIVE +} + +define internal i16 @test4() { + ret i16 0 +} + +define i32 @main() { + %ret = call {i32, i16} @test2() ; [#uses=1] + %LIVE = extractvalue {i32, i16} %ret, 0 + %DEAD = extractvalue {i32, i16} %ret, 1 + %Y = add i32 %LIVE, -123 ; [#uses=1] + %LIVE2 = call i32 @test3(i16 %DEAD) ; [#uses=1] + %Z = add i32 %LIVE2, %Y ; [#uses=1] + ret i32 %Z +} From gohman at apple.com Tue Jun 24 11:40:22 2008 From: gohman at apple.com (Dan Gohman) Date: Tue, 24 Jun 2008 16:40:22 -0000 Subject: [llvm-commits] [llvm] r52678 - /llvm/trunk/include/llvm/ADT/StringMap.h Message-ID: <200806241640.m5OGeMlR009379@zion.cs.uiuc.edu> Author: djg Date: Tue Jun 24 11:40:22 2008 New Revision: 52678 URL: http://llvm.org/viewvc/llvm-project?rev=52678&view=rev Log: Pass std::string by reference. Thanks Chris! Modified: llvm/trunk/include/llvm/ADT/StringMap.h Modified: llvm/trunk/include/llvm/ADT/StringMap.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/StringMap.h?rev=52678&r1=52677&r2=52678&view=diff ============================================================================== --- llvm/trunk/include/llvm/ADT/StringMap.h (original) +++ llvm/trunk/include/llvm/ADT/StringMap.h Tue Jun 24 11:40:22 2008 @@ -384,7 +384,7 @@ return true; } - bool erase(std::string Key) { + bool erase(const std::string &Key) { iterator I = find(Key); if (I == end()) return false; erase(I); From clattner at apple.com Tue Jun 24 11:54:36 2008 From: clattner at apple.com (Chris Lattner) Date: Tue, 24 Jun 2008 09:54:36 -0700 Subject: [llvm-commits] [llvm] r52670 - in /llvm/trunk: lib/Target/X86/X86InstrInfo.cpp test/CodeGen/X86/remat-mov0.ll In-Reply-To: <200806240710.m5O7ApK2012365@zion.cs.uiuc.edu> References: <200806240710.m5O7ApK2012365@zion.cs.uiuc.edu> Message-ID: On Jun 24, 2008, at 12:10 AM, Evan Cheng wrote: > URL: http://llvm.org/viewvc/llvm-project?rev=52670&view=rev > Log: > If it's determined safe, remat MOV32r0 (i.e. xor r, r) and others as > it is instead of using the longer MOV32ri instruction. Very cool! -Chris From clattner at apple.com Tue Jun 24 12:40:23 2008 From: clattner at apple.com (Chris Lattner) Date: Tue, 24 Jun 2008 10:40:23 -0700 Subject: [llvm-commits] [llvm] r52217 - in /llvm/trunk: lib/Transforms/Scalar/InstructionCombining.cpp test/Transforms/InstCombine/extractvalue.ll In-Reply-To: <20080624083305.GX3816@katherina.student.utwente.nl> References: <200806111405.m5BE55rj002564@zion.cs.uiuc.edu> <20080624083305.GX3816@katherina.student.utwente.nl> Message-ID: <889C13AE-3A76-4343-8282-A65A7DFD31AB@apple.com> On Jun 24, 2008, at 1:33 AM, Matthijs Kooijman wrote: >> visitExtractValueInst(I) { >> op = I.getOperand(0); >> if (isa(op)) >> use new zero; >> else if (insertvalueinst) { >> if (index is the thing inserted) >> use inserted value >> else >> use new extract value inst of aggregate input >> ... >> } > > The inserted extractvalues can be folded in the next iteration, > resulting in > the wanted: > > D = insertvalue undef, X, 0 ; {X, _} > C = insertvalue A, Y, 1 ; {X, Y} > > So, it seems that this approach is indeed simpler and would work in > all cases > I can think of just now. Any other thoughts? I think it will work. To me, the most interesting cases is when things get scalarized. I really wouldn't mind seeing things like: X = call {a,b,c} @foo() %a = extract X, 0 %b = extract X, 1 %c = extract X, 2 %A = insert undef, %a, 0 %B = insert %A, %b, 1 %C = insert %B, %c, 2 call void @bar(%C) As Dan likes to say, first class aggregate should really be treated as a convenience to front-end authors. I think the optimizer should rip them apart readily as soon as possible as much as possible. Having instcombine do this is a great thing for local aggregate accesses, and having IP passes do this for argument/results when the ABI can be changed is also great. Seem reasonable? -Chris From clattner at apple.com Tue Jun 24 12:41:46 2008 From: clattner at apple.com (Chris Lattner) Date: Tue, 24 Jun 2008 10:41:46 -0700 Subject: [llvm-commits] [llvm] r52315 - in /llvm/trunk: include/llvm/Analysis/ValueTracking.h lib/Analysis/ValueTracking.cpp lib/Transforms/Scalar/InstructionCombining.cpp In-Reply-To: <20080624075754.GV3816@katherina.student.utwente.nl> References: <200806161248.m5GCmM01015536@zion.cs.uiuc.edu> <3A364BBB-5B94-468F-8D53-39395F910FD4@apple.com> <20080624075754.GV3816@katherina.student.utwente.nl> Message-ID: <73BCCA81-7781-40CF-BDFB-85F35FA7D772@apple.com> On Jun 24, 2008, at 12:57 AM, Matthijs Kooijman wrote: > Hi Chris, > >> Can't passes just insert a new ExtractValueInst and expect >> instcombine >> to simplify stuff away? > Currently, this method is only used by SCCP, IPConstProp and > InstCombine > itself. The first two use it to propagate constants or known values > out of > functions (ie, propage known return values). This means they really > have to > try to find the actual value instead of just inserting extractvalue. > > We could probably reduce this to only look at the first level of > inserts or > something, but that would require always running instcombine before > these > passes (which ends up being slower, I would expect) and causes some > simplifications to be left out. These interprocedural passes can only be run roughly when the ABI is changable for a function. Shouldn't they just "flatten" the return value and scalarize arguments when this is the case? If that is so, the "walking" of insertvalue etc should be minimal. -Chris From sabre at nondot.org Tue Jun 24 12:44:43 2008 From: sabre at nondot.org (Chris Lattner) Date: Tue, 24 Jun 2008 17:44:43 -0000 Subject: [llvm-commits] [llvm] r52682 - in /llvm/trunk: Makefile.rules include/llvm/System/Solaris.h utils/GenLibDeps.pl Message-ID: <200806241744.m5OHihku011503@zion.cs.uiuc.edu> Author: lattner Date: Tue Jun 24 12:44:42 2008 New Revision: 52682 URL: http://llvm.org/viewvc/llvm-project?rev=52682&view=rev Log: Add support for building on solaris, working around namespace polution problems from system headers. Patch by Nathan Keynes! Added: llvm/trunk/include/llvm/System/Solaris.h Modified: llvm/trunk/Makefile.rules llvm/trunk/utils/GenLibDeps.pl Modified: llvm/trunk/Makefile.rules URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/Makefile.rules?rev=52682&r1=52681&r2=52682&view=diff ============================================================================== --- llvm/trunk/Makefile.rules (original) +++ llvm/trunk/Makefile.rules Tue Jun 24 12:44:42 2008 @@ -451,6 +451,10 @@ DISABLE_AUTO_DEPENDENCIES=1 endif +ifeq ($(OS),SunOS) +CPP.BaseFlags += -include llvm/System/Solaris.h +endif + LD.Flags += -L$(LibDir) -L$(LLVMLibDir) CPP.BaseFlags += -D_GNU_SOURCE -D__STDC_LIMIT_MACROS # All -I flags should go here, so that they don't confuse llvm-config. Added: llvm/trunk/include/llvm/System/Solaris.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/System/Solaris.h?rev=52682&view=auto ============================================================================== --- llvm/trunk/include/llvm/System/Solaris.h (added) +++ llvm/trunk/include/llvm/System/Solaris.h Tue Jun 24 12:44:42 2008 @@ -0,0 +1,40 @@ +/*===- llvm/System/Solaris.h ------------------------------------*- C++ -*-===* + * + * The LLVM Compiler Infrastructure + * + * This file is distributed under the University of Illinois Open Source + * License. See LICENSE.TXT for details. + * + *===----------------------------------------------------------------------===* + * + * This file contains portability fixes for Solaris hosts. + * + *===----------------------------------------------------------------------===*/ + +#ifndef LLVM_SYSTEM_SOLARIS_H +#define LLVM_SYSTEM_SOLARIS_H + +#include +#include + +#undef CS +#undef DS +#undef ES +#undef FS +#undef GS +#undef SS +#undef EAX +#undef ECX +#undef EDX +#undef EBX +#undef ESP +#undef EBP +#undef ESI +#undef EDI +#undef EIP +#undef UESP +#undef EFL +#undef ERR +#undef TRAPNO + +#endif Modified: llvm/trunk/utils/GenLibDeps.pl URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/GenLibDeps.pl?rev=52682&r1=52681&r2=52682&view=diff ============================================================================== --- llvm/trunk/utils/GenLibDeps.pl (original) +++ llvm/trunk/utils/GenLibDeps.pl Tue Jun 24 12:44:42 2008 @@ -96,7 +96,7 @@ print "

    $lib
      \n"; } open UNDEFS, - "$nmPath -g -u $Directory/$lib | sed -e 's/^ *U //' | sort | uniq |"; + "$nmPath -g -u $Directory/$lib | sed -e 's/^[ 0]* U //' | sort | uniq |"; my %DepLibs; while () { chomp; From gohman at apple.com Tue Jun 24 12:46:48 2008 From: gohman at apple.com (Dan Gohman) Date: Tue, 24 Jun 2008 17:46:48 -0000 Subject: [llvm-commits] [llvm] r52683 - /llvm/trunk/include/llvm/PassSupport.h Message-ID: <200806241746.m5OHkmuq011907@zion.cs.uiuc.edu> Author: djg Date: Tue Jun 24 12:46:48 2008 New Revision: 52683 URL: http://llvm.org/viewvc/llvm-project?rev=52683&view=rev Log: Correct a comment. Modified: llvm/trunk/include/llvm/PassSupport.h Modified: llvm/trunk/include/llvm/PassSupport.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/PassSupport.h?rev=52683&r1=52682&r2=52683&view=diff ============================================================================== --- llvm/trunk/include/llvm/PassSupport.h (original) +++ llvm/trunk/include/llvm/PassSupport.h Tue Jun 24 12:46:48 2008 @@ -185,7 +185,7 @@ /// /// If no analysis implementing the interface is available, a default /// implementation is created and added. A pass registers itself as the default -/// implementation by specifying 'true' as the third template argument of this +/// implementation by specifying 'true' as the second template argument of this /// class. /// /// In addition to registering itself as an analysis group member, a pass must From gohman at apple.com Tue Jun 24 12:47:37 2008 From: gohman at apple.com (Dan Gohman) Date: Tue, 24 Jun 2008 17:47:37 -0000 Subject: [llvm-commits] [llvm] r52684 - /llvm/trunk/lib/VMCore/Verifier.cpp Message-ID: <200806241747.m5OHlbxl012175@zion.cs.uiuc.edu> Author: djg Date: Tue Jun 24 12:47:37 2008 New Revision: 52684 URL: http://llvm.org/viewvc/llvm-project?rev=52684&view=rev Log: Use const_cast instead of a C-style cast. Modified: llvm/trunk/lib/VMCore/Verifier.cpp Modified: llvm/trunk/lib/VMCore/Verifier.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Verifier.cpp?rev=52684&r1=52683&r2=52684&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/Verifier.cpp (original) +++ llvm/trunk/lib/VMCore/Verifier.cpp Tue Jun 24 12:47:37 2008 @@ -1504,7 +1504,7 @@ PassManager PM; Verifier *V = new Verifier(action); PM.add(V); - PM.run((Module&)M); + PM.run(const_cast(M)); if (ErrorInfo && V->Broken) *ErrorInfo = V->msgs.str(); From tonic at nondot.org Tue Jun 24 12:49:13 2008 From: tonic at nondot.org (Tanya Lattner) Date: Tue, 24 Jun 2008 17:49:13 -0000 Subject: [llvm-commits] [llvm] r52685 - /llvm/trunk/configure Message-ID: <200806241749.m5OHnERc012240@zion.cs.uiuc.edu> Author: tbrethou Date: Tue Jun 24 12:49:13 2008 New Revision: 52685 URL: http://llvm.org/viewvc/llvm-project?rev=52685&view=rev Log: Regenerate configure. Modified: llvm/trunk/configure Modified: llvm/trunk/configure URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/configure?rev=52685&r1=52684&r2=52685&view=diff ============================================================================== --- llvm/trunk/configure (original) +++ llvm/trunk/configure Tue Jun 24 12:49:13 2008 @@ -2090,6 +2090,8 @@ ;; llvm-stacker) subdirs="$subdirs projects/llvm-stacker" ;; + # llvm-test is the old name of the test-suite, kept here for backwards + # compatibility llvm-test) subdirs="$subdirs projects/llvm-test" ;; test-suite) subdirs="$subdirs projects/test-suite" @@ -10639,7 +10641,7 @@ lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext < conftest.$ac_ext + echo '#line 12788 "configure"' > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? @@ -14501,11 +14503,11 @@ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:14501: $lt_compile\"" >&5) + (eval echo "\"\$as_me:14506: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:14505: \$? = $ac_status" >&5 + echo "$as_me:14510: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -14769,11 +14771,11 @@ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:14769: $lt_compile\"" >&5) + (eval echo "\"\$as_me:14774: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:14773: \$? = $ac_status" >&5 + echo "$as_me:14778: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -14873,11 +14875,11 @@ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:14873: $lt_compile\"" >&5) + (eval echo "\"\$as_me:14878: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:14877: \$? = $ac_status" >&5 + echo "$as_me:14882: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -17325,7 +17327,7 @@ lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext < conftest.$ac_ext <&5) + (eval echo "\"\$as_me:19798: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:19797: \$? = $ac_status" >&5 + echo "$as_me:19802: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -19897,11 +19899,11 @@ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:19897: $lt_compile\"" >&5) + (eval echo "\"\$as_me:19902: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:19901: \$? = $ac_status" >&5 + echo "$as_me:19906: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -21467,11 +21469,11 @@ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:21467: $lt_compile\"" >&5) + (eval echo "\"\$as_me:21472: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:21471: \$? = $ac_status" >&5 + echo "$as_me:21476: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -21571,11 +21573,11 @@ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:21571: $lt_compile\"" >&5) + (eval echo "\"\$as_me:21576: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:21575: \$? = $ac_status" >&5 + echo "$as_me:21580: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -23806,11 +23808,11 @@ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:23806: $lt_compile\"" >&5) + (eval echo "\"\$as_me:23811: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:23810: \$? = $ac_status" >&5 + echo "$as_me:23815: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -24074,11 +24076,11 @@ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:24074: $lt_compile\"" >&5) + (eval echo "\"\$as_me:24079: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:24078: \$? = $ac_status" >&5 + echo "$as_me:24083: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -24178,11 +24180,11 @@ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:24178: $lt_compile\"" >&5) + (eval echo "\"\$as_me:24183: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:24182: \$? = $ac_status" >&5 + echo "$as_me:24187: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized From gohman at apple.com Tue Jun 24 12:49:26 2008 From: gohman at apple.com (Dan Gohman) Date: Tue, 24 Jun 2008 17:49:26 -0000 Subject: [llvm-commits] [llvm] r52686 - /llvm/trunk/include/llvm/Support/Allocator.h Message-ID: <200806241749.m5OHnQQC014244@zion.cs.uiuc.edu> Author: djg Date: Tue Jun 24 12:49:26 2008 New Revision: 52686 URL: http://llvm.org/viewvc/llvm-project?rev=52686&view=rev Log: Make Allocate() return a T* instead of a void*. And use static_cast instead of reinterpret_cast. Modified: llvm/trunk/include/llvm/Support/Allocator.h Modified: llvm/trunk/include/llvm/Support/Allocator.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/Allocator.h?rev=52686&r1=52685&r2=52686&view=diff ============================================================================== --- llvm/trunk/include/llvm/Support/Allocator.h (original) +++ llvm/trunk/include/llvm/Support/Allocator.h Tue Jun 24 12:49:26 2008 @@ -25,12 +25,14 @@ ~MallocAllocator() {} void Reset() {} + void *Allocate(size_t Size, size_t Alignment) { return malloc(Size); } template - void *Allocate() { return reinterpret_cast(malloc(sizeof(T))); } + T *Allocate() { return static_cast(malloc(sizeof(T))); } void Deallocate(void *Ptr) { free(Ptr); } + void PrintStats() const {} }; @@ -45,15 +47,16 @@ ~BumpPtrAllocator(); void Reset(); + void *Allocate(size_t Size, size_t Alignment); template - void *Allocate() { - return reinterpret_cast(Allocate(sizeof(T),AlignOf::Alignment)); + T *Allocate() { + return static_cast(Allocate(sizeof(T),AlignOf::Alignment)); } - void Deallocate(void *Ptr) {} + void PrintStats() const; }; From clattner at apple.com Tue Jun 24 12:55:50 2008 From: clattner at apple.com (Chris Lattner) Date: Tue, 24 Jun 2008 10:55:50 -0700 Subject: [llvm-commits] [llvm] r52537 - /llvm/trunk/lib/Transforms/IPO/DeadArgumentElimination.cpp In-Reply-To: <200806201516.m5KFGkRv024435@zion.cs.uiuc.edu> References: <200806201516.m5KFGkRv024435@zion.cs.uiuc.edu> Message-ID: On Jun 20, 2008, at 8:16 AM, Matthijs Kooijman wrote: > Author: matthijs > Date: Fri Jun 20 10:16:45 2008 > New Revision: 52537 > > URL: http://llvm.org/viewvc/llvm-project?rev=52537&view=rev > Log: > Don't let DeadArgElimination change the return type ({} into void > and {T} > into T) when no return values are actually dead. Out of curiosity, why not? {x} -> x would eliminate extractvalue instructions, so it seems that it would reduce the size of the IR. > +++ llvm/trunk/lib/Transforms/IPO/DeadArgumentElimination.cpp Fri > Jun 20 10:16:45 2008 > @@ -598,15 +598,21 @@ > ++NumRetValsEliminated; > Changed = true; > } > - if (RetTypes.size() == 0) > - // No return types? Make it void > - NRetTy = Type::VoidTy; > + if (RetTypes.size() > 1 || (STy && STy->getNumElements() == > RetTypes.size())) > + // More than one return type? Return a struct with them. > Also, if we used > + // to return a struct and didn't change the number of return > values, > + // return a struct again. This prevents chaning {something} > into something typo: chaning -> changing -Chris From gohman at apple.com Tue Jun 24 13:00:21 2008 From: gohman at apple.com (Dan Gohman) Date: Tue, 24 Jun 2008 18:00:21 -0000 Subject: [llvm-commits] [llvm] r52687 - /llvm/trunk/lib/Transforms/Scalar/LoopIndexSplit.cpp Message-ID: <200806241800.m5OI0LeK025525@zion.cs.uiuc.edu> Author: djg Date: Tue Jun 24 13:00:21 2008 New Revision: 52687 URL: http://llvm.org/viewvc/llvm-project?rev=52687&view=rev Log: Fix a typo in a comment. Modified: llvm/trunk/lib/Transforms/Scalar/LoopIndexSplit.cpp Modified: llvm/trunk/lib/Transforms/Scalar/LoopIndexSplit.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/LoopIndexSplit.cpp?rev=52687&r1=52686&r2=52687&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/LoopIndexSplit.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/LoopIndexSplit.cpp Tue Jun 24 13:00:21 2008 @@ -1399,7 +1399,7 @@ BasicBlock *SplitCondBlock = SD.SplitCondition->getParent(); - // Unable to handle triange loops at the moment. + // Unable to handle triangle loops at the moment. // In triangle loop, split condition is in header and one of the // the split destination is loop latch. If split condition is EQ // then such loops are already handle in processOneIterationLoop(). From matthijs at stdin.nl Tue Jun 24 13:02:47 2008 From: matthijs at stdin.nl (Matthijs Kooijman) Date: Tue, 24 Jun 2008 20:02:47 +0200 Subject: [llvm-commits] [llvm] r52537 - /llvm/trunk/lib/Transforms/IPO/DeadArgumentElimination.cpp In-Reply-To: References: <200806201516.m5KFGkRv024435@zion.cs.uiuc.edu> Message-ID: <20080624180247.GG438@katherina.student.utwente.nl> > Out of curiosity, why not? {x} -> x would eliminate extractvalue > instructions, so it seems that it would reduce the size of the IR. Because that would also perform this transformation on external functions and other functions that are intrinsically alive (Since we don't store that they are intrinsically alive, only that all of their return values and arguments are). On second thought, however, it might be better to store intrinsically alive functions as such, which should also reduce the size of the Uses map and reduce lookup times. > typo: chaning -> changing I think Dan pointed this out somewhere as well, I didn't get around to fixing those yet :-) Gr. Matthijs -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: Digital signature Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20080624/96cbd165/attachment.bin From clattner at apple.com Tue Jun 24 13:03:58 2008 From: clattner at apple.com (Chris Lattner) Date: Tue, 24 Jun 2008 11:03:58 -0700 Subject: [llvm-commits] atomics memoperands patch In-Reply-To: References: <5EAD215D-D32D-4C78-8020-E17D5179A72A@apple.com> Message-ID: <8B909C58-8DF5-44FF-98AC-18980D4E2E93@apple.com> On Jun 20, 2008, at 12:28 AM, Evan Cheng wrote: > > Do we need the if () else if? AddNodeIDNode has already added those > fields to the FoldingSetNodeId. > > Also, do we want to cse nodes that are volatile? FYI, CSE'ing nodes that are volatile is *required*. If they are different loads and volatile they should have different chain inputs. If all inputs are the same (including the chain) they should definitely be CSE'd. -Chris From clattner at apple.com Tue Jun 24 13:06:36 2008 From: clattner at apple.com (Chris Lattner) Date: Tue, 24 Jun 2008 11:06:36 -0700 Subject: [llvm-commits] [llvm] r52537 - /llvm/trunk/lib/Transforms/IPO/DeadArgumentElimination.cpp In-Reply-To: <20080624180247.GG438@katherina.student.utwente.nl> References: <200806201516.m5KFGkRv024435@zion.cs.uiuc.edu> <20080624180247.GG438@katherina.student.utwente.nl> Message-ID: <15D57419-D31D-4E0E-8CD5-D7CBFF494764@apple.com> On Jun 24, 2008, at 11:02 AM, Matthijs Kooijman wrote: >> Out of curiosity, why not? {x} -> x would eliminate extractvalue >> instructions, so it seems that it would reduce the size of the IR. > Because that would also perform this transformation on external > functions and > other functions that are intrinsically alive (Since we don't store > that they > are intrinsically alive, only that all of their return values and > arguments > are). Ah, that would be bad. > On second thought, however, it might be better to store intrinsically > alive functions as such, which should also reduce the size of the > Uses map and > reduce lookup times. Makes sense! >> typo: chaning -> changing > I think Dan pointed this out somewhere as well, I didn't get around > to fixing > those yet :-) ok :) -Chris From clattner at apple.com Tue Jun 24 13:15:29 2008 From: clattner at apple.com (Chris Lattner) Date: Tue, 24 Jun 2008 11:15:29 -0700 Subject: [llvm-commits] [llvm] r52073 - in /llvm/trunk: lib/Transforms/Utils/SimplifyCFG.cpp test/Transforms/SimplifyCFG/SpeculativeExec.ll In-Reply-To: <200806070852.m578qTpD008596@zion.cs.uiuc.edu> References: <200806070852.m578qTpD008596@zion.cs.uiuc.edu> Message-ID: On Jun 7, 2008, at 1:52 AM, Evan Cheng wrote: > Author: evancheng > Date: Sat Jun 7 03:52:29 2008 > New Revision: 52073 > > URL: http://llvm.org/viewvc/llvm-project?rev=52073&view=rev > Log: > Speculatively execute a block when the the block is the then part of > a triangle shape and it contains a single, side effect free, cheap > instruction. The branch is eliminated by adding a select > instruction. i.e. Ok > @@ -955,6 +955,109 @@ > +static bool SpeculativelyExecuteBB(BranchInst *BI, BasicBlock *BB1) { > + // Only speculatively execution a single instruction (not > counting the > + // terminator) for now. > + if (BB1->size() != 2) > + return false; This is O(n) for a check that should be O(1). Can you do something (admittedly gross) like this: BasicBlock::iterator I = BB1->begin(); ++I; // must have at least a terminator if (I == BB1->end()) return false; // only one inst ++I; if (I != BB1->end()) return false; // more than 2 insts. > + Instruction *I = BB1->begin(); > + switch (I->getOpcode()) { > + default: return false; // Not safe / profitable to hoist. > + case Instruction::Add: > + case Instruction::Sub: > + case Instruction::And: > + case Instruction::Or: > + case Instruction::Xor: > + case Instruction::Shl: > + case Instruction::LShr: > + case Instruction::AShr: > + if (I->getOperand(0)->getType()->isFPOrFPVector()) > + return false; // FP arithmetic might trap. > + break; // These are all cheap and non-trapping instructions. > + } Is this worthwhile to do for vector operations? -Chris From matthijs at stdin.nl Tue Jun 24 13:22:40 2008 From: matthijs at stdin.nl (Matthijs Kooijman) Date: Tue, 24 Jun 2008 20:22:40 +0200 Subject: [llvm-commits] [llvm] r52217 - in /llvm/trunk: lib/Transforms/Scalar/InstructionCombining.cpp test/Transforms/InstCombine/extractvalue.ll In-Reply-To: <889C13AE-3A76-4343-8282-A65A7DFD31AB@apple.com> References: <200806111405.m5BE55rj002564@zion.cs.uiuc.edu> <20080624083305.GX3816@katherina.student.utwente.nl> <889C13AE-3A76-4343-8282-A65A7DFD31AB@apple.com> Message-ID: <20080624182240.GH438@katherina.student.utwente.nl> Hi Chris, > X = call {a,b,c} @foo() > > %a = extract X, 0 > %b = extract X, 1 > %c = extract X, 2 > > > %A = insert undef, %a, 0 > %B = insert %A, %b, 1 > %C = insert %B, %c, 2 > call void @bar(%C) I have no intention to make instcombine change the above into a call @bar(X) so that should work out. However, if the front end already emits that, I don't think we will turn it into the above. I have been playing with a though, however, of making a multiple return canonicalize (or rather, a first class aggregate canonicalize) that puts all extractvalue instructions directly after their aggregate argument and insertvalue instructions directly before their use. Also, it could prevent aggregate return values from being used directly (ie, only through extractvalue) and force aggregate arguments to be built just before a call using insertvalues. Not sure what the gain from this would be yet, though, but it might make other passes slightly simpler. Also, I was planning on committing my flatten return value patch sometime soon, which also makes things slightly less complicated :-) > As Dan likes to say, first class aggregate should really be treated as > a convenience to front-end authors. I think the optimizer should rip > them apart readily as soon as possible as much as possible. Having > instcombine do this is a great thing for local aggregate accesses, and > having IP passes do this for argument/results when the ABI can be > changed is also great. Yeah, I think we can thrash most uses of insert/extract quite readily, except when dealing with multiple return values. In that specific case, it might be useful for backends to get a canonicalized version. > Seem reasonable? I'll whip up something and we'll see what happens :-) Gr. Matthijs -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: Digital signature Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20080624/617d456d/attachment.bin From gohman at apple.com Tue Jun 24 14:05:38 2008 From: gohman at apple.com (Dan Gohman) Date: Tue, 24 Jun 2008 12:05:38 -0700 Subject: [llvm-commits] [llvm] r52073 - in /llvm/trunk: lib/Transforms/Utils/SimplifyCFG.cpp test/Transforms/SimplifyCFG/SpeculativeExec.ll In-Reply-To: References: <200806070852.m578qTpD008596@zion.cs.uiuc.edu> Message-ID: On Jun 24, 2008, at 11:15 AM, Chris Lattner wrote: > On Jun 7, 2008, at 1:52 AM, Evan Cheng wrote: >> >> @@ -955,6 +955,109 @@ >> +static bool SpeculativelyExecuteBB(BranchInst *BI, BasicBlock >> *BB1) { >> + // Only speculatively execution a single instruction (not >> counting the >> + // terminator) for now. >> + if (BB1->size() != 2) >> + return false; > > This is O(n) for a check that should be O(1). Can you do something > (admittedly gross) like this: > > BasicBlock::iterator I = BB1->begin(); > ++I; // must have at least a terminator > if (I == BB1->end()) return false; // only one inst > ++I; > if (I != BB1->end()) return false; // more than 2 insts. Less gross would a helper function for this. It might not be unlike Value::hasNUsesOrMore. Dan From dag at cray.com Tue Jun 24 14:55:51 2008 From: dag at cray.com (David Greene) Date: Tue, 24 Jun 2008 14:55:51 -0500 Subject: [llvm-commits] [llvm] r51934 - in /llvm/trunk: include/llvm/CodeGen/LiveInterval.h include/llvm/CodeGen/LiveStackAnalysis.h include/llvm/CodeGen/MachineFrameInfo.h include/llvm/CodeGen/Passes.h lib/CodeGen/LLVMTargetMachine.cpp lib/CodeGen/LiveInterval.cpp lib/CodeGen/LiveIntervalAnalysis.cpp lib/CodeGen/LiveStackAnalysis.cpp lib/CodeGen/RegAllocLinearScan.cpp lib/CodeGen/StackSlotColoring.cpp In-Reply-To: <8A05AF50-C3DE-4C98-A3F1-07EA45276F68@apple.com> References: <200806040918.m549Ig4X026263@zion.cs.uiuc.edu> <0CF4F6C2-A13F-4B82-B1CD-609B818F7A06@apple.com> <8A05AF50-C3DE-4C98-A3F1-07EA45276F68@apple.com> Message-ID: <200806241455.51879.dag@cray.com> On Tuesday 24 June 2008 00:13, Chris Lattner wrote: > > This option is used to debug coloring. Once the limit is reached, > > the rest of the slots are not colored. Cool. > Ok, so it's similar to cutting off instcombine at some point. It > would be nice to teach the passmgr how to do this somehow so bugpoint > could drive it. In the meantime, could you add a comment explaining > more of what it is for? ... or deleteing it is fine also. :) Yes wrt bugpoint. I've added a number of such hooks in our local copy here (coalescing, spill folding, etc.). Having a generic PassManager interface to drive these things and allow bugpoint access to them would be _very_ nice. -Dave From gohman at apple.com Tue Jun 24 15:44:42 2008 From: gohman at apple.com (Dan Gohman) Date: Tue, 24 Jun 2008 20:44:42 -0000 Subject: [llvm-commits] [llvm] r52688 - in /llvm/trunk: lib/Transforms/Utils/UnrollLoop.cpp test/Transforms/LoopUnroll/multiple-phis.ll test/Transforms/LoopUnroll/pr2253.ll Message-ID: <200806242044.m5OKihhI031581@zion.cs.uiuc.edu> Author: djg Date: Tue Jun 24 15:44:42 2008 New Revision: 52688 URL: http://llvm.org/viewvc/llvm-project?rev=52688&view=rev Log: Revert 52645, the loop unroller changes. It caused a regression in 252.eon. Removed: llvm/trunk/test/Transforms/LoopUnroll/multiple-phis.ll llvm/trunk/test/Transforms/LoopUnroll/pr2253.ll Modified: llvm/trunk/lib/Transforms/Utils/UnrollLoop.cpp Modified: llvm/trunk/lib/Transforms/Utils/UnrollLoop.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/UnrollLoop.cpp?rev=52688&r1=52687&r2=52688&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Utils/UnrollLoop.cpp (original) +++ llvm/trunk/lib/Transforms/Utils/UnrollLoop.cpp Tue Jun 24 15:44:42 2008 @@ -22,7 +22,6 @@ #include "llvm/Transforms/Utils/UnrollLoop.h" #include "llvm/BasicBlock.h" #include "llvm/ADT/Statistic.h" -#include "llvm/ADT/STLExtras.h" #include "llvm/Analysis/ConstantFolding.h" #include "llvm/Analysis/LoopPass.h" #include "llvm/Support/Debug.h" @@ -107,17 +106,13 @@ /// /// If a LoopPassManager is passed in, and the loop is fully removed, it will be /// removed from the LoopPassManager as well. LPM can also be NULL. -bool llvm::UnrollLoop(Loop *L, unsigned Count, LoopInfo* LI, - LPPassManager* LPM) { +bool llvm::UnrollLoop(Loop *L, unsigned Count, LoopInfo* LI, LPPassManager* LPM) { assert(L->isLCSSAForm()); BasicBlock *Header = L->getHeader(); BasicBlock *LatchBlock = L->getLoopLatch(); BranchInst *BI = dyn_cast(LatchBlock->getTerminator()); - - Function *Func = Header->getParent(); - Function::iterator BBInsertPt = next(Function::iterator(LatchBlock)); - + if (!BI || BI->isUnconditional()) { // The loop-rotate pass can be helpful to avoid this in many cases. DOUT << " Can't unroll; loop not terminated by a conditional branch.\n"; @@ -173,148 +168,162 @@ DOUT << "!\n"; } - // Make a copy of the original LoopBlocks list so we can keep referring - // to it while hacking on the loop. std::vector LoopBlocks = L->getBlocks(); - bool ContinueOnTrue = BI->getSuccessor(0) == Header; + bool ContinueOnTrue = L->contains(BI->getSuccessor(0)); BasicBlock *LoopExit = BI->getSuccessor(ContinueOnTrue); // For the first iteration of the loop, we should use the precloned values for // PHI nodes. Insert associations now. typedef DenseMap ValueMapTy; ValueMapTy LastValueMap; + std::vector OrigPHINode; for (BasicBlock::iterator I = Header->begin(); isa(I); ++I) { PHINode *PN = cast(I); + OrigPHINode.push_back(PN); if (Instruction *I = dyn_cast(PN->getIncomingValueForBlock(LatchBlock))) if (L->contains(I->getParent())) LastValueMap[I] = I; } - // Keep track of all the headers and latches that we create. These are - // needed by the logic that inserts the branches to connect all the - // new blocks. std::vector Headers; std::vector Latches; - Headers.reserve(Count); - Latches.reserve(Count); Headers.push_back(Header); Latches.push_back(LatchBlock); - // Iterate through all but the first iterations, cloning blocks from - // the first iteration to populate the subsequent iterations. for (unsigned It = 1; It != Count; ++It) { char SuffixBuffer[100]; sprintf(SuffixBuffer, ".%d", It); std::vector NewBlocks; - NewBlocks.reserve(LoopBlocks.size()); - // Iterate through all the blocks in the original loop. - for (std::vector::const_iterator BBI = LoopBlocks.begin(), - E = LoopBlocks.end(); BBI != E; ++BBI) { - bool SuppressExitEdges = false; - BasicBlock *BB = *BBI; + for (std::vector::iterator BB = LoopBlocks.begin(), + E = LoopBlocks.end(); BB != E; ++BB) { ValueMapTy ValueMap; - BasicBlock *New = CloneBasicBlock(BB, ValueMap, SuffixBuffer); - NewBlocks.push_back(New); - Func->getBasicBlockList().insert(BBInsertPt, New); - L->addBasicBlockToLoop(New, LI->getBase()); + BasicBlock *New = CloneBasicBlock(*BB, ValueMap, SuffixBuffer); + Header->getParent()->getBasicBlockList().push_back(New); - // Special handling for the loop header block. - if (BB == Header) { - // Keep track of new headers as we create them, so that we can insert - // the proper branches later. - Headers[It] = New; - - // Loop over all of the PHI nodes in the block, changing them to use - // the incoming values from the previous block. - for (BasicBlock::iterator I = Header->begin(); isa(I); ++I) { - PHINode *NewPHI = cast(ValueMap[I]); + // Loop over all of the PHI nodes in the block, changing them to use the + // incoming values from the previous block. + if (*BB == Header) + for (unsigned i = 0, e = OrigPHINode.size(); i != e; ++i) { + PHINode *NewPHI = cast(ValueMap[OrigPHINode[i]]); Value *InVal = NewPHI->getIncomingValueForBlock(LatchBlock); if (Instruction *InValI = dyn_cast(InVal)) if (It > 1 && L->contains(InValI->getParent())) InVal = LastValueMap[InValI]; - ValueMap[I] = InVal; + ValueMap[OrigPHINode[i]] = InVal; New->getInstList().erase(NewPHI); } - } - - // Special handling for the loop latch block. - if (BB == LatchBlock) { - // Keep track of new latches as we create them, so that we can insert - // the proper branches later. - Latches[It] = New; - - // If knowledge of the trip count and/or multiple will allow us - // to emit unconditional branches in some of the new latch blocks, - // those blocks shouldn't be referenced by PHIs that reference - // the original latch. - unsigned NextIt = (It + 1) % Count; - SuppressExitEdges = - NextIt != BreakoutTrip && - (TripMultiple == 0 || NextIt % TripMultiple != 0); - } // Update our running map of newest clones - LastValueMap[BB] = New; + LastValueMap[*BB] = New; for (ValueMapTy::iterator VI = ValueMap.begin(), VE = ValueMap.end(); VI != VE; ++VI) LastValueMap[VI->first] = VI->second; - // Add incoming values to phi nodes that reference this block. The last - // latch block may need to be referenced by the first header, and any - // block with an exit edge may be referenced from outside the loop. - for (Value::use_iterator UI = BB->use_begin(), UE = BB->use_end(); - UI != UE; ) { - PHINode *PN = dyn_cast(*UI++); - if (PN && - ((BB == LatchBlock && It == Count - 1 && !CompletelyUnroll) || - (!SuppressExitEdges && !L->contains(PN->getParent())))) { - Value *InVal = PN->getIncomingValueForBlock(BB); - // If this value was defined in the loop, take the value defined - // by the last iteration of the loop. - ValueMapTy::iterator VI = LastValueMap.find(InVal); - if (VI != LastValueMap.end()) - InVal = VI->second; - PN->addIncoming(InVal, New); + L->addBasicBlockToLoop(New, LI->getBase()); + + // Add phi entries for newly created values to all exit blocks except + // the successor of the latch block. The successor of the exit block will + // be updated specially after unrolling all the way. + if (*BB != LatchBlock) + for (Value::use_iterator UI = (*BB)->use_begin(), UE = (*BB)->use_end(); + UI != UE;) { + Instruction *UseInst = cast(*UI); + ++UI; + if (isa(UseInst) && !L->contains(UseInst->getParent())) { + PHINode *phi = cast(UseInst); + Value *Incoming = phi->getIncomingValueForBlock(*BB); + phi->addIncoming(Incoming, New); + } } + + // Keep track of new headers and latches as we create them, so that + // we can insert the proper branches later. + if (*BB == Header) + Headers.push_back(New); + if (*BB == LatchBlock) { + Latches.push_back(New); + + // Also, clear out the new latch's back edge so that it doesn't look + // like a new loop, so that it's amenable to being merged with adjacent + // blocks later on. + TerminatorInst *Term = New->getTerminator(); + assert(L->contains(Term->getSuccessor(!ContinueOnTrue))); + assert(Term->getSuccessor(ContinueOnTrue) == LoopExit); + Term->setSuccessor(!ContinueOnTrue, NULL); } + + NewBlocks.push_back(New); } // Remap all instructions in the most recent iteration - for (unsigned i = 0, e = NewBlocks.size(); i != e; ++i) + for (unsigned i = 0; i < NewBlocks.size(); ++i) for (BasicBlock::iterator I = NewBlocks[i]->begin(), E = NewBlocks[i]->end(); I != E; ++I) RemapInstruction(I, LastValueMap); } + + // The latch block exits the loop. If there are any PHI nodes in the + // successor blocks, update them to use the appropriate values computed as the + // last iteration of the loop. + if (Count != 1) { + SmallPtrSet Users; + for (Value::use_iterator UI = LatchBlock->use_begin(), + UE = LatchBlock->use_end(); UI != UE; ++UI) + if (PHINode *phi = dyn_cast(*UI)) + Users.insert(phi); + + BasicBlock *LastIterationBB = cast(LastValueMap[LatchBlock]); + for (SmallPtrSet::iterator SI = Users.begin(), SE = Users.end(); + SI != SE; ++SI) { + PHINode *PN = *SI; + Value *InVal = PN->removeIncomingValue(LatchBlock, false); + // If this value was defined in the loop, take the value defined by the + // last iteration of the loop. + if (Instruction *InValI = dyn_cast(InVal)) { + if (L->contains(InValI->getParent())) + InVal = LastValueMap[InVal]; + } + PN->addIncoming(InVal, LastIterationBB); + } + } + + // Now, if we're doing complete unrolling, loop over the PHI nodes in the + // original block, setting them to their incoming values. + if (CompletelyUnroll) { + BasicBlock *Preheader = L->getLoopPreheader(); + for (unsigned i = 0, e = OrigPHINode.size(); i != e; ++i) { + PHINode *PN = OrigPHINode[i]; + PN->replaceAllUsesWith(PN->getIncomingValueForBlock(Preheader)); + Header->getInstList().erase(PN); + } + } // Now that all the basic blocks for the unrolled iterations are in place, // set up the branches to connect them. - for (unsigned It = 0; It != Count; ++It) { + for (unsigned i = 0, e = Latches.size(); i != e; ++i) { // The original branch was replicated in each unrolled iteration. - BranchInst *Term = cast(Latches[It]->getTerminator()); + BranchInst *Term = cast(Latches[i]->getTerminator()); // The branch destination. - unsigned NextIt = (It + 1) % Count; - BasicBlock *Dest = Headers[NextIt]; + unsigned j = (i + 1) % e; + BasicBlock *Dest = Headers[j]; bool NeedConditional = true; - bool HasExit = true; - // For a complete unroll, make the last iteration end with an - // unconditional branch to the exit block. - if (CompletelyUnroll && NextIt == 0) { + // For a complete unroll, make the last iteration end with a branch + // to the exit block. + if (CompletelyUnroll && j == 0) { Dest = LoopExit; NeedConditional = false; } // If we know the trip count or a multiple of it, we can safely use an // unconditional branch for some iterations. - if (NextIt != BreakoutTrip && - (TripMultiple == 0 || NextIt % TripMultiple != 0)) { + if (j != BreakoutTrip && (TripMultiple == 0 || j % TripMultiple != 0)) { NeedConditional = false; - HasExit = false; } if (NeedConditional) { @@ -329,50 +338,24 @@ std::replace(Headers.begin(), Headers.end(), Dest, Fold); } } - - // Special handling for the first iteration. If the first latch is - // now unconditionally branching to the second header, then it is - // no longer an exit node. Delete PHI references to it both from - // the first header and from outsie the loop. - if (It == 0) - for (Value::use_iterator UI = LatchBlock->use_begin(), - UE = LatchBlock->use_end(); UI != UE; ) { - PHINode *PN = dyn_cast(*UI++); - if (PN && (PN->getParent() == Header ? Count > 1 : !HasExit)) - PN->removeIncomingValue(LatchBlock); - } } - // At this point, unrolling is complete and the code is well formed. - // Now, do some simplifications. - - // If we're doing complete unrolling, loop over the PHI nodes in the - // original block, setting them to their incoming values. - if (CompletelyUnroll) { - BasicBlock *Preheader = L->getLoopPreheader(); - for (BasicBlock::iterator I = Header->begin(); isa(I); ) { - PHINode *PN = cast(I++); - PN->replaceAllUsesWith(PN->getIncomingValueForBlock(Preheader)); - Header->getInstList().erase(PN); - } - } - - // We now do a quick sweep over the inserted code, doing constant - // propagation and dead code elimination as we go. - for (Loop::block_iterator BI = L->block_begin(), BBE = L->block_end(); - BI != BBE; ++BI) { - BasicBlock *BB = *BI; - for (BasicBlock::iterator I = BB->begin(), E = BB->end(); I != E; ) { + // At this point, the code is well formed. We now do a quick sweep over the + // inserted code, doing constant propagation and dead code elimination as we + // go. + const std::vector &NewLoopBlocks = L->getBlocks(); + for (std::vector::const_iterator BB = NewLoopBlocks.begin(), + BBE = NewLoopBlocks.end(); BB != BBE; ++BB) + for (BasicBlock::iterator I = (*BB)->begin(), E = (*BB)->end(); I != E; ) { Instruction *Inst = I++; if (isInstructionTriviallyDead(Inst)) - BB->getInstList().erase(Inst); + (*BB)->getInstList().erase(Inst); else if (Constant *C = ConstantFoldInstruction(Inst)) { Inst->replaceAllUsesWith(C); - BB->getInstList().erase(Inst); + (*BB)->getInstList().erase(Inst); } } - } NumCompletelyUnrolled += CompletelyUnroll; ++NumUnrolled; Removed: llvm/trunk/test/Transforms/LoopUnroll/multiple-phis.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/LoopUnroll/multiple-phis.ll?rev=52687&view=auto ============================================================================== --- llvm/trunk/test/Transforms/LoopUnroll/multiple-phis.ll (original) +++ llvm/trunk/test/Transforms/LoopUnroll/multiple-phis.ll (removed) @@ -1,51 +0,0 @@ -; RUN: llvm-as < %s | opt -loop-unroll -unroll-count 6 -unroll-threshold 300 | llvm-dis > %t -; RUN: grep {br label \%bbe} %t | count 12 -; RUN: grep {br i1 \%z} %t | count 3 -; RUN: grep {br i1 \%q} %t | count 6 -; RUN: grep call %t | count 12 -; RUN: grep urem %t | count 6 -; RUN: grep store %t | count 6 -; RUN: grep phi %t | count 11 -; RUN: grep {lcssa = phi} %t | count 2 - -; This testcase uses -; - an unknown tripcount, but a known trip multiple of 2. -; - an unroll count of 6, so we should get 3 conditional branches -; in the loop. -; - values defined inside the loop and used outside, by phis that -; also use values defined elsewhere outside the loop. -; - a phi inside the loop that only uses values defined -; inside the loop and is only used inside the loop. - -declare i32 @foo() -declare i32 @bar() - -define i32 @fib(i32 %n, i1 %a, i32* %p) nounwind { -entry: - %n2 = mul i32 %n, 2 - br i1 %a, label %bb, label %return - -bb: ; loop header block - %t0 = phi i32 [ 0, %entry ], [ %t1, %bbe ] - %td = urem i32 %t0, 7 - %q = trunc i32 %td to i1 - br i1 %q, label %bbt, label %bbf -bbt: - %bbtv = call i32 @foo() - br label %bbe -bbf: - %bbfv = call i32 @bar() - br label %bbe -bbe: ; loop latch block - %bbpv = phi i32 [ %bbtv, %bbt ], [ %bbfv, %bbf ] - store i32 %bbpv, i32* %p - %t1 = add i32 %t0, 1 - %z = icmp ne i32 %t1, %n2 - br i1 %z, label %bb, label %return - -return: - %f = phi i32 [ -2, %entry ], [ %t0, %bbe ] - %g = phi i32 [ -3, %entry ], [ %t1, %bbe ] - %h = mul i32 %f, %g - ret i32 %h -} Removed: llvm/trunk/test/Transforms/LoopUnroll/pr2253.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/LoopUnroll/pr2253.ll?rev=52687&view=auto ============================================================================== --- llvm/trunk/test/Transforms/LoopUnroll/pr2253.ll (original) +++ llvm/trunk/test/Transforms/LoopUnroll/pr2253.ll (removed) @@ -1,21 +0,0 @@ -; RUN: llvm-as < %s | opt -loop-unroll -unroll-count 2 | llvm-dis | grep add | count 2 -; PR2253 - -; There's a use outside the loop, and the PHI needs an incoming edge for -; each unrolled iteration, since the trip count is unknown and any iteration -; could exit. - -define i32 @fib(i32 %n) nounwind { -entry: - br i1 false, label %bb, label %return - -bb: - %t0 = phi i32 [ 0, %entry ], [ %t1, %bb ] - %t1 = add i32 %t0, 1 - %c = icmp ne i32 %t0, %n - br i1 %c, label %bb, label %return - -return: - %f2.0.lcssa = phi i32 [ -1, %entry ], [ %t0, %bb ] - ret i32 %f2.0.lcssa -} From resistor at mac.com Tue Jun 24 16:45:00 2008 From: resistor at mac.com (Owen Anderson) Date: Tue, 24 Jun 2008 21:45:00 -0000 Subject: [llvm-commits] [llvm] r52689 - /llvm/trunk/lib/CodeGen/DwarfWriter.cpp Message-ID: <200806242145.m5OLj0EC002034@zion.cs.uiuc.edu> Author: resistor Date: Tue Jun 24 16:44:59 2008 New Revision: 52689 URL: http://llvm.org/viewvc/llvm-project?rev=52689&view=rev Log: Use SmallVector instead of std::vector for a minor compile time improvement. Modified: llvm/trunk/lib/CodeGen/DwarfWriter.cpp Modified: llvm/trunk/lib/CodeGen/DwarfWriter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/DwarfWriter.cpp?rev=52689&r1=52688&r2=52689&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/DwarfWriter.cpp (original) +++ llvm/trunk/lib/CodeGen/DwarfWriter.cpp Tue Jun 24 16:44:59 2008 @@ -140,7 +140,7 @@ /// Data - Raw data bytes for abbreviation. /// - std::vector Data; + SmallVector Data; public: @@ -155,7 +155,7 @@ unsigned getTag() const { return Tag; } unsigned getNumber() const { return Number; } unsigned getChildrenFlag() const { return ChildrenFlag; } - const std::vector &getData() const { return Data; } + const SmallVector &getData() const { return Data; } void setTag(unsigned T) { Tag = T; } void setChildrenFlag(unsigned CF) { ChildrenFlag = CF; } void setNumber(unsigned N) { Number = N; } @@ -219,7 +219,7 @@ /// Attributes values. /// - std::vector Values; + SmallVector Values; public: explicit DIE(unsigned Tag) @@ -240,7 +240,7 @@ unsigned getOffset() const { return Offset; } unsigned getSize() const { return Size; } const std::vector &getChildren() const { return Children; } - std::vector &getValues() { return Values; } + SmallVector &getValues() { return Values; } void setTag(unsigned Tag) { Abbrev.setTag(Tag); } void setOffset(unsigned O) { Offset = O; } void setSize(unsigned S) { Size = S; } @@ -2081,8 +2081,8 @@ ":0x" + utohexstr(Die->getSize()) + " " + TagString(Abbrev->getTag()))); - std::vector &Values = Die->getValues(); - const std::vector &AbbrevData = Abbrev->getData(); + SmallVector &Values = Die->getValues(); + const SmallVector &AbbrevData = Abbrev->getData(); // Emit the DIE attribute values. for (unsigned i = 0, N = Values.size(); i < N; ++i) { @@ -2139,8 +2139,8 @@ // Start the size with the size of abbreviation code. Offset += Asm->SizeULEB128(AbbrevNumber); - const std::vector &Values = Die->getValues(); - const std::vector &AbbrevData = Abbrev->getData(); + const SmallVector &Values = Die->getValues(); + const SmallVector &AbbrevData = Abbrev->getData(); // Size the DIE attribute values. for (unsigned i = 0, N = Values.size(); i < N; ++i) { @@ -3726,7 +3726,7 @@ /// unsigned DIEBlock::ComputeSize(DwarfDebug &DD) { if (!Size) { - const std::vector &AbbrevData = Abbrev.getData(); + const SmallVector &AbbrevData = Abbrev.getData(); for (unsigned i = 0, N = Values.size(); i < N; ++i) { Size += Values[i]->SizeOf(DD, AbbrevData[i].getForm()); @@ -3746,7 +3746,7 @@ default: assert(0 && "Improper form for block"); break; } - const std::vector &AbbrevData = Abbrev.getData(); + const SmallVector &AbbrevData = Abbrev.getData(); for (unsigned i = 0, N = Values.size(); i < N; ++i) { DD.getAsm()->EOL(); @@ -3819,7 +3819,7 @@ } O << "\n"; - const std::vector &Data = Abbrev.getData(); + const SmallVector &Data = Abbrev.getData(); IndentCount += 2; for (unsigned i = 0, N = Data.size(); i < N; ++i) { From resistor at mac.com Tue Jun 24 16:58:29 2008 From: resistor at mac.com (Owen Anderson) Date: Tue, 24 Jun 2008 21:58:29 -0000 Subject: [llvm-commits] [llvm] r52690 - /llvm/trunk/lib/VMCore/Constants.cpp Message-ID: <200806242158.m5OLwT9J002436@zion.cs.uiuc.edu> Author: resistor Date: Tue Jun 24 16:58:29 2008 New Revision: 52690 URL: http://llvm.org/viewvc/llvm-project?rev=52690&view=rev Log: In ConstantArray::getAsString(), we know the size of the resultant string in advance so we can pre-allocate it and just fill in the entries. This improves the time for the AsmPrinter on InstructionCombining.cpp from 0.4248s to 0.3370s. Modified: llvm/trunk/lib/VMCore/Constants.cpp Modified: llvm/trunk/lib/VMCore/Constants.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Constants.cpp?rev=52690&r1=52689&r2=52690&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/Constants.cpp (original) +++ llvm/trunk/lib/VMCore/Constants.cpp Tue Jun 24 16:58:29 2008 @@ -1378,8 +1378,9 @@ std::string ConstantArray::getAsString() const { assert(isString() && "Not a string!"); std::string Result; + Result.reserve(getNumOperands()); for (unsigned i = 0, e = getNumOperands(); i != e; ++i) - Result += (char)cast(getOperand(i))->getZExtValue(); + Result[i] = (char)cast(getOperand(i))->getZExtValue(); return Result; } From dalej at apple.com Tue Jun 24 17:01:44 2008 From: dalej at apple.com (Dale Johannesen) Date: Tue, 24 Jun 2008 22:01:44 -0000 Subject: [llvm-commits] [llvm] r52691 - in /llvm/trunk/lib/Target/X86: X86CallingConv.td X86ISelLowering.cpp X86InstrMMX.td X86RegisterInfo.td Message-ID: <200806242201.m5OM1j8D002551@zion.cs.uiuc.edu> Author: johannes Date: Tue Jun 24 17:01:44 2008 New Revision: 52691 URL: http://llvm.org/viewvc/llvm-project?rev=52691&view=rev Log: Add v2f32 (MMX) type to X86. Support is primitive: load,store,call,return,bitcast. This is enough to make call and return work. Modified: llvm/trunk/lib/Target/X86/X86CallingConv.td llvm/trunk/lib/Target/X86/X86ISelLowering.cpp llvm/trunk/lib/Target/X86/X86InstrMMX.td llvm/trunk/lib/Target/X86/X86RegisterInfo.td Modified: llvm/trunk/lib/Target/X86/X86CallingConv.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86CallingConv.td?rev=52691&r1=52690&r2=52691&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86CallingConv.td (original) +++ llvm/trunk/lib/Target/X86/X86CallingConv.td Tue Jun 24 17:01:44 2008 @@ -35,7 +35,7 @@ // MMX vector types are always returned in MM0. If the target doesn't have // MM0, it doesn't support these vector types. - CCIfType<[v8i8, v4i16, v2i32, v1i64], CCAssignToReg<[MM0]>>, + CCIfType<[v8i8, v4i16, v2i32, v1i64, v2f32], CCAssignToReg<[MM0]>>, // Long double types are always returned in ST0 (even with SSE). CCIfType<[f80], CCAssignToReg<[ST0, ST1]>> @@ -75,6 +75,9 @@ // The X86-64 calling convention always returns FP values in XMM0. CCIfType<[f32], CCAssignToReg<[XMM0, XMM1]>>, CCIfType<[f64], CCAssignToReg<[XMM0, XMM1]>>, + + // MMX vector types are always returned in XMM0. + CCIfType<[v8i8, v4i16, v2i32, v1i64, v2f32], CCAssignToReg<[XMM0, XMM1]>>, CCDelegateTo ]>; @@ -141,7 +144,7 @@ // The first 8 MMX (except for v1i64) vector arguments are passed in XMM // registers on Darwin. - CCIfType<[v8i8, v4i16, v2i32], + CCIfType<[v8i8, v4i16, v2i32, v2f32], CCIfSubtarget<"isTargetDarwin()", CCIfSubtarget<"hasSSE2()", CCAssignToReg<[XMM0, XMM1, XMM2, XMM3, XMM4, XMM5, XMM6, XMM7]>>>>, @@ -163,7 +166,7 @@ CCIfType<[v16i8, v8i16, v4i32, v2i64, v4f32, v2f64], CCAssignToStack<16, 16>>, // __m64 vectors get 8-byte stack slots that are 8-byte aligned. - CCIfType<[v8i8, v4i16, v2i32, v1i64], CCAssignToStack<8, 8>> + CCIfType<[v8i8, v4i16, v2i32, v1i64, v2f32], CCAssignToStack<8, 8>> ]>; // Calling convention used on Win64 @@ -189,7 +192,7 @@ [RCX , RDX , R8 , R9 ]>>, // The first 4 MMX vector arguments are passed in GPRs. - CCIfType<[v8i8, v4i16, v2i32, v1i64], + CCIfType<[v8i8, v4i16, v2i32, v1i64, v2f32], CCAssignToRegWithShadow<[RCX , RDX , R8 , R9 ], [XMM0, XMM1, XMM2, XMM3]>>, @@ -230,7 +233,7 @@ // The first 8 MMX (except for v1i64) vector arguments are passed in XMM // registers on Darwin. - CCIfType<[v8i8, v4i16, v2i32], + CCIfType<[v8i8, v4i16, v2i32, v2f32], CCIfSubtarget<"isTargetDarwin()", CCAssignToReg<[XMM0, XMM1, XMM2, XMM3, XMM4, XMM5, XMM6, XMM7]>>>, @@ -270,7 +273,7 @@ // The first 3 __m64 (except for v1i64) vector arguments are passed in mmx // registers if the call is not a vararg call. - CCIfNotVarArg>>, // Integer/Float values get stored in stack slots that are 4 bytes in Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.cpp?rev=52691&r1=52690&r2=52691&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original) +++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Tue Jun 24 17:01:44 2008 @@ -536,6 +536,7 @@ addRegisterClass(MVT::v8i8, X86::VR64RegisterClass); addRegisterClass(MVT::v4i16, X86::VR64RegisterClass); addRegisterClass(MVT::v2i32, X86::VR64RegisterClass); + addRegisterClass(MVT::v2f32, X86::VR64RegisterClass); addRegisterClass(MVT::v1i64, X86::VR64RegisterClass); // FIXME: add MMX packed arithmetics @@ -583,11 +584,14 @@ AddPromotedToType (ISD::LOAD, MVT::v4i16, MVT::v1i64); setOperationAction(ISD::LOAD, MVT::v2i32, Promote); AddPromotedToType (ISD::LOAD, MVT::v2i32, MVT::v1i64); + setOperationAction(ISD::LOAD, MVT::v2f32, Promote); + AddPromotedToType (ISD::LOAD, MVT::v2f32, MVT::v1i64); setOperationAction(ISD::LOAD, MVT::v1i64, Legal); setOperationAction(ISD::BUILD_VECTOR, MVT::v8i8, Custom); setOperationAction(ISD::BUILD_VECTOR, MVT::v4i16, Custom); setOperationAction(ISD::BUILD_VECTOR, MVT::v2i32, Custom); + setOperationAction(ISD::BUILD_VECTOR, MVT::v2f32, Custom); setOperationAction(ISD::BUILD_VECTOR, MVT::v1i64, Custom); setOperationAction(ISD::VECTOR_SHUFFLE, MVT::v8i8, Custom); @@ -894,7 +898,7 @@ // Don't emit a copytoreg. continue; } - + Chain = DAG.getCopyToReg(Chain, VA.getLocReg(), ValToCopy, Flag); Flag = Chain.getValue(1); } Modified: llvm/trunk/lib/Target/X86/X86InstrMMX.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86InstrMMX.td?rev=52691&r1=52690&r2=52691&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86InstrMMX.td (original) +++ llvm/trunk/lib/Target/X86/X86InstrMMX.td Tue Jun 24 17:01:44 2008 @@ -528,20 +528,30 @@ (MMX_MOVQ64mr addr:$dst, VR64:$src)>; def : Pat<(store (v2i32 VR64:$src), addr:$dst), (MMX_MOVQ64mr addr:$dst, VR64:$src)>; +def : Pat<(store (v2f32 VR64:$src), addr:$dst), + (MMX_MOVQ64mr addr:$dst, VR64:$src)>; def : Pat<(store (v1i64 VR64:$src), addr:$dst), (MMX_MOVQ64mr addr:$dst, VR64:$src)>; // Bit convert. def : Pat<(v8i8 (bitconvert (v1i64 VR64:$src))), (v8i8 VR64:$src)>; def : Pat<(v8i8 (bitconvert (v2i32 VR64:$src))), (v8i8 VR64:$src)>; +def : Pat<(v8i8 (bitconvert (v2f32 VR64:$src))), (v8i8 VR64:$src)>; def : Pat<(v8i8 (bitconvert (v4i16 VR64:$src))), (v8i8 VR64:$src)>; def : Pat<(v4i16 (bitconvert (v1i64 VR64:$src))), (v4i16 VR64:$src)>; def : Pat<(v4i16 (bitconvert (v2i32 VR64:$src))), (v4i16 VR64:$src)>; +def : Pat<(v4i16 (bitconvert (v2f32 VR64:$src))), (v4i16 VR64:$src)>; def : Pat<(v4i16 (bitconvert (v8i8 VR64:$src))), (v4i16 VR64:$src)>; def : Pat<(v2i32 (bitconvert (v1i64 VR64:$src))), (v2i32 VR64:$src)>; +def : Pat<(v2i32 (bitconvert (v2f32 VR64:$src))), (v2i32 VR64:$src)>; def : Pat<(v2i32 (bitconvert (v4i16 VR64:$src))), (v2i32 VR64:$src)>; def : Pat<(v2i32 (bitconvert (v8i8 VR64:$src))), (v2i32 VR64:$src)>; +def : Pat<(v2f32 (bitconvert (v1i64 VR64:$src))), (v2f32 VR64:$src)>; +def : Pat<(v2f32 (bitconvert (v2i32 VR64:$src))), (v2f32 VR64:$src)>; +def : Pat<(v2f32 (bitconvert (v4i16 VR64:$src))), (v2f32 VR64:$src)>; +def : Pat<(v2f32 (bitconvert (v8i8 VR64:$src))), (v2f32 VR64:$src)>; def : Pat<(v1i64 (bitconvert (v2i32 VR64:$src))), (v1i64 VR64:$src)>; +def : Pat<(v1i64 (bitconvert (v2f32 VR64:$src))), (v1i64 VR64:$src)>; def : Pat<(v1i64 (bitconvert (v4i16 VR64:$src))), (v1i64 VR64:$src)>; def : Pat<(v1i64 (bitconvert (v8i8 VR64:$src))), (v1i64 VR64:$src)>; @@ -550,6 +560,8 @@ (MMX_MOVD64to64rr GR64:$src)>; def : Pat<(v2i32 (bitconvert (i64 GR64:$src))), (MMX_MOVD64to64rr GR64:$src)>; +def : Pat<(v2f32 (bitconvert (i64 GR64:$src))), + (MMX_MOVD64to64rr GR64:$src)>; def : Pat<(v4i16 (bitconvert (i64 GR64:$src))), (MMX_MOVD64to64rr GR64:$src)>; def : Pat<(v8i8 (bitconvert (i64 GR64:$src))), @@ -558,6 +570,8 @@ (MMX_MOVD64from64rr VR64:$src)>; def : Pat<(i64 (bitconvert (v2i32 VR64:$src))), (MMX_MOVD64from64rr VR64:$src)>; +def : Pat<(i64 (bitconvert (v2f32 VR64:$src))), + (MMX_MOVD64from64rr VR64:$src)>; def : Pat<(i64 (bitconvert (v4i16 VR64:$src))), (MMX_MOVD64from64rr VR64:$src)>; def : Pat<(i64 (bitconvert (v8i8 VR64:$src))), Modified: llvm/trunk/lib/Target/X86/X86RegisterInfo.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86RegisterInfo.td?rev=52691&r1=52690&r2=52691&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86RegisterInfo.td (original) +++ llvm/trunk/lib/Target/X86/X86RegisterInfo.td Tue Jun 24 17:01:44 2008 @@ -509,7 +509,7 @@ } // Generic vector registers: VR64 and VR128. -def VR64 : RegisterClass<"X86", [v8i8, v4i16, v2i32, v1i64], 64, +def VR64 : RegisterClass<"X86", [v8i8, v4i16, v2i32, v1i64, v2f32], 64, [MM0, MM1, MM2, MM3, MM4, MM5, MM6, MM7]>; def VR128 : RegisterClass<"X86", [v16i8, v8i16, v4i32, v2i64, v4f32, v2f64],128, [XMM0, XMM1, XMM2, XMM3, XMM4, XMM5, XMM6, XMM7, From dalej at apple.com Tue Jun 24 17:03:37 2008 From: dalej at apple.com (Dale Johannesen) Date: Tue, 24 Jun 2008 22:03:37 -0000 Subject: [llvm-commits] [llvm] r52692 - /llvm/trunk/test/CodeGen/X86/split-select.ll Message-ID: <200806242203.m5OM3bYV002612@zion.cs.uiuc.edu> Author: johannes Date: Tue Jun 24 17:03:36 2008 New Revision: 52692 URL: http://llvm.org/viewvc/llvm-project?rev=52692&view=rev Log: v2f32 is now a valid (MMX) type which breaks this test (doesn't work for any MMX vector types, it's not me). Rewritten to use v2i16 which is generic and going to stay that way; I think that preserves the point of the test. Modified: llvm/trunk/test/CodeGen/X86/split-select.ll Modified: llvm/trunk/test/CodeGen/X86/split-select.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/split-select.ll?rev=52692&r1=52691&r2=52692&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/X86/split-select.ll (original) +++ llvm/trunk/test/CodeGen/X86/split-select.ll Tue Jun 24 17:03:36 2008 @@ -1,7 +1,7 @@ ; RUN: llvm-as < %s | llc -march=x86-64 | grep test | count 1 -define void @foo(i1 %c, <2 x float> %a, <2 x float> %b, <2 x float>* %p) { - %x = select i1 %c, <2 x float> %a, <2 x float> %b - store <2 x float> %x, <2 x float>* %p +define void @foo(i1 %c, <2 x i16> %a, <2 x i16> %b, <2 x i16>* %p) { + %x = select i1 %c, <2 x i16> %a, <2 x i16> %b + store <2 x i16> %x, <2 x i16>* %p ret void } From gohman at apple.com Tue Jun 24 17:07:08 2008 From: gohman at apple.com (Dan Gohman) Date: Tue, 24 Jun 2008 22:07:08 -0000 Subject: [llvm-commits] [llvm] r52693 - /llvm/trunk/lib/Support/Timer.cpp Message-ID: <200806242207.m5OM78TH002776@zion.cs.uiuc.edu> Author: djg Date: Tue Jun 24 17:07:07 2008 New Revision: 52693 URL: http://llvm.org/viewvc/llvm-project?rev=52693&view=rev Log: Append to the ActiveTimers std::vector before looking at the timer instead of after, so that any reallocation it does doesn't get counted for the pass being timed. This probably doesn't account for a timing discrepancy I was looking into, but I'm fixing it anyway. Modified: llvm/trunk/lib/Support/Timer.cpp Modified: llvm/trunk/lib/Support/Timer.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/Timer.cpp?rev=52693&r1=52692&r2=52693&view=diff ============================================================================== --- llvm/trunk/lib/Support/Timer.cpp (original) +++ llvm/trunk/lib/Support/Timer.cpp Tue Jun 24 17:07:07 2008 @@ -132,13 +132,13 @@ void Timer::startTimer() { Started = true; + ActiveTimers->push_back(this); TimeRecord TR = getTimeRecord(true); Elapsed -= TR.Elapsed; UserTime -= TR.UserTime; SystemTime -= TR.SystemTime; MemUsed -= TR.MemUsed; PeakMemBase = TR.MemUsed; - ActiveTimers->push_back(this); } void Timer::stopTimer() { From echristo at apple.com Tue Jun 24 17:13:59 2008 From: echristo at apple.com (Eric Christopher) Date: Tue, 24 Jun 2008 15:13:59 -0700 Subject: [llvm-commits] [llvm] r52675 - in /llvm/trunk: autoconf/configure.ac configure projects/Makefile In-Reply-To: <200806241301.m5OD1w3G001748@zion.cs.uiuc.edu> References: <200806241301.m5OD1w3G001748@zion.cs.uiuc.edu> Message-ID: On Jun 24, 2008, at 6:01 AM, Matthijs Kooijman wrote: > The changes to configure are made manually, since I lack > autoconf-2.6. Someone > might want to run AutoGen.sh to see if that changes anything. It's very easy to download and install into a separate directory. Have you run into problems? -eric From dalej at apple.com Tue Jun 24 17:19:13 2008 From: dalej at apple.com (Dale Johannesen) Date: Tue, 24 Jun 2008 22:19:13 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r52695 - in /llvm-gcc-4.2/trunk/gcc: config/i386/llvm-i386-target.h config/i386/llvm-i386.cpp llvm-abi.h llvm-convert.cpp Message-ID: <200806242219.m5OMJE7t003179@zion.cs.uiuc.edu> Author: johannes Date: Tue Jun 24 17:19:13 2008 New Revision: 52695 URL: http://llvm.org/viewvc/llvm-project?rev=52695&view=rev Log: Add hook for passing vectors byval. Used on x86-64 for vectors > 128 bits. Modified: llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386-target.h llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386.cpp llvm-gcc-4.2/trunk/gcc/llvm-abi.h llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp Modified: llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386-target.h URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386-target.h?rev=52695&r1=52694&r2=52695&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386-target.h (original) +++ llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386-target.h Tue Jun 24 17:19:13 2008 @@ -112,33 +112,39 @@ #define LLVM_SHOULD_PASS_AGGREGATE_IN_INTEGER_REGS(X, Y, Z) \ llvm_x86_should_pass_aggregate_in_integer_regs((X), (Y), (Z)) -extern bool llvm_x86_should_pass_vector_in_integer_regs(tree); +extern const Type *llvm_x86_scalar_type_for_struct_return(tree type, + unsigned *Offset); /* LLVM_SCALAR_TYPE_FOR_STRUCT_RETURN - Return LLVM Type if X can be returned as a scalar, otherwise return NULL. */ #define LLVM_SCALAR_TYPE_FOR_STRUCT_RETURN(X, Y) \ llvm_x86_scalar_type_for_struct_return((X), (Y)) -extern const Type *llvm_x86_scalar_type_for_struct_return(tree type, - unsigned *Offset); +extern const Type *llvm_x86_aggr_type_for_struct_return(tree type); /* LLVM_AGGR_TYPE_FOR_STRUCT_RETURN - Return LLVM Type if X can be returned as an aggregate, otherwise return NULL. */ #define LLVM_AGGR_TYPE_FOR_STRUCT_RETURN(X) \ llvm_x86_aggr_type_for_struct_return(X) -extern const Type *llvm_x86_aggr_type_for_struct_return(tree type); +extern void llvm_x86_extract_multiple_return_value(Value *Src, Value *Dest, + bool isVolatile, + IRBuilder &B); /* LLVM_EXTRACT_MULTIPLE_RETURN_VALUE - Extract multiple return value from SRC and assign it to DEST. */ #define LLVM_EXTRACT_MULTIPLE_RETURN_VALUE(Src,Dest,V,B) \ llvm_x86_extract_multiple_return_value((Src),(Dest),(V),(B)) -extern void llvm_x86_extract_multiple_return_value(Value *Src, Value *Dest, - bool isVolatile, - IRBuilder &B); +extern bool llvm_x86_should_pass_vector_using_byval_attr(tree); + +/* On x86-64, vectors which are not MMX nor SSE should be passed byval. */ +#define LLVM_SHOULD_PASS_VECTOR_USING_BYVAL_ATTR(X) \ + llvm_x86_should_pass_vector_using_byval_attr((X)) + +extern bool llvm_x86_should_pass_vector_in_integer_regs(tree); -/* Vectors which are not MMX nor SSE should be passed as integers. */ +/* On x86-32, vectors which are not MMX nor SSE should be passed as integers. */ #define LLVM_SHOULD_PASS_VECTOR_IN_INTEGER_REGS(X) \ llvm_x86_should_pass_vector_in_integer_regs((X)) Modified: llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386.cpp URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386.cpp?rev=52695&r1=52694&r2=52695&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386.cpp (original) +++ llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386.cpp Tue Jun 24 17:19:13 2008 @@ -845,7 +845,9 @@ return !totallyEmpty; } -/* On Darwin, vectors which are not MMX nor SSE should be passed as integers. */ +/* On Darwin x86-32, vectors which are not MMX nor SSE should be passed as + integers. On Darwin x86-64, such vectors bigger than 128 bits should be + passed in memory (byval). */ bool llvm_x86_should_pass_vector_in_integer_regs(tree type) { if (!TARGET_MACHO) return false; @@ -856,6 +858,24 @@ return false; if (TREE_INT_CST_LOW(TYPE_SIZE(type))==128 && TARGET_SSE) return false; + if (TARGET_64BIT && TREE_INT_CST_LOW(TYPE_SIZE(type)) > 128) + return false; + } + return true; +} + +/* On Darwin x86-64, vectors which are bigger than 128 bits should be passed + byval (in memory). */ +bool llvm_x86_should_pass_vector_using_byval_attr(tree type) { + if (!TARGET_MACHO) + return false; + if (!TARGET_64BIT) + return false; + if (TREE_CODE(type) == VECTOR_TYPE && + TYPE_SIZE(type) && + TREE_CODE(TYPE_SIZE(type))==INTEGER_CST) { + if (TREE_INT_CST_LOW(TYPE_SIZE(type))<=128) + return false; } return true; } 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=52695&r1=52694&r2=52695&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/llvm-abi.h (original) +++ llvm-gcc-4.2/trunk/gcc/llvm-abi.h Tue Jun 24 17:19:13 2008 @@ -236,6 +236,13 @@ false #endif +// LLVM_SHOULD_PASS_VECTOR_USING_BYVAL_ATTR - Return true if this vector +// type should be passed byval. Used for generic vectors on x86-64. +#ifndef LLVM_SHOULD_PASS_VECTOR_USING_BYVAL_ATTR +#define LLVM_SHOULD_PASS_VECTOR_USING_BYVAL_ATTR(X) \ + false +#endif + // LLVM_SHOULD_PASS_AGGREGATE_USING_BYVAL_ATTR - Return true if this aggregate // value should be passed by value, i.e. passing its address with the byval // attribute bit set. The default is false. @@ -420,6 +427,13 @@ } else if (Ty->getTypeID()==Type::VectorTyID) { if (LLVM_SHOULD_PASS_VECTOR_IN_INTEGER_REGS(type)) { PassInIntegerRegisters(type, Ty, ScalarElts, 0, false); + } else if (LLVM_SHOULD_PASS_VECTOR_USING_BYVAL_ATTR(type)) { + C.HandleByValArgument(Ty, type); + if (Attributes) { + *Attributes |= ParamAttr::ByVal; + *Attributes |= + ParamAttr::constructAlignmentFromInt(LLVM_BYVAL_ALIGNMENT(type)); + } } else { C.HandleScalarArgument(Ty, type); ScalarElts.push_back(Ty); 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=52695&r1=52694&r2=52695&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp (original) +++ llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp Tue Jun 24 17:19:13 2008 @@ -717,6 +717,8 @@ const Type *ArgTy = ConvertType(TREE_TYPE(Args)); bool isInvRef = isPassedByInvisibleReference(TREE_TYPE(Args)); if (isInvRef || + (ArgTy->getTypeID()==Type::VectorTyID && + LLVM_SHOULD_PASS_VECTOR_USING_BYVAL_ATTR(TREE_TYPE(Args))) || (!ArgTy->isSingleValueType() && isPassedByVal(TREE_TYPE(Args), ArgTy, ScalarArgs))) { // If the value is passed by 'invisible reference' or 'byval reference', From clattner at apple.com Tue Jun 24 17:31:15 2008 From: clattner at apple.com (Chris Lattner) Date: Tue, 24 Jun 2008 15:31:15 -0700 Subject: [llvm-commits] [llvm] r52690 - /llvm/trunk/lib/VMCore/Constants.cpp In-Reply-To: <200806242158.m5OLwT9J002436@zion.cs.uiuc.edu> References: <200806242158.m5OLwT9J002436@zion.cs.uiuc.edu> Message-ID: <22CFAECF-E91B-47CC-BD94-DEE65B466ABB@apple.com> On Jun 24, 2008, at 2:58 PM, Owen Anderson wrote: > Author: resistor > Date: Tue Jun 24 16:58:29 2008 > New Revision: 52690 > > URL: http://llvm.org/viewvc/llvm-project?rev=52690&view=rev > Log: > In ConstantArray::getAsString(), we know the size of the resultant > string in advance so we can pre-allocate it and just fill in > the entries. This improves the time for the AsmPrinter on > InstructionCombining.cpp from 0.4248s to 0.3370s. Whoa! -Chris From clattner at apple.com Tue Jun 24 17:32:04 2008 From: clattner at apple.com (Chris Lattner) Date: Tue, 24 Jun 2008 15:32:04 -0700 Subject: [llvm-commits] [llvm] r52691 - in /llvm/trunk/lib/Target/X86: X86CallingConv.td X86ISelLowering.cpp X86InstrMMX.td X86RegisterInfo.td In-Reply-To: <200806242201.m5OM1j8D002551@zion.cs.uiuc.edu> References: <200806242201.m5OM1j8D002551@zion.cs.uiuc.edu> Message-ID: <7302B645-6876-46A0-B047-54E121BF812E@apple.com> On Jun 24, 2008, at 3:01 PM, Dale Johannesen wrote: > Author: johannes > Date: Tue Jun 24 17:01:44 2008 > New Revision: 52691 > > URL: http://llvm.org/viewvc/llvm-project?rev=52691&view=rev > Log: > Add v2f32 (MMX) type to X86. Support is primitive: > load,store,call,return,bitcast. This is enough to > make call and return work. If LLVM IR contains an add (or some other operation) on v2f32 values, do they correctly still get scalarized? -Chris > > > > Modified: > llvm/trunk/lib/Target/X86/X86CallingConv.td > llvm/trunk/lib/Target/X86/X86ISelLowering.cpp > llvm/trunk/lib/Target/X86/X86InstrMMX.td > llvm/trunk/lib/Target/X86/X86RegisterInfo.td > > Modified: llvm/trunk/lib/Target/X86/X86CallingConv.td > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86CallingConv.td?rev=52691&r1=52690&r2=52691&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/lib/Target/X86/X86CallingConv.td (original) > +++ llvm/trunk/lib/Target/X86/X86CallingConv.td Tue Jun 24 17:01:44 > 2008 > @@ -35,7 +35,7 @@ > > // MMX vector types are always returned in MM0. If the target > doesn't have > // MM0, it doesn't support these vector types. > - CCIfType<[v8i8, v4i16, v2i32, v1i64], CCAssignToReg<[MM0]>>, > + CCIfType<[v8i8, v4i16, v2i32, v1i64, v2f32], CCAssignToReg<[MM0]>>, > > // Long double types are always returned in ST0 (even with SSE). > CCIfType<[f80], CCAssignToReg<[ST0, ST1]>> > @@ -75,6 +75,9 @@ > // The X86-64 calling convention always returns FP values in XMM0. > CCIfType<[f32], CCAssignToReg<[XMM0, XMM1]>>, > CCIfType<[f64], CCAssignToReg<[XMM0, XMM1]>>, > + > + // MMX vector types are always returned in XMM0. > + CCIfType<[v8i8, v4i16, v2i32, v1i64, v2f32], CCAssignToReg<[XMM0, > XMM1]>>, > CCDelegateTo > ]>; > > @@ -141,7 +144,7 @@ > > // The first 8 MMX (except for v1i64) vector arguments are passed > in XMM > // registers on Darwin. > - CCIfType<[v8i8, v4i16, v2i32], > + CCIfType<[v8i8, v4i16, v2i32, v2f32], > CCIfSubtarget<"isTargetDarwin()", > CCIfSubtarget<"hasSSE2()", > CCAssignToReg<[XMM0, XMM1, XMM2, XMM3, XMM4, XMM5, XMM6, > XMM7]>>>>, > @@ -163,7 +166,7 @@ > CCIfType<[v16i8, v8i16, v4i32, v2i64, v4f32, v2f64], > CCAssignToStack<16, 16>>, > > // __m64 vectors get 8-byte stack slots that are 8-byte aligned. > - CCIfType<[v8i8, v4i16, v2i32, v1i64], CCAssignToStack<8, 8>> > + CCIfType<[v8i8, v4i16, v2i32, v1i64, v2f32], CCAssignToStack<8, 8>> > ]>; > > // Calling convention used on Win64 > @@ -189,7 +192,7 @@ > [RCX , RDX , R8 , R9 ]>>, > > // The first 4 MMX vector arguments are passed in GPRs. > - CCIfType<[v8i8, v4i16, v2i32, v1i64], > + CCIfType<[v8i8, v4i16, v2i32, v1i64, v2f32], > CCAssignToRegWithShadow<[RCX , RDX , R8 , R9 ], > [XMM0, XMM1, XMM2, XMM3]>>, > > @@ -230,7 +233,7 @@ > > // The first 8 MMX (except for v1i64) vector arguments are passed > in XMM > // registers on Darwin. > - CCIfType<[v8i8, v4i16, v2i32], > + CCIfType<[v8i8, v4i16, v2i32, v2f32], > CCIfSubtarget<"isTargetDarwin()", > CCAssignToReg<[XMM0, XMM1, XMM2, XMM3, XMM4, XMM5, XMM6, > XMM7]>>>, > > @@ -270,7 +273,7 @@ > > // The first 3 __m64 (except for v1i64) vector arguments are > passed in mmx > // registers if the call is not a vararg call. > - CCIfNotVarArg + CCIfNotVarArg CCAssignToReg<[MM0, MM1, MM2]>>>, > > // Integer/Float values get stored in stack slots that are 4 bytes > in > > Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.cpp?rev=52691&r1=52690&r2=52691&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original) > +++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Tue Jun 24 > 17:01:44 2008 > @@ -536,6 +536,7 @@ > addRegisterClass(MVT::v8i8, X86::VR64RegisterClass); > addRegisterClass(MVT::v4i16, X86::VR64RegisterClass); > addRegisterClass(MVT::v2i32, X86::VR64RegisterClass); > + addRegisterClass(MVT::v2f32, X86::VR64RegisterClass); > addRegisterClass(MVT::v1i64, X86::VR64RegisterClass); > > // FIXME: add MMX packed arithmetics > @@ -583,11 +584,14 @@ > AddPromotedToType (ISD::LOAD, MVT::v4i16, > MVT::v1i64); > setOperationAction(ISD::LOAD, MVT::v2i32, Promote); > AddPromotedToType (ISD::LOAD, MVT::v2i32, > MVT::v1i64); > + setOperationAction(ISD::LOAD, MVT::v2f32, Promote); > + AddPromotedToType (ISD::LOAD, MVT::v2f32, > MVT::v1i64); > setOperationAction(ISD::LOAD, MVT::v1i64, Legal); > > setOperationAction(ISD::BUILD_VECTOR, MVT::v8i8, Custom); > setOperationAction(ISD::BUILD_VECTOR, MVT::v4i16, Custom); > setOperationAction(ISD::BUILD_VECTOR, MVT::v2i32, Custom); > + setOperationAction(ISD::BUILD_VECTOR, MVT::v2f32, Custom); > setOperationAction(ISD::BUILD_VECTOR, MVT::v1i64, Custom); > > setOperationAction(ISD::VECTOR_SHUFFLE, MVT::v8i8, Custom); > @@ -894,7 +898,7 @@ > // Don't emit a copytoreg. > continue; > } > - > + > Chain = DAG.getCopyToReg(Chain, VA.getLocReg(), ValToCopy, Flag); > Flag = Chain.getValue(1); > } > > Modified: llvm/trunk/lib/Target/X86/X86InstrMMX.td > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86InstrMMX.td?rev=52691&r1=52690&r2=52691&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/lib/Target/X86/X86InstrMMX.td (original) > +++ llvm/trunk/lib/Target/X86/X86InstrMMX.td Tue Jun 24 17:01:44 2008 > @@ -528,20 +528,30 @@ > (MMX_MOVQ64mr addr:$dst, VR64:$src)>; > def : Pat<(store (v2i32 VR64:$src), addr:$dst), > (MMX_MOVQ64mr addr:$dst, VR64:$src)>; > +def : Pat<(store (v2f32 VR64:$src), addr:$dst), > + (MMX_MOVQ64mr addr:$dst, VR64:$src)>; > def : Pat<(store (v1i64 VR64:$src), addr:$dst), > (MMX_MOVQ64mr addr:$dst, VR64:$src)>; > > // Bit convert. > def : Pat<(v8i8 (bitconvert (v1i64 VR64:$src))), (v8i8 VR64:$src)>; > def : Pat<(v8i8 (bitconvert (v2i32 VR64:$src))), (v8i8 VR64:$src)>; > +def : Pat<(v8i8 (bitconvert (v2f32 VR64:$src))), (v8i8 VR64:$src)>; > def : Pat<(v8i8 (bitconvert (v4i16 VR64:$src))), (v8i8 VR64:$src)>; > def : Pat<(v4i16 (bitconvert (v1i64 VR64:$src))), (v4i16 VR64:$src)>; > def : Pat<(v4i16 (bitconvert (v2i32 VR64:$src))), (v4i16 VR64:$src)>; > +def : Pat<(v4i16 (bitconvert (v2f32 VR64:$src))), (v4i16 VR64:$src)>; > def : Pat<(v4i16 (bitconvert (v8i8 VR64:$src))), (v4i16 VR64:$src)>; > def : Pat<(v2i32 (bitconvert (v1i64 VR64:$src))), (v2i32 VR64:$src)>; > +def : Pat<(v2i32 (bitconvert (v2f32 VR64:$src))), (v2i32 VR64:$src)>; > def : Pat<(v2i32 (bitconvert (v4i16 VR64:$src))), (v2i32 VR64:$src)>; > def : Pat<(v2i32 (bitconvert (v8i8 VR64:$src))), (v2i32 VR64:$src)>; > +def : Pat<(v2f32 (bitconvert (v1i64 VR64:$src))), (v2f32 VR64:$src)>; > +def : Pat<(v2f32 (bitconvert (v2i32 VR64:$src))), (v2f32 VR64:$src)>; > +def : Pat<(v2f32 (bitconvert (v4i16 VR64:$src))), (v2f32 VR64:$src)>; > +def : Pat<(v2f32 (bitconvert (v8i8 VR64:$src))), (v2f32 VR64:$src)>; > def : Pat<(v1i64 (bitconvert (v2i32 VR64:$src))), (v1i64 VR64:$src)>; > +def : Pat<(v1i64 (bitconvert (v2f32 VR64:$src))), (v1i64 VR64:$src)>; > def : Pat<(v1i64 (bitconvert (v4i16 VR64:$src))), (v1i64 VR64:$src)>; > def : Pat<(v1i64 (bitconvert (v8i8 VR64:$src))), (v1i64 VR64:$src)>; > > @@ -550,6 +560,8 @@ > (MMX_MOVD64to64rr GR64:$src)>; > def : Pat<(v2i32 (bitconvert (i64 GR64:$src))), > (MMX_MOVD64to64rr GR64:$src)>; > +def : Pat<(v2f32 (bitconvert (i64 GR64:$src))), > + (MMX_MOVD64to64rr GR64:$src)>; > def : Pat<(v4i16 (bitconvert (i64 GR64:$src))), > (MMX_MOVD64to64rr GR64:$src)>; > def : Pat<(v8i8 (bitconvert (i64 GR64:$src))), > @@ -558,6 +570,8 @@ > (MMX_MOVD64from64rr VR64:$src)>; > def : Pat<(i64 (bitconvert (v2i32 VR64:$src))), > (MMX_MOVD64from64rr VR64:$src)>; > +def : Pat<(i64 (bitconvert (v2f32 VR64:$src))), > + (MMX_MOVD64from64rr VR64:$src)>; > def : Pat<(i64 (bitconvert (v4i16 VR64:$src))), > (MMX_MOVD64from64rr VR64:$src)>; > def : Pat<(i64 (bitconvert (v8i8 VR64:$src))), > > Modified: llvm/trunk/lib/Target/X86/X86RegisterInfo.td > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86RegisterInfo.td?rev=52691&r1=52690&r2=52691&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/lib/Target/X86/X86RegisterInfo.td (original) > +++ llvm/trunk/lib/Target/X86/X86RegisterInfo.td Tue Jun 24 17:01:44 > 2008 > @@ -509,7 +509,7 @@ > } > > // Generic vector registers: VR64 and VR128. > -def VR64 : RegisterClass<"X86", [v8i8, v4i16, v2i32, v1i64], 64, > +def VR64 : RegisterClass<"X86", [v8i8, v4i16, v2i32, v1i64, > v2f32], 64, > [MM0, MM1, MM2, MM3, MM4, MM5, MM6, MM7]>; > def VR128 : RegisterClass<"X86", [v16i8, v8i16, v4i32, v2i64, v4f32, > v2f64],128, > [XMM0, XMM1, XMM2, XMM3, XMM4, XMM5, XMM6, > XMM7, > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From gohman at apple.com Tue Jun 24 17:40:51 2008 From: gohman at apple.com (Dan Gohman) Date: Tue, 24 Jun 2008 15:40:51 -0700 Subject: [llvm-commits] [llvm] r52690 - /llvm/trunk/lib/VMCore/Constants.cpp In-Reply-To: <200806242158.m5OLwT9J002436@zion.cs.uiuc.edu> References: <200806242158.m5OLwT9J002436@zion.cs.uiuc.edu> Message-ID: <943BB3DB-302E-470D-BD7D-2F4AFAEAE658@apple.com> On Jun 24, 2008, at 2:58 PM, Owen Anderson wrote: > Author: resistor > Date: Tue Jun 24 16:58:29 2008 > New Revision: 52690 > > URL: http://llvm.org/viewvc/llvm-project?rev=52690&view=rev > Log: > In ConstantArray::getAsString(), we know the size of the resultant > string in advance so we can pre-allocate it and just fill in > the entries. This improves the time for the AsmPrinter on > InstructionCombining.cpp from 0.4248s to 0.3370s. > > Modified: > llvm/trunk/lib/VMCore/Constants.cpp > > Modified: llvm/trunk/lib/VMCore/Constants.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Constants.cpp?rev=52690&r1=52689&r2=52690&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/lib/VMCore/Constants.cpp (original) > +++ llvm/trunk/lib/VMCore/Constants.cpp Tue Jun 24 16:58:29 2008 > @@ -1378,8 +1378,9 @@ > std::string ConstantArray::getAsString() const { > assert(isString() && "Not a string!"); > std::string Result; > + Result.reserve(getNumOperands()); This should be resize, not reserve. > > for (unsigned i = 0, e = getNumOperands(); i != e; ++i) > - Result += (char)cast(getOperand(i))->getZExtValue(); > + Result[i] = (char)cast(getOperand(i))- > >getZExtValue(); > return Result; > } Dan From dalej at apple.com Tue Jun 24 17:45:28 2008 From: dalej at apple.com (Dale Johannesen) Date: Tue, 24 Jun 2008 15:45:28 -0700 Subject: [llvm-commits] [llvm] r52691 - in /llvm/trunk/lib/Target/X86: X86CallingConv.td X86ISelLowering.cpp X86InstrMMX.td X86RegisterInfo.td In-Reply-To: <7302B645-6876-46A0-B047-54E121BF812E@apple.com> References: <200806242201.m5OM1j8D002551@zion.cs.uiuc.edu> <7302B645-6876-46A0-B047-54E121BF812E@apple.com> Message-ID: <57FB4A18-A5C5-4CB1-8210-62586226B6D5@apple.com> On Jun 24, 2008, at 3:32 PMPDT, Chris Lattner wrote: > > On Jun 24, 2008, at 3:01 PM, Dale Johannesen wrote: > >> Author: johannes >> Date: Tue Jun 24 17:01:44 2008 >> New Revision: 52691 >> >> URL: http://llvm.org/viewvc/llvm-project?rev=52691&view=rev >> Log: >> Add v2f32 (MMX) type to X86. Support is primitive: >> load,store,call,return,bitcast. This is enough to >> make call and return work. > > If LLVM IR contains an add (or some other operation) on v2f32 values, > do they correctly still get scalarized? > > -Chris I haven't tested extensively, but add of two v2f32's appears to produce the right code (two float adds). >> Modified: >> llvm/trunk/lib/Target/X86/X86CallingConv.td >> llvm/trunk/lib/Target/X86/X86ISelLowering.cpp >> llvm/trunk/lib/Target/X86/X86InstrMMX.td >> llvm/trunk/lib/Target/X86/X86RegisterInfo.td >> >> Modified: llvm/trunk/lib/Target/X86/X86CallingConv.td >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86CallingConv.td?rev=52691&r1=52690&r2=52691&view=diff >> >> = >> = >> = >> = >> = >> = >> = >> = >> = >> ===================================================================== >> --- llvm/trunk/lib/Target/X86/X86CallingConv.td (original) >> +++ llvm/trunk/lib/Target/X86/X86CallingConv.td Tue Jun 24 17:01:44 >> 2008 >> @@ -35,7 +35,7 @@ >> >> // MMX vector types are always returned in MM0. If the target >> doesn't have >> // MM0, it doesn't support these vector types. >> - CCIfType<[v8i8, v4i16, v2i32, v1i64], CCAssignToReg<[MM0]>>, >> + CCIfType<[v8i8, v4i16, v2i32, v1i64, v2f32], >> CCAssignToReg<[MM0]>>, >> >> // Long double types are always returned in ST0 (even with SSE). >> CCIfType<[f80], CCAssignToReg<[ST0, ST1]>> >> @@ -75,6 +75,9 @@ >> // The X86-64 calling convention always returns FP values in XMM0. >> CCIfType<[f32], CCAssignToReg<[XMM0, XMM1]>>, >> CCIfType<[f64], CCAssignToReg<[XMM0, XMM1]>>, >> + >> + // MMX vector types are always returned in XMM0. >> + CCIfType<[v8i8, v4i16, v2i32, v1i64, v2f32], CCAssignToReg<[XMM0, >> XMM1]>>, >> CCDelegateTo >> ]>; >> >> @@ -141,7 +144,7 @@ >> >> // The first 8 MMX (except for v1i64) vector arguments are passed >> in XMM >> // registers on Darwin. >> - CCIfType<[v8i8, v4i16, v2i32], >> + CCIfType<[v8i8, v4i16, v2i32, v2f32], >> CCIfSubtarget<"isTargetDarwin()", >> CCIfSubtarget<"hasSSE2()", >> CCAssignToReg<[XMM0, XMM1, XMM2, XMM3, XMM4, XMM5, XMM6, >> XMM7]>>>>, >> @@ -163,7 +166,7 @@ >> CCIfType<[v16i8, v8i16, v4i32, v2i64, v4f32, v2f64], >> CCAssignToStack<16, 16>>, >> >> // __m64 vectors get 8-byte stack slots that are 8-byte aligned. >> - CCIfType<[v8i8, v4i16, v2i32, v1i64], CCAssignToStack<8, 8>> >> + CCIfType<[v8i8, v4i16, v2i32, v1i64, v2f32], CCAssignToStack<8, >> 8>> >> ]>; >> >> // Calling convention used on Win64 >> @@ -189,7 +192,7 @@ >> [RCX , RDX , R8 , R9 ]>>, >> >> // The first 4 MMX vector arguments are passed in GPRs. >> - CCIfType<[v8i8, v4i16, v2i32, v1i64], >> + CCIfType<[v8i8, v4i16, v2i32, v1i64, v2f32], >> CCAssignToRegWithShadow<[RCX , RDX , R8 , R9 ], >> [XMM0, XMM1, XMM2, XMM3]>>, >> >> @@ -230,7 +233,7 @@ >> >> // The first 8 MMX (except for v1i64) vector arguments are passed >> in XMM >> // registers on Darwin. >> - CCIfType<[v8i8, v4i16, v2i32], >> + CCIfType<[v8i8, v4i16, v2i32, v2f32], >> CCIfSubtarget<"isTargetDarwin()", >> CCAssignToReg<[XMM0, XMM1, XMM2, XMM3, XMM4, XMM5, XMM6, >> XMM7]>>>, >> >> @@ -270,7 +273,7 @@ >> >> // The first 3 __m64 (except for v1i64) vector arguments are >> passed in mmx >> // registers if the call is not a vararg call. >> - CCIfNotVarArg> + CCIfNotVarArg> CCAssignToReg<[MM0, MM1, MM2]>>>, >> >> // Integer/Float values get stored in stack slots that are 4 bytes >> in >> >> Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.cpp?rev=52691&r1=52690&r2=52691&view=diff >> >> = >> = >> = >> = >> = >> = >> = >> = >> = >> ===================================================================== >> --- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original) >> +++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Tue Jun 24 >> 17:01:44 2008 >> @@ -536,6 +536,7 @@ >> addRegisterClass(MVT::v8i8, X86::VR64RegisterClass); >> addRegisterClass(MVT::v4i16, X86::VR64RegisterClass); >> addRegisterClass(MVT::v2i32, X86::VR64RegisterClass); >> + addRegisterClass(MVT::v2f32, X86::VR64RegisterClass); >> addRegisterClass(MVT::v1i64, X86::VR64RegisterClass); >> >> // FIXME: add MMX packed arithmetics >> @@ -583,11 +584,14 @@ >> AddPromotedToType (ISD::LOAD, MVT::v4i16, >> MVT::v1i64); >> setOperationAction(ISD::LOAD, MVT::v2i32, Promote); >> AddPromotedToType (ISD::LOAD, MVT::v2i32, >> MVT::v1i64); >> + setOperationAction(ISD::LOAD, MVT::v2f32, >> Promote); >> + AddPromotedToType (ISD::LOAD, MVT::v2f32, >> MVT::v1i64); >> setOperationAction(ISD::LOAD, MVT::v1i64, Legal); >> >> setOperationAction(ISD::BUILD_VECTOR, MVT::v8i8, Custom); >> setOperationAction(ISD::BUILD_VECTOR, MVT::v4i16, Custom); >> setOperationAction(ISD::BUILD_VECTOR, MVT::v2i32, Custom); >> + setOperationAction(ISD::BUILD_VECTOR, MVT::v2f32, Custom); >> setOperationAction(ISD::BUILD_VECTOR, MVT::v1i64, Custom); >> >> setOperationAction(ISD::VECTOR_SHUFFLE, MVT::v8i8, Custom); >> @@ -894,7 +898,7 @@ >> // Don't emit a copytoreg. >> continue; >> } >> - >> + >> Chain = DAG.getCopyToReg(Chain, VA.getLocReg(), ValToCopy, Flag); >> Flag = Chain.getValue(1); >> } >> >> Modified: llvm/trunk/lib/Target/X86/X86InstrMMX.td >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86InstrMMX.td?rev=52691&r1=52690&r2=52691&view=diff >> >> = >> = >> = >> = >> = >> = >> = >> = >> = >> ===================================================================== >> --- llvm/trunk/lib/Target/X86/X86InstrMMX.td (original) >> +++ llvm/trunk/lib/Target/X86/X86InstrMMX.td Tue Jun 24 17:01:44 2008 >> @@ -528,20 +528,30 @@ >> (MMX_MOVQ64mr addr:$dst, VR64:$src)>; >> def : Pat<(store (v2i32 VR64:$src), addr:$dst), >> (MMX_MOVQ64mr addr:$dst, VR64:$src)>; >> +def : Pat<(store (v2f32 VR64:$src), addr:$dst), >> + (MMX_MOVQ64mr addr:$dst, VR64:$src)>; >> def : Pat<(store (v1i64 VR64:$src), addr:$dst), >> (MMX_MOVQ64mr addr:$dst, VR64:$src)>; >> >> // Bit convert. >> def : Pat<(v8i8 (bitconvert (v1i64 VR64:$src))), (v8i8 VR64:$src)>; >> def : Pat<(v8i8 (bitconvert (v2i32 VR64:$src))), (v8i8 VR64:$src)>; >> +def : Pat<(v8i8 (bitconvert (v2f32 VR64:$src))), (v8i8 >> VR64:$src)>; >> def : Pat<(v8i8 (bitconvert (v4i16 VR64:$src))), (v8i8 VR64:$src)>; >> def : Pat<(v4i16 (bitconvert (v1i64 VR64:$src))), (v4i16 VR64:$src)>; >> def : Pat<(v4i16 (bitconvert (v2i32 VR64:$src))), (v4i16 VR64:$src)>; >> +def : Pat<(v4i16 (bitconvert (v2f32 VR64:$src))), (v4i16 >> VR64:$src)>; >> def : Pat<(v4i16 (bitconvert (v8i8 VR64:$src))), (v4i16 VR64:$src)>; >> def : Pat<(v2i32 (bitconvert (v1i64 VR64:$src))), (v2i32 VR64:$src)>; >> +def : Pat<(v2i32 (bitconvert (v2f32 VR64:$src))), (v2i32 >> VR64:$src)>; >> def : Pat<(v2i32 (bitconvert (v4i16 VR64:$src))), (v2i32 VR64:$src)>; >> def : Pat<(v2i32 (bitconvert (v8i8 VR64:$src))), (v2i32 VR64:$src)>; >> +def : Pat<(v2f32 (bitconvert (v1i64 VR64:$src))), (v2f32 >> VR64:$src)>; >> +def : Pat<(v2f32 (bitconvert (v2i32 VR64:$src))), (v2f32 >> VR64:$src)>; >> +def : Pat<(v2f32 (bitconvert (v4i16 VR64:$src))), (v2f32 >> VR64:$src)>; >> +def : Pat<(v2f32 (bitconvert (v8i8 VR64:$src))), (v2f32 >> VR64:$src)>; >> def : Pat<(v1i64 (bitconvert (v2i32 VR64:$src))), (v1i64 VR64:$src)>; >> +def : Pat<(v1i64 (bitconvert (v2f32 VR64:$src))), (v1i64 >> VR64:$src)>; >> def : Pat<(v1i64 (bitconvert (v4i16 VR64:$src))), (v1i64 VR64:$src)>; >> def : Pat<(v1i64 (bitconvert (v8i8 VR64:$src))), (v1i64 VR64:$src)>; >> >> @@ -550,6 +560,8 @@ >> (MMX_MOVD64to64rr GR64:$src)>; >> def : Pat<(v2i32 (bitconvert (i64 GR64:$src))), >> (MMX_MOVD64to64rr GR64:$src)>; >> +def : Pat<(v2f32 (bitconvert (i64 GR64:$src))), >> + (MMX_MOVD64to64rr GR64:$src)>; >> def : Pat<(v4i16 (bitconvert (i64 GR64:$src))), >> (MMX_MOVD64to64rr GR64:$src)>; >> def : Pat<(v8i8 (bitconvert (i64 GR64:$src))), >> @@ -558,6 +570,8 @@ >> (MMX_MOVD64from64rr VR64:$src)>; >> def : Pat<(i64 (bitconvert (v2i32 VR64:$src))), >> (MMX_MOVD64from64rr VR64:$src)>; >> +def : Pat<(i64 (bitconvert (v2f32 VR64:$src))), >> + (MMX_MOVD64from64rr VR64:$src)>; >> def : Pat<(i64 (bitconvert (v4i16 VR64:$src))), >> (MMX_MOVD64from64rr VR64:$src)>; >> def : Pat<(i64 (bitconvert (v8i8 VR64:$src))), >> >> Modified: llvm/trunk/lib/Target/X86/X86RegisterInfo.td >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86RegisterInfo.td?rev=52691&r1=52690&r2=52691&view=diff >> >> = >> = >> = >> = >> = >> = >> = >> = >> = >> ===================================================================== >> --- llvm/trunk/lib/Target/X86/X86RegisterInfo.td (original) >> +++ llvm/trunk/lib/Target/X86/X86RegisterInfo.td Tue Jun 24 17:01:44 >> 2008 >> @@ -509,7 +509,7 @@ >> } >> >> // Generic vector registers: VR64 and VR128. >> -def VR64 : RegisterClass<"X86", [v8i8, v4i16, v2i32, v1i64], 64, >> +def VR64 : RegisterClass<"X86", [v8i8, v4i16, v2i32, v1i64, >> v2f32], 64, >> [MM0, MM1, MM2, MM3, MM4, MM5, MM6, MM7]>; >> def VR128 : RegisterClass<"X86", [v16i8, v8i16, v4i32, v2i64, v4f32, >> v2f64],128, >> [XMM0, XMM1, XMM2, XMM3, XMM4, XMM5, XMM6, >> XMM7, >> >> >> _______________________________________________ >> 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 monping at apple.com Tue Jun 24 17:47:18 2008 From: monping at apple.com (Mon P Wang) Date: Tue, 24 Jun 2008 15:47:18 -0700 Subject: [llvm-commits] atomics memoperands patch In-Reply-To: <343994E7-B22F-4585-9424-4319A65924BE@apple.com> References: <5EAD215D-D32D-4C78-8020-E17D5179A72A@apple.com> <2FBBC83F-5CEB-456E-8101-E64987C4BEF1@apple.com> <343994E7-B22F-4585-9424-4319A65924BE@apple.com> Message-ID: <23B65FA1-D064-42F5-96E2-977C73849DF1@apple.com> Hi, As I was reviewing code, I noticed that I didn't change the intrinsic names. I'm assuming that we want to change llvm.atomic.lcs => llvm.atomic.cmp_swap etc... and add it to the list to auto-upgrade -- Mon Ping On Jun 20, 2008, at 12:26 PM, Evan Cheng wrote: > > On Jun 20, 2008, at 9:30 AM, Mon P Wang wrote: > >> Hi Evan, >> On Jun 20, 2008, at 12:11 AM, Evan Cheng wrote: >> >>> Thanks Mon Ping. Some comments: >>> >>> + N->getOpcode() == ISD::ATOMIC_LCS || >>> + N->getOpcode() == ISD::ATOMIC_LAS || >>> + N->getOpcode() == ISD::ATOMIC_SWAP || >>> + N->getOpcode() == ISD::ATOMIC_LSS || >>> + N->getOpcode() == ISD::ATOMIC_LOAD_AND || >>> + N->getOpcode() == ISD::ATOMIC_LOAD_OR || >>> + N->getOpcode() == ISD::ATOMIC_LOAD_XOR || >>> >>> Does it make sense to take this opportunity to rename lcs, las, and >>> lss? >>> >> >> I heard the same comment from Andrew and I think it makes sense. How >> about the following >> ATOMIC_LCS => ATOMIC_CMP_SWAP >> ATOMIC_LAS => ATOMIC_LOAD_ADD >> ATOMIC_LSS => ATOMIC_LOAD_SUB > > Yes! > >> >> >> This would make the names more consistent. >> From ggreif at gmail.com Tue Jun 24 19:10:22 2008 From: ggreif at gmail.com (Gabor Greif) Date: Wed, 25 Jun 2008 00:10:22 -0000 Subject: [llvm-commits] [llvm] r52699 - /llvm/trunk/docs/ProgrammersManual.html Message-ID: <200806250010.m5P0AMTv007283@zion.cs.uiuc.edu> Author: ggreif Date: Tue Jun 24 19:10:22 2008 New Revision: 52699 URL: http://llvm.org/viewvc/llvm-project?rev=52699&view=rev Log: Use present tense when talking about User layout. It is implemented now. Modified: llvm/trunk/docs/ProgrammersManual.html Modified: llvm/trunk/docs/ProgrammersManual.html URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/ProgrammersManual.html?rev=52699&r1=52698&r2=52699&view=diff ============================================================================== --- llvm/trunk/docs/ProgrammersManual.html (original) +++ llvm/trunk/docs/ProgrammersManual.html Tue Jun 24 19:10:22 2008 @@ -2265,18 +2265,18 @@ number of them.

    -Initially each layout will possess a direct pointer to the +As of v2.4 each layout still possesses a direct pointer to the start of the array of Uses. Though not mandatory for layout a), we stick to this redundancy for the sake of simplicity. -The User object will also store the number of Use objects it +The User object also stores the number of Use objects it has. (Theoretically this information can also be calculated given the scheme presented below.)

    Special forms of allocation operators (operator new) -will enforce the following memory layouts:

    +enforce the following memory layouts:

      -
    • Layout a) will be modelled by prepending the User object by the Use[] array.

      +
    • Layout a) is modelled by prepending the User object by the Use[] array.

       ...---.---.---.---.-------...
      @@ -2284,7 +2284,7 @@
       '''---'---'---'---'-------'''
       
      -
    • Layout b) will be modelled by pointing at the Use[] array.

      +
    • Layout b) is modelled by pointing at the Use[] array.

       .-------...
       | User
      @@ -2306,12 +2306,12 @@
       
       

      -Since the Use objects will be deprived of the direct pointer to +Since the Use objects are deprived of the direct (back)pointer to their User objects, there must be a fast and exact method to recover it. This is accomplished by the following scheme:

      -A bit-encoding in the 2 LSBits (least significant bits) of the Use::Prev will allow to find the +A bit-encoding in the 2 LSBits (least significant bits) of the Use::Prev allows to find the start of the User object:
      • 00 —> binary digit 0
      • @@ -2441,9 +2441,9 @@ new Use** on every modification. Accordingly getters must strip the tag bits.

        -For layout b) instead of the User we will find a pointer (User* with LSBit set). -Following this pointer brings us to the User. A portable trick will ensure -that the first bytes of User (if interpreted as a pointer) will never have +For layout b) instead of the User we find a pointer (User* with LSBit set). +Following this pointer brings us to the User. A portable trick ensures +that the first bytes of User (if interpreted as a pointer) never has the LSBit set.

    From eli.friedman at gmail.com Tue Jun 24 19:59:02 2008 From: eli.friedman at gmail.com (Eli Friedman) Date: Tue, 24 Jun 2008 17:59:02 -0700 Subject: [llvm-commits] [llvm] r52691 - in /llvm/trunk/lib/Target/X86: X86CallingConv.td X86ISelLowering.cpp X86InstrMMX.td X86RegisterInfo.td Message-ID: "Add v2f32 (MMX) type to X86." This doesn't make any sense. x86 doesn't have a v2f32 type: floating point operations aren't supported on MMX registers. Is there anything useful that can be done with a legal v2f32 that can't be done by just bitcasting it to a v2i32? -Eli From resistor at mac.com Tue Jun 24 20:05:06 2008 From: resistor at mac.com (Owen Anderson) Date: Wed, 25 Jun 2008 01:05:06 -0000 Subject: [llvm-commits] [llvm] r52700 - /llvm/trunk/lib/VMCore/Constants.cpp Message-ID: <200806250105.m5P156Cu008876@zion.cs.uiuc.edu> Author: resistor Date: Tue Jun 24 20:05:05 2008 New Revision: 52700 URL: http://llvm.org/viewvc/llvm-project?rev=52700&view=rev Log: Use push_back rather than operator[], which is incorrect in this cases. Unfortunately, this slow the testcase down a little bit, but only marginally. Modified: llvm/trunk/lib/VMCore/Constants.cpp Modified: llvm/trunk/lib/VMCore/Constants.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Constants.cpp?rev=52700&r1=52699&r2=52700&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/Constants.cpp (original) +++ llvm/trunk/lib/VMCore/Constants.cpp Tue Jun 24 20:05:05 2008 @@ -1380,7 +1380,7 @@ std::string Result; Result.reserve(getNumOperands()); for (unsigned i = 0, e = getNumOperands(); i != e; ++i) - Result[i] = (char)cast(getOperand(i))->getZExtValue(); + Result.push_back((char)cast(getOperand(i))->getZExtValue()); return Result; } From evan.cheng at apple.com Tue Jun 24 20:16:39 2008 From: evan.cheng at apple.com (Evan Cheng) Date: Wed, 25 Jun 2008 01:16:39 -0000 Subject: [llvm-commits] [llvm] r52701 - in /llvm/trunk: lib/CodeGen/TwoAddressInstructionPass.cpp lib/Target/X86/X86Instr64bit.td test/CodeGen/X86/2007-11-30-LoadFolding-Bug.ll test/CodeGen/X86/twoaddr-remat.ll Message-ID: <200806250116.m5P1Gdnm009223@zion.cs.uiuc.edu> Author: evancheng Date: Tue Jun 24 20:16:38 2008 New Revision: 52701 URL: http://llvm.org/viewvc/llvm-project?rev=52701&view=rev Log: Enable two-address remat by default. Added: llvm/trunk/test/CodeGen/X86/twoaddr-remat.ll Modified: llvm/trunk/lib/CodeGen/TwoAddressInstructionPass.cpp llvm/trunk/lib/Target/X86/X86Instr64bit.td llvm/trunk/test/CodeGen/X86/2007-11-30-LoadFolding-Bug.ll Modified: llvm/trunk/lib/CodeGen/TwoAddressInstructionPass.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/TwoAddressInstructionPass.cpp?rev=52701&r1=52700&r2=52701&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/TwoAddressInstructionPass.cpp (original) +++ llvm/trunk/lib/CodeGen/TwoAddressInstructionPass.cpp Tue Jun 24 20:16:38 2008 @@ -53,10 +53,6 @@ STATISTIC(Num3AddrSunk, "Number of 3-address instructions sunk"); STATISTIC(NumReMats, "Number of instructions re-materialized"); -static cl::opt -EnableReMat("two-addr-remat", cl::init(false), cl::Hidden, - cl::desc("Two-addr conversion should remat when possible.")); - namespace { class VISIBILITY_HIDDEN TwoAddressInstructionPass : public MachineFunctionPass { @@ -71,8 +67,8 @@ bool isSafeToReMat(unsigned DstReg, MachineInstr *MI); bool isProfitableToReMat(unsigned Reg, const TargetRegisterClass *RC, - MachineInstr *MI, unsigned Loc, - MachineInstr *DefMI, MachineBasicBlock *MBB, + MachineInstr *MI, MachineInstr *DefMI, + MachineBasicBlock *MBB, unsigned Loc, DenseMap &DistanceMap); public: static char ID; // Pass identification, replacement for typeid @@ -248,12 +244,9 @@ bool TwoAddressInstructionPass::isProfitableToReMat(unsigned Reg, const TargetRegisterClass *RC, - MachineInstr *MI, unsigned Loc, - MachineInstr *DefMI, MachineBasicBlock *MBB, - DenseMap &DistanceMap) { - if (DefMI->getParent() != MBB) - return true; - // If earlier uses in MBB are not two-address uses, then don't remat. + MachineInstr *MI, MachineInstr *DefMI, + MachineBasicBlock *MBB, unsigned Loc, + DenseMap &DistanceMap){ bool OtherUse = false; for (MachineRegisterInfo::use_iterator UI = MRI->use_begin(Reg), UE = MRI->use_end(); UI != UE; ++UI) { @@ -261,18 +254,26 @@ if (!UseMO.isUse()) continue; MachineInstr *UseMI = UseMO.getParent(); - if (UseMI->getParent() != MBB) - continue; - DenseMap::iterator DI = DistanceMap.find(UseMI); - if (DI != DistanceMap.end() && DI->second == Loc) - continue; // Current use. - OtherUse = true; - // There is at least one other use in the MBB that will clobber the - // register. - if (isTwoAddrUse(UseMI, Reg)) - return true; + MachineBasicBlock *UseMBB = UseMI->getParent(); + if (UseMBB == MBB) { + DenseMap::iterator DI = DistanceMap.find(UseMI); + if (DI != DistanceMap.end() && DI->second == Loc) + continue; // Current use. + OtherUse = true; + // There is at least one other use in the MBB that will clobber the + // register. + if (isTwoAddrUse(UseMI, Reg)) + return true; + } } - return !OtherUse; + + // If other uses in MBB are not two-address uses, then don't remat. + if (OtherUse) + return false; + + // No other uses in the same block, remat if it's defined in the same + // block so it does not unnecessarily extend the live range. + return MBB == DefMI->getParent(); } /// runOnMachineFunction - Reduce two-address instructions to two operands. @@ -428,9 +429,9 @@ MachineInstr *DefMI = MRI->getVRegDef(regB); // If it's safe and profitable, remat the definition instead of // copying it. - if (EnableReMat && DefMI && + if (DefMI && isSafeToReMat(regB, DefMI) && - isProfitableToReMat(regB, rc, mi, Dist, DefMI, mbbi,DistanceMap)){ + isProfitableToReMat(regB, rc, mi, DefMI, mbbi, Dist,DistanceMap)){ DEBUG(cerr << "2addr: REMATTING : " << *DefMI << "\n"); TII->reMaterialize(*mbbi, mi, regA, DefMI); ReMatRegs.set(regB); @@ -473,17 +474,14 @@ } } - if (EnableReMat) { - // Some remat'ed instructions are dead. - int VReg = ReMatRegs.find_first(); - while (VReg != -1) { - if (MRI->use_empty(VReg)) { - MachineInstr *DefMI = MRI->getVRegDef(VReg); - DefMI->eraseFromParent(); - } - VReg = ReMatRegs.find_next(VReg); + // Some remat'ed instructions are dead. + int VReg = ReMatRegs.find_first(); + while (VReg != -1) { + if (MRI->use_empty(VReg)) { + MachineInstr *DefMI = MRI->getVRegDef(VReg); + DefMI->eraseFromParent(); } - + VReg = ReMatRegs.find_next(VReg); } return MadeChange; Modified: llvm/trunk/lib/Target/X86/X86Instr64bit.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86Instr64bit.td?rev=52701&r1=52700&r2=52701&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86Instr64bit.td (original) +++ llvm/trunk/lib/Target/X86/X86Instr64bit.td Tue Jun 24 20:16:38 2008 @@ -199,7 +199,7 @@ def MOV64rr : RI<0x89, MRMDestReg, (outs GR64:$dst), (ins GR64:$src), "mov{q}\t{$src, $dst|$dst, $src}", []>; -let isReMaterializable = 1 in { +let isReMaterializable = 1, isAsCheapAsAMove = 1 in { def MOV64ri : RIi64<0xB8, AddRegFrm, (outs GR64:$dst), (ins i64imm:$src), "movabs{q}\t{$src, $dst|$dst, $src}", [(set GR64:$dst, imm:$src)]>; Modified: llvm/trunk/test/CodeGen/X86/2007-11-30-LoadFolding-Bug.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/2007-11-30-LoadFolding-Bug.ll?rev=52701&r1=52700&r2=52701&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/X86/2007-11-30-LoadFolding-Bug.ll (original) +++ llvm/trunk/test/CodeGen/X86/2007-11-30-LoadFolding-Bug.ll Tue Jun 24 20:16:38 2008 @@ -3,7 +3,7 @@ declare fastcc void @rdft(i32, i32, double*, i32*, double*) -define fastcc void @mp_sqrt(i32 %n, i32 %radix, i32* %in, i32* %out, i32* %tmp1, i32* %tmp2, i32 %nfft, double* %tmp1fft, double* %tmp2fft, i32* %ip, double* %w) { +define fastcc void @mp_sqrt(i32 %n, i32 %radix, i32* %in, i32* %out, i32* %tmp1, i32* %tmp2, i32 %nfft, double* %tmp1fft, double* %tmp2fft, i32* %ip, double* %w) nounwind { entry: br label %bb.i5 Added: llvm/trunk/test/CodeGen/X86/twoaddr-remat.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/twoaddr-remat.ll?rev=52701&view=auto ============================================================================== --- llvm/trunk/test/CodeGen/X86/twoaddr-remat.ll (added) +++ llvm/trunk/test/CodeGen/X86/twoaddr-remat.ll Tue Jun 24 20:16:38 2008 @@ -0,0 +1,67 @@ +; RUN: llvm-as < %s | llc -march=x86 | grep 59796 | count 3 + + %Args = type %Value* + %Exec = type opaque* + %Identifier = type opaque* + %JSFunction = type %Value (%Exec, %Scope, %Value, %Args) + %PropertyNameArray = type opaque* + %Scope = type opaque* + %Value = type opaque* + +declare i1 @X1(%Exec) readonly + +declare %Value @X2(%Exec) + +declare i32 @X3(%Exec, %Value) + +declare %Value @X4(i32) readnone + +define internal %Value @fast3bitlookup(%Exec %exec, %Scope %scope, %Value %this, %Args %args) nounwind { +prologue: + %eh_check = tail call i1 @X1( %Exec %exec ) readonly ; [#uses=1] + br i1 %eh_check, label %exception, label %no_exception + +exception: ; preds = %no_exception, %prologue + %rethrow_result = tail call %Value @X2( %Exec %exec ) ; <%Value> [#uses=1] + ret %Value %rethrow_result + +no_exception: ; preds = %prologue + %args_intptr = bitcast %Args %args to i32* ; [#uses=1] + %argc_val = load i32* %args_intptr ; [#uses=1] + %cmpParamArgc = icmp sgt i32 %argc_val, 0 ; [#uses=1] + %arg_ptr = getelementptr %Args %args, i32 1 ; <%Args> [#uses=1] + %arg_val = load %Args %arg_ptr ; <%Value> [#uses=1] + %ext_arg_val = select i1 %cmpParamArgc, %Value %arg_val, %Value inttoptr (i32 5 to %Value) ; <%Value> [#uses=1] + %toInt325 = tail call i32 @X3( %Exec %exec, %Value %ext_arg_val ) ; [#uses=3] + %eh_check6 = tail call i1 @X1( %Exec %exec ) readonly ; [#uses=1] + br i1 %eh_check6, label %exception, label %no_exception7 + +no_exception7: ; preds = %no_exception + %shl_tmp_result = shl i32 %toInt325, 1 ; [#uses=1] + %rhs_masked13 = and i32 %shl_tmp_result, 14 ; [#uses=1] + %ashr_tmp_result = lshr i32 59796, %rhs_masked13 ; [#uses=1] + %and_tmp_result15 = and i32 %ashr_tmp_result, 3 ; [#uses=1] + %ashr_tmp_result3283 = lshr i32 %toInt325, 2 ; [#uses=1] + %rhs_masked38 = and i32 %ashr_tmp_result3283, 14 ; [#uses=1] + %ashr_tmp_result39 = lshr i32 59796, %rhs_masked38 ; [#uses=1] + %and_tmp_result41 = and i32 %ashr_tmp_result39, 3 ; [#uses=1] + %addconv = add i32 %and_tmp_result15, %and_tmp_result41 ; [#uses=1] + %ashr_tmp_result6181 = lshr i32 %toInt325, 5 ; [#uses=1] + %rhs_masked67 = and i32 %ashr_tmp_result6181, 6 ; [#uses=1] + %ashr_tmp_result68 = lshr i32 59796, %rhs_masked67 ; [#uses=1] + %and_tmp_result70 = and i32 %ashr_tmp_result68, 3 ; [#uses=1] + %addconv82 = add i32 %addconv, %and_tmp_result70 ; [#uses=3] + %rangetmp = add i32 %addconv82, 536870912 ; [#uses=1] + %rangecmp = icmp ult i32 %rangetmp, 1073741824 ; [#uses=1] + br i1 %rangecmp, label %NumberLiteralIntFast, label %NumberLiteralIntSlow + +NumberLiteralIntFast: ; preds = %no_exception7 + %imm_shift = shl i32 %addconv82, 2 ; [#uses=1] + %imm_or = or i32 %imm_shift, 3 ; [#uses=1] + %imm_val = inttoptr i32 %imm_or to %Value ; <%Value> [#uses=1] + ret %Value %imm_val + +NumberLiteralIntSlow: ; preds = %no_exception7 + %toVal = call %Value @X4( i32 %addconv82 ) ; <%Value> [#uses=1] + ret %Value %toVal +} From dalej at apple.com Tue Jun 24 20:20:14 2008 From: dalej at apple.com (Dale Johannesen) Date: Tue, 24 Jun 2008 18:20:14 -0700 Subject: [llvm-commits] [llvm] r52691 - in /llvm/trunk/lib/Target/X86: X86CallingConv.td X86ISelLowering.cpp X86InstrMMX.td X86RegisterInfo.td In-Reply-To: References: Message-ID: <93CF5F93-F500-4066-8EFE-75FB81149D30@apple.com> On Jun 24, 2008, at 5:59 PMPDT, Eli Friedman wrote: > "Add v2f32 (MMX) type to X86." > > This doesn't make any sense. x86 doesn't have a v2f32 type: floating > point operations aren't supported on MMX registers. Is there anything > useful that can be done with a legal v2f32 that can't be done by just > bitcasting it to a v2i32? For parameter passing purposes this type uses MMX registers, so I think it makes sense to represent it this way. You could probably get it to work the way you suggest. From evan.cheng at apple.com Tue Jun 24 20:24:25 2008 From: evan.cheng at apple.com (Evan Cheng) Date: Tue, 24 Jun 2008 18:24:25 -0700 Subject: [llvm-commits] [llvm] r52688 - in /llvm/trunk: lib/Transforms/Utils/UnrollLoop.cpp test/Transforms/LoopUnroll/multiple-phis.ll test/Transforms/LoopUnroll/pr2253.ll In-Reply-To: <200806242044.m5OKihhI031581@zion.cs.uiuc.edu> References: <200806242044.m5OKihhI031581@zion.cs.uiuc.edu> Message-ID: <86DA0DDE-13BA-4E51-9A79-22DB5628CBA7@apple.com> This causes these annoying dejagnu failures since the files are now empty. Perhaps we should just xfail them for now? FAIL: /Users/echeng/LLVM/llvm/test/Transforms/LoopUnroll/multiple- phis.ll: Does not have a RUN line FAIL: /Users/echeng/LLVM/llvm/test/Transforms/LoopUnroll/pr2253.ll: Does not have a RUN line Evan On Jun 24, 2008, at 1:44 PM, Dan Gohman wrote: > Author: djg > Date: Tue Jun 24 15:44:42 2008 > New Revision: 52688 > > URL: http://llvm.org/viewvc/llvm-project?rev=52688&view=rev > Log: > Revert 52645, the loop unroller changes. It caused a regression in > 252.eon. > > Removed: > llvm/trunk/test/Transforms/LoopUnroll/multiple-phis.ll > llvm/trunk/test/Transforms/LoopUnroll/pr2253.ll > Modified: > llvm/trunk/lib/Transforms/Utils/UnrollLoop.cpp > > Modified: llvm/trunk/lib/Transforms/Utils/UnrollLoop.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/UnrollLoop.cpp?rev=52688&r1=52687&r2=52688&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/lib/Transforms/Utils/UnrollLoop.cpp (original) > +++ llvm/trunk/lib/Transforms/Utils/UnrollLoop.cpp Tue Jun 24 > 15:44:42 2008 > @@ -22,7 +22,6 @@ > #include "llvm/Transforms/Utils/UnrollLoop.h" > #include "llvm/BasicBlock.h" > #include "llvm/ADT/Statistic.h" > -#include "llvm/ADT/STLExtras.h" > #include "llvm/Analysis/ConstantFolding.h" > #include "llvm/Analysis/LoopPass.h" > #include "llvm/Support/Debug.h" > @@ -107,17 +106,13 @@ > /// > /// If a LoopPassManager is passed in, and the loop is fully > removed, it will be > /// removed from the LoopPassManager as well. LPM can also be NULL. > -bool llvm::UnrollLoop(Loop *L, unsigned Count, LoopInfo* LI, > - LPPassManager* LPM) { > +bool llvm::UnrollLoop(Loop *L, unsigned Count, LoopInfo* LI, > LPPassManager* LPM) { > assert(L->isLCSSAForm()); > > BasicBlock *Header = L->getHeader(); > BasicBlock *LatchBlock = L->getLoopLatch(); > BranchInst *BI = dyn_cast(LatchBlock->getTerminator()); > - > - Function *Func = Header->getParent(); > - Function::iterator BBInsertPt = > next(Function::iterator(LatchBlock)); > - > + > if (!BI || BI->isUnconditional()) { > // The loop-rotate pass can be helpful to avoid this in many > cases. > DOUT << " Can't unroll; loop not terminated by a conditional > branch.\n"; > @@ -173,148 +168,162 @@ > DOUT << "!\n"; > } > > - // Make a copy of the original LoopBlocks list so we can keep > referring > - // to it while hacking on the loop. > std::vector LoopBlocks = L->getBlocks(); > > - bool ContinueOnTrue = BI->getSuccessor(0) == Header; > + bool ContinueOnTrue = L->contains(BI->getSuccessor(0)); > BasicBlock *LoopExit = BI->getSuccessor(ContinueOnTrue); > > // For the first iteration of the loop, we should use the > precloned values for > // PHI nodes. Insert associations now. > typedef DenseMap ValueMapTy; > ValueMapTy LastValueMap; > + std::vector OrigPHINode; > for (BasicBlock::iterator I = Header->begin(); isa(I); + > +I) { > PHINode *PN = cast(I); > + OrigPHINode.push_back(PN); > if (Instruction *I = > dyn_cast(PN- > >getIncomingValueForBlock(LatchBlock))) > if (L->contains(I->getParent())) > LastValueMap[I] = I; > } > > - // Keep track of all the headers and latches that we create. > These are > - // needed by the logic that inserts the branches to connect all the > - // new blocks. > std::vector Headers; > std::vector Latches; > - Headers.reserve(Count); > - Latches.reserve(Count); > Headers.push_back(Header); > Latches.push_back(LatchBlock); > > - // Iterate through all but the first iterations, cloning blocks > from > - // the first iteration to populate the subsequent iterations. > for (unsigned It = 1; It != Count; ++It) { > char SuffixBuffer[100]; > sprintf(SuffixBuffer, ".%d", It); > > std::vector NewBlocks; > - NewBlocks.reserve(LoopBlocks.size()); > > - // Iterate through all the blocks in the original loop. > - for (std::vector::const_iterator BBI = > LoopBlocks.begin(), > - E = LoopBlocks.end(); BBI != E; ++BBI) { > - bool SuppressExitEdges = false; > - BasicBlock *BB = *BBI; > + for (std::vector::iterator BB = LoopBlocks.begin(), > + E = LoopBlocks.end(); BB != E; ++BB) { > ValueMapTy ValueMap; > - BasicBlock *New = CloneBasicBlock(BB, ValueMap, SuffixBuffer); > - NewBlocks.push_back(New); > - Func->getBasicBlockList().insert(BBInsertPt, New); > - L->addBasicBlockToLoop(New, LI->getBase()); > + BasicBlock *New = CloneBasicBlock(*BB, ValueMap, SuffixBuffer); > + Header->getParent()->getBasicBlockList().push_back(New); > > - // Special handling for the loop header block. > - if (BB == Header) { > - // Keep track of new headers as we create them, so that we > can insert > - // the proper branches later. > - Headers[It] = New; > - > - // Loop over all of the PHI nodes in the block, changing > them to use > - // the incoming values from the previous block. > - for (BasicBlock::iterator I = Header->begin(); > isa(I); ++I) { > - PHINode *NewPHI = cast(ValueMap[I]); > + // Loop over all of the PHI nodes in the block, changing them > to use the > + // incoming values from the previous block. > + if (*BB == Header) > + for (unsigned i = 0, e = OrigPHINode.size(); i != e; ++i) { > + PHINode *NewPHI = cast(ValueMap[OrigPHINode[i]]); > Value *InVal = NewPHI->getIncomingValueForBlock(LatchBlock); > if (Instruction *InValI = dyn_cast(InVal)) > if (It > 1 && L->contains(InValI->getParent())) > InVal = LastValueMap[InValI]; > - ValueMap[I] = InVal; > + ValueMap[OrigPHINode[i]] = InVal; > New->getInstList().erase(NewPHI); > } > - } > - > - // Special handling for the loop latch block. > - if (BB == LatchBlock) { > - // Keep track of new latches as we create them, so that we > can insert > - // the proper branches later. > - Latches[It] = New; > - > - // If knowledge of the trip count and/or multiple will > allow us > - // to emit unconditional branches in some of the new latch > blocks, > - // those blocks shouldn't be referenced by PHIs that > reference > - // the original latch. > - unsigned NextIt = (It + 1) % Count; > - SuppressExitEdges = > - NextIt != BreakoutTrip && > - (TripMultiple == 0 || NextIt % TripMultiple != 0); > - } > > // Update our running map of newest clones > - LastValueMap[BB] = New; > + LastValueMap[*BB] = New; > for (ValueMapTy::iterator VI = ValueMap.begin(), VE = > ValueMap.end(); > VI != VE; ++VI) > LastValueMap[VI->first] = VI->second; > > - // Add incoming values to phi nodes that reference this > block. The last > - // latch block may need to be referenced by the first header, > and any > - // block with an exit edge may be referenced from outside the > loop. > - for (Value::use_iterator UI = BB->use_begin(), UE = BB- > >use_end(); > - UI != UE; ) { > - PHINode *PN = dyn_cast(*UI++); > - if (PN && > - ((BB == LatchBlock && It == Count - 1 && ! > CompletelyUnroll) || > - (!SuppressExitEdges && !L->contains(PN- > >getParent())))) { > - Value *InVal = PN->getIncomingValueForBlock(BB); > - // If this value was defined in the loop, take the value > defined > - // by the last iteration of the loop. > - ValueMapTy::iterator VI = LastValueMap.find(InVal); > - if (VI != LastValueMap.end()) > - InVal = VI->second; > - PN->addIncoming(InVal, New); > + L->addBasicBlockToLoop(New, LI->getBase()); > + > + // Add phi entries for newly created values to all exit > blocks except > + // the successor of the latch block. The successor of the > exit block will > + // be updated specially after unrolling all the way. > + if (*BB != LatchBlock) > + for (Value::use_iterator UI = (*BB)->use_begin(), UE = > (*BB)->use_end(); > + UI != UE;) { > + Instruction *UseInst = cast(*UI); > + ++UI; > + if (isa(UseInst) && !L->contains(UseInst- > >getParent())) { > + PHINode *phi = cast(UseInst); > + Value *Incoming = phi->getIncomingValueForBlock(*BB); > + phi->addIncoming(Incoming, New); > + } > } > + > + // Keep track of new headers and latches as we create them, > so that > + // we can insert the proper branches later. > + if (*BB == Header) > + Headers.push_back(New); > + if (*BB == LatchBlock) { > + Latches.push_back(New); > + > + // Also, clear out the new latch's back edge so that it > doesn't look > + // like a new loop, so that it's amenable to being merged > with adjacent > + // blocks later on. > + TerminatorInst *Term = New->getTerminator(); > + assert(L->contains(Term->getSuccessor(!ContinueOnTrue))); > + assert(Term->getSuccessor(ContinueOnTrue) == LoopExit); > + Term->setSuccessor(!ContinueOnTrue, NULL); > } > + > + NewBlocks.push_back(New); > } > > // Remap all instructions in the most recent iteration > - for (unsigned i = 0, e = NewBlocks.size(); i != e; ++i) > + for (unsigned i = 0; i < NewBlocks.size(); ++i) > for (BasicBlock::iterator I = NewBlocks[i]->begin(), > E = NewBlocks[i]->end(); I != E; ++I) > RemapInstruction(I, LastValueMap); > } > + > + // The latch block exits the loop. If there are any PHI nodes in > the > + // successor blocks, update them to use the appropriate values > computed as the > + // last iteration of the loop. > + if (Count != 1) { > + SmallPtrSet Users; > + for (Value::use_iterator UI = LatchBlock->use_begin(), > + UE = LatchBlock->use_end(); UI != UE; ++UI) > + if (PHINode *phi = dyn_cast(*UI)) > + Users.insert(phi); > + > + BasicBlock *LastIterationBB = > cast(LastValueMap[LatchBlock]); > + for (SmallPtrSet::iterator SI = Users.begin(), SE = > Users.end(); > + SI != SE; ++SI) { > + PHINode *PN = *SI; > + Value *InVal = PN->removeIncomingValue(LatchBlock, false); > + // If this value was defined in the loop, take the value > defined by the > + // last iteration of the loop. > + if (Instruction *InValI = dyn_cast(InVal)) { > + if (L->contains(InValI->getParent())) > + InVal = LastValueMap[InVal]; > + } > + PN->addIncoming(InVal, LastIterationBB); > + } > + } > + > + // Now, if we're doing complete unrolling, loop over the PHI > nodes in the > + // original block, setting them to their incoming values. > + if (CompletelyUnroll) { > + BasicBlock *Preheader = L->getLoopPreheader(); > + for (unsigned i = 0, e = OrigPHINode.size(); i != e; ++i) { > + PHINode *PN = OrigPHINode[i]; > + PN->replaceAllUsesWith(PN- > >getIncomingValueForBlock(Preheader)); > + Header->getInstList().erase(PN); > + } > + } > > // Now that all the basic blocks for the unrolled iterations are > in place, > // set up the branches to connect them. > - for (unsigned It = 0; It != Count; ++It) { > + for (unsigned i = 0, e = Latches.size(); i != e; ++i) { > // The original branch was replicated in each unrolled iteration. > - BranchInst *Term = cast(Latches[It]- > >getTerminator()); > + BranchInst *Term = cast(Latches[i]->getTerminator()); > > // The branch destination. > - unsigned NextIt = (It + 1) % Count; > - BasicBlock *Dest = Headers[NextIt]; > + unsigned j = (i + 1) % e; > + BasicBlock *Dest = Headers[j]; > bool NeedConditional = true; > - bool HasExit = true; > > - // For a complete unroll, make the last iteration end with an > - // unconditional branch to the exit block. > - if (CompletelyUnroll && NextIt == 0) { > + // For a complete unroll, make the last iteration end with a > branch > + // to the exit block. > + if (CompletelyUnroll && j == 0) { > Dest = LoopExit; > NeedConditional = false; > } > > // If we know the trip count or a multiple of it, we can safely > use an > // unconditional branch for some iterations. > - if (NextIt != BreakoutTrip && > - (TripMultiple == 0 || NextIt % TripMultiple != 0)) { > + if (j != BreakoutTrip && (TripMultiple == 0 || j % > TripMultiple != 0)) { > NeedConditional = false; > - HasExit = false; > } > > if (NeedConditional) { > @@ -329,50 +338,24 @@ > std::replace(Headers.begin(), Headers.end(), Dest, Fold); > } > } > - > - // Special handling for the first iteration. If the first latch > is > - // now unconditionally branching to the second header, then it is > - // no longer an exit node. Delete PHI references to it both from > - // the first header and from outsie the loop. > - if (It == 0) > - for (Value::use_iterator UI = LatchBlock->use_begin(), > - UE = LatchBlock->use_end(); UI != UE; ) { > - PHINode *PN = dyn_cast(*UI++); > - if (PN && (PN->getParent() == Header ? Count > 1 : !HasExit)) > - PN->removeIncomingValue(LatchBlock); > - } > } > > - // At this point, unrolling is complete and the code is well > formed. > - // Now, do some simplifications. > - > - // If we're doing complete unrolling, loop over the PHI nodes in > the > - // original block, setting them to their incoming values. > - if (CompletelyUnroll) { > - BasicBlock *Preheader = L->getLoopPreheader(); > - for (BasicBlock::iterator I = Header->begin(); > isa(I); ) { > - PHINode *PN = cast(I++); > - PN->replaceAllUsesWith(PN- > >getIncomingValueForBlock(Preheader)); > - Header->getInstList().erase(PN); > - } > - } > - > - // We now do a quick sweep over the inserted code, doing constant > - // propagation and dead code elimination as we go. > - for (Loop::block_iterator BI = L->block_begin(), BBE = L- > >block_end(); > - BI != BBE; ++BI) { > - BasicBlock *BB = *BI; > - for (BasicBlock::iterator I = BB->begin(), E = BB->end(); I != > E; ) { > + // At this point, the code is well formed. We now do a quick > sweep over the > + // inserted code, doing constant propagation and dead code > elimination as we > + // go. > + const std::vector &NewLoopBlocks = L->getBlocks(); > + for (std::vector::const_iterator BB = > NewLoopBlocks.begin(), > + BBE = NewLoopBlocks.end(); BB != BBE; ++BB) > + for (BasicBlock::iterator I = (*BB)->begin(), E = (*BB)->end(); > I != E; ) { > Instruction *Inst = I++; > > if (isInstructionTriviallyDead(Inst)) > - BB->getInstList().erase(Inst); > + (*BB)->getInstList().erase(Inst); > else if (Constant *C = ConstantFoldInstruction(Inst)) { > Inst->replaceAllUsesWith(C); > - BB->getInstList().erase(Inst); > + (*BB)->getInstList().erase(Inst); > } > } > - } > > NumCompletelyUnrolled += CompletelyUnroll; > ++NumUnrolled; > > Removed: llvm/trunk/test/Transforms/LoopUnroll/multiple-phis.ll > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/LoopUnroll/multiple-phis.ll?rev=52687&view=auto > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/test/Transforms/LoopUnroll/multiple-phis.ll (original) > +++ llvm/trunk/test/Transforms/LoopUnroll/multiple-phis.ll (removed) > @@ -1,51 +0,0 @@ > -; RUN: llvm-as < %s | opt -loop-unroll -unroll-count 6 -unroll- > threshold 300 | llvm-dis > %t > -; RUN: grep {br label \%bbe} %t | count 12 > -; RUN: grep {br i1 \%z} %t | count 3 > -; RUN: grep {br i1 \%q} %t | count 6 > -; RUN: grep call %t | count 12 > -; RUN: grep urem %t | count 6 > -; RUN: grep store %t | count 6 > -; RUN: grep phi %t | count 11 > -; RUN: grep {lcssa = phi} %t | count 2 > - > -; This testcase uses > -; - an unknown tripcount, but a known trip multiple of 2. > -; - an unroll count of 6, so we should get 3 conditional branches > -; in the loop. > -; - values defined inside the loop and used outside, by phis that > -; also use values defined elsewhere outside the loop. > -; - a phi inside the loop that only uses values defined > -; inside the loop and is only used inside the loop. > - > -declare i32 @foo() > -declare i32 @bar() > - > -define i32 @fib(i32 %n, i1 %a, i32* %p) nounwind { > -entry: > - %n2 = mul i32 %n, 2 > - br i1 %a, label %bb, label %return > - > -bb: ; loop header block > - %t0 = phi i32 [ 0, %entry ], [ %t1, %bbe ] > - %td = urem i32 %t0, 7 > - %q = trunc i32 %td to i1 > - br i1 %q, label %bbt, label %bbf > -bbt: > - %bbtv = call i32 @foo() > - br label %bbe > -bbf: > - %bbfv = call i32 @bar() > - br label %bbe > -bbe: ; loop latch block > - %bbpv = phi i32 [ %bbtv, %bbt ], [ %bbfv, %bbf ] > - store i32 %bbpv, i32* %p > - %t1 = add i32 %t0, 1 > - %z = icmp ne i32 %t1, %n2 > - br i1 %z, label %bb, label %return > - > -return: > - %f = phi i32 [ -2, %entry ], [ %t0, %bbe ] > - %g = phi i32 [ -3, %entry ], [ %t1, %bbe ] > - %h = mul i32 %f, %g > - ret i32 %h > -} > > Removed: llvm/trunk/test/Transforms/LoopUnroll/pr2253.ll > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/LoopUnroll/pr2253.ll?rev=52687&view=auto > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/test/Transforms/LoopUnroll/pr2253.ll (original) > +++ llvm/trunk/test/Transforms/LoopUnroll/pr2253.ll (removed) > @@ -1,21 +0,0 @@ > -; RUN: llvm-as < %s | opt -loop-unroll -unroll-count 2 | llvm-dis | > grep add | count 2 > -; PR2253 > - > -; There's a use outside the loop, and the PHI needs an incoming > edge for > -; each unrolled iteration, since the trip count is unknown and any > iteration > -; could exit. > - > -define i32 @fib(i32 %n) nounwind { > -entry: > - br i1 false, label %bb, label %return > - > -bb: > - %t0 = phi i32 [ 0, %entry ], [ %t1, %bb ] > - %t1 = add i32 %t0, 1 > - %c = icmp ne i32 %t0, %n > - br i1 %c, label %bb, label %return > - > -return: > - %f2.0.lcssa = phi i32 [ -1, %entry ], [ %t0, %bb ] > - ret i32 %f2.0.lcssa > -} > > > _______________________________________________ > 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 Jun 24 20:37:22 2008 From: evan.cheng at apple.com (Evan Cheng) Date: Tue, 24 Jun 2008 18:37:22 -0700 Subject: [llvm-commits] atomics memoperands patch In-Reply-To: References: <5EAD215D-D32D-4C78-8020-E17D5179A72A@apple.com> <855FB51F-F2D0-4E04-93E6-D3EBA8C74D52@apple.com> Message-ID: On Jun 20, 2008, at 1:16 PM, Chris Lattner wrote: >>>> ID.AddInteger(LD->getAddressingMode()); >>>> ID.AddInteger(LD->getExtensionType()); >>>> ID.AddInteger(LD->getMemoryVT().getRawBits()); >>>> ID.AddInteger(LD->getAlignment()); >>>> ID.AddInteger(LD->isVolatile()); >>>> } else if (const StoreSDNode *ST = dyn_cast(N)) { >>>> ID.AddInteger(ST->getAddressingMode()); >>>> ID.AddInteger(ST->isTruncatingStore()); >>>> ID.AddInteger(ST->getMemoryVT().getRawBits()); >>>> ID.AddInteger(ST->getAlignment()); >>>> ID.AddInteger(ST->isVolatile()); >>>> } >>>> >>>> Do we need the if () else if? AddNodeIDNode has already added those >>>> fields to the FoldingSetNodeId. >>>> >>> >>> Looking at the code, it does seem wrong to add the fields twice. >> >> I think so too. Chris? > > Yeah you're right, that is bogus. Please make sure that all the > places that are dealing with loads/stores are putting the same > number of values into the folding set though: if this is changed > other places may need changes as well. Actually these are needed. AddNodeIDNode(ID, N->getOpcode(), N- >getVTList(), Ops, NumOps); only add opcode, vtlist and operands to CSE id. Evan > > > Great catch, > > -Chris > From clattner at apple.com Wed Jun 25 00:03:10 2008 From: clattner at apple.com (Chris Lattner) Date: Tue, 24 Jun 2008 22:03:10 -0700 Subject: [llvm-commits] [llvm] r52691 - in /llvm/trunk/lib/Target/X86: X86CallingConv.td X86ISelLowering.cpp X86InstrMMX.td X86RegisterInfo.td In-Reply-To: <93CF5F93-F500-4066-8EFE-75FB81149D30@apple.com> References: <93CF5F93-F500-4066-8EFE-75FB81149D30@apple.com> Message-ID: <89ECC84E-368F-4A10-B43B-7A9C07099B39@apple.com> On Jun 24, 2008, at 6:20 PM, Dale Johannesen wrote: > > On Jun 24, 2008, at 5:59 PMPDT, Eli Friedman wrote: > >> "Add v2f32 (MMX) type to X86." >> >> This doesn't make any sense. x86 doesn't have a v2f32 type: floating >> point operations aren't supported on MMX registers. Is there >> anything >> useful that can be done with a legal v2f32 that can't be done by just >> bitcasting it to a v2i32? > > For parameter passing purposes this type uses MMX registers, so I > think it makes sense to represent it this way. > You could probably get it to work the way you suggest. I tend to agree with Eli here. The code generator only considers a type to be legal if there are a pretty decent set of operations supported on it. Why couldn't llvm-gcc turn the type into v2i32 and use a bitcast when passing? -Chris From clattner at apple.com Wed Jun 25 00:03:56 2008 From: clattner at apple.com (Chris Lattner) Date: Tue, 24 Jun 2008 22:03:56 -0700 Subject: [llvm-commits] [llvm] r52700 - /llvm/trunk/lib/VMCore/Constants.cpp In-Reply-To: <200806250105.m5P156Cu008876@zion.cs.uiuc.edu> References: <200806250105.m5P156Cu008876@zion.cs.uiuc.edu> Message-ID: On Jun 24, 2008, at 6:05 PM, Owen Anderson wrote: > Author: resistor > Date: Tue Jun 24 20:05:05 2008 > New Revision: 52700 > > URL: http://llvm.org/viewvc/llvm-project?rev=52700&view=rev > Log: > Use push_back rather than operator[], which is incorrect in this > cases. Unfortunately, this slow the testcase down a little bit, > but only marginally. Is resize + [] faster? -Chris > > > Modified: > llvm/trunk/lib/VMCore/Constants.cpp > > Modified: llvm/trunk/lib/VMCore/Constants.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Constants.cpp?rev=52700&r1=52699&r2=52700&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/lib/VMCore/Constants.cpp (original) > +++ llvm/trunk/lib/VMCore/Constants.cpp Tue Jun 24 20:05:05 2008 > @@ -1380,7 +1380,7 @@ > std::string Result; > Result.reserve(getNumOperands()); > for (unsigned i = 0, e = getNumOperands(); i != e; ++i) > - Result[i] = (char)cast(getOperand(i))- > >getZExtValue(); > + Result.push_back((char)cast(getOperand(i))- > >getZExtValue()); > return Result; > } > > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From resistor at mac.com Wed Jun 25 00:09:54 2008 From: resistor at mac.com (Owen Anderson) Date: Tue, 24 Jun 2008 22:09:54 -0700 Subject: [llvm-commits] [llvm] r52700 - /llvm/trunk/lib/VMCore/Constants.cpp In-Reply-To: References: <200806250105.m5P156Cu008876@zion.cs.uiuc.edu> Message-ID: No, it's significantly slower because resize() has to zero the elements. --Owen On Jun 24, 2008, at 10:03 PM, Chris Lattner wrote: > > On Jun 24, 2008, at 6:05 PM, Owen Anderson wrote: > >> Author: resistor >> Date: Tue Jun 24 20:05:05 2008 >> New Revision: 52700 >> >> URL: http://llvm.org/viewvc/llvm-project?rev=52700&view=rev >> Log: >> Use push_back rather than operator[], which is incorrect in this >> cases. Unfortunately, this slow the testcase down a little bit, >> but only marginally. > > Is resize + [] faster? > > -Chris > >> >> >> Modified: >> llvm/trunk/lib/VMCore/Constants.cpp >> >> Modified: llvm/trunk/lib/VMCore/Constants.cpp >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Constants.cpp?rev=52700&r1=52699&r2=52700&view=diff >> >> = >> = >> = >> = >> = >> = >> = >> = >> = >> ===================================================================== >> --- llvm/trunk/lib/VMCore/Constants.cpp (original) >> +++ llvm/trunk/lib/VMCore/Constants.cpp Tue Jun 24 20:05:05 2008 >> @@ -1380,7 +1380,7 @@ >> std::string Result; >> Result.reserve(getNumOperands()); >> for (unsigned i = 0, e = getNumOperands(); i != e; ++i) >> - Result[i] = (char)cast(getOperand(i))- >>> getZExtValue(); >> + Result.push_back((char)cast(getOperand(i))- >>> getZExtValue()); >> return Result; >> } >> >> >> >> _______________________________________________ >> llvm-commits mailing list >> llvm-commits at cs.uiuc.edu >> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/pkcs7-signature Size: 4260 bytes Desc: not available Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20080624/67ca35e8/attachment.bin From clattner at apple.com Wed Jun 25 00:26:16 2008 From: clattner at apple.com (Chris Lattner) Date: Tue, 24 Jun 2008 22:26:16 -0700 Subject: [llvm-commits] [llvm] r52700 - /llvm/trunk/lib/VMCore/Constants.cpp In-Reply-To: References: <200806250105.m5P156Cu008876@zion.cs.uiuc.edu> Message-ID: On Jun 24, 2008, at 10:09 PM, Owen Anderson wrote: > No, it's significantly slower because resize() has to zero the > elements. Ok, you've tried it? -Chris From clattner at apple.com Wed Jun 25 00:27:13 2008 From: clattner at apple.com (Chris Lattner) Date: Tue, 24 Jun 2008 22:27:13 -0700 Subject: [llvm-commits] [llvm] r52700 - /llvm/trunk/lib/VMCore/Constants.cpp In-Reply-To: References: <200806250105.m5P156Cu008876@zion.cs.uiuc.edu> Message-ID: <9A7D2778-D96F-48D2-9639-4349786EF087@apple.com> On Jun 24, 2008, at 10:09 PM, Owen Anderson wrote: > No, it's significantly slower because resize() has to zero the > elements. Also, what happens if you add a new method where you pass in a SmallStringImpl and the method fills it in. This would avoid the heap allocation in common cases. -Chris From sabre at nondot.org Wed Jun 25 00:59:29 2008 From: sabre at nondot.org (Chris Lattner) Date: Wed, 25 Jun 2008 05:59:29 -0000 Subject: [llvm-commits] [llvm] r52702 - in /llvm/trunk: lib/Transforms/Scalar/InstructionCombining.cpp test/Transforms/InstCombine/2008-06-24-StackRestore.ll Message-ID: <200806250559.m5P5xTif017972@zion.cs.uiuc.edu> Author: lattner Date: Wed Jun 25 00:59:28 2008 New Revision: 52702 URL: http://llvm.org/viewvc/llvm-project?rev=52702&view=rev Log: Fix PR2488, a case where we deleted stack restores too aggressively. Added: llvm/trunk/test/Transforms/InstCombine/2008-06-24-StackRestore.ll Modified: llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp Modified: llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp?rev=52702&r1=52701&r2=52702&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp Wed Jun 25 00:59:28 2008 @@ -8697,13 +8697,18 @@ CannotRemove = true; break; } - if (isa(BI)) { - if (!isa(BI)) { + if (CallInst *BCI = dyn_cast(BI)) { + if (IntrinsicInst *II = dyn_cast(BCI)) { + // If there is a stackrestore below this one, remove this one. + if (II->getIntrinsicID() == Intrinsic::stackrestore) + return EraseInstFromFunction(CI); + // Otherwise, ignore the intrinsic. + } else { + // If we found a non-intrinsic call, we can't remove the stack + // restore. CannotRemove = true; break; } - // If there is a stackrestore below this one, remove this one. - return EraseInstFromFunction(CI); } } Added: llvm/trunk/test/Transforms/InstCombine/2008-06-24-StackRestore.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/2008-06-24-StackRestore.ll?rev=52702&view=auto ============================================================================== --- llvm/trunk/test/Transforms/InstCombine/2008-06-24-StackRestore.ll (added) +++ llvm/trunk/test/Transforms/InstCombine/2008-06-24-StackRestore.ll Wed Jun 25 00:59:28 2008 @@ -0,0 +1,39 @@ +; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep {call.*llvm.stackrestore} +; PR2488 +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 = "i386-pc-linux-gnu" + at p = weak global i8* null ; [#uses=2] + +define i32 @main() nounwind { +entry: + %tmp248 = call i8* @llvm.stacksave( ) ; [#uses=1] + %tmp2752 = alloca i32 ; [#uses=2] + %tmpcast53 = bitcast i32* %tmp2752 to i8* ; [#uses=1] + store i32 2, i32* %tmp2752, align 4 + volatile store i8* %tmpcast53, i8** @p, align 4 + br label %bb44 + +bb: ; preds = %bb44 + ret i32 0 + +bb44: ; preds = %bb44, %entry + %indvar = phi i32 [ 0, %entry ], [ %tmp3857, %bb44 ] ; [#uses=1] + %tmp249 = phi i8* [ %tmp248, %entry ], [ %tmp2, %bb44 ] ; [#uses=1] + %tmp3857 = add i32 %indvar, 1 ; [#uses=3] + call void @llvm.stackrestore( i8* %tmp249 ) + %tmp2 = call i8* @llvm.stacksave( ) ; [#uses=1] + %tmp4 = srem i32 %tmp3857, 1000 ; [#uses=2] + %tmp5 = add i32 %tmp4, 1 ; [#uses=1] + %tmp27 = alloca i32, i32 %tmp5 ; [#uses=3] + %tmpcast = bitcast i32* %tmp27 to i8* ; [#uses=1] + store i32 1, i32* %tmp27, align 4 + %tmp34 = getelementptr i32* %tmp27, i32 %tmp4 ; [#uses=1] + store i32 2, i32* %tmp34, align 4 + volatile store i8* %tmpcast, i8** @p, align 4 + %exitcond = icmp eq i32 %tmp3857, 999999 ; [#uses=1] + br i1 %exitcond, label %bb, label %bb44 +} + +declare i8* @llvm.stacksave() nounwind + +declare void @llvm.stackrestore(i8*) nounwind From resistor at mac.com Wed Jun 25 02:02:20 2008 From: resistor at mac.com (Owen Anderson) Date: Wed, 25 Jun 2008 00:02:20 -0700 Subject: [llvm-commits] [llvm] r52700 - /llvm/trunk/lib/VMCore/Constants.cpp In-Reply-To: References: <200806250105.m5P156Cu008876@zion.cs.uiuc.edu> Message-ID: On Jun 24, 2008, at 10:26 PM, Chris Lattner wrote: > > On Jun 24, 2008, at 10:09 PM, Owen Anderson wrote: > >> No, it's significantly slower because resize() has to zero the >> elements. > > Ok, you've tried it? Yes. :-) -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/pkcs7-signature Size: 4260 bytes Desc: not available Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20080625/6f8cd28c/attachment.bin From resistor at mac.com Wed Jun 25 02:02:47 2008 From: resistor at mac.com (Owen Anderson) Date: Wed, 25 Jun 2008 00:02:47 -0700 Subject: [llvm-commits] [llvm] r52700 - /llvm/trunk/lib/VMCore/Constants.cpp In-Reply-To: <9A7D2778-D96F-48D2-9639-4349786EF087@apple.com> References: <200806250105.m5P156Cu008876@zion.cs.uiuc.edu> <9A7D2778-D96F-48D2-9639-4349786EF087@apple.com> Message-ID: On Jun 24, 2008, at 10:27 PM, Chris Lattner wrote: > > On Jun 24, 2008, at 10:09 PM, Owen Anderson wrote: > >> No, it's significantly slower because resize() has to zero the >> elements. > > Also, what happens if you add a new method where you pass in a > SmallStringImpl and the method fills it in. This would avoid the heap > allocation in common cases. > I'll give it a try. --Owen -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/pkcs7-signature Size: 4260 bytes Desc: not available Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20080625/aee5ee92/attachment.bin From matthijs at stdin.nl Wed Jun 25 02:42:31 2008 From: matthijs at stdin.nl (Matthijs Kooijman) Date: Wed, 25 Jun 2008 09:42:31 +0200 Subject: [llvm-commits] [llvm] r52675 - in /llvm/trunk: autoconf/configure.ac configure projects/Makefile In-Reply-To: References: <200806241301.m5OD1w3G001748@zion.cs.uiuc.edu> Message-ID: <20080625074231.GK438@katherina.student.utwente.nl> Hi Eric, > > [ autoconf-2.6 ] > It's very easy to download and install into a separate directory. Have you > run into problems? Nope, I just haven't tried. Ubuntu doesn't ship it, and I've not really needed it until now. If I need it again, I'll have a go at it instead of asking other people :-) Gr. Matthijs -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: Digital signature Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20080625/f46153af/attachment.bin From matthijs at stdin.nl Wed Jun 25 02:47:17 2008 From: matthijs at stdin.nl (Matthijs Kooijman) Date: Wed, 25 Jun 2008 09:47:17 +0200 Subject: [llvm-commits] [llvm] r52688 - in /llvm/trunk: lib/Transforms/Utils/UnrollLoop.cpp test/Transforms/LoopUnroll/multiple-phis.ll test/Transforms/LoopUnroll/pr2253.ll In-Reply-To: <86DA0DDE-13BA-4E51-9A79-22DB5628CBA7@apple.com> References: <200806242044.m5OKihhI031581@zion.cs.uiuc.edu> <86DA0DDE-13BA-4E51-9A79-22DB5628CBA7@apple.com> Message-ID: <20080625074717.GL438@katherina.student.utwente.nl> Hi Evan, > This causes these annoying dejagnu failures since the files are now > empty. Perhaps we should just xfail them for now? > > Removed: > > llvm/trunk/test/Transforms/LoopUnroll/multiple-phis.ll > > llvm/trunk/test/Transforms/LoopUnroll/pr2253.ll Shouldn't svn have removed them for you? They are gone for me (though I might not have updated between their addition and removal, which could change things). Gr. Matthijs -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: Digital signature Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20080625/ff9de048/attachment.bin From echristo at apple.com Wed Jun 25 02:48:31 2008 From: echristo at apple.com (Eric Christopher) Date: Wed, 25 Jun 2008 00:48:31 -0700 Subject: [llvm-commits] [llvm] r52675 - in /llvm/trunk: autoconf/configure.ac configure projects/Makefile In-Reply-To: <20080625074231.GK438@katherina.student.utwente.nl> References: <200806241301.m5OD1w3G001748@zion.cs.uiuc.edu> <20080625074231.GK438@katherina.student.utwente.nl> Message-ID: <1698A4D0-FAD8-4E41-BEBB-E3BC65A91CFF@apple.com> On Jun 25, 2008, at 12:42 AM, Matthijs Kooijman wrote: > Hi Eric, > >>> [ autoconf-2.6 ] >> It's very easy to download and install into a separate directory. >> Have you >> run into problems? > Nope, I just haven't tried. Ubuntu doesn't ship it, and I've not > really needed > it until now. If I need it again, I'll have a go at it instead of > asking other > people :-) Cool. Let me know if you need help. -eric From evan.cheng at apple.com Wed Jun 25 02:50:13 2008 From: evan.cheng at apple.com (Evan Cheng) Date: Wed, 25 Jun 2008 07:50:13 -0000 Subject: [llvm-commits] [llvm] r52703 - /llvm/trunk/lib/Transforms/Utils/SimplifyCFG.cpp Message-ID: <200806250750.m5P7oD7N028579@zion.cs.uiuc.edu> Author: evancheng Date: Wed Jun 25 02:50:12 2008 New Revision: 52703 URL: http://llvm.org/viewvc/llvm-project?rev=52703&view=rev Log: - Use O(1) check of basic block size limit. - Avoid speculatively execute vector ops. Modified: llvm/trunk/lib/Transforms/Utils/SimplifyCFG.cpp Modified: llvm/trunk/lib/Transforms/Utils/SimplifyCFG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/SimplifyCFG.cpp?rev=52703&r1=52702&r2=52703&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Utils/SimplifyCFG.cpp (original) +++ llvm/trunk/lib/Transforms/Utils/SimplifyCFG.cpp Wed Jun 25 02:50:12 2008 @@ -965,8 +965,11 @@ static bool SpeculativelyExecuteBB(BranchInst *BI, BasicBlock *BB1) { // Only speculatively execution a single instruction (not counting the // terminator) for now. - if (BB1->size() != 2) - return false; + BasicBlock::iterator BBI = BB1->begin(); + ++BBI; // must have at least a terminator + if (BBI == BB1->end()) return false; // only one inst + ++BBI; + if (BBI != BB1->end()) return false; // more than 2 insts. // Be conservative for now. FP select instruction can often be expensive. Value *BrCond = BI->getCondition(); @@ -1006,8 +1009,9 @@ case Instruction::Shl: case Instruction::LShr: case Instruction::AShr: - if (I->getOperand(0)->getType()->isFPOrFPVector()) - return false; // FP arithmetic might trap. + if (!I->getOperand(0)->getType()->isInteger()) + // FP arithmetic might trap. Not worth doing for vector ops. + return false; break; // These are all cheap and non-trapping instructions. } From evan.cheng at apple.com Wed Jun 25 02:50:08 2008 From: evan.cheng at apple.com (Evan Cheng) Date: Wed, 25 Jun 2008 00:50:08 -0700 Subject: [llvm-commits] [llvm] r52073 - in /llvm/trunk: lib/Transforms/Utils/SimplifyCFG.cpp test/Transforms/SimplifyCFG/SpeculativeExec.ll In-Reply-To: References: <200806070852.m578qTpD008596@zion.cs.uiuc.edu> Message-ID: <72B65961-8981-41DC-A0CF-C6E531E8B528@apple.com> On Jun 24, 2008, at 11:15 AM, Chris Lattner wrote: > On Jun 7, 2008, at 1:52 AM, Evan Cheng wrote: >> Author: evancheng >> Date: Sat Jun 7 03:52:29 2008 >> New Revision: 52073 >> >> URL: http://llvm.org/viewvc/llvm-project?rev=52073&view=rev >> Log: >> Speculatively execute a block when the the block is the then part of >> a triangle shape and it contains a single, side effect free, cheap >> instruction. The branch is eliminated by adding a select >> instruction. i.e. > > Ok > >> @@ -955,6 +955,109 @@ >> +static bool SpeculativelyExecuteBB(BranchInst *BI, BasicBlock >> *BB1) { >> + // Only speculatively execution a single instruction (not >> counting the >> + // terminator) for now. >> + if (BB1->size() != 2) >> + return false; > > This is O(n) for a check that should be O(1). Can you do something > (admittedly gross) like this: > > BasicBlock::iterator I = BB1->begin(); > ++I; // must have at least a terminator > if (I == BB1->end()) return false; // only one inst > ++I; > if (I != BB1->end()) return false; // more than 2 insts. > Alright. Done. >> + Instruction *I = BB1->begin(); >> + switch (I->getOpcode()) { >> + default: return false; // Not safe / profitable to hoist. >> + case Instruction::Add: >> + case Instruction::Sub: >> + case Instruction::And: >> + case Instruction::Or: >> + case Instruction::Xor: >> + case Instruction::Shl: >> + case Instruction::LShr: >> + case Instruction::AShr: >> + if (I->getOperand(0)->getType()->isFPOrFPVector()) >> + return false; // FP arithmetic might trap. >> + break; // These are all cheap and non-trapping instructions. >> + } > > Is this worthwhile to do for vector operations? Probably not. Fixed. Evan > > > -Chris > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From matthijs at stdin.nl Wed Jun 25 03:10:21 2008 From: matthijs at stdin.nl (Matthijs Kooijman) Date: Wed, 25 Jun 2008 08:10:21 -0000 Subject: [llvm-commits] [llvm] r52704 - /llvm/trunk/lib/Transforms/IPO/DeadArgumentElimination.cpp Message-ID: <200806250810.m5P8AL4o032320@zion.cs.uiuc.edu> Author: matthijs Date: Wed Jun 25 03:10:21 2008 New Revision: 52704 URL: http://llvm.org/viewvc/llvm-project?rev=52704&view=rev Log: Fix some cosmetics in comments. Modified: llvm/trunk/lib/Transforms/IPO/DeadArgumentElimination.cpp Modified: llvm/trunk/lib/Transforms/IPO/DeadArgumentElimination.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/DeadArgumentElimination.cpp?rev=52704&r1=52703&r2=52704&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/IPO/DeadArgumentElimination.cpp (original) +++ llvm/trunk/lib/Transforms/IPO/DeadArgumentElimination.cpp Wed Jun 25 03:10:21 2008 @@ -72,7 +72,7 @@ /// Liveness enum - During our initial pass over the program, we determine /// that things are either alive or maybe alive. We don't mark anything - /// explicitely dead (even if we know they are), since anything not alive + /// explicitly dead (even if we know they are), since anything not alive /// with no registered uses (in Uses) will never be marked alive and will /// thus become dead in the end. enum Liveness { Live, MaybeLive }; @@ -616,7 +616,7 @@ if (RetTypes.size() > 1 || STy && STy->getNumElements() == RetTypes.size()) // More than one return type? Return a struct with them. Also, if we used // to return a struct and didn't change the number of return values, - // return a struct again. This prevents chaning {something} into something + // return a struct again. This prevents changing {something} into something // and {} into void. // Make the new struct packed if we used to return a packed struct // already. @@ -626,7 +626,7 @@ // return a struct with that simple value before. NRetTy = RetTypes.front(); else if (RetTypes.size() == 0) - // No return types? Make it void, but only if we didn't use to return {} + // No return types? Make it void, but only if we didn't use to return {}. NRetTy = Type::VoidTy; } else { NRetTy = Type::VoidTy; @@ -685,8 +685,8 @@ return false; // The function type is only allowed to be different if we actually left out - // an argument or return value - assert(Changed && "Function type changed while no arguments or retrurn values" + // an argument or return value. + assert(Changed && "Function type changed while no arguments or return values" "were removed!"); // Create the new function body and insert it into the module... @@ -694,7 +694,7 @@ NF->copyAttributesFrom(F); NF->setParamAttrs(NewPAL); // Insert the new function before the old function, so we won't be processing - // it again + // it again. F->getParent()->getFunctionList().insert(F, NF); NF->takeName(F); From matthijs at stdin.nl Wed Jun 25 03:12:17 2008 From: matthijs at stdin.nl (Matthijs Kooijman) Date: Wed, 25 Jun 2008 08:12:17 -0000 Subject: [llvm-commits] [llvm] r52705 - /llvm/trunk/lib/Transforms/IPO/DeadArgumentElimination.cpp Message-ID: <200806250812.m5P8CH0Z032399@zion.cs.uiuc.edu> Author: matthijs Date: Wed Jun 25 03:12:16 2008 New Revision: 52705 URL: http://llvm.org/viewvc/llvm-project?rev=52705&view=rev Log: Fix a (false) warning on darwin. Modified: llvm/trunk/lib/Transforms/IPO/DeadArgumentElimination.cpp Modified: llvm/trunk/lib/Transforms/IPO/DeadArgumentElimination.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/DeadArgumentElimination.cpp?rev=52705&r1=52704&r2=52705&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/IPO/DeadArgumentElimination.cpp (original) +++ llvm/trunk/lib/Transforms/IPO/DeadArgumentElimination.cpp Wed Jun 25 03:12:16 2008 @@ -579,7 +579,7 @@ // Find out the new return value const Type *RetTy = FTy->getReturnType(); - const Type *NRetTy; + const Type *NRetTy = NULL; unsigned RetCount = NumRetVals(F); // Explicitely track if anything changed, for debugging bool Changed = false; @@ -632,6 +632,8 @@ NRetTy = Type::VoidTy; } + assert(NRetTy && "No new return type found?"); + // Remove any incompatible attributes RAttrs &= ~ParamAttr::typeIncompatible(NRetTy); if (RAttrs) From wangmp at apple.com Wed Jun 25 03:15:40 2008 From: wangmp at apple.com (Mon P Wang) Date: Wed, 25 Jun 2008 08:15:40 -0000 Subject: [llvm-commits] [llvm] r52706 - in /llvm/trunk: docs/ include/llvm/ include/llvm/CodeGen/ lib/AsmParser/ lib/CodeGen/SelectionDAG/ lib/Target/ lib/Target/Alpha/ lib/Target/PowerPC/ lib/Target/X86/ lib/VMCore/ test/CodeGen/PowerPC/ test/CodeGen/X86/ utils/TableGen/ Message-ID: <200806250815.m5P8Ffh2032561@zion.cs.uiuc.edu> Author: wangmp Date: Wed Jun 25 03:15:39 2008 New Revision: 52706 URL: http://llvm.org/viewvc/llvm-project?rev=52706&view=rev Log: Added MemOperands to Atomic operations since Atomics touches memory. Added abstract class MemSDNode for any Node that have an associated MemOperand Changed atomic.lcs => atomic.cmp.swap, atomic.las => atomic.load.add, and atomic.lss => atomic.load.sub Modified: llvm/trunk/docs/LangRef.html llvm/trunk/include/llvm/CodeGen/SelectionDAG.h llvm/trunk/include/llvm/CodeGen/SelectionDAGNodes.h llvm/trunk/include/llvm/Intrinsics.td llvm/trunk/lib/AsmParser/llvmAsmParser.cpp.cvs llvm/trunk/lib/AsmParser/llvmAsmParser.h.cvs llvm/trunk/lib/AsmParser/llvmAsmParser.y.cvs llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp llvm/trunk/lib/Target/Alpha/AlphaInstrInfo.td llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp llvm/trunk/lib/Target/PowerPC/PPCISelLowering.h llvm/trunk/lib/Target/TargetSelectionDAG.td llvm/trunk/lib/Target/X86/X86ISelLowering.cpp llvm/trunk/lib/Target/X86/X86ISelLowering.h llvm/trunk/lib/Target/X86/X86Instr64bit.td llvm/trunk/lib/Target/X86/X86InstrInfo.td llvm/trunk/lib/VMCore/AutoUpgrade.cpp llvm/trunk/test/CodeGen/PowerPC/atomic-1.ll llvm/trunk/test/CodeGen/PowerPC/atomic-2.ll llvm/trunk/test/CodeGen/X86/atomic_op.ll llvm/trunk/utils/TableGen/CodeGenDAGPatterns.cpp llvm/trunk/utils/TableGen/CodeGenTarget.cpp llvm/trunk/utils/TableGen/CodeGenTarget.h llvm/trunk/utils/TableGen/DAGISelEmitter.cpp Modified: llvm/trunk/docs/LangRef.html URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/LangRef.html?rev=52706&r1=52705&r2=52706&view=diff ============================================================================== --- llvm/trunk/docs/LangRef.html (original) +++ llvm/trunk/docs/LangRef.html Wed Jun 25 03:15:39 2008 @@ -216,9 +216,18 @@
  24. Atomic intrinsics
    1. llvm.memory_barrier
    2. -
    3. llvm.atomic.lcs
    4. -
    5. llvm.atomic.las
    6. +
    7. llvm.atomic.cmp.swap
    8. llvm.atomic.swap
    9. +
    10. llvm.atomic.load.add
    11. +
    12. llvm.atomic.load.sub
    13. +
    14. llvm.atomic.load.and
    15. +
    16. llvm.atomic.load.nand
    17. +
    18. llvm.atomic.load.or
    19. +
    20. llvm.atomic.load.xor
    21. +
    22. llvm.atomic.load.max
    23. +
    24. llvm.atomic.load.min
    25. +
    26. llvm.atomic.load.umax
    27. +
    28. llvm.atomic.load.umin
  25. General intrinsics @@ -5777,19 +5786,19 @@
    Syntax:

    - This is an overloaded intrinsic. You can use llvm.atomic.lcs on any + This is an overloaded intrinsic. You can use llvm.atomic.cmp.swap on any integer bit width. Not all targets support all bit widths however.

    -declare i8 @llvm.atomic.lcs.i8( i8* <ptr>, i8 <cmp>, i8 <val> )
    -declare i16 @llvm.atomic.lcs.i16( i16* <ptr>, i16 <cmp>, i16 <val> )
    -declare i32 @llvm.atomic.lcs.i32( i32* <ptr>, i32 <cmp>, i32 <val> )
    -declare i64 @llvm.atomic.lcs.i64( i64* <ptr>, i64 <cmp>, i64 <val> )
    +declare i8 @llvm.atomic.cmp.swap.i8( i8* <ptr>, i8 <cmp>, i8 <val> )
    +declare i16 @llvm.atomic.cmp.swap.i16( i16* <ptr>, i16 <cmp>, i16 <val> )
    +declare i32 @llvm.atomic.cmp.swap.i32( i32* <ptr>, i32 <cmp>, i32 <val> )
    +declare i64 @llvm.atomic.cmp.swap.i64( i64* <ptr>, i64 <cmp>, i64 <val> )
     
     
    Overview:
    @@ -5799,7 +5808,7 @@

    Arguments:

    - The llvm.atomic.lcs intrinsic takes three arguments. The result as + The llvm.atomic.cmp.swap intrinsic takes three arguments. The result as well as both cmp and val must be integer values with the same bit width. The ptr argument must be a pointer to a value of this integer type. While any bit width integer may be used, targets may only @@ -5821,13 +5830,13 @@ store i32 4, %ptr %val1 = add i32 4, 4 -%result1 = call i32 @llvm.atomic.lcs.i32( i32* %ptr, i32 4, %val1 ) +%result1 = call i32 @llvm.atomic.cmp.swap.i32( i32* %ptr, i32 4, %val1 ) ; yields {i32}:result1 = 4 %stored1 = icmp eq i32 %result1, 4 ; yields {i1}:stored1 = true %memval1 = load i32* %ptr ; yields {i32}:memval1 = 8 %val2 = add i32 1, 1 -%result2 = call i32 @llvm.atomic.lcs.i32( i32* %ptr, i32 5, %val2 ) +%result2 = call i32 @llvm.atomic.cmp.swap.i32( i32* %ptr, i32 5, %val2 ) ; yields {i32}:result2 = 8 %stored2 = icmp eq i32 %result2, 5 ; yields {i1}:stored2 = false @@ -5861,7 +5870,7 @@

    Arguments:

    - The llvm.atomic.ls intrinsic takes two arguments. Both the + The llvm.atomic.swap intrinsic takes two arguments. Both the val argument and the result must be integers of the same bit width. The first argument, ptr, must be a pointer to a value of this integer type. The targets may only lower integer representations they @@ -5896,19 +5905,19 @@

    Syntax:

    - This is an overloaded intrinsic. You can use llvm.atomic.las on any + This is an overloaded intrinsic. You can use llvm.atomic.load.add on any integer bit width. Not all targets support all bit widths however.

    -declare i8 @llvm.atomic.las.i8.( i8* <ptr>, i8 <delta> )
    -declare i16 @llvm.atomic.las.i16.( i16* <ptr>, i16 <delta> )
    -declare i32 @llvm.atomic.las.i32.( i32* <ptr>, i32 <delta> )
    -declare i64 @llvm.atomic.las.i64.( i64* <ptr>, i64 <delta> )
    +declare i8 @llvm.atomic.load.add.i8.( i8* <ptr>, i8 <delta> )
    +declare i16 @llvm.atomic.load.add.i16.( i16* <ptr>, i16 <delta> )
    +declare i32 @llvm.atomic.load.add.i32.( i32* <ptr>, i32 <delta> )
    +declare i64 @llvm.atomic.load.add.i64.( i64* <ptr>, i64 <delta> )
     
     
    Overview:
    @@ -5935,16 +5944,235 @@
     %ptr      = malloc i32
             store i32 4, %ptr
    -%result1  = call i32 @llvm.atomic.las.i32( i32* %ptr, i32 4 )
    +%result1  = call i32 @llvm.atomic.load.add.i32( i32* %ptr, i32 4 )
                                     ; yields {i32}:result1 = 4
    -%result2  = call i32 @llvm.atomic.las.i32( i32* %ptr, i32 2 )
    +%result2  = call i32 @llvm.atomic.load.add.i32( i32* %ptr, i32 2 )
                                     ; yields {i32}:result2 = 8
    -%result3  = call i32 @llvm.atomic.las.i32( i32* %ptr, i32 5 )
    +%result3  = call i32 @llvm.atomic.load.add.i32( i32* %ptr, i32 5 )
                                     ; yields {i32}:result3 = 10
    -%memval   = load i32* %ptr      ; yields {i32}:memval1 = 15
    +%memval1  = load i32* %ptr      ; yields {i32}:memval1 = 15
     
    + + +
    +
    Syntax:
    +

    + This is an overloaded intrinsic. You can use llvm.atomic.load.sub on + any integer bit width. Not all targets support all bit widths however.

    +
    +declare i8 @llvm.atomic.load.sub.i8.( i8* <ptr>, i8 <delta> )
    +declare i16 @llvm.atomic.load.sub.i16.( i16* <ptr>, i16 <delta> )
    +declare i32 @llvm.atomic.load.sub.i32.( i32* <ptr>, i32 <delta> )
    +declare i64 @llvm.atomic.load.sub.i64.( i64* <ptr>, i64 <delta> )
    +
    +
    +
    Overview:
    +

    + This intrinsic subtracts delta to the value stored in memory at + ptr. It yields the original value at ptr. +

    +
    Arguments:
    +

    + + The intrinsic takes two arguments, the first a pointer to an integer value + and the second an integer value. The result is also an integer value. These + integer types can have any bit width, but they must all have the same bit + width. The targets may only lower integer representations they support. +

    +
    Semantics:
    +

    + This intrinsic does a series of operations atomically. It first loads the + value stored at ptr. It then subtracts delta, stores the + result to ptr. It yields the original value stored at ptr. +

    + +
    Examples:
    +
    +%ptr      = malloc i32
    +        store i32 8, %ptr
    +%result1  = call i32 @llvm.atomic.load.sub.i32( i32* %ptr, i32 4 )
    +                                ; yields {i32}:result1 = 8
    +%result2  = call i32 @llvm.atomic.load.sub.i32( i32* %ptr, i32 2 )
    +                                ; yields {i32}:result2 = 4
    +%result3  = call i32 @llvm.atomic.load.sub.i32( i32* %ptr, i32 5 )
    +                                ; yields {i32}:result3 = 2
    +%memval1  = load i32* %ptr      ; yields {i32}:memval1 = -3
    +
    +
    + + + +
    +
    Syntax:
    +

    + These are overloaded intrinsics. You can use llvm.atomic.load_and, + llvm.atomic.load_nand, llvm.atomic.load_or, and + llvm.atomic.load_xor on any integer bit width. Not all targets + support all bit widths however.

    +
    +declare i8 @llvm.atomic.load.and.i8.( i8* <ptr>, i8 <delta> )
    +declare i16 @llvm.atomic.load.and.i16.( i16* <ptr>, i16 <delta> )
    +declare i32 @llvm.atomic.load.and.i32.( i32* <ptr>, i32 <delta> )
    +declare i64 @llvm.atomic.load.and.i64.( i64* <ptr>, i64 <delta> )
    +
    +
    + +
    +declare i8 @llvm.atomic.load.or.i8.( i8* <ptr>, i8 <delta> )
    +declare i16 @llvm.atomic.load.or.i16.( i16* <ptr>, i16 <delta> )
    +declare i32 @llvm.atomic.load.or.i32.( i32* <ptr>, i32 <delta> )
    +declare i64 @llvm.atomic.load.or.i64.( i64* <ptr>, i64 <delta> )
    +
    +
    + +
    +declare i8 @llvm.atomic.load.nand.i8.( i8* <ptr>, i8 <delta> )
    +declare i16 @llvm.atomic.load.nand.i16.( i16* <ptr>, i16 <delta> )
    +declare i32 @llvm.atomic.load.nand.i32.( i32* <ptr>, i32 <delta> )
    +declare i64 @llvm.atomic.load.nand.i64.( i64* <ptr>, i64 <delta> )
    +
    +
    + +
    +declare i8 @llvm.atomic.load.xor.i8.( i8* <ptr>, i8 <delta> )
    +declare i16 @llvm.atomic.load.xor.i16.( i16* <ptr>, i16 <delta> )
    +declare i32 @llvm.atomic.load.xor.i32.( i32* <ptr>, i32 <delta> )
    +declare i64 @llvm.atomic.load.xor.i64.( i64* <ptr>, i64 <delta> )
    +
    +
    +
    Overview:
    +

    + These intrinsics bitwise the operation (and, nand, or, xor) delta to + the value stored in memory at ptr. It yields the original value + at ptr. +

    +
    Arguments:
    +

    + + These intrinsics take two arguments, the first a pointer to an integer value + and the second an integer value. The result is also an integer value. These + integer types can have any bit width, but they must all have the same bit + width. The targets may only lower integer representations they support. +

    +
    Semantics:
    +

    + These intrinsics does a series of operations atomically. They first load the + value stored at ptr. They then do the bitwise operation + delta, store the result to ptr. They yield the original + value stored at ptr. +

    + +
    Examples:
    +
    +%ptr      = malloc i32
    +        store i32 0x0F0F, %ptr
    +%result0  = call i32 @llvm.atomic.load.nand.i32( i32* %ptr, i32 0xFF )
    +                                ; yields {i32}:result0 = 0x0F0F
    +%result1  = call i32 @llvm.atomic.load.and.i32( i32* %ptr, i32 0xFF )
    +                                ; yields {i32}:result1 = 0xFFFFFFF0
    +%result2  = call i32 @llvm.atomic.load.or.i32( i32* %ptr, i32 0F )
    +                                ; yields {i32}:result2 = 0xF0
    +%result3  = call i32 @llvm.atomic.load.xor.i32( i32* %ptr, i32 0F )
    +                                ; yields {i32}:result3 = FF
    +%memval1  = load i32* %ptr      ; yields {i32}:memval1 = F0
    +
    +
    + + + + +
    +
    Syntax:
    +

    + These are overloaded intrinsics. You can use llvm.atomic.load_max, + llvm.atomic.load_min, llvm.atomic.load_umax, and + llvm.atomic.load_umin on any integer bit width. Not all targets + support all bit widths however.

    +
    +declare i8 @llvm.atomic.load.max.i8.( i8* <ptr>, i8 <delta> )
    +declare i16 @llvm.atomic.load.max.i16.( i16* <ptr>, i16 <delta> )
    +declare i32 @llvm.atomic.load.max.i32.( i32* <ptr>, i32 <delta> )
    +declare i64 @llvm.atomic.load.max.i64.( i64* <ptr>, i64 <delta> )
    +
    +
    + +
    +declare i8 @llvm.atomic.load.min.i8.( i8* <ptr>, i8 <delta> )
    +declare i16 @llvm.atomic.load.min.i16.( i16* <ptr>, i16 <delta> )
    +declare i32 @llvm.atomic.load.min.i32.( i32* <ptr>, i32 <delta> )
    +declare i64 @llvm.atomic.load.min.i64.( i64* <ptr>, i64 <delta> )
    +
    +
    + +
    +declare i8 @llvm.atomic.load.umax.i8.( i8* <ptr>, i8 <delta> )
    +declare i16 @llvm.atomic.load.umax.i16.( i16* <ptr>, i16 <delta> )
    +declare i32 @llvm.atomic.load.umax.i32.( i32* <ptr>, i32 <delta> )
    +declare i64 @llvm.atomic.load.umax.i64.( i64* <ptr>, i64 <delta> )
    +
    +
    + +
    +declare i8 @llvm.atomic.load.umin.i8.( i8* <ptr>, i8 <delta> )
    +declare i16 @llvm.atomic.load.umin.i16.( i16* <ptr>, i16 <delta> )
    +declare i32 @llvm.atomic.load.umin.i32.( i32* <ptr>, i32 <delta> )
    +declare i64 @llvm.atomic.load.umin.i64.( i64* <ptr>, i64 <delta> )
    +
    +
    +
    Overview:
    +

    + These intrinsics takes the signed or unsigned minimum or maximum of + delta and the value stored in memory at ptr. It yields the + original value at ptr. +

    +
    Arguments:
    +

    + + These intrinsics take two arguments, the first a pointer to an integer value + and the second an integer value. The result is also an integer value. These + integer types can have any bit width, but they must all have the same bit + width. The targets may only lower integer representations they support. +

    +
    Semantics:
    +

    + These intrinsics does a series of operations atomically. They first load the + value stored at ptr. They then do the signed or unsigned min or max + delta and the value, store the result to ptr. They yield + the original value stored at ptr. +

    + +
    Examples:
    +
    +%ptr      = malloc i32
    +        store i32 7, %ptr
    +%result0  = call i32 @llvm.atomic.load.min.i32( i32* %ptr, i32 -2 )
    +                                ; yields {i32}:result0 = 7
    +%result1  = call i32 @llvm.atomic.load.max.i32( i32* %ptr, i32 8 )
    +                                ; yields {i32}:result1 = -2
    +%result2  = call i32 @llvm.atomic.load.umin.i32( i32* %ptr, i32 10 )
    +                                ; yields {i32}:result2 = 8
    +%result3  = call i32 @llvm.atomic.load.umax.i32( i32* %ptr, i32 30 )
    +                                ; yields {i32}:result3 = 8
    +%memval1  = load i32* %ptr      ; yields {i32}:memval1 = 30
    +
    +
    Modified: llvm/trunk/include/llvm/CodeGen/SelectionDAG.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/SelectionDAG.h?rev=52706&r1=52705&r2=52706&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/SelectionDAG.h (original) +++ llvm/trunk/include/llvm/CodeGen/SelectionDAG.h Wed Jun 25 03:15:39 2008 @@ -368,14 +368,16 @@ SDOperand SV); /// getAtomic - Gets a node for an atomic op, produces result and chain, takes - // 3 operands + /// 3 operands SDOperand getAtomic(unsigned Opcode, SDOperand Chain, SDOperand Ptr, - SDOperand Cmp, SDOperand Swp, MVT VT); + SDOperand Cmp, SDOperand Swp, MVT VT, const Value* PtrVal, + unsigned Alignment=0); /// getAtomic - Gets a node for an atomic op, produces result and chain, takes - // 2 operands + /// 2 operands SDOperand getAtomic(unsigned Opcode, SDOperand Chain, SDOperand Ptr, - SDOperand Val, MVT VT); + SDOperand Val, MVT VT, const Value* PtrVal, + unsigned Alignment = 0); /// getLoad - Loads are not normal binary operators: their result type is not /// determined by their operands, and they produce a value AND a token chain. Modified: llvm/trunk/include/llvm/CodeGen/SelectionDAGNodes.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/SelectionDAGNodes.h?rev=52706&r1=52705&r2=52706&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/SelectionDAGNodes.h (original) +++ llvm/trunk/include/llvm/CodeGen/SelectionDAGNodes.h Wed Jun 25 03:15:39 2008 @@ -584,17 +584,17 @@ // and produces an output chain. MEMBARRIER, - // Val, OUTCHAIN = ATOMIC_LCS(INCHAIN, ptr, cmp, swap) + // Val, OUTCHAIN = ATOMIC_CMP_SWAP(INCHAIN, ptr, cmp, swap) // this corresponds to the atomic.lcs intrinsic. // cmp is compared to *ptr, and if equal, swap is stored in *ptr. // the return is always the original value in *ptr - ATOMIC_LCS, + ATOMIC_CMP_SWAP, - // Val, OUTCHAIN = ATOMIC_LAS(INCHAIN, ptr, amt) + // Val, OUTCHAIN = ATOMIC_LOAD_ADD(INCHAIN, ptr, amt) // this corresponds to the atomic.las intrinsic. // *ptr + amt is stored to *ptr atomically. // the return is always the original value in *ptr - ATOMIC_LAS, + ATOMIC_LOAD_ADD, // Val, OUTCHAIN = ATOMIC_SWAP(INCHAIN, ptr, amt) // this corresponds to the atomic.swap intrinsic. @@ -602,11 +602,11 @@ // the return is always the original value in *ptr ATOMIC_SWAP, - // Val, OUTCHAIN = ATOMIC_LSS(INCHAIN, ptr, amt) + // Val, OUTCHAIN = ATOMIC_LOAD_SUB(INCHAIN, ptr, amt) // this corresponds to the atomic.lss intrinsic. // *ptr - amt is stored to *ptr atomically. // the return is always the original value in *ptr - ATOMIC_LSS, + ATOMIC_LOAD_SUB, // Val, OUTCHAIN = ATOMIC_L[OpName]S(INCHAIN, ptr, amt) // this corresponds to the atomic.[OpName] intrinsic. @@ -1437,32 +1437,122 @@ SDUse getValue() const { return Op; } }; -class AtomicSDNode : public SDNode { +/// Abstact virtual class for operations for memory operations +class MemSDNode : public SDNode { + virtual void ANCHOR(); // Out-of-line virtual method to give class a home. + +private: + //! SrcValue - Memory location for alias analysis. + const Value *SrcValue; + + //! Alignment - Alignment of memory location in bytes. + unsigned Alignment; + +public: + MemSDNode(unsigned Opc, SDVTList VTs, const Value *SrcValue, + unsigned Alignment) + : SDNode(Opc, VTs), SrcValue(SrcValue), Alignment(Alignment) {} + + virtual ~MemSDNode() {} + + /// Returns alignment and volatility of the memory access + unsigned getAlignment() const { return Alignment; } + virtual bool isVolatile() const = 0; + + /// Returns the SrcValue and offset that describes the location of the access + const Value *getSrcValue() const { return SrcValue; } + virtual int getSrcValueOffset() const = 0; + + /// getMemOperand - Return a MachineMemOperand object describing the memory + /// reference performed by operation. + virtual MachineMemOperand getMemOperand() const = 0; + + // Methods to support isa and dyn_cast + static bool classof(const MemSDNode *) { return true; } + static bool classof(const SDNode *N) { + return N->getOpcode() == ISD::LOAD || + N->getOpcode() == ISD::STORE || + N->getOpcode() == ISD::ATOMIC_CMP_SWAP || + N->getOpcode() == ISD::ATOMIC_LOAD_ADD || + N->getOpcode() == ISD::ATOMIC_SWAP || + N->getOpcode() == ISD::ATOMIC_LOAD_SUB || + N->getOpcode() == ISD::ATOMIC_LOAD_AND || + N->getOpcode() == ISD::ATOMIC_LOAD_OR || + N->getOpcode() == ISD::ATOMIC_LOAD_XOR || + N->getOpcode() == ISD::ATOMIC_LOAD_NAND || + N->getOpcode() == ISD::ATOMIC_LOAD_MIN || + N->getOpcode() == ISD::ATOMIC_LOAD_MAX || + N->getOpcode() == ISD::ATOMIC_LOAD_UMIN || + N->getOpcode() == ISD::ATOMIC_LOAD_UMAX; + } +}; + +/// Atomic operations node +class AtomicSDNode : public MemSDNode { virtual void ANCHOR(); // Out-of-line virtual method to give class a home. SDUse Ops[4]; MVT OrigVT; -public: + + public: + // Opc: opcode for atomic + // VTL: value type list + // Chain: memory chain for operaand + // Ptr: address to update as a SDOperand + // Cmp: compare value + // Swp: swap value + // VT: resulting value type + // SrcVal: address to update as a Value (used for MemOperand) + // Align: alignment of memory AtomicSDNode(unsigned Opc, SDVTList VTL, SDOperand Chain, SDOperand Ptr, - SDOperand Cmp, SDOperand Swp, MVT VT) - : SDNode(Opc, VTL) { + SDOperand Cmp, SDOperand Swp, MVT VT, const Value* SrcVal, + unsigned Align=0) + : MemSDNode(Opc, VTL, SrcVal, Align), OrigVT(VT) { Ops[0] = Chain; Ops[1] = Ptr; Ops[2] = Swp; Ops[3] = Cmp; InitOperands(Ops, 4); - OrigVT=VT; } AtomicSDNode(unsigned Opc, SDVTList VTL, SDOperand Chain, SDOperand Ptr, - SDOperand Val, MVT VT) - : SDNode(Opc, VTL) { + SDOperand Val, MVT VT, const Value* SrcVal, unsigned Align=0) + : MemSDNode(Opc, VTL, SrcVal, Align), OrigVT(VT) { Ops[0] = Chain; Ops[1] = Ptr; Ops[2] = Val; InitOperands(Ops, 3); - OrigVT=VT; } + MVT getVT() const { return OrigVT; } - bool isCompareAndSwap() const { return getOpcode() == ISD::ATOMIC_LCS; } + const SDOperand &getChain() const { return getOperand(0); } + const SDOperand &getBasePtr() const { return getOperand(1); } + const SDOperand &getVal() const { return getOperand(2); } + + bool isCompareAndSwap() const { return getOpcode() == ISD::ATOMIC_CMP_SWAP; } + + // Implementation for MemSDNode + virtual int getSrcValueOffset() const { return 0; } + virtual bool isVolatile() const { return true; } + + /// getMemOperand - Return a MachineMemOperand object describing the memory + /// reference performed by this atomic load/store. + virtual MachineMemOperand getMemOperand() const; + + // Methods to support isa and dyn_cast + static bool classof(const AtomicSDNode *) { return true; } + static bool classof(const SDNode *N) { + return N->getOpcode() == ISD::ATOMIC_CMP_SWAP || + N->getOpcode() == ISD::ATOMIC_LOAD_ADD || + N->getOpcode() == ISD::ATOMIC_SWAP || + N->getOpcode() == ISD::ATOMIC_LOAD_SUB || + N->getOpcode() == ISD::ATOMIC_LOAD_AND || + N->getOpcode() == ISD::ATOMIC_LOAD_OR || + N->getOpcode() == ISD::ATOMIC_LOAD_XOR || + N->getOpcode() == ISD::ATOMIC_LOAD_NAND || + N->getOpcode() == ISD::ATOMIC_LOAD_MIN || + N->getOpcode() == ISD::ATOMIC_LOAD_MAX || + N->getOpcode() == ISD::ATOMIC_LOAD_UMIN || + N->getOpcode() == ISD::ATOMIC_LOAD_UMAX; + } }; class StringSDNode : public SDNode { @@ -1934,7 +2024,7 @@ /// LSBaseSDNode - Base class for LoadSDNode and StoreSDNode /// -class LSBaseSDNode : public SDNode { +class LSBaseSDNode : public MemSDNode { private: // AddrMode - unindexed, pre-indexed, post-indexed. ISD::MemIndexedMode AddrMode; @@ -1942,17 +2032,12 @@ // MemoryVT - VT of in-memory value. MVT MemoryVT; - //! SrcValue - Memory location for alias analysis. - const Value *SrcValue; - - //! SVOffset - Memory location offset. + //! SVOffset - Memory location offset. Note that base is defined in MemSDNode int SVOffset; - //! Alignment - Alignment of memory location in bytes. - unsigned Alignment; - - //! IsVolatile - True if the store is volatile. + //! IsVolatile - True if the load/store is volatile. bool IsVolatile; + protected: //! Operand array for load and store /*! @@ -1965,9 +2050,8 @@ LSBaseSDNode(ISD::NodeType NodeTy, SDOperand *Operands, unsigned numOperands, SDVTList VTs, ISD::MemIndexedMode AM, MVT VT, const Value *SV, int SVO, unsigned Align, bool Vol) - : SDNode(NodeTy, VTs), - AddrMode(AM), MemoryVT(VT), - SrcValue(SV), SVOffset(SVO), Alignment(Align), IsVolatile(Vol) { + : MemSDNode(NodeTy, VTs, SV, Align), AddrMode(AM), MemoryVT(VT), + SVOffset(SVO), IsVolatile(Vol) { for (unsigned i = 0; i != numOperands; ++i) Ops[i] = Operands[i]; InitOperands(Ops, numOperands); @@ -1984,12 +2068,8 @@ return getOperand(getOpcode() == ISD::LOAD ? 2 : 3); } - const Value *getSrcValue() const { return SrcValue; } - int getSrcValueOffset() const { return SVOffset; } - unsigned getAlignment() const { return Alignment; } MVT getMemoryVT() const { return MemoryVT; } - bool isVolatile() const { return IsVolatile; } - + ISD::MemIndexedMode getAddressingMode() const { return AddrMode; } /// isIndexed - Return true if this is a pre/post inc/dec load/store. @@ -1998,9 +2078,13 @@ /// isUnindexed - Return true if this is NOT a pre/post inc/dec load/store. bool isUnindexed() const { return AddrMode == ISD::UNINDEXED; } + // Implementation for MemSDNode + virtual int getSrcValueOffset() const { return SVOffset; } + virtual bool isVolatile() const { return IsVolatile; } + /// getMemOperand - Return a MachineMemOperand object describing the memory /// reference performed by this load or store. - MachineMemOperand getMemOperand() const; + virtual MachineMemOperand getMemOperand() const; static bool classof(const LSBaseSDNode *) { return true; } static bool classof(const SDNode *N) { Modified: llvm/trunk/include/llvm/Intrinsics.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Intrinsics.td?rev=52706&r1=52705&r2=52706&view=diff ============================================================================== --- llvm/trunk/include/llvm/Intrinsics.td (original) +++ llvm/trunk/include/llvm/Intrinsics.td Wed Jun 25 03:15:39 2008 @@ -270,26 +270,26 @@ def int_memory_barrier : Intrinsic<[llvm_void_ty, llvm_i1_ty, llvm_i1_ty, llvm_i1_ty, llvm_i1_ty, llvm_i1_ty], []>; -def int_atomic_lcs : Intrinsic<[llvm_anyint_ty, +def int_atomic_cmp_swap : Intrinsic<[llvm_anyint_ty, LLVMPointerType>, LLVMMatchType<0>, LLVMMatchType<0>], [IntrWriteArgMem]>, - GCCBuiltin<"__sync_val_compare_and_swap">; -def int_atomic_las : Intrinsic<[llvm_anyint_ty, + GCCBuiltin<"__sync_val_compare_and_swap">; +def int_atomic_load_add : Intrinsic<[llvm_anyint_ty, LLVMPointerType>, LLVMMatchType<0>], [IntrWriteArgMem]>, - GCCBuiltin<"__sync_fetch_and_add">; -def int_atomic_swap : Intrinsic<[llvm_anyint_ty, + GCCBuiltin<"__sync_fetch_and_add">; +def int_atomic_swap : Intrinsic<[llvm_anyint_ty, LLVMPointerType>, LLVMMatchType<0>], [IntrWriteArgMem]>, - GCCBuiltin<"__sync_lock_test_and_set">; -def int_atomic_lss : Intrinsic<[llvm_anyint_ty, + GCCBuiltin<"__sync_lock_test_and_set">; +def int_atomic_load_sub : Intrinsic<[llvm_anyint_ty, LLVMPointerType>, LLVMMatchType<0>], [IntrWriteArgMem]>, - GCCBuiltin<"__sync_fetch_and_sub">; + GCCBuiltin<"__sync_fetch_and_sub">; def int_atomic_load_and : Intrinsic<[llvm_anyint_ty, LLVMPointerType>, LLVMMatchType<0>], @@ -300,7 +300,7 @@ LLVMMatchType<0>], [IntrWriteArgMem]>, GCCBuiltin<"__sync_fetch_and_or">; -def int_atomic_load_xor : Intrinsic<[llvm_anyint_ty, +def int_atomic_load_xor : Intrinsic<[llvm_anyint_ty, LLVMPointerType>, LLVMMatchType<0>], [IntrWriteArgMem]>, Modified: llvm/trunk/lib/AsmParser/llvmAsmParser.cpp.cvs URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/AsmParser/llvmAsmParser.cpp.cvs?rev=52706&r1=52705&r2=52706&view=diff ============================================================================== --- llvm/trunk/lib/AsmParser/llvmAsmParser.cpp.cvs (original) +++ llvm/trunk/lib/AsmParser/llvmAsmParser.cpp.cvs Wed Jun 25 03:15:39 2008 @@ -388,7 +388,7 @@ /* Copy the first part of user declarations. */ -#line 14 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 14 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" #include "ParserInternals.h" #include "llvm/CallingConv.h" @@ -1348,7 +1348,7 @@ #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED typedef union YYSTYPE -#line 953 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 953 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { llvm::Module *ModuleVal; llvm::Function *FunctionVal; @@ -3598,152 +3598,152 @@ switch (yyn) { case 29: -#line 1124 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1124 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { (yyval.IPredicate) = ICmpInst::ICMP_EQ; ;} break; case 30: -#line 1124 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1124 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { (yyval.IPredicate) = ICmpInst::ICMP_NE; ;} break; case 31: -#line 1125 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1125 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { (yyval.IPredicate) = ICmpInst::ICMP_SLT; ;} break; case 32: -#line 1125 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1125 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { (yyval.IPredicate) = ICmpInst::ICMP_SGT; ;} break; case 33: -#line 1126 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1126 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { (yyval.IPredicate) = ICmpInst::ICMP_SLE; ;} break; case 34: -#line 1126 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1126 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { (yyval.IPredicate) = ICmpInst::ICMP_SGE; ;} break; case 35: -#line 1127 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1127 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { (yyval.IPredicate) = ICmpInst::ICMP_ULT; ;} break; case 36: -#line 1127 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1127 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { (yyval.IPredicate) = ICmpInst::ICMP_UGT; ;} break; case 37: -#line 1128 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1128 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { (yyval.IPredicate) = ICmpInst::ICMP_ULE; ;} break; case 38: -#line 1128 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1128 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { (yyval.IPredicate) = ICmpInst::ICMP_UGE; ;} break; case 39: -#line 1132 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1132 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { (yyval.FPredicate) = FCmpInst::FCMP_OEQ; ;} break; case 40: -#line 1132 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1132 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { (yyval.FPredicate) = FCmpInst::FCMP_ONE; ;} break; case 41: -#line 1133 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1133 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { (yyval.FPredicate) = FCmpInst::FCMP_OLT; ;} break; case 42: -#line 1133 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1133 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { (yyval.FPredicate) = FCmpInst::FCMP_OGT; ;} break; case 43: -#line 1134 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1134 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { (yyval.FPredicate) = FCmpInst::FCMP_OLE; ;} break; case 44: -#line 1134 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1134 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { (yyval.FPredicate) = FCmpInst::FCMP_OGE; ;} break; case 45: -#line 1135 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1135 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { (yyval.FPredicate) = FCmpInst::FCMP_ORD; ;} break; case 46: -#line 1135 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1135 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { (yyval.FPredicate) = FCmpInst::FCMP_UNO; ;} break; case 47: -#line 1136 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1136 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { (yyval.FPredicate) = FCmpInst::FCMP_UEQ; ;} break; case 48: -#line 1136 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1136 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { (yyval.FPredicate) = FCmpInst::FCMP_UNE; ;} break; case 49: -#line 1137 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1137 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { (yyval.FPredicate) = FCmpInst::FCMP_ULT; ;} break; case 50: -#line 1137 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1137 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { (yyval.FPredicate) = FCmpInst::FCMP_UGT; ;} break; case 51: -#line 1138 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1138 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { (yyval.FPredicate) = FCmpInst::FCMP_ULE; ;} break; case 52: -#line 1138 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1138 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { (yyval.FPredicate) = FCmpInst::FCMP_UGE; ;} break; case 53: -#line 1139 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1139 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { (yyval.FPredicate) = FCmpInst::FCMP_TRUE; ;} break; case 54: -#line 1140 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1140 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { (yyval.FPredicate) = FCmpInst::FCMP_FALSE; ;} break; case 65: -#line 1149 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1149 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { (yyval.StrVal) = 0; ;} break; case 66: -#line 1151 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1151 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { (yyval.UIntVal)=(yyvsp[(3) - (4)].UInt64Val); ;} break; case 67: -#line 1152 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1152 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { (yyval.UIntVal)=0; ;} break; case 68: -#line 1156 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1156 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { (yyval.StrVal) = (yyvsp[(1) - (2)].StrVal); CHECK_FOR_ERROR @@ -3751,7 +3751,7 @@ break; case 69: -#line 1160 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1160 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { (yyval.StrVal) = 0; CHECK_FOR_ERROR @@ -3759,7 +3759,7 @@ break; case 73: -#line 1168 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1168 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { (yyval.StrVal) = 0; CHECK_FOR_ERROR @@ -3767,7 +3767,7 @@ break; case 74: -#line 1173 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1173 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { (yyval.StrVal) = (yyvsp[(1) - (2)].StrVal); CHECK_FOR_ERROR @@ -3775,157 +3775,157 @@ break; case 75: -#line 1179 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1179 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { (yyval.Linkage) = GlobalValue::InternalLinkage; ;} break; case 76: -#line 1180 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1180 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { (yyval.Linkage) = GlobalValue::WeakLinkage; ;} break; case 77: -#line 1181 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1181 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { (yyval.Linkage) = GlobalValue::LinkOnceLinkage; ;} break; case 78: -#line 1182 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1182 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { (yyval.Linkage) = GlobalValue::AppendingLinkage; ;} break; case 79: -#line 1183 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1183 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { (yyval.Linkage) = GlobalValue::DLLExportLinkage; ;} break; case 80: -#line 1184 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1184 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { (yyval.Linkage) = GlobalValue::CommonLinkage; ;} break; case 81: -#line 1188 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1188 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { (yyval.Linkage) = GlobalValue::DLLImportLinkage; ;} break; case 82: -#line 1189 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1189 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { (yyval.Linkage) = GlobalValue::ExternalWeakLinkage; ;} break; case 83: -#line 1190 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1190 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;} break; case 84: -#line 1194 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1194 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { (yyval.Visibility) = GlobalValue::DefaultVisibility; ;} break; case 85: -#line 1195 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1195 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { (yyval.Visibility) = GlobalValue::DefaultVisibility; ;} break; case 86: -#line 1196 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1196 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { (yyval.Visibility) = GlobalValue::HiddenVisibility; ;} break; case 87: -#line 1197 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1197 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { (yyval.Visibility) = GlobalValue::ProtectedVisibility; ;} break; case 88: -#line 1201 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1201 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;} break; case 89: -#line 1202 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1202 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { (yyval.Linkage) = GlobalValue::DLLImportLinkage; ;} break; case 90: -#line 1203 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1203 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { (yyval.Linkage) = GlobalValue::ExternalWeakLinkage; ;} break; case 91: -#line 1207 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1207 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;} break; case 92: -#line 1208 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1208 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { (yyval.Linkage) = GlobalValue::InternalLinkage; ;} break; case 93: -#line 1209 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1209 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { (yyval.Linkage) = GlobalValue::LinkOnceLinkage; ;} break; case 94: -#line 1210 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1210 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { (yyval.Linkage) = GlobalValue::WeakLinkage; ;} break; case 95: -#line 1211 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1211 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { (yyval.Linkage) = GlobalValue::DLLExportLinkage; ;} break; case 96: -#line 1215 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1215 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;} break; case 97: -#line 1216 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1216 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { (yyval.Linkage) = GlobalValue::WeakLinkage; ;} break; case 98: -#line 1217 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1217 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { (yyval.Linkage) = GlobalValue::InternalLinkage; ;} break; case 99: -#line 1220 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1220 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { (yyval.UIntVal) = CallingConv::C; ;} break; case 100: -#line 1221 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1221 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { (yyval.UIntVal) = CallingConv::C; ;} break; case 101: -#line 1222 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1222 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { (yyval.UIntVal) = CallingConv::Fast; ;} break; case 102: -#line 1223 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1223 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { (yyval.UIntVal) = CallingConv::Cold; ;} break; case 103: -#line 1224 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1224 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { (yyval.UIntVal) = CallingConv::X86_StdCall; ;} break; case 104: -#line 1225 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1225 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { (yyval.UIntVal) = CallingConv::X86_FastCall; ;} break; case 105: -#line 1226 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1226 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { if ((unsigned)(yyvsp[(2) - (2)].UInt64Val) != (yyvsp[(2) - (2)].UInt64Val)) GEN_ERROR("Calling conv too large"); @@ -3935,129 +3935,129 @@ break; case 106: -#line 1233 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1233 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { (yyval.ParamAttrs) = ParamAttr::ZExt; ;} break; case 107: -#line 1234 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1234 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { (yyval.ParamAttrs) = ParamAttr::ZExt; ;} break; case 108: -#line 1235 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1235 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { (yyval.ParamAttrs) = ParamAttr::SExt; ;} break; case 109: -#line 1236 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1236 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { (yyval.ParamAttrs) = ParamAttr::SExt; ;} break; case 110: -#line 1237 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1237 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { (yyval.ParamAttrs) = ParamAttr::InReg; ;} break; case 111: -#line 1238 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1238 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { (yyval.ParamAttrs) = ParamAttr::StructRet; ;} break; case 112: -#line 1239 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1239 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { (yyval.ParamAttrs) = ParamAttr::NoAlias; ;} break; case 113: -#line 1240 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1240 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { (yyval.ParamAttrs) = ParamAttr::ByVal; ;} break; case 114: -#line 1241 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1241 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { (yyval.ParamAttrs) = ParamAttr::Nest; ;} break; case 115: -#line 1242 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1242 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { (yyval.ParamAttrs) = ParamAttr::constructAlignmentFromInt((yyvsp[(2) - (2)].UInt64Val)); ;} break; case 116: -#line 1246 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1246 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { (yyval.ParamAttrs) = ParamAttr::None; ;} break; case 117: -#line 1247 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1247 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { (yyval.ParamAttrs) = (yyvsp[(1) - (2)].ParamAttrs) | (yyvsp[(2) - (2)].ParamAttrs); ;} break; case 118: -#line 1252 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1252 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { (yyval.ParamAttrs) = ParamAttr::NoReturn; ;} break; case 119: -#line 1253 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1253 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { (yyval.ParamAttrs) = ParamAttr::NoUnwind; ;} break; case 120: -#line 1254 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1254 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { (yyval.ParamAttrs) = ParamAttr::ZExt; ;} break; case 121: -#line 1255 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1255 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { (yyval.ParamAttrs) = ParamAttr::SExt; ;} break; case 122: -#line 1256 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1256 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { (yyval.ParamAttrs) = ParamAttr::ReadNone; ;} break; case 123: -#line 1257 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1257 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { (yyval.ParamAttrs) = ParamAttr::ReadOnly; ;} break; case 124: -#line 1260 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1260 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { (yyval.ParamAttrs) = ParamAttr::None; ;} break; case 125: -#line 1261 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1261 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { (yyval.ParamAttrs) = (yyvsp[(1) - (2)].ParamAttrs) | (yyvsp[(2) - (2)].ParamAttrs); ;} break; case 126: -#line 1266 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1266 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { (yyval.StrVal) = 0; ;} break; case 127: -#line 1267 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1267 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { (yyval.StrVal) = (yyvsp[(2) - (2)].StrVal); ;} break; case 128: -#line 1274 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1274 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { (yyval.UIntVal) = 0; ;} break; case 129: -#line 1275 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1275 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { (yyval.UIntVal) = (yyvsp[(2) - (2)].UInt64Val); if ((yyval.UIntVal) != 0 && !isPowerOf2_32((yyval.UIntVal))) @@ -4067,12 +4067,12 @@ break; case 130: -#line 1281 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1281 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { (yyval.UIntVal) = 0; ;} break; case 131: -#line 1282 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1282 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { (yyval.UIntVal) = (yyvsp[(3) - (3)].UInt64Val); if ((yyval.UIntVal) != 0 && !isPowerOf2_32((yyval.UIntVal))) @@ -4082,7 +4082,7 @@ break; case 132: -#line 1291 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1291 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { for (unsigned i = 0, e = (yyvsp[(2) - (2)].StrVal)->length(); i != e; ++i) if ((*(yyvsp[(2) - (2)].StrVal))[i] == '"' || (*(yyvsp[(2) - (2)].StrVal))[i] == '\\') @@ -4093,27 +4093,27 @@ break; case 133: -#line 1299 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1299 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { (yyval.StrVal) = 0; ;} break; case 134: -#line 1300 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1300 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { (yyval.StrVal) = (yyvsp[(1) - (1)].StrVal); ;} break; case 135: -#line 1305 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1305 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" {;} break; case 136: -#line 1306 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1306 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" {;} break; case 137: -#line 1307 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1307 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { CurGV->setSection(*(yyvsp[(1) - (1)].StrVal)); delete (yyvsp[(1) - (1)].StrVal); @@ -4122,7 +4122,7 @@ break; case 138: -#line 1312 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1312 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { if ((yyvsp[(2) - (2)].UInt64Val) != 0 && !isPowerOf2_32((yyvsp[(2) - (2)].UInt64Val))) GEN_ERROR("Alignment must be a power of two"); @@ -4132,7 +4132,7 @@ break; case 146: -#line 1328 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1328 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { (yyval.TypeVal) = new PATypeHolder(OpaqueType::get()); CHECK_FOR_ERROR @@ -4140,7 +4140,7 @@ break; case 147: -#line 1332 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1332 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { (yyval.TypeVal) = new PATypeHolder((yyvsp[(1) - (1)].PrimType)); CHECK_FOR_ERROR @@ -4148,7 +4148,7 @@ break; case 148: -#line 1336 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1336 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { // Pointer type? if (*(yyvsp[(1) - (3)].TypeVal) == Type::LabelTy) GEN_ERROR("Cannot form a pointer to a basic block"); @@ -4159,7 +4159,7 @@ break; case 149: -#line 1343 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1343 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { // Named types are also simple types... const Type* tmp = getTypeVal((yyvsp[(1) - (1)].ValIDVal)); CHECK_FOR_ERROR @@ -4168,7 +4168,7 @@ break; case 150: -#line 1348 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1348 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { // Type UpReference if ((yyvsp[(2) - (2)].UInt64Val) > (uint64_t)~0U) GEN_ERROR("Value out of range"); OpaqueType *OT = OpaqueType::get(); // Use temporary placeholder @@ -4180,7 +4180,7 @@ break; case 151: -#line 1356 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1356 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { // Allow but ignore attributes on function types; this permits auto-upgrade. // FIXME: remove in LLVM 3.0. @@ -4213,7 +4213,7 @@ break; case 152: -#line 1385 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1385 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { // Allow but ignore attributes on function types; this permits auto-upgrade. // FIXME: remove in LLVM 3.0. @@ -4241,7 +4241,7 @@ break; case 153: -#line 1410 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1410 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { // Sized array type? (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(ArrayType::get(*(yyvsp[(4) - (5)].TypeVal), (yyvsp[(2) - (5)].UInt64Val)))); delete (yyvsp[(4) - (5)].TypeVal); @@ -4250,7 +4250,7 @@ break; case 154: -#line 1415 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1415 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { // Vector type? const llvm::Type* ElemTy = (yyvsp[(4) - (5)].TypeVal)->get(); if ((unsigned)(yyvsp[(2) - (5)].UInt64Val) != (yyvsp[(2) - (5)].UInt64Val)) @@ -4264,7 +4264,7 @@ break; case 155: -#line 1425 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1425 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { // Structure type? std::vector Elements; for (std::list::iterator I = (yyvsp[(2) - (3)].TypeList)->begin(), @@ -4278,7 +4278,7 @@ break; case 156: -#line 1435 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1435 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { // Empty structure type? (yyval.TypeVal) = new PATypeHolder(StructType::get(std::vector())); CHECK_FOR_ERROR @@ -4286,7 +4286,7 @@ break; case 157: -#line 1439 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1439 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { std::vector Elements; for (std::list::iterator I = (yyvsp[(3) - (5)].TypeList)->begin(), @@ -4300,7 +4300,7 @@ break; case 158: -#line 1449 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1449 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { // Empty structure type? (yyval.TypeVal) = new PATypeHolder(StructType::get(std::vector(), true)); CHECK_FOR_ERROR @@ -4308,7 +4308,7 @@ break; case 159: -#line 1456 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1456 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { // Allow but ignore attributes on function types; this permits auto-upgrade. // FIXME: remove in LLVM 3.0. @@ -4318,7 +4318,7 @@ break; case 160: -#line 1465 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1465 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (1)].TypeVal))->getDescription()); @@ -4329,14 +4329,14 @@ break; case 161: -#line 1472 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1472 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { (yyval.TypeVal) = new PATypeHolder(Type::VoidTy); ;} break; case 162: -#line 1477 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1477 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { (yyval.TypeWithAttrsList) = new TypeWithAttrsList(); (yyval.TypeWithAttrsList)->push_back((yyvsp[(1) - (1)].TypeWithAttrs)); @@ -4345,7 +4345,7 @@ break; case 163: -#line 1482 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1482 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { ((yyval.TypeWithAttrsList)=(yyvsp[(1) - (3)].TypeWithAttrsList))->push_back((yyvsp[(3) - (3)].TypeWithAttrs)); CHECK_FOR_ERROR @@ -4353,7 +4353,7 @@ break; case 165: -#line 1490 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1490 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { (yyval.TypeWithAttrsList)=(yyvsp[(1) - (3)].TypeWithAttrsList); TypeWithAttrs TWA; TWA.Attrs = ParamAttr::None; @@ -4364,7 +4364,7 @@ break; case 166: -#line 1497 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1497 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { (yyval.TypeWithAttrsList) = new TypeWithAttrsList; TypeWithAttrs TWA; TWA.Attrs = ParamAttr::None; @@ -4375,7 +4375,7 @@ break; case 167: -#line 1504 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1504 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { (yyval.TypeWithAttrsList) = new TypeWithAttrsList(); CHECK_FOR_ERROR @@ -4383,7 +4383,7 @@ break; case 168: -#line 1512 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1512 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { (yyval.TypeList) = new std::list(); (yyval.TypeList)->push_back(*(yyvsp[(1) - (1)].TypeVal)); @@ -4393,7 +4393,7 @@ break; case 169: -#line 1518 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1518 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { ((yyval.TypeList)=(yyvsp[(1) - (3)].TypeList))->push_back(*(yyvsp[(3) - (3)].TypeVal)); delete (yyvsp[(3) - (3)].TypeVal); @@ -4402,7 +4402,7 @@ break; case 170: -#line 1530 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1530 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { // Nonempty unsized arr if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (4)].TypeVal))->getDescription()); @@ -4414,10 +4414,10 @@ uint64_t NumElements = ATy->getNumElements(); // Verify that we have the correct size... - if (NumElements != -1 && NumElements != (int)(yyvsp[(3) - (4)].ConstVector)->size()) + if (NumElements != uint64_t(-1) && NumElements != (yyvsp[(3) - (4)].ConstVector)->size()) GEN_ERROR("Type mismatch: constant sized array initialized with " + utostr((yyvsp[(3) - (4)].ConstVector)->size()) + " arguments, but has size of " + - itostr(NumElements) + ""); + utostr(NumElements) + ""); // Verify all elements are correct type! for (unsigned i = 0; i < (yyvsp[(3) - (4)].ConstVector)->size(); i++) { @@ -4434,7 +4434,7 @@ break; case 171: -#line 1558 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1558 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (3)].TypeVal))->getDescription()); @@ -4444,9 +4444,9 @@ (*(yyvsp[(1) - (3)].TypeVal))->getDescription() + "'"); uint64_t NumElements = ATy->getNumElements(); - if (NumElements != -1 && NumElements != 0) + if (NumElements != uint64_t(-1) && NumElements != 0) GEN_ERROR("Type mismatch: constant sized array initialized with 0" - " arguments, but has size of " + itostr(NumElements) +""); + " arguments, but has size of " + utostr(NumElements) +""); (yyval.ConstVal) = ConstantArray::get(ATy, std::vector()); delete (yyvsp[(1) - (3)].TypeVal); CHECK_FOR_ERROR @@ -4454,7 +4454,7 @@ break; case 172: -#line 1574 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1574 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (3)].TypeVal))->getDescription()); @@ -4465,13 +4465,13 @@ uint64_t NumElements = ATy->getNumElements(); const Type *ETy = ATy->getElementType(); - if (NumElements != -1 && NumElements != int((yyvsp[(3) - (3)].StrVal)->length())) + if (NumElements != uint64_t(-1) && NumElements != (yyvsp[(3) - (3)].StrVal)->length()) GEN_ERROR("Can't build string constant of size " + - itostr((int)((yyvsp[(3) - (3)].StrVal)->length())) + - " when array has size " + itostr(NumElements) + ""); + utostr((yyvsp[(3) - (3)].StrVal)->length()) + + " when array has size " + utostr(NumElements) + ""); std::vector Vals; if (ETy == Type::Int8Ty) { - for (unsigned i = 0; i < (yyvsp[(3) - (3)].StrVal)->length(); ++i) + for (uint64_t i = 0; i < (yyvsp[(3) - (3)].StrVal)->length(); ++i) Vals.push_back(ConstantInt::get(ETy, (*(yyvsp[(3) - (3)].StrVal))[i])); } else { delete (yyvsp[(3) - (3)].StrVal); @@ -4485,7 +4485,7 @@ break; case 173: -#line 1601 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1601 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { // Nonempty unsized arr if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (4)].TypeVal))->getDescription()); @@ -4497,10 +4497,10 @@ unsigned NumElements = PTy->getNumElements(); // Verify that we have the correct size... - if (NumElements != -1 && NumElements != (int)(yyvsp[(3) - (4)].ConstVector)->size()) + if (NumElements != unsigned(-1) && NumElements != (unsigned)(yyvsp[(3) - (4)].ConstVector)->size()) GEN_ERROR("Type mismatch: constant sized packed initialized with " + utostr((yyvsp[(3) - (4)].ConstVector)->size()) + " arguments, but has size of " + - itostr(NumElements) + ""); + utostr(NumElements) + ""); // Verify all elements are correct type! for (unsigned i = 0; i < (yyvsp[(3) - (4)].ConstVector)->size(); i++) { @@ -4517,7 +4517,7 @@ break; case 174: -#line 1629 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1629 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { const StructType *STy = dyn_cast((yyvsp[(1) - (4)].TypeVal)->get()); if (STy == 0) @@ -4547,7 +4547,7 @@ break; case 175: -#line 1655 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1655 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (3)].TypeVal))->getDescription()); @@ -4571,7 +4571,7 @@ break; case 176: -#line 1675 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1675 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { const StructType *STy = dyn_cast((yyvsp[(1) - (6)].TypeVal)->get()); if (STy == 0) @@ -4601,7 +4601,7 @@ break; case 177: -#line 1701 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1701 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (5)].TypeVal))->getDescription()); @@ -4625,7 +4625,7 @@ break; case 178: -#line 1721 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1721 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription()); @@ -4641,7 +4641,7 @@ break; case 179: -#line 1733 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1733 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription()); @@ -4652,7 +4652,7 @@ break; case 180: -#line 1740 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1740 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription()); @@ -4722,7 +4722,7 @@ break; case 181: -#line 1806 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1806 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription()); @@ -4736,7 +4736,7 @@ break; case 182: -#line 1816 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1816 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription()); @@ -4750,7 +4750,7 @@ break; case 183: -#line 1826 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1826 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { // integral constants if (!ConstantInt::isValueValidForType((yyvsp[(1) - (2)].PrimType), (yyvsp[(2) - (2)].SInt64Val))) GEN_ERROR("Constant value doesn't fit in type"); @@ -4760,7 +4760,7 @@ break; case 184: -#line 1832 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1832 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { // arbitrary precision integer constants uint32_t BitWidth = cast((yyvsp[(1) - (2)].PrimType))->getBitWidth(); if ((yyvsp[(2) - (2)].APIntVal)->getBitWidth() > BitWidth) { @@ -4774,7 +4774,7 @@ break; case 185: -#line 1842 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1842 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { // integral constants if (!ConstantInt::isValueValidForType((yyvsp[(1) - (2)].PrimType), (yyvsp[(2) - (2)].UInt64Val))) GEN_ERROR("Constant value doesn't fit in type"); @@ -4784,7 +4784,7 @@ break; case 186: -#line 1848 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1848 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { // arbitrary precision integer constants uint32_t BitWidth = cast((yyvsp[(1) - (2)].PrimType))->getBitWidth(); if ((yyvsp[(2) - (2)].APIntVal)->getBitWidth() > BitWidth) { @@ -4798,7 +4798,7 @@ break; case 187: -#line 1858 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1858 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { // Boolean constants if (cast((yyvsp[(1) - (2)].PrimType))->getBitWidth() != 1) GEN_ERROR("Constant true must have type i1"); @@ -4808,7 +4808,7 @@ break; case 188: -#line 1864 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1864 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { // Boolean constants if (cast((yyvsp[(1) - (2)].PrimType))->getBitWidth() != 1) GEN_ERROR("Constant false must have type i1"); @@ -4818,7 +4818,7 @@ break; case 189: -#line 1870 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1870 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { // Floating point constants if (!ConstantFP::isValueValidForType((yyvsp[(1) - (2)].PrimType), *(yyvsp[(2) - (2)].FPVal))) GEN_ERROR("Floating point constant invalid for type"); @@ -4833,7 +4833,7 @@ break; case 190: -#line 1883 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1883 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(5) - (6)].TypeVal))->getDescription()); @@ -4849,7 +4849,7 @@ break; case 191: -#line 1895 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1895 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { if (!isa((yyvsp[(3) - (5)].ConstVal)->getType())) GEN_ERROR("GetElementPtr requires a pointer operand"); @@ -4874,7 +4874,7 @@ break; case 192: -#line 1916 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1916 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { if ((yyvsp[(3) - (8)].ConstVal)->getType() != Type::Int1Ty) GEN_ERROR("Select condition must be of boolean type"); @@ -4886,7 +4886,7 @@ break; case 193: -#line 1924 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1924 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { if ((yyvsp[(3) - (6)].ConstVal)->getType() != (yyvsp[(5) - (6)].ConstVal)->getType()) GEN_ERROR("Binary operator types must match"); @@ -4896,7 +4896,7 @@ break; case 194: -#line 1930 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1930 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { if ((yyvsp[(3) - (6)].ConstVal)->getType() != (yyvsp[(5) - (6)].ConstVal)->getType()) GEN_ERROR("Logical operator types must match"); @@ -4911,7 +4911,7 @@ break; case 195: -#line 1941 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1941 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { if ((yyvsp[(4) - (7)].ConstVal)->getType() != (yyvsp[(6) - (7)].ConstVal)->getType()) GEN_ERROR("icmp operand types must match"); @@ -4920,7 +4920,7 @@ break; case 196: -#line 1946 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1946 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { if ((yyvsp[(4) - (7)].ConstVal)->getType() != (yyvsp[(6) - (7)].ConstVal)->getType()) GEN_ERROR("fcmp operand types must match"); @@ -4929,7 +4929,7 @@ break; case 197: -#line 1951 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1951 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { if ((yyvsp[(4) - (7)].ConstVal)->getType() != (yyvsp[(6) - (7)].ConstVal)->getType()) GEN_ERROR("vicmp operand types must match"); @@ -4938,7 +4938,7 @@ break; case 198: -#line 1956 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1956 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { if ((yyvsp[(4) - (7)].ConstVal)->getType() != (yyvsp[(6) - (7)].ConstVal)->getType()) GEN_ERROR("vfcmp operand types must match"); @@ -4947,7 +4947,7 @@ break; case 199: -#line 1961 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1961 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { if (!ExtractElementInst::isValidOperands((yyvsp[(3) - (6)].ConstVal), (yyvsp[(5) - (6)].ConstVal))) GEN_ERROR("Invalid extractelement operands"); @@ -4957,7 +4957,7 @@ break; case 200: -#line 1967 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1967 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { if (!InsertElementInst::isValidOperands((yyvsp[(3) - (8)].ConstVal), (yyvsp[(5) - (8)].ConstVal), (yyvsp[(7) - (8)].ConstVal))) GEN_ERROR("Invalid insertelement operands"); @@ -4967,7 +4967,7 @@ break; case 201: -#line 1973 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1973 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { if (!ShuffleVectorInst::isValidOperands((yyvsp[(3) - (8)].ConstVal), (yyvsp[(5) - (8)].ConstVal), (yyvsp[(7) - (8)].ConstVal))) GEN_ERROR("Invalid shufflevector operands"); @@ -4977,7 +4977,7 @@ break; case 202: -#line 1979 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1979 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { if (!isa((yyvsp[(3) - (5)].ConstVal)->getType()) && !isa((yyvsp[(3) - (5)].ConstVal)->getType())) GEN_ERROR("ExtractValue requires an aggregate operand"); @@ -4989,7 +4989,7 @@ break; case 203: -#line 1987 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1987 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { if (!isa((yyvsp[(3) - (7)].ConstVal)->getType()) && !isa((yyvsp[(3) - (7)].ConstVal)->getType())) GEN_ERROR("InsertValue requires an aggregate operand"); @@ -5001,7 +5001,7 @@ break; case 204: -#line 1998 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1998 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { ((yyval.ConstVector) = (yyvsp[(1) - (3)].ConstVector))->push_back((yyvsp[(3) - (3)].ConstVal)); CHECK_FOR_ERROR @@ -5009,7 +5009,7 @@ break; case 205: -#line 2002 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2002 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { (yyval.ConstVector) = new std::vector(); (yyval.ConstVector)->push_back((yyvsp[(1) - (1)].ConstVal)); @@ -5018,27 +5018,27 @@ break; case 206: -#line 2010 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2010 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { (yyval.BoolVal) = false; ;} break; case 207: -#line 2010 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2010 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { (yyval.BoolVal) = true; ;} break; case 208: -#line 2013 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2013 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { (yyval.BoolVal) = true; ;} break; case 209: -#line 2013 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2013 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { (yyval.BoolVal) = false; ;} break; case 210: -#line 2016 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2016 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { const Type* VTy = (yyvsp[(1) - (2)].TypeVal)->get(); Value *V = getVal(VTy, (yyvsp[(2) - (2)].ValIDVal)); @@ -5054,7 +5054,7 @@ break; case 211: -#line 2028 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2028 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { Constant *Val = (yyvsp[(3) - (6)].ConstVal); const Type *DestTy = (yyvsp[(5) - (6)].TypeVal)->get(); @@ -5070,7 +5070,7 @@ break; case 212: -#line 2049 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2049 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { (yyval.ModuleVal) = ParserResult = CurModule.CurrentModule; CurModule.ModuleDone(); @@ -5079,7 +5079,7 @@ break; case 213: -#line 2054 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2054 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { (yyval.ModuleVal) = ParserResult = CurModule.CurrentModule; CurModule.ModuleDone(); @@ -5088,12 +5088,12 @@ break; case 216: -#line 2067 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2067 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { CurFun.isDeclare = false; ;} break; case 217: -#line 2067 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2067 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { CurFun.FunctionDone(); CHECK_FOR_ERROR @@ -5101,26 +5101,26 @@ break; case 218: -#line 2071 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2071 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { CurFun.isDeclare = true; ;} break; case 219: -#line 2071 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2071 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { CHECK_FOR_ERROR ;} break; case 220: -#line 2074 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2074 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { CHECK_FOR_ERROR ;} break; case 221: -#line 2077 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2077 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (3)].TypeVal))->getDescription()); @@ -5148,7 +5148,7 @@ break; case 222: -#line 2101 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2101 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { ResolveTypeTo((yyvsp[(1) - (3)].StrVal), (yyvsp[(3) - (3)].PrimType)); @@ -5163,7 +5163,7 @@ break; case 223: -#line 2113 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2113 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { /* "Externally Visible" Linkage */ if ((yyvsp[(5) - (6)].ConstVal) == 0) @@ -5175,14 +5175,14 @@ break; case 224: -#line 2120 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2120 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { CurGV = 0; ;} break; case 225: -#line 2124 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2124 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { if ((yyvsp[(6) - (7)].ConstVal) == 0) GEN_ERROR("Global value initializer is not a constant"); @@ -5192,14 +5192,14 @@ break; case 226: -#line 2129 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2129 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { CurGV = 0; ;} break; case 227: -#line 2133 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2133 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(6) - (7)].TypeVal))->getDescription()); @@ -5210,7 +5210,7 @@ break; case 228: -#line 2139 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2139 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { CurGV = 0; CHECK_FOR_ERROR @@ -5218,7 +5218,7 @@ break; case 229: -#line 2143 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2143 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { std::string Name; if ((yyvsp[(1) - (5)].StrVal)) { @@ -5262,21 +5262,21 @@ break; case 230: -#line 2183 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2183 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { CHECK_FOR_ERROR ;} break; case 231: -#line 2186 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2186 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { CHECK_FOR_ERROR ;} break; case 232: -#line 2192 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2192 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { const std::string &AsmSoFar = CurModule.CurrentModule->getModuleInlineAsm(); if (AsmSoFar.empty()) @@ -5289,7 +5289,7 @@ break; case 233: -#line 2202 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2202 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { CurModule.CurrentModule->setTargetTriple(*(yyvsp[(3) - (3)].StrVal)); delete (yyvsp[(3) - (3)].StrVal); @@ -5297,7 +5297,7 @@ break; case 234: -#line 2206 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2206 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { CurModule.CurrentModule->setDataLayout(*(yyvsp[(3) - (3)].StrVal)); delete (yyvsp[(3) - (3)].StrVal); @@ -5305,7 +5305,7 @@ break; case 236: -#line 2213 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2213 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { CurModule.CurrentModule->addLibrary(*(yyvsp[(3) - (3)].StrVal)); delete (yyvsp[(3) - (3)].StrVal); @@ -5314,7 +5314,7 @@ break; case 237: -#line 2218 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2218 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { CurModule.CurrentModule->addLibrary(*(yyvsp[(1) - (1)].StrVal)); delete (yyvsp[(1) - (1)].StrVal); @@ -5323,14 +5323,14 @@ break; case 238: -#line 2223 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2223 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { CHECK_FOR_ERROR ;} break; case 239: -#line 2232 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2232 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (5)].TypeVal))->getDescription()); @@ -5344,7 +5344,7 @@ break; case 240: -#line 2242 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2242 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (3)].TypeVal))->getDescription()); @@ -5358,7 +5358,7 @@ break; case 241: -#line 2253 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2253 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { (yyval.ArgList) = (yyvsp[(1) - (1)].ArgList); CHECK_FOR_ERROR @@ -5366,7 +5366,7 @@ break; case 242: -#line 2257 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2257 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { (yyval.ArgList) = (yyvsp[(1) - (3)].ArgList); struct ArgListEntry E; @@ -5379,7 +5379,7 @@ break; case 243: -#line 2266 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2266 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { (yyval.ArgList) = new ArgListType; struct ArgListEntry E; @@ -5392,7 +5392,7 @@ break; case 244: -#line 2275 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2275 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { (yyval.ArgList) = 0; CHECK_FOR_ERROR @@ -5400,7 +5400,7 @@ break; case 245: -#line 2281 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2281 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { std::string FunctionName(*(yyvsp[(3) - (10)].StrVal)); delete (yyvsp[(3) - (10)].StrVal); // Free strdup'd memory! @@ -5531,7 +5531,7 @@ break; case 248: -#line 2411 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2411 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { (yyval.FunctionVal) = CurFun.CurrentFunction; @@ -5543,7 +5543,7 @@ break; case 251: -#line 2422 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2422 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { (yyval.FunctionVal) = (yyvsp[(1) - (2)].FunctionVal); CHECK_FOR_ERROR @@ -5551,7 +5551,7 @@ break; case 252: -#line 2427 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2427 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { CurFun.CurrentFunction->setLinkage((yyvsp[(1) - (3)].Linkage)); CurFun.CurrentFunction->setVisibility((yyvsp[(2) - (3)].Visibility)); @@ -5562,7 +5562,7 @@ break; case 253: -#line 2439 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2439 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { (yyval.BoolVal) = false; CHECK_FOR_ERROR @@ -5570,7 +5570,7 @@ break; case 254: -#line 2443 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2443 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { (yyval.BoolVal) = true; CHECK_FOR_ERROR @@ -5578,7 +5578,7 @@ break; case 255: -#line 2448 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2448 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { // A reference to a direct constant (yyval.ValIDVal) = ValID::create((yyvsp[(1) - (1)].SInt64Val)); CHECK_FOR_ERROR @@ -5586,7 +5586,7 @@ break; case 256: -#line 2452 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2452 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { (yyval.ValIDVal) = ValID::create((yyvsp[(1) - (1)].UInt64Val)); CHECK_FOR_ERROR @@ -5594,7 +5594,7 @@ break; case 257: -#line 2456 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2456 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { // Perhaps it's an FP constant? (yyval.ValIDVal) = ValID::create((yyvsp[(1) - (1)].FPVal)); CHECK_FOR_ERROR @@ -5602,7 +5602,7 @@ break; case 258: -#line 2460 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2460 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { (yyval.ValIDVal) = ValID::create(ConstantInt::getTrue()); CHECK_FOR_ERROR @@ -5610,7 +5610,7 @@ break; case 259: -#line 2464 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2464 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { (yyval.ValIDVal) = ValID::create(ConstantInt::getFalse()); CHECK_FOR_ERROR @@ -5618,7 +5618,7 @@ break; case 260: -#line 2468 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2468 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { (yyval.ValIDVal) = ValID::createNull(); CHECK_FOR_ERROR @@ -5626,7 +5626,7 @@ break; case 261: -#line 2472 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2472 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { (yyval.ValIDVal) = ValID::createUndef(); CHECK_FOR_ERROR @@ -5634,7 +5634,7 @@ break; case 262: -#line 2476 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2476 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { // A vector zero constant. (yyval.ValIDVal) = ValID::createZeroInit(); CHECK_FOR_ERROR @@ -5642,7 +5642,7 @@ break; case 263: -#line 2480 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2480 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { // Nonempty unsized packed vector const Type *ETy = (*(yyvsp[(2) - (3)].ConstVector))[0]->getType(); unsigned NumElements = (yyvsp[(2) - (3)].ConstVector)->size(); @@ -5668,7 +5668,7 @@ break; case 264: -#line 2502 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2502 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { // Nonempty unsized arr const Type *ETy = (*(yyvsp[(2) - (3)].ConstVector))[0]->getType(); uint64_t NumElements = (yyvsp[(2) - (3)].ConstVector)->size(); @@ -5694,7 +5694,7 @@ break; case 265: -#line 2524 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2524 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { // Use undef instead of an array because it's inconvenient to determine // the element type at this point, there being no elements to examine. @@ -5704,7 +5704,7 @@ break; case 266: -#line 2530 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2530 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { uint64_t NumElements = (yyvsp[(2) - (2)].StrVal)->length(); const Type *ETy = Type::Int8Ty; @@ -5721,7 +5721,7 @@ break; case 267: -#line 2543 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2543 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { std::vector Elements((yyvsp[(2) - (3)].ConstVector)->size()); for (unsigned i = 0, e = (yyvsp[(2) - (3)].ConstVector)->size(); i != e; ++i) @@ -5737,7 +5737,7 @@ break; case 268: -#line 2555 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2555 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { const StructType *STy = StructType::get(std::vector()); (yyval.ValIDVal) = ValID::create(ConstantStruct::get(STy, std::vector())); @@ -5746,7 +5746,7 @@ break; case 269: -#line 2560 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2560 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { std::vector Elements((yyvsp[(3) - (5)].ConstVector)->size()); for (unsigned i = 0, e = (yyvsp[(3) - (5)].ConstVector)->size(); i != e; ++i) @@ -5762,7 +5762,7 @@ break; case 270: -#line 2572 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2572 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { const StructType *STy = StructType::get(std::vector(), /*isPacked=*/true); @@ -5772,7 +5772,7 @@ break; case 271: -#line 2578 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2578 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { (yyval.ValIDVal) = ValID::create((yyvsp[(1) - (1)].ConstVal)); CHECK_FOR_ERROR @@ -5780,7 +5780,7 @@ break; case 272: -#line 2582 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2582 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { (yyval.ValIDVal) = ValID::createInlineAsm(*(yyvsp[(3) - (5)].StrVal), *(yyvsp[(5) - (5)].StrVal), (yyvsp[(2) - (5)].BoolVal)); delete (yyvsp[(3) - (5)].StrVal); @@ -5790,7 +5790,7 @@ break; case 273: -#line 2592 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2592 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { // Is it an integer reference...? (yyval.ValIDVal) = ValID::createLocalID((yyvsp[(1) - (1)].UIntVal)); CHECK_FOR_ERROR @@ -5798,7 +5798,7 @@ break; case 274: -#line 2596 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2596 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { (yyval.ValIDVal) = ValID::createGlobalID((yyvsp[(1) - (1)].UIntVal)); CHECK_FOR_ERROR @@ -5806,7 +5806,7 @@ break; case 275: -#line 2600 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2600 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { // Is it a named reference...? (yyval.ValIDVal) = ValID::createLocalName(*(yyvsp[(1) - (1)].StrVal)); delete (yyvsp[(1) - (1)].StrVal); @@ -5815,7 +5815,7 @@ break; case 276: -#line 2605 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2605 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { // Is it a named reference...? (yyval.ValIDVal) = ValID::createGlobalName(*(yyvsp[(1) - (1)].StrVal)); delete (yyvsp[(1) - (1)].StrVal); @@ -5824,7 +5824,7 @@ break; case 279: -#line 2618 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2618 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription()); @@ -5835,7 +5835,7 @@ break; case 280: -#line 2627 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2627 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { (yyval.ValueList) = new std::vector(); (yyval.ValueList)->push_back((yyvsp[(1) - (1)].ValueVal)); @@ -5844,7 +5844,7 @@ break; case 281: -#line 2632 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2632 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { ((yyval.ValueList)=(yyvsp[(1) - (3)].ValueList))->push_back((yyvsp[(3) - (3)].ValueVal)); CHECK_FOR_ERROR @@ -5852,7 +5852,7 @@ break; case 282: -#line 2637 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2637 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { (yyval.FunctionVal) = (yyvsp[(1) - (2)].FunctionVal); CHECK_FOR_ERROR @@ -5860,7 +5860,7 @@ break; case 283: -#line 2641 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2641 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { // Do not allow functions with 0 basic blocks (yyval.FunctionVal) = (yyvsp[(1) - (2)].FunctionVal); CHECK_FOR_ERROR @@ -5868,7 +5868,7 @@ break; case 284: -#line 2650 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2650 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { setValueName((yyvsp[(3) - (3)].TermInstVal), (yyvsp[(2) - (3)].StrVal)); CHECK_FOR_ERROR @@ -5880,7 +5880,7 @@ break; case 285: -#line 2659 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2659 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { if (CastInst *CI1 = dyn_cast((yyvsp[(2) - (2)].InstVal))) if (CastInst *CI2 = dyn_cast(CI1->getOperand(0))) @@ -5893,7 +5893,7 @@ break; case 286: -#line 2668 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2668 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { // Empty space between instruction lists (yyval.BasicBlockVal) = defineBBVal(ValID::createLocalID(CurFun.NextValNum)); CHECK_FOR_ERROR @@ -5901,7 +5901,7 @@ break; case 287: -#line 2672 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2672 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { // Labelled (named) basic block (yyval.BasicBlockVal) = defineBBVal(ValID::createLocalName(*(yyvsp[(1) - (1)].StrVal))); delete (yyvsp[(1) - (1)].StrVal); @@ -5911,7 +5911,7 @@ break; case 288: -#line 2680 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2680 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { // Return with a result... ValueList &VL = *(yyvsp[(2) - (2)].ValueList); assert(!VL.empty() && "Invalid ret operands!"); @@ -5922,7 +5922,7 @@ break; case 289: -#line 2687 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2687 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { // Return with no result... (yyval.TermInstVal) = ReturnInst::Create(); CHECK_FOR_ERROR @@ -5930,7 +5930,7 @@ break; case 290: -#line 2691 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2691 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { // Unconditional Branch... BasicBlock* tmpBB = getBBVal((yyvsp[(3) - (3)].ValIDVal)); CHECK_FOR_ERROR @@ -5939,7 +5939,7 @@ break; case 291: -#line 2696 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2696 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { if (cast((yyvsp[(2) - (9)].PrimType))->getBitWidth() != 1) GEN_ERROR("Branch condition must have type i1"); @@ -5954,7 +5954,7 @@ break; case 292: -#line 2707 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2707 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { Value* tmpVal = getVal((yyvsp[(2) - (9)].PrimType), (yyvsp[(3) - (9)].ValIDVal)); CHECK_FOR_ERROR @@ -5977,7 +5977,7 @@ break; case 293: -#line 2726 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2726 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { Value* tmpVal = getVal((yyvsp[(2) - (8)].PrimType), (yyvsp[(3) - (8)].ValIDVal)); CHECK_FOR_ERROR @@ -5990,7 +5990,7 @@ break; case 294: -#line 2736 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2736 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { // Handle the short syntax @@ -6079,7 +6079,7 @@ break; case 295: -#line 2821 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2821 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { (yyval.TermInstVal) = new UnwindInst(); CHECK_FOR_ERROR @@ -6087,7 +6087,7 @@ break; case 296: -#line 2825 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2825 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { (yyval.TermInstVal) = new UnreachableInst(); CHECK_FOR_ERROR @@ -6095,7 +6095,7 @@ break; case 297: -#line 2832 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2832 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { (yyval.JumpTable) = (yyvsp[(1) - (6)].JumpTable); Constant *V = cast(getExistingVal((yyvsp[(2) - (6)].PrimType), (yyvsp[(3) - (6)].ValIDVal))); @@ -6110,7 +6110,7 @@ break; case 298: -#line 2843 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2843 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { (yyval.JumpTable) = new std::vector >(); Constant *V = cast(getExistingVal((yyvsp[(1) - (5)].PrimType), (yyvsp[(2) - (5)].ValIDVal))); @@ -6126,7 +6126,7 @@ break; case 299: -#line 2856 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2856 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { // Is this definition named?? if so, assign the name... setValueName((yyvsp[(2) - (2)].InstVal), (yyvsp[(1) - (2)].StrVal)); @@ -6138,7 +6138,7 @@ break; case 300: -#line 2866 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2866 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { // Used for PHI nodes if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (6)].TypeVal))->getDescription()); @@ -6153,7 +6153,7 @@ break; case 301: -#line 2877 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2877 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { (yyval.PHIList) = (yyvsp[(1) - (7)].PHIList); Value* tmpVal = getVal((yyvsp[(1) - (7)].PHIList)->front().first->getType(), (yyvsp[(4) - (7)].ValIDVal)); @@ -6165,7 +6165,7 @@ break; case 302: -#line 2887 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2887 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { // FIXME: Remove trailing OptParamAttrs in LLVM 3.0, it was a mistake in 2.0 if (!UpRefs.empty()) @@ -6180,7 +6180,7 @@ break; case 303: -#line 2898 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2898 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { // FIXME: Remove trailing OptParamAttrs in LLVM 3.0, it was a mistake in 2.0 // Labels are only valid in ASMs @@ -6192,7 +6192,7 @@ break; case 304: -#line 2906 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2906 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { // FIXME: Remove trailing OptParamAttrs in LLVM 3.0, it was a mistake in 2.0 if (!UpRefs.empty()) @@ -6206,7 +6206,7 @@ break; case 305: -#line 2916 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2916 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { // FIXME: Remove trailing OptParamAttrs in LLVM 3.0, it was a mistake in 2.0 (yyval.ParamList) = (yyvsp[(1) - (6)].ParamList); @@ -6217,17 +6217,17 @@ break; case 306: -#line 2923 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2923 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { (yyval.ParamList) = new ParamList(); ;} break; case 307: -#line 2926 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2926 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { (yyval.ValueList) = new std::vector(); ;} break; case 308: -#line 2927 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2927 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { (yyval.ValueList) = (yyvsp[(1) - (3)].ValueList); (yyval.ValueList)->push_back((yyvsp[(3) - (3)].ValueVal)); @@ -6236,7 +6236,7 @@ break; case 309: -#line 2935 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2935 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { (yyval.ConstantList) = new std::vector(); if ((unsigned)(yyvsp[(2) - (2)].UInt64Val) != (yyvsp[(2) - (2)].UInt64Val)) @@ -6246,7 +6246,7 @@ break; case 310: -#line 2941 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2941 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { (yyval.ConstantList) = (yyvsp[(1) - (3)].ConstantList); if ((unsigned)(yyvsp[(3) - (3)].UInt64Val) != (yyvsp[(3) - (3)].UInt64Val)) @@ -6257,7 +6257,7 @@ break; case 311: -#line 2950 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2950 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { (yyval.BoolVal) = true; CHECK_FOR_ERROR @@ -6265,7 +6265,7 @@ break; case 312: -#line 2954 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2954 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { (yyval.BoolVal) = false; CHECK_FOR_ERROR @@ -6273,7 +6273,7 @@ break; case 313: -#line 2959 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2959 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (5)].TypeVal))->getDescription()); @@ -6293,7 +6293,7 @@ break; case 314: -#line 2975 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2975 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (5)].TypeVal))->getDescription()); @@ -6314,7 +6314,7 @@ break; case 315: -#line 2992 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2992 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (6)].TypeVal))->getDescription()); @@ -6332,7 +6332,7 @@ break; case 316: -#line 3006 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 3006 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (6)].TypeVal))->getDescription()); @@ -6350,7 +6350,7 @@ break; case 317: -#line 3020 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 3020 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (6)].TypeVal))->getDescription()); @@ -6368,7 +6368,7 @@ break; case 318: -#line 3034 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 3034 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (6)].TypeVal))->getDescription()); @@ -6386,7 +6386,7 @@ break; case 319: -#line 3048 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 3048 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(4) - (4)].TypeVal))->getDescription()); @@ -6402,7 +6402,7 @@ break; case 320: -#line 3060 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 3060 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { if ((yyvsp[(2) - (6)].ValueVal)->getType() != Type::Int1Ty) GEN_ERROR("select condition must be boolean"); @@ -6414,7 +6414,7 @@ break; case 321: -#line 3068 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 3068 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(4) - (4)].TypeVal))->getDescription()); @@ -6425,7 +6425,7 @@ break; case 322: -#line 3075 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 3075 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { if (!ExtractElementInst::isValidOperands((yyvsp[(2) - (4)].ValueVal), (yyvsp[(4) - (4)].ValueVal))) GEN_ERROR("Invalid extractelement operands"); @@ -6435,7 +6435,7 @@ break; case 323: -#line 3081 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 3081 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { if (!InsertElementInst::isValidOperands((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal))) GEN_ERROR("Invalid insertelement operands"); @@ -6445,7 +6445,7 @@ break; case 324: -#line 3087 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 3087 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { if (!ShuffleVectorInst::isValidOperands((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal))) GEN_ERROR("Invalid shufflevector operands"); @@ -6455,7 +6455,7 @@ break; case 325: -#line 3093 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 3093 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { const Type *Ty = (yyvsp[(2) - (2)].PHIList)->front().first->getType(); if (!Ty->isFirstClassType()) @@ -6474,7 +6474,7 @@ break; case 326: -#line 3109 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 3109 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { // Handle the short syntax @@ -6567,7 +6567,7 @@ break; case 327: -#line 3198 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 3198 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { (yyval.InstVal) = (yyvsp[(1) - (1)].InstVal); CHECK_FOR_ERROR @@ -6575,7 +6575,7 @@ break; case 328: -#line 3203 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 3203 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { (yyval.BoolVal) = true; CHECK_FOR_ERROR @@ -6583,7 +6583,7 @@ break; case 329: -#line 3207 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 3207 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { (yyval.BoolVal) = false; CHECK_FOR_ERROR @@ -6591,7 +6591,7 @@ break; case 330: -#line 3214 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 3214 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (3)].TypeVal))->getDescription()); @@ -6602,7 +6602,7 @@ break; case 331: -#line 3221 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 3221 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (6)].TypeVal))->getDescription()); @@ -6616,7 +6616,7 @@ break; case 332: -#line 3231 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 3231 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (3)].TypeVal))->getDescription()); @@ -6627,7 +6627,7 @@ break; case 333: -#line 3238 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 3238 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (6)].TypeVal))->getDescription()); @@ -6641,7 +6641,7 @@ break; case 334: -#line 3248 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 3248 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { if (!isa((yyvsp[(2) - (2)].ValueVal)->getType())) GEN_ERROR("Trying to free nonpointer type " + @@ -6652,7 +6652,7 @@ break; case 335: -#line 3256 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 3256 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (5)].TypeVal))->getDescription()); @@ -6670,7 +6670,7 @@ break; case 336: -#line 3270 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 3270 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(5) - (7)].TypeVal))->getDescription()); @@ -6691,7 +6691,7 @@ break; case 337: -#line 3287 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 3287 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { Value *TmpVal = getVal((yyvsp[(2) - (5)].TypeVal)->get(), (yyvsp[(3) - (5)].ValIDVal)); if (!GetResultInst::isValidOperands(TmpVal, (yyvsp[(5) - (5)].UInt64Val))) @@ -6703,7 +6703,7 @@ break; case 338: -#line 3295 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 3295 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (4)].TypeVal))->getDescription()); @@ -6722,7 +6722,7 @@ break; case 339: -#line 3310 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 3310 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (4)].TypeVal))->getDescription()); @@ -6741,7 +6741,7 @@ break; case 340: -#line 3325 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 3325 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (7)].TypeVal))->getDescription()); @@ -6977,7 +6977,7 @@ } -#line 3344 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 3344 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" // common code from the two 'RunVMAsmParser' functions Modified: llvm/trunk/lib/AsmParser/llvmAsmParser.h.cvs URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/AsmParser/llvmAsmParser.h.cvs?rev=52706&r1=52705&r2=52706&view=diff ============================================================================== --- llvm/trunk/lib/AsmParser/llvmAsmParser.h.cvs (original) +++ llvm/trunk/lib/AsmParser/llvmAsmParser.h.cvs Wed Jun 25 03:15:39 2008 @@ -354,7 +354,7 @@ #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED typedef union YYSTYPE -#line 953 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" +#line 953 "/Volumes/Data/Code/work/llvm2/lib/AsmParser/llvmAsmParser.y" { llvm::Module *ModuleVal; llvm::Function *FunctionVal; Modified: llvm/trunk/lib/AsmParser/llvmAsmParser.y.cvs URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/AsmParser/llvmAsmParser.y.cvs?rev=52706&r1=52705&r2=52706&view=diff ============================================================================== --- llvm/trunk/lib/AsmParser/llvmAsmParser.y.cvs (original) +++ llvm/trunk/lib/AsmParser/llvmAsmParser.y.cvs Wed Jun 25 03:15:39 2008 @@ -1538,10 +1538,10 @@ uint64_t NumElements = ATy->getNumElements(); // Verify that we have the correct size... - if (NumElements != -1 && NumElements != (int)$3->size()) + if (NumElements != uint64_t(-1) && NumElements != $3->size()) GEN_ERROR("Type mismatch: constant sized array initialized with " + utostr($3->size()) + " arguments, but has size of " + - itostr(NumElements) + ""); + utostr(NumElements) + ""); // Verify all elements are correct type! for (unsigned i = 0; i < $3->size(); i++) { @@ -1564,9 +1564,9 @@ (*$1)->getDescription() + "'"); uint64_t NumElements = ATy->getNumElements(); - if (NumElements != -1 && NumElements != 0) + if (NumElements != uint64_t(-1) && NumElements != 0) GEN_ERROR("Type mismatch: constant sized array initialized with 0" - " arguments, but has size of " + itostr(NumElements) +""); + " arguments, but has size of " + utostr(NumElements) +""); $$ = ConstantArray::get(ATy, std::vector()); delete $1; CHECK_FOR_ERROR @@ -1581,13 +1581,13 @@ uint64_t NumElements = ATy->getNumElements(); const Type *ETy = ATy->getElementType(); - if (NumElements != -1 && NumElements != int($3->length())) + if (NumElements != uint64_t(-1) && NumElements != $3->length()) GEN_ERROR("Can't build string constant of size " + - itostr((int)($3->length())) + - " when array has size " + itostr(NumElements) + ""); + utostr($3->length()) + + " when array has size " + utostr(NumElements) + ""); std::vector Vals; if (ETy == Type::Int8Ty) { - for (unsigned i = 0; i < $3->length(); ++i) + for (uint64_t i = 0; i < $3->length(); ++i) Vals.push_back(ConstantInt::get(ETy, (*$3)[i])); } else { delete $3; @@ -1609,10 +1609,10 @@ unsigned NumElements = PTy->getNumElements(); // Verify that we have the correct size... - if (NumElements != -1 && NumElements != (int)$3->size()) + if (NumElements != unsigned(-1) && NumElements != (unsigned)$3->size()) GEN_ERROR("Type mismatch: constant sized packed initialized with " + utostr($3->size()) + " arguments, but has size of " + - itostr(NumElements) + ""); + utostr(NumElements) + ""); // Verify all elements are correct type! for (unsigned i = 0; i < $3->size(); i++) { Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp?rev=52706&r1=52705&r2=52706&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Wed Jun 25 03:15:39 2008 @@ -1228,7 +1228,7 @@ break; } - case ISD::ATOMIC_LCS: { + case ISD::ATOMIC_CMP_SWAP: { unsigned int num_operands = 4; assert(Node->getNumOperands() == num_operands && "Invalid Atomic node!"); SDOperand Ops[4]; @@ -1248,8 +1248,8 @@ AddLegalizedOperand(SDOperand(Node, 1), Result.getValue(1)); return Result.getValue(Op.ResNo); } - case ISD::ATOMIC_LAS: - case ISD::ATOMIC_LSS: + case ISD::ATOMIC_LOAD_ADD: + case ISD::ATOMIC_LOAD_SUB: case ISD::ATOMIC_LOAD_AND: case ISD::ATOMIC_LOAD_OR: case ISD::ATOMIC_LOAD_XOR: @@ -4270,18 +4270,20 @@ break; } - case ISD::ATOMIC_LCS: { + case ISD::ATOMIC_CMP_SWAP: { + AtomicSDNode* AtomNode = cast(Node); Tmp2 = PromoteOp(Node->getOperand(2)); Tmp3 = PromoteOp(Node->getOperand(3)); - Result = DAG.getAtomic(Node->getOpcode(), Node->getOperand(0), - Node->getOperand(1), Tmp2, Tmp3, - cast(Node)->getVT()); + Result = DAG.getAtomic(Node->getOpcode(), AtomNode->getChain(), + AtomNode->getBasePtr(), Tmp2, Tmp3, + AtomNode->getVT(), AtomNode->getSrcValue(), + AtomNode->getAlignment()); // Remember that we legalized the chain. AddLegalizedOperand(Op.getValue(1), LegalizeOp(Result.getValue(1))); break; } - case ISD::ATOMIC_LAS: - case ISD::ATOMIC_LSS: + case ISD::ATOMIC_LOAD_ADD: + case ISD::ATOMIC_LOAD_SUB: case ISD::ATOMIC_LOAD_AND: case ISD::ATOMIC_LOAD_OR: case ISD::ATOMIC_LOAD_XOR: @@ -4291,10 +4293,12 @@ case ISD::ATOMIC_LOAD_UMIN: case ISD::ATOMIC_LOAD_UMAX: case ISD::ATOMIC_SWAP: { + AtomicSDNode* AtomNode = cast(Node); Tmp2 = PromoteOp(Node->getOperand(2)); - Result = DAG.getAtomic(Node->getOpcode(), Node->getOperand(0), - Node->getOperand(1), Tmp2, - cast(Node)->getVT()); + Result = DAG.getAtomic(Node->getOpcode(), AtomNode->getChain(), + AtomNode->getBasePtr(), Tmp2, + AtomNode->getVT(), AtomNode->getSrcValue(), + AtomNode->getAlignment()); // Remember that we legalized the chain. AddLegalizedOperand(Op.getValue(1), LegalizeOp(Result.getValue(1))); break; @@ -6151,7 +6155,7 @@ break; } - case ISD::ATOMIC_LCS: { + case ISD::ATOMIC_CMP_SWAP: { SDOperand Tmp = TLI.LowerOperation(Op, DAG); assert(Tmp.Val && "Node must be custom expanded!"); ExpandOp(Tmp.getValue(0), Lo, Hi); Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp?rev=52706&r1=52705&r2=52706&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Wed Jun 25 03:15:39 2008 @@ -430,7 +430,24 @@ ID.AddInteger(ST->isVolatile()); break; } + case ISD::ATOMIC_CMP_SWAP: + case ISD::ATOMIC_LOAD_ADD: + case ISD::ATOMIC_SWAP: + case ISD::ATOMIC_LOAD_SUB: + case ISD::ATOMIC_LOAD_AND: + case ISD::ATOMIC_LOAD_OR: + case ISD::ATOMIC_LOAD_XOR: + case ISD::ATOMIC_LOAD_NAND: + case ISD::ATOMIC_LOAD_MIN: + case ISD::ATOMIC_LOAD_MAX: + case ISD::ATOMIC_LOAD_UMIN: + case ISD::ATOMIC_LOAD_UMAX: { + AtomicSDNode *AT = cast(N); + ID.AddInteger(AT->getAlignment()); + ID.AddInteger(AT->isVolatile()); + break; } + } // end switch (N->getOpcode()) } //===----------------------------------------------------------------------===// @@ -2972,8 +2989,9 @@ SDOperand SelectionDAG::getAtomic(unsigned Opcode, SDOperand Chain, SDOperand Ptr, SDOperand Cmp, - SDOperand Swp, MVT VT) { - assert(Opcode == ISD::ATOMIC_LCS && "Invalid Atomic Op"); + SDOperand Swp, MVT VT, const Value* PtrVal, + unsigned Alignment) { + assert(Opcode == ISD::ATOMIC_CMP_SWAP && "Invalid Atomic Op"); assert(Cmp.getValueType() == Swp.getValueType() && "Invalid Atomic Op Types"); SDVTList VTs = getVTList(Cmp.getValueType(), MVT::Other); FoldingSetNodeID ID; @@ -2983,7 +3001,8 @@ void* IP = 0; if (SDNode *E = CSEMap.FindNodeOrInsertPos(ID, IP)) return SDOperand(E, 0); - SDNode* N = new AtomicSDNode(Opcode, VTs, Chain, Ptr, Cmp, Swp, VT); + SDNode* N = new AtomicSDNode(Opcode, VTs, Chain, Ptr, Cmp, Swp, VT, + PtrVal, Alignment); CSEMap.InsertNode(N, IP); AllNodes.push_back(N); return SDOperand(N, 0); @@ -2991,8 +3010,9 @@ SDOperand SelectionDAG::getAtomic(unsigned Opcode, SDOperand Chain, SDOperand Ptr, SDOperand Val, - MVT VT) { - assert(( Opcode == ISD::ATOMIC_LAS || Opcode == ISD::ATOMIC_LSS + MVT VT, const Value* PtrVal, + unsigned Alignment) { + assert(( Opcode == ISD::ATOMIC_LOAD_ADD || Opcode == ISD::ATOMIC_LOAD_SUB || Opcode == ISD::ATOMIC_SWAP || Opcode == ISD::ATOMIC_LOAD_AND || Opcode == ISD::ATOMIC_LOAD_OR || Opcode == ISD::ATOMIC_LOAD_XOR || Opcode == ISD::ATOMIC_LOAD_NAND @@ -3007,7 +3027,8 @@ void* IP = 0; if (SDNode *E = CSEMap.FindNodeOrInsertPos(ID, IP)) return SDOperand(E, 0); - SDNode* N = new AtomicSDNode(Opcode, VTs, Chain, Ptr, Val, VT); + SDNode* N = new AtomicSDNode(Opcode, VTs, Chain, Ptr, Val, VT, + PtrVal, Alignment); CSEMap.InsertNode(N, IP); AllNodes.push_back(N); return SDOperand(N, 0); @@ -4171,6 +4192,7 @@ void CondCodeSDNode::ANCHOR() {} void ARG_FLAGSSDNode::ANCHOR() {} void VTSDNode::ANCHOR() {} +void MemSDNode::ANCHOR() {} void LoadSDNode::ANCHOR() {} void StoreSDNode::ANCHOR() {} void AtomicSDNode::ANCHOR() {} @@ -4193,13 +4215,31 @@ } /// getMemOperand - Return a MachineMemOperand object describing the memory +/// reference performed by this atomic. +MachineMemOperand AtomicSDNode::getMemOperand() const { + int Size = (getVT().getSizeInBits() + 7) >> 3; + int Flags = MachineMemOperand::MOLoad | MachineMemOperand::MOStore; + if (isVolatile()) Flags |= MachineMemOperand::MOVolatile; + + // Check if the atomic references a frame index + const FrameIndexSDNode *FI = + dyn_cast(getBasePtr().Val); + if (!getSrcValue() && FI) + return MachineMemOperand(PseudoSourceValue::getFixedStack(), Flags, + FI->getIndex(), Size, getAlignment()); + else + return MachineMemOperand(getSrcValue(), Flags, getSrcValueOffset(), + Size, getAlignment()); +} + +/// getMemOperand - Return a MachineMemOperand object describing the memory /// reference performed by this load or store. MachineMemOperand LSBaseSDNode::getMemOperand() const { int Size = (getMemoryVT().getSizeInBits() + 7) >> 3; int Flags = getOpcode() == ISD::LOAD ? MachineMemOperand::MOLoad : MachineMemOperand::MOStore; - if (IsVolatile) Flags |= MachineMemOperand::MOVolatile; + if (isVolatile()) Flags |= MachineMemOperand::MOVolatile; // Check if the load references a frame index, and does not have // an SV attached. @@ -4207,10 +4247,10 @@ dyn_cast(getBasePtr().Val); if (!getSrcValue() && FI) return MachineMemOperand(PseudoSourceValue::getFixedStack(), Flags, - FI->getIndex(), Size, Alignment); + FI->getIndex(), Size, getAlignment()); else return MachineMemOperand(getSrcValue(), Flags, - getSrcValueOffset(), Size, Alignment); + getSrcValueOffset(), Size, getAlignment()); } /// Profile - Gather unique data for the node. @@ -4401,9 +4441,9 @@ case ISD::PREFETCH: return "Prefetch"; case ISD::MEMBARRIER: return "MemBarrier"; - case ISD::ATOMIC_LCS: return "AtomicLCS"; - case ISD::ATOMIC_LAS: return "AtomicLAS"; - case ISD::ATOMIC_LSS: return "AtomicLSS"; + case ISD::ATOMIC_CMP_SWAP: return "AtomicCmpSwap"; + case ISD::ATOMIC_LOAD_ADD: return "AtomicLoadAdd"; + case ISD::ATOMIC_LOAD_SUB: return "AtomicLoadSub"; case ISD::ATOMIC_LOAD_AND: return "AtomicLoadAnd"; case ISD::ATOMIC_LOAD_OR: return "AtomicLoadOr"; case ISD::ATOMIC_LOAD_XOR: return "AtomicLoadXor"; @@ -4756,7 +4796,8 @@ cerr << N->getArgFlags().getArgFlagsString(); } else if (const VTSDNode *N = dyn_cast(this)) { cerr << ":" << N->getVT().getMVTString(); - } else if (const LoadSDNode *LD = dyn_cast(this)) { + } + else if (const LoadSDNode *LD = dyn_cast(this)) { const Value *SrcValue = LD->getSrcValue(); int SrcOffset = LD->getSrcValueOffset(); cerr << " <"; @@ -4808,6 +4849,18 @@ if (ST->isVolatile()) cerr << " "; cerr << " alignment=" << ST->getAlignment(); + } else if (const AtomicSDNode* AT = dyn_cast(this)) { + const Value *SrcValue = AT->getSrcValue(); + int SrcOffset = AT->getSrcValueOffset(); + cerr << " <"; + if (SrcValue) + cerr << SrcValue; + else + cerr << "null"; + cerr << ":" << SrcOffset << ">"; + if (AT->isVolatile()) + cerr << " "; + cerr << " alignment=" << AT->getAlignment(); } } Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp?rev=52706&r1=52705&r2=52706&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Wed Jun 25 03:15:39 2008 @@ -3088,7 +3088,8 @@ SDOperand O2 = getValue(I.getOperand(2)); SDOperand L = DAG.getAtomic(Op, Root, getValue(I.getOperand(1)), - O2, O2.getValueType()); + O2, O2.getValueType(), + I.getOperand(1)); setValue(&I, L); DAG.setRoot(L.getValue(1)); return 0; @@ -3518,21 +3519,22 @@ DAG.setRoot(DAG.getNode(ISD::MEMBARRIER, MVT::Other, &Ops[0], 6)); return 0; } - case Intrinsic::atomic_lcs: { + case Intrinsic::atomic_cmp_swap: { SDOperand Root = getRoot(); SDOperand O3 = getValue(I.getOperand(3)); - SDOperand L = DAG.getAtomic(ISD::ATOMIC_LCS, Root, + SDOperand L = DAG.getAtomic(ISD::ATOMIC_CMP_SWAP, Root, getValue(I.getOperand(1)), getValue(I.getOperand(2)), - O3, O3.getValueType()); + O3, O3.getValueType(), + I.getOperand(1)); setValue(&I, L); DAG.setRoot(L.getValue(1)); return 0; } - case Intrinsic::atomic_las: - return implVisitBinaryAtomic(I, ISD::ATOMIC_LAS); - case Intrinsic::atomic_lss: - return implVisitBinaryAtomic(I, ISD::ATOMIC_LSS); + case Intrinsic::atomic_load_add: + return implVisitBinaryAtomic(I, ISD::ATOMIC_LOAD_ADD); + case Intrinsic::atomic_load_sub: + return implVisitBinaryAtomic(I, ISD::ATOMIC_LOAD_SUB); case Intrinsic::atomic_load_and: return implVisitBinaryAtomic(I, ISD::ATOMIC_LOAD_AND); case Intrinsic::atomic_load_or: Modified: llvm/trunk/lib/Target/Alpha/AlphaInstrInfo.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Alpha/AlphaInstrInfo.td?rev=52706&r1=52705&r2=52706&view=diff ============================================================================== --- llvm/trunk/lib/Target/Alpha/AlphaInstrInfo.td (original) +++ llvm/trunk/lib/Target/Alpha/AlphaInstrInfo.td Wed Jun 25 03:15:39 2008 @@ -160,14 +160,14 @@ let usesCustomDAGSchedInserter = 1 in { // Expanded by the scheduler. def CAS32 : PseudoInstAlpha<(outs GPRC:$dst), (ins GPRC:$ptr, GPRC:$cmp, GPRC:$swp), "", - [(set GPRC:$dst, (atomic_lcs_32 GPRC:$ptr, GPRC:$cmp, GPRC:$swp))], s_pseudo>; + [(set GPRC:$dst, (atomic_cmp_swap_32 GPRC:$ptr, GPRC:$cmp, GPRC:$swp))], s_pseudo>; def CAS64 : PseudoInstAlpha<(outs GPRC:$dst), (ins GPRC:$ptr, GPRC:$cmp, GPRC:$swp), "", - [(set GPRC:$dst, (atomic_lcs_64 GPRC:$ptr, GPRC:$cmp, GPRC:$swp))], s_pseudo>; + [(set GPRC:$dst, (atomic_cmp_swap_64 GPRC:$ptr, GPRC:$cmp, GPRC:$swp))], s_pseudo>; def LAS32 : PseudoInstAlpha<(outs GPRC:$dst), (ins GPRC:$ptr, GPRC:$swp), "", - [(set GPRC:$dst, (atomic_las_32 GPRC:$ptr, GPRC:$swp))], s_pseudo>; + [(set GPRC:$dst, (atomic_load_add_32 GPRC:$ptr, GPRC:$swp))], s_pseudo>; def LAS64 :PseudoInstAlpha<(outs GPRC:$dst), (ins GPRC:$ptr, GPRC:$swp), "", - [(set GPRC:$dst, (atomic_las_64 GPRC:$ptr, GPRC:$swp))], s_pseudo>; + [(set GPRC:$dst, (atomic_load_add_64 GPRC:$ptr, GPRC:$swp))], s_pseudo>; def SWAP32 : PseudoInstAlpha<(outs GPRC:$dst), (ins GPRC:$ptr, GPRC:$swp), "", [(set GPRC:$dst, (atomic_swap_32 GPRC:$ptr, GPRC:$swp))], s_pseudo>; Modified: llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp?rev=52706&r1=52705&r2=52706&view=diff ============================================================================== --- llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp (original) +++ llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp Wed Jun 25 03:15:39 2008 @@ -204,12 +204,12 @@ setOperationAction(ISD::DYNAMIC_STACKALLOC, MVT::i32 , Custom); setOperationAction(ISD::DYNAMIC_STACKALLOC, MVT::i64 , Custom); - setOperationAction(ISD::ATOMIC_LAS , MVT::i32 , Custom); - setOperationAction(ISD::ATOMIC_LCS , MVT::i32 , Custom); + setOperationAction(ISD::ATOMIC_LOAD_ADD , MVT::i32 , Custom); + setOperationAction(ISD::ATOMIC_CMP_SWAP , MVT::i32 , Custom); setOperationAction(ISD::ATOMIC_SWAP , MVT::i32 , Custom); if (TM.getSubtarget().has64BitSupport()) { - setOperationAction(ISD::ATOMIC_LAS , MVT::i64 , Custom); - setOperationAction(ISD::ATOMIC_LCS , MVT::i64 , Custom); + setOperationAction(ISD::ATOMIC_LOAD_ADD , MVT::i64 , Custom); + setOperationAction(ISD::ATOMIC_CMP_SWAP , MVT::i64 , Custom); setOperationAction(ISD::ATOMIC_SWAP , MVT::i64 , Custom); } @@ -2721,7 +2721,7 @@ return DAG.getNode(PPCISD::DYNALLOC, VTs, Ops, 3); } -SDOperand PPCTargetLowering::LowerAtomicLAS(SDOperand Op, SelectionDAG &DAG) { +SDOperand PPCTargetLowering::LowerAtomicLOAD_ADD(SDOperand Op, SelectionDAG &DAG) { MVT VT = Op.Val->getValueType(0); SDOperand Chain = Op.getOperand(0); SDOperand Ptr = Op.getOperand(1); @@ -2757,7 +2757,7 @@ OutOps, 2); } -SDOperand PPCTargetLowering::LowerAtomicLCS(SDOperand Op, SelectionDAG &DAG) { +SDOperand PPCTargetLowering::LowerAtomicCMP_SWAP(SDOperand Op, SelectionDAG &DAG) { MVT VT = Op.Val->getValueType(0); SDOperand Chain = Op.getOperand(0); SDOperand Ptr = Op.getOperand(1); @@ -3942,8 +3942,8 @@ case ISD::DYNAMIC_STACKALLOC: return LowerDYNAMIC_STACKALLOC(Op, DAG, PPCSubTarget); - case ISD::ATOMIC_LAS: return LowerAtomicLAS(Op, DAG); - case ISD::ATOMIC_LCS: return LowerAtomicLCS(Op, DAG); + case ISD::ATOMIC_LOAD_ADD: return LowerAtomicLOAD_ADD(Op, DAG); + case ISD::ATOMIC_CMP_SWAP: return LowerAtomicCMP_SWAP(Op, DAG); case ISD::ATOMIC_SWAP: return LowerAtomicSWAP(Op, DAG); case ISD::SELECT_CC: return LowerSELECT_CC(Op, DAG); Modified: llvm/trunk/lib/Target/PowerPC/PPCISelLowering.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/PPCISelLowering.h?rev=52706&r1=52705&r2=52706&view=diff ============================================================================== --- llvm/trunk/lib/Target/PowerPC/PPCISelLowering.h (original) +++ llvm/trunk/lib/Target/PowerPC/PPCISelLowering.h Wed Jun 25 03:15:39 2008 @@ -366,8 +366,8 @@ SDOperand LowerDYNAMIC_STACKALLOC(SDOperand Op, SelectionDAG &DAG, const PPCSubtarget &Subtarget); SDOperand LowerSELECT_CC(SDOperand Op, SelectionDAG &DAG); - SDOperand LowerAtomicLAS(SDOperand Op, SelectionDAG &DAG); - SDOperand LowerAtomicLCS(SDOperand Op, SelectionDAG &DAG); + SDOperand LowerAtomicLOAD_ADD(SDOperand Op, SelectionDAG &DAG); + SDOperand LowerAtomicCMP_SWAP(SDOperand Op, SelectionDAG &DAG); SDOperand LowerAtomicSWAP(SDOperand Op, SelectionDAG &DAG); SDOperand LowerFP_TO_SINT(SDOperand Op, SelectionDAG &DAG); SDOperand LowerSINT_TO_FP(SDOperand Op, SelectionDAG &DAG); Modified: llvm/trunk/lib/Target/TargetSelectionDAG.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/TargetSelectionDAG.td?rev=52706&r1=52705&r2=52706&view=diff ============================================================================== --- llvm/trunk/lib/Target/TargetSelectionDAG.td (original) +++ llvm/trunk/lib/Target/TargetSelectionDAG.td Wed Jun 25 03:15:39 2008 @@ -220,6 +220,7 @@ def SDNPMayStore : SDNodeProperty; // May write to memory, sets 'mayStore'. def SDNPMayLoad : SDNodeProperty; // May read memory, sets 'mayLoad'. def SDNPSideEffect : SDNodeProperty; // Sets 'HasUnmodelledSideEffects'. +def SDNPMemOperand : SDNodeProperty; // Touches memory, has assoc MemOperand //===----------------------------------------------------------------------===// // Selection DAG Node definitions. @@ -353,39 +354,39 @@ [SDNPHasChain, SDNPSideEffect]>; // Do not use atomic_* directly, use atomic_*_size (see below) -def atomic_lcs : SDNode<"ISD::ATOMIC_LCS" , STDAtomic3, - [SDNPHasChain, SDNPMayStore, SDNPMayLoad]>; -def atomic_las : SDNode<"ISD::ATOMIC_LAS" , STDAtomic2, - [SDNPHasChain, SDNPMayStore, SDNPMayLoad]>; -def atomic_swap : SDNode<"ISD::ATOMIC_SWAP", STDAtomic2, - [SDNPHasChain, SDNPMayStore, SDNPMayLoad]>; -def atomic_lss : SDNode<"ISD::ATOMIC_LSS" , STDAtomic2, - [SDNPHasChain, SDNPMayStore, SDNPMayLoad]>; +def atomic_cmp_swap : SDNode<"ISD::ATOMIC_CMP_SWAP" , STDAtomic3, + [SDNPHasChain, SDNPMayStore, SDNPMayLoad, SDNPMemOperand]>; +def atomic_load_add : SDNode<"ISD::ATOMIC_LOAD_ADD" , STDAtomic2, + [SDNPHasChain, SDNPMayStore, SDNPMayLoad, SDNPMemOperand]>; +def atomic_swap : SDNode<"ISD::ATOMIC_SWAP", STDAtomic2, + [SDNPHasChain, SDNPMayStore, SDNPMayLoad, SDNPMemOperand]>; +def atomic_load_sub : SDNode<"ISD::ATOMIC_LOAD_SUB" , STDAtomic2, + [SDNPHasChain, SDNPMayStore, SDNPMayLoad, SDNPMemOperand]>; def atomic_load_and : SDNode<"ISD::ATOMIC_LOAD_AND" , STDAtomic2, - [SDNPHasChain, SDNPMayStore, SDNPMayLoad]>; + [SDNPHasChain, SDNPMayStore, SDNPMayLoad, SDNPMemOperand]>; def atomic_load_or : SDNode<"ISD::ATOMIC_LOAD_OR" , STDAtomic2, - [SDNPHasChain, SDNPMayStore, SDNPMayLoad]>; + [SDNPHasChain, SDNPMayStore, SDNPMayLoad, SDNPMemOperand]>; def atomic_load_xor : SDNode<"ISD::ATOMIC_LOAD_XOR" , STDAtomic2, - [SDNPHasChain, SDNPMayStore, SDNPMayLoad]>; + [SDNPHasChain, SDNPMayStore, SDNPMayLoad, SDNPMemOperand]>; def atomic_load_nand: SDNode<"ISD::ATOMIC_LOAD_NAND", STDAtomic2, - [SDNPHasChain, SDNPMayStore, SDNPMayLoad]>; + [SDNPHasChain, SDNPMayStore, SDNPMayLoad, SDNPMemOperand]>; def atomic_load_min : SDNode<"ISD::ATOMIC_LOAD_MIN", STDAtomic2, - [SDNPHasChain, SDNPMayStore, SDNPMayLoad]>; + [SDNPHasChain, SDNPMayStore, SDNPMayLoad, SDNPMemOperand]>; def atomic_load_max : SDNode<"ISD::ATOMIC_LOAD_MAX", STDAtomic2, - [SDNPHasChain, SDNPMayStore, SDNPMayLoad]>; + [SDNPHasChain, SDNPMayStore, SDNPMayLoad, SDNPMemOperand]>; def atomic_load_umin : SDNode<"ISD::ATOMIC_LOAD_UMIN", STDAtomic2, - [SDNPHasChain, SDNPMayStore, SDNPMayLoad]>; + [SDNPHasChain, SDNPMayStore, SDNPMayLoad, SDNPMemOperand]>; def atomic_load_umax : SDNode<"ISD::ATOMIC_LOAD_UMAX", STDAtomic2, - [SDNPHasChain, SDNPMayStore, SDNPMayLoad]>; + [SDNPHasChain, SDNPMayStore, SDNPMayLoad, SDNPMemOperand]>; // Do not use ld, st directly. Use load, extload, sextload, zextload, store, // and truncst (see below). def ld : SDNode<"ISD::LOAD" , SDTLoad, - [SDNPHasChain, SDNPMayLoad]>; + [SDNPHasChain, SDNPMayLoad, SDNPMemOperand]>; def st : SDNode<"ISD::STORE" , SDTStore, - [SDNPHasChain, SDNPMayStore]>; + [SDNPHasChain, SDNPMayStore, SDNPMemOperand]>; def ist : SDNode<"ISD::STORE" , SDTIStore, - [SDNPHasChain, SDNPMayStore]>; + [SDNPHasChain, SDNPMayStore, SDNPMemOperand]>; def vector_shuffle : SDNode<"ISD::VECTOR_SHUFFLE", SDTVecShuffle, []>; def build_vector : SDNode<"ISD::BUILD_VECTOR", SDTypeProfile<1, 0, []>, []>; @@ -764,51 +765,51 @@ }]>; //Atomic patterns -def atomic_lcs_8 : PatFrag<(ops node:$ptr, node:$cmp, node:$swp), - (atomic_lcs node:$ptr, node:$cmp, node:$swp), [{ +def atomic_cmp_swap_8 : PatFrag<(ops node:$ptr, node:$cmp, node:$swp), + (atomic_cmp_swap node:$ptr, node:$cmp, node:$swp), [{ if (AtomicSDNode* V = dyn_cast(N)) return V->getVT() == MVT::i8; return false; }]>; -def atomic_lcs_16 : PatFrag<(ops node:$ptr, node:$cmp, node:$swp), - (atomic_lcs node:$ptr, node:$cmp, node:$swp), [{ +def atomic_cmp_swap_16 : PatFrag<(ops node:$ptr, node:$cmp, node:$swp), + (atomic_cmp_swap node:$ptr, node:$cmp, node:$swp), [{ if (AtomicSDNode* V = dyn_cast(N)) return V->getVT() == MVT::i16; return false; }]>; -def atomic_lcs_32 : PatFrag<(ops node:$ptr, node:$cmp, node:$swp), - (atomic_lcs node:$ptr, node:$cmp, node:$swp), [{ +def atomic_cmp_swap_32 : PatFrag<(ops node:$ptr, node:$cmp, node:$swp), + (atomic_cmp_swap node:$ptr, node:$cmp, node:$swp), [{ if (AtomicSDNode* V = dyn_cast(N)) return V->getVT() == MVT::i32; return false; }]>; -def atomic_lcs_64 : PatFrag<(ops node:$ptr, node:$cmp, node:$swp), - (atomic_lcs node:$ptr, node:$cmp, node:$swp), [{ +def atomic_cmp_swap_64 : PatFrag<(ops node:$ptr, node:$cmp, node:$swp), + (atomic_cmp_swap node:$ptr, node:$cmp, node:$swp), [{ if (AtomicSDNode* V = dyn_cast(N)) return V->getVT() == MVT::i64; return false; }]>; -def atomic_las_8 : PatFrag<(ops node:$ptr, node:$inc), - (atomic_las node:$ptr, node:$inc), [{ +def atomic_load_add_8 : PatFrag<(ops node:$ptr, node:$inc), + (atomic_load_add node:$ptr, node:$inc), [{ if (AtomicSDNode* V = dyn_cast(N)) return V->getVT() == MVT::i8; return false; }]>; -def atomic_las_16 : PatFrag<(ops node:$ptr, node:$inc), - (atomic_las node:$ptr, node:$inc), [{ +def atomic_load_add_16 : PatFrag<(ops node:$ptr, node:$inc), + (atomic_load_add node:$ptr, node:$inc), [{ if (AtomicSDNode* V = dyn_cast(N)) return V->getVT() == MVT::i16; return false; }]>; -def atomic_las_32 : PatFrag<(ops node:$ptr, node:$inc), - (atomic_las node:$ptr, node:$inc), [{ +def atomic_load_add_32 : PatFrag<(ops node:$ptr, node:$inc), + (atomic_load_add node:$ptr, node:$inc), [{ if (AtomicSDNode* V = dyn_cast(N)) return V->getVT() == MVT::i32; return false; }]>; -def atomic_las_64 : PatFrag<(ops node:$ptr, node:$inc), - (atomic_las node:$ptr, node:$inc), [{ +def atomic_load_add_64 : PatFrag<(ops node:$ptr, node:$inc), + (atomic_load_add node:$ptr, node:$inc), [{ if (AtomicSDNode* V = dyn_cast(N)) return V->getVT() == MVT::i64; return false; Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.cpp?rev=52706&r1=52705&r2=52706&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original) +++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Wed Jun 25 03:15:39 2008 @@ -292,11 +292,11 @@ setOperationAction(ISD::MEMBARRIER , MVT::Other, Expand); // Expand certain atomics - setOperationAction(ISD::ATOMIC_LCS , MVT::i8, Custom); - setOperationAction(ISD::ATOMIC_LCS , MVT::i16, Custom); - setOperationAction(ISD::ATOMIC_LCS , MVT::i32, Custom); - setOperationAction(ISD::ATOMIC_LCS , MVT::i64, Custom); - setOperationAction(ISD::ATOMIC_LSS , MVT::i32, Expand); + setOperationAction(ISD::ATOMIC_CMP_SWAP , MVT::i8, Custom); + setOperationAction(ISD::ATOMIC_CMP_SWAP , MVT::i16, Custom); + setOperationAction(ISD::ATOMIC_CMP_SWAP , MVT::i32, Custom); + setOperationAction(ISD::ATOMIC_CMP_SWAP , MVT::i64, Custom); + setOperationAction(ISD::ATOMIC_LOAD_SUB , MVT::i32, Expand); // Use the default ISD::LOCATION, ISD::DECLARE expansion. setOperationAction(ISD::LOCATION, MVT::Other, Expand); @@ -5655,7 +5655,7 @@ return Op; } -SDOperand X86TargetLowering::LowerLCS(SDOperand Op, SelectionDAG &DAG) { +SDOperand X86TargetLowering::LowerCMP_SWAP(SDOperand Op, SelectionDAG &DAG) { MVT T = cast(Op.Val)->getVT(); unsigned Reg = 0; unsigned size = 0; @@ -5669,7 +5669,7 @@ if (Subtarget->is64Bit()) { Reg = X86::RAX; size = 8; } else //Should go away when LowerType stuff lands - return SDOperand(ExpandATOMIC_LCS(Op.Val, DAG), 0); + return SDOperand(ExpandATOMIC_CMP_SWAP(Op.Val, DAG), 0); break; }; SDOperand cpIn = DAG.getCopyToReg(Op.getOperand(0), Reg, @@ -5686,9 +5686,9 @@ return cpOut; } -SDNode* X86TargetLowering::ExpandATOMIC_LCS(SDNode* Op, SelectionDAG &DAG) { +SDNode* X86TargetLowering::ExpandATOMIC_CMP_SWAP(SDNode* Op, SelectionDAG &DAG) { MVT T = cast(Op)->getVT(); - assert (T == MVT::i64 && "Only know how to expand i64 CAS"); + assert (T == MVT::i64 && "Only know how to expand i64 Cmp and Swap"); SDOperand cpInL, cpInH; cpInL = DAG.getNode(ISD::EXTRACT_ELEMENT, MVT::i32, Op->getOperand(3), DAG.getConstant(0, MVT::i32)); @@ -5722,13 +5722,15 @@ return DAG.getNode(ISD::MERGE_VALUES, Tys, ResultVal, cpOutH.getValue(1)).Val; } -SDNode* X86TargetLowering::ExpandATOMIC_LSS(SDNode* Op, SelectionDAG &DAG) { +SDNode* X86TargetLowering::ExpandATOMIC_LOAD_SUB(SDNode* Op, SelectionDAG &DAG) { MVT T = cast(Op)->getVT(); - assert (T == MVT::i32 && "Only know how to expand i32 LSS"); + assert (T == MVT::i32 && "Only know how to expand i32 Atomic Load Sub"); SDOperand negOp = DAG.getNode(ISD::SUB, T, DAG.getConstant(0, T), Op->getOperand(2)); - return DAG.getAtomic(ISD::ATOMIC_LAS, Op->getOperand(0), - Op->getOperand(1), negOp, T).Val; + return DAG.getAtomic(ISD::ATOMIC_LOAD_ADD, Op->getOperand(0), + Op->getOperand(1), negOp, T, + cast(Op)->getSrcValue(), + cast(Op)->getAlignment()).Val; } /// LowerOperation - Provide custom lowering hooks for some operations. @@ -5736,7 +5738,7 @@ SDOperand X86TargetLowering::LowerOperation(SDOperand Op, SelectionDAG &DAG) { switch (Op.getOpcode()) { default: assert(0 && "Should not custom lower this!"); - case ISD::ATOMIC_LCS: return LowerLCS(Op,DAG); + case ISD::ATOMIC_CMP_SWAP: return LowerCMP_SWAP(Op,DAG); case ISD::BUILD_VECTOR: return LowerBUILD_VECTOR(Op, DAG); case ISD::VECTOR_SHUFFLE: return LowerVECTOR_SHUFFLE(Op, DAG); case ISD::EXTRACT_VECTOR_ELT: return LowerEXTRACT_VECTOR_ELT(Op, DAG); @@ -5788,8 +5790,8 @@ default: assert(0 && "Should not custom lower this!"); case ISD::FP_TO_SINT: return ExpandFP_TO_SINT(N, DAG); case ISD::READCYCLECOUNTER: return ExpandREADCYCLECOUNTER(N, DAG); - case ISD::ATOMIC_LCS: return ExpandATOMIC_LCS(N, DAG); - case ISD::ATOMIC_LSS: return ExpandATOMIC_LSS(N,DAG); + case ISD::ATOMIC_CMP_SWAP: return ExpandATOMIC_CMP_SWAP(N, DAG); + case ISD::ATOMIC_LOAD_SUB: return ExpandATOMIC_LOAD_SUB(N,DAG); } } Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.h?rev=52706&r1=52705&r2=52706&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86ISelLowering.h (original) +++ llvm/trunk/lib/Target/X86/X86ISelLowering.h Wed Jun 25 03:15:39 2008 @@ -541,11 +541,11 @@ SDOperand LowerFLT_ROUNDS_(SDOperand Op, SelectionDAG &DAG); SDOperand LowerCTLZ(SDOperand Op, SelectionDAG &DAG); SDOperand LowerCTTZ(SDOperand Op, SelectionDAG &DAG); - SDOperand LowerLCS(SDOperand Op, SelectionDAG &DAG); + SDOperand LowerCMP_SWAP(SDOperand Op, SelectionDAG &DAG); SDNode *ExpandFP_TO_SINT(SDNode *N, SelectionDAG &DAG); SDNode *ExpandREADCYCLECOUNTER(SDNode *N, SelectionDAG &DAG); - SDNode *ExpandATOMIC_LCS(SDNode *N, SelectionDAG &DAG); - SDNode *ExpandATOMIC_LSS(SDNode *N, SelectionDAG &DAG); + SDNode *ExpandATOMIC_CMP_SWAP(SDNode *N, SelectionDAG &DAG); + SDNode *ExpandATOMIC_LOAD_SUB(SDNode *N, SelectionDAG &DAG); SDOperand EmitTargetCodeForMemset(SelectionDAG &DAG, SDOperand Chain, Modified: llvm/trunk/lib/Target/X86/X86Instr64bit.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86Instr64bit.td?rev=52706&r1=52705&r2=52706&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86Instr64bit.td (original) +++ llvm/trunk/lib/Target/X86/X86Instr64bit.td Wed Jun 25 03:15:39 2008 @@ -1124,7 +1124,7 @@ let Constraints = "$val = $dst", Defs = [EFLAGS] in { def LXADD64 : RI<0xC1, MRMSrcMem, (outs GR64:$dst), (ins i64mem:$ptr,GR64:$val), "lock xadd $val, $ptr", - [(set GR64:$dst, (atomic_las_64 addr:$ptr, GR64:$val))]>, + [(set GR64:$dst, (atomic_load_add_64 addr:$ptr, GR64:$val))]>, TB, LOCK; def XCHG64rm : RI<0x87, MRMSrcMem, (outs GR64:$dst), (ins i64mem:$ptr,GR64:$val), "xchg $val, $ptr", Modified: llvm/trunk/lib/Target/X86/X86InstrInfo.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86InstrInfo.td?rev=52706&r1=52705&r2=52706&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86InstrInfo.td (original) +++ llvm/trunk/lib/Target/X86/X86InstrInfo.td Wed Jun 25 03:15:39 2008 @@ -2614,19 +2614,19 @@ let Constraints = "$val = $dst", Defs = [EFLAGS] in { def LXADD32 : I<0xC1, MRMSrcMem, (outs GR32:$dst), (ins i32mem:$ptr, GR32:$val), "lock xadd{l}\t{$val, $ptr|$ptr, $val}", - [(set GR32:$dst, (atomic_las_32 addr:$ptr, GR32:$val))]>, + [(set GR32:$dst, (atomic_load_add_32 addr:$ptr, GR32:$val))]>, TB, LOCK; def LXADD16 : I<0xC1, MRMSrcMem, (outs GR16:$dst), (ins i16mem:$ptr, GR16:$val), "lock xadd{w}\t{$val, $ptr|$ptr, $val}", - [(set GR16:$dst, (atomic_las_16 addr:$ptr, GR16:$val))]>, + [(set GR16:$dst, (atomic_load_add_16 addr:$ptr, GR16:$val))]>, TB, OpSize, LOCK; def LXADD8 : I<0xC0, MRMSrcMem, (outs GR8:$dst), (ins i8mem:$ptr, GR8:$val), "lock xadd{b}\t{$val, $ptr|$ptr, $val}", - [(set GR8:$dst, (atomic_las_8 addr:$ptr, GR8:$val))]>, + [(set GR8:$dst, (atomic_load_add_8 addr:$ptr, GR8:$val))]>, TB, LOCK; } -// Atomic exchange and and, or, xor +// Atomic exchange, and, or, xor let Constraints = "$val = $dst", Defs = [EFLAGS], usesCustomDAGSchedInserter = 1 in { def ATOMAND32 : I<0, Pseudo, (outs GR32:$dst),(ins i32mem:$ptr, GR32:$val), @@ -2639,7 +2639,7 @@ "#ATOMXOR32 PSUEDO!", [(set GR32:$dst, (atomic_load_xor addr:$ptr, GR32:$val))]>; def ATOMNAND32 : I<0, Pseudo,(outs GR32:$dst),(ins i32mem:$ptr, GR32:$val), - "#ATOMXOR32 PSUEDO!", + "#ATOMNAND32 PSUEDO!", [(set GR32:$dst, (atomic_load_nand addr:$ptr, GR32:$val))]>; def ATOMMIN32: I<0, Pseudo, (outs GR32:$dst), (ins i32mem:$ptr, GR32:$val), Modified: llvm/trunk/lib/VMCore/AutoUpgrade.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/AutoUpgrade.cpp?rev=52706&r1=52705&r2=52706&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/AutoUpgrade.cpp (original) +++ llvm/trunk/lib/VMCore/AutoUpgrade.cpp Wed Jun 25 03:15:39 2008 @@ -39,6 +39,30 @@ Module *M = F->getParent(); switch (Name[5]) { default: break; + case 'a': + // This upgrades the llvm.atomic.lcs, llvm.atomic.las, and llvm.atomic.lss + // to their new function name + if (Name.compare(5,8,"atomic.l",8) == 0) { + if (Name.compare(12,3,"lcs",3) == 0) { + std::string::size_type delim = Name.find('.',12); + F->setName("llvm.atomic.cmp.swap"+Name.substr(delim)); + NewFn = F; + return true; + } + else if (Name.compare(12,3,"las",3) == 0) { + std::string::size_type delim = Name.find('.',12); + F->setName("llvm.atomic.load.add"+Name.substr(delim)); + NewFn = F; + return true; + } + else if (Name.compare(12,3,"lss",3) == 0) { + std::string::size_type delim = Name.find('.',12); + F->setName("llvm.atomic.load.sub"+Name.substr(delim)); + NewFn = F; + return true; + } + } + break; case 'b': // This upgrades the name of the llvm.bswap intrinsic function to only use // a single type name for overloading. We only care about the old format Modified: llvm/trunk/test/CodeGen/PowerPC/atomic-1.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/PowerPC/atomic-1.ll?rev=52706&r1=52705&r2=52706&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/PowerPC/atomic-1.ll (original) +++ llvm/trunk/test/CodeGen/PowerPC/atomic-1.ll Wed Jun 25 03:15:39 2008 @@ -2,17 +2,17 @@ ; RUN: llvm-as < %s | llc -march=ppc32 | grep stwcx. | count 4 define i32 @exchange_and_add(i32* %mem, i32 %val) nounwind { - %tmp = call i32 @llvm.atomic.las.i32( i32* %mem, i32 %val ) + %tmp = call i32 @llvm.atomic.load.add.i32( i32* %mem, i32 %val ) ret i32 %tmp } define i32 @exchange_and_cmp(i32* %mem) nounwind { - %tmp = call i32 @llvm.atomic.lcs.i32( i32* %mem, i32 0, i32 1 ) + %tmp = call i32 @llvm.atomic.cmp.swap.i32( i32* %mem, i32 0, i32 1 ) ret i32 %tmp } define i16 @exchange_and_cmp16(i16* %mem) nounwind { - %tmp = call i16 @llvm.atomic.lcs.i16( i16* %mem, i16 0, i16 1 ) + %tmp = call i16 @llvm.atomic.cmp.swap.i16( i16* %mem, i16 0, i16 1 ) ret i16 %tmp } @@ -21,7 +21,7 @@ ret i32 %tmp } -declare i32 @llvm.atomic.las.i32(i32*, i32) nounwind -declare i32 @llvm.atomic.lcs.i32(i32*, i32, i32) nounwind -declare i16 @llvm.atomic.lcs.i16(i16*, i16, i16) nounwind +declare i32 @llvm.atomic.load.add.i32(i32*, i32) nounwind +declare i32 @llvm.atomic.cmp.swap.i32(i32*, i32, i32) nounwind +declare i16 @llvm.atomic.cmp.swap.i16(i16*, i16, i16) nounwind declare i32 @llvm.atomic.swap.i32(i32*, i32) nounwind Modified: llvm/trunk/test/CodeGen/PowerPC/atomic-2.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/PowerPC/atomic-2.ll?rev=52706&r1=52705&r2=52706&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/PowerPC/atomic-2.ll (original) +++ llvm/trunk/test/CodeGen/PowerPC/atomic-2.ll Wed Jun 25 03:15:39 2008 @@ -2,12 +2,12 @@ ; RUN: llvm-as < %s | llc -march=ppc64 | grep stdcx. | count 3 define i64 @exchange_and_add(i64* %mem, i64 %val) nounwind { - %tmp = call i64 @llvm.atomic.las.i64( i64* %mem, i64 %val ) + %tmp = call i64 @llvm.atomic.load.add.i64( i64* %mem, i64 %val ) ret i64 %tmp } define i64 @exchange_and_cmp(i64* %mem) nounwind { - %tmp = call i64 @llvm.atomic.lcs.i64( i64* %mem, i64 0, i64 1 ) + %tmp = call i64 @llvm.atomic.cmp.swap.i64( i64* %mem, i64 0, i64 1 ) ret i64 %tmp } @@ -16,6 +16,6 @@ ret i64 %tmp } -declare i64 @llvm.atomic.las.i64(i64*, i64) nounwind -declare i64 @llvm.atomic.lcs.i64(i64*, i64, i64) nounwind +declare i64 @llvm.atomic.load.add.i64(i64*, i64) nounwind +declare i64 @llvm.atomic.cmp.swap.i64(i64*, i64, i64) nounwind declare i64 @llvm.atomic.swap.i64(i64*, i64) nounwind Modified: llvm/trunk/test/CodeGen/X86/atomic_op.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/atomic_op.ll?rev=52706&r1=52705&r2=52706&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/X86/atomic_op.ll (original) +++ llvm/trunk/test/CodeGen/X86/atomic_op.ll Wed Jun 25 03:15:39 2008 @@ -29,13 +29,13 @@ store i32 3855, i32* %xort store i32 4, i32* %temp %tmp = load i32* %temp ; [#uses=1] - call i32 @llvm.atomic.las.i32( i32* %val1, i32 %tmp ) ; :0 [#uses=1] + call i32 @llvm.atomic.load.add.i32( i32* %val1, i32 %tmp ) ; :0 [#uses=1] store i32 %0, i32* %old - call i32 @llvm.atomic.lss.i32( i32* %val2, i32 30 ) ; :1 [#uses=1] + call i32 @llvm.atomic.load.sub.i32( i32* %val2, i32 30 ) ; :1 [#uses=1] store i32 %1, i32* %old - call i32 @llvm.atomic.las.i32( i32* %val2, i32 1 ) ; :2 [#uses=1] + call i32 @llvm.atomic.load.add.i32( i32* %val2, i32 1 ) ; :2 [#uses=1] store i32 %2, i32* %old - call i32 @llvm.atomic.lss.i32( i32* %val2, i32 1 ) ; :3 [#uses=1] + call i32 @llvm.atomic.load.sub.i32( i32* %val2, i32 1 ) ; :3 [#uses=1] store i32 %3, i32* %old call i32 @llvm.atomic.load.and.i32( i32* %andt, i32 4080 ) ; :4 [#uses=1] store i32 %4, i32* %old @@ -63,16 +63,16 @@ call i32 @llvm.atomic.swap.i32( i32* %val2, i32 1976 ) ; :15 [#uses=1] store i32 %15, i32* %old %neg1 = sub i32 0, 10 ; [#uses=1] - call i32 @llvm.atomic.lcs.i32( i32* %val2, i32 %neg1, i32 1 ) ; :16 [#uses=1] + call i32 @llvm.atomic.cmp.swap.i32( i32* %val2, i32 %neg1, i32 1 ) ; :16 [#uses=1] store i32 %16, i32* %old - call i32 @llvm.atomic.lcs.i32( i32* %val2, i32 1976, i32 1 ) ; :17 [#uses=1] + call i32 @llvm.atomic.cmp.swap.i32( i32* %val2, i32 1976, i32 1 ) ; :17 [#uses=1] store i32 %17, i32* %old ret void } -declare i32 @llvm.atomic.las.i32(i32*, i32) nounwind +declare i32 @llvm.atomic.load.add.i32(i32*, i32) nounwind -declare i32 @llvm.atomic.lss.i32(i32*, i32) nounwind +declare i32 @llvm.atomic.load.sub.i32(i32*, i32) nounwind declare i32 @llvm.atomic.load.and.i32(i32*, i32) nounwind @@ -90,4 +90,4 @@ declare i32 @llvm.atomic.swap.i32(i32*, i32) nounwind -declare i32 @llvm.atomic.lcs.i32(i32*, i32, i32) nounwind +declare i32 @llvm.atomic.cmp.swap.i32(i32*, i32, i32) nounwind Modified: llvm/trunk/utils/TableGen/CodeGenDAGPatterns.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/CodeGenDAGPatterns.cpp?rev=52706&r1=52705&r2=52706&view=diff ============================================================================== --- llvm/trunk/utils/TableGen/CodeGenDAGPatterns.cpp (original) +++ llvm/trunk/utils/TableGen/CodeGenDAGPatterns.cpp Wed Jun 25 03:15:39 2008 @@ -401,6 +401,8 @@ Properties |= 1 << SDNPMayLoad; } else if (PropList[i]->getName() == "SDNPSideEffect") { Properties |= 1 << SDNPSideEffect; + } else if (PropList[i]->getName() == "SDNPMemOperand") { + Properties |= 1 << SDNPMemOperand; } else { cerr << "Unknown SD Node property '" << PropList[i]->getName() << "' on node '" << R->getName() << "'!\n"; Modified: llvm/trunk/utils/TableGen/CodeGenTarget.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/CodeGenTarget.cpp?rev=52706&r1=52705&r2=52706&view=diff ============================================================================== --- llvm/trunk/utils/TableGen/CodeGenTarget.cpp (original) +++ llvm/trunk/utils/TableGen/CodeGenTarget.cpp Wed Jun 25 03:15:39 2008 @@ -366,6 +366,8 @@ Properties |= 1 << SDNPMayLoad; } else if (PropList[i]->getName() == "SDNPSideEffect") { Properties |= 1 << SDNPSideEffect; + } else if (PropList[i]->getName() == "SDNPMemOperand") { + Properties |= 1 << SDNPMemOperand; } else { cerr << "Unsupported SD Node property '" << PropList[i]->getName() << "' on ComplexPattern '" << R->getName() << "'!\n"; Modified: llvm/trunk/utils/TableGen/CodeGenTarget.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/CodeGenTarget.h?rev=52706&r1=52705&r2=52706&view=diff ============================================================================== --- llvm/trunk/utils/TableGen/CodeGenTarget.h (original) +++ llvm/trunk/utils/TableGen/CodeGenTarget.h Wed Jun 25 03:15:39 2008 @@ -30,6 +30,8 @@ class CodeGenTarget; // SelectionDAG node properties. +// SDNPMemOperand: indicates that a node touches memory and therefore must +// have an associated memory operand that describes the access. enum SDNP { SDNPCommutative, SDNPAssociative, @@ -39,7 +41,8 @@ SDNPOptInFlag, SDNPMayLoad, SDNPMayStore, - SDNPSideEffect + SDNPSideEffect, + SDNPMemOperand }; // ComplexPattern attributes. Modified: llvm/trunk/utils/TableGen/DAGISelEmitter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/DAGISelEmitter.cpp?rev=52706&r1=52705&r2=52706&view=diff ============================================================================== --- llvm/trunk/utils/TableGen/DAGISelEmitter.cpp (original) +++ llvm/trunk/utils/TableGen/DAGISelEmitter.cpp Wed Jun 25 03:15:39 2008 @@ -394,11 +394,8 @@ // Save loads/stores matched by a pattern. if (!N->isLeaf() && N->getName().empty()) { - std::string EnumName = N->getOperator()->getValueAsString("Opcode"); - if (EnumName == "ISD::LOAD" || - EnumName == "ISD::STORE") { + if (NodeHasProperty(N, SDNPMemOperand, CGP)) LSI.push_back(RootName); - } } bool isRoot = (P == NULL); @@ -1082,7 +1079,7 @@ std::vector::const_iterator mi, mie; for (mi = LSI.begin(), mie = LSI.end(); mi != mie; ++mi) { emitCode("SDOperand LSI_" + *mi + " = " - "CurDAG->getMemOperand(cast(" + + "CurDAG->getMemOperand(cast(" + *mi + ")->getMemOperand());"); if (IsVariadic) emitCode("Ops" + utostr(OpsNo) + ".push_back(LSI_" + *mi + ");"); From baldrick at free.fr Wed Jun 25 04:17:11 2008 From: baldrick at free.fr (Duncan Sands) Date: Wed, 25 Jun 2008 11:17:11 +0200 Subject: [llvm-commits] =?iso-8859-1?q?=5Bllvm=5D_r52691_-_in_/llvm/trunk/?= =?iso-8859-1?q?lib/Target/X86=3A_X86CallingConv=2Etd_X86ISelLowering=2Ecp?= =?iso-8859-1?q?p=09X86InstrMMX=2Etd=09X86RegisterInfo=2Etd?= In-Reply-To: <89ECC84E-368F-4A10-B43B-7A9C07099B39@apple.com> References: <93CF5F93-F500-4066-8EFE-75FB81149D30@apple.com> <89ECC84E-368F-4A10-B43B-7A9C07099B39@apple.com> Message-ID: <200806251117.11497.baldrick@free.fr> > I tend to agree with Eli here. The code generator only considers a > type to be legal if there are a pretty decent set of operations > supported on it. Why couldn't llvm-gcc turn the type into v2i32 and > use a bitcast when passing? Or a "soften" method could be added for vector legalization, which would turn a vector a float into a vector of same sized ints. I didn't think this through so I don't know if this would really make sense. Ciao, Duncan. From nicolas.geoffray at lip6.fr Wed Jun 25 04:59:51 2008 From: nicolas.geoffray at lip6.fr (Nicolas Geoffray) Date: Wed, 25 Jun 2008 09:59:51 -0000 Subject: [llvm-commits] [vmkit] r52708 - in /vmkit/trunk: ./ autoconf/ include/mvm/Config/ lib/ lib/JnJVM/ lib/JnJVM/Classpath/ lib/JnJVM/LLVMRuntime/ lib/JnJVM/VMCore/ lib/Mvm/ lib/Mvm/Allocator/ lib/Mvm/BoehmGC/ lib/Mvm/CommonThread/ lib/Mvm/GCMmap2/ lib/N3/ lib/N3/VMCore/ patches/ tools/ tools/jnjvm/ tools/n3/ tools/testAllocator/ tools/testCollector/ tools/vtoffset/ Message-ID: <200806251000.m5PA00Wk004316@zion.cs.uiuc.edu> Author: geoffray Date: Wed Jun 25 04:59:39 2008 New Revision: 52708 URL: http://llvm.org/viewvc/llvm-project?rev=52708&view=rev Log: Make vmkit use a llvm-project like build system. Now executables are {Debug|Release}/bin/{jnjvm|n3}. Added: vmkit/trunk/CREDITS.TXT vmkit/trunk/Makefile (with props) vmkit/trunk/Makefile.common.in (with props) vmkit/trunk/Makefile.config.in (with props) vmkit/trunk/README.txt vmkit/trunk/autoconf/ vmkit/trunk/autoconf/AutoRegen.sh (with props) vmkit/trunk/autoconf/config.guess (with props) vmkit/trunk/autoconf/config.sub (with props) vmkit/trunk/autoconf/configure.ac vmkit/trunk/autoconf/install-sh vmkit/trunk/configure (with props) vmkit/trunk/include/mvm/Config/ vmkit/trunk/include/mvm/Config/config.h.in vmkit/trunk/lib/JnJVM/Classpath/ClasspathConstructor.cpp.inc vmkit/trunk/lib/JnJVM/Classpath/ClasspathMethod.cpp.inc vmkit/trunk/lib/JnJVM/Classpath/ClasspathVMClass.cpp.inc vmkit/trunk/lib/JnJVM/Classpath/ClasspathVMClassLoader.cpp.inc vmkit/trunk/lib/JnJVM/Classpath/ClasspathVMField.cpp.inc vmkit/trunk/lib/JnJVM/Classpath/ClasspathVMObject.cpp.inc vmkit/trunk/lib/JnJVM/Classpath/ClasspathVMRuntime.cpp.inc vmkit/trunk/lib/JnJVM/Classpath/ClasspathVMStackWalker.cpp.inc vmkit/trunk/lib/JnJVM/Classpath/ClasspathVMSystem.cpp.inc vmkit/trunk/lib/JnJVM/Classpath/ClasspathVMSystemProperties.cpp.inc vmkit/trunk/lib/JnJVM/Classpath/ClasspathVMThread.cpp.inc vmkit/trunk/lib/JnJVM/Classpath/ClasspathVMThrowable.cpp.inc vmkit/trunk/lib/JnJVM/Classpath/Makefile vmkit/trunk/lib/JnJVM/LLVMRuntime/Makefile vmkit/trunk/lib/JnJVM/Makefile vmkit/trunk/lib/JnJVM/README.txt vmkit/trunk/lib/JnJVM/VMCore/Makefile vmkit/trunk/lib/Main.cpp vmkit/trunk/lib/Makefile (with props) vmkit/trunk/lib/Mvm/Allocator/Makefile vmkit/trunk/lib/Mvm/Allocator/README.txt vmkit/trunk/lib/Mvm/BoehmGC/Makefile vmkit/trunk/lib/Mvm/CommonThread/Makefile vmkit/trunk/lib/Mvm/GCMmap2/Makefile vmkit/trunk/lib/Mvm/Makefile vmkit/trunk/lib/N3/Makefile vmkit/trunk/lib/N3/README.txt vmkit/trunk/lib/N3/VMCore/Makefile vmkit/trunk/patches/ vmkit/trunk/patches/vmkit-llvm-ppc.patch vmkit/trunk/patches/vmkit-llvm-x86.patch vmkit/trunk/tools/ vmkit/trunk/tools/Makefile (with props) vmkit/trunk/tools/jnjvm/ vmkit/trunk/tools/jnjvm/Makefile (with props) vmkit/trunk/tools/n3/ vmkit/trunk/tools/n3/Makefile (with props) vmkit/trunk/tools/testAllocator/ vmkit/trunk/tools/testAllocator/Main.cpp vmkit/trunk/tools/testAllocator/Makefile vmkit/trunk/tools/testCollector/ vmkit/trunk/tools/testCollector/Main.cpp vmkit/trunk/tools/testCollector/Makefile (with props) vmkit/trunk/tools/vtoffset/ vmkit/trunk/tools/vtoffset/Makefile vmkit/trunk/tools/vtoffset/VTOffset.cpp Removed: vmkit/trunk/AUTHORS vmkit/trunk/ChangeLog vmkit/trunk/Makefile.am vmkit/trunk/NEWS vmkit/trunk/README vmkit/trunk/autogen.sh vmkit/trunk/configure.ac vmkit/trunk/lib/JnJVM/Classpath/ClasspathConstructor.cpp vmkit/trunk/lib/JnJVM/Classpath/ClasspathMethod.cpp vmkit/trunk/lib/JnJVM/Classpath/ClasspathVMClass.cpp vmkit/trunk/lib/JnJVM/Classpath/ClasspathVMClassLoader.cpp vmkit/trunk/lib/JnJVM/Classpath/ClasspathVMField.cpp vmkit/trunk/lib/JnJVM/Classpath/ClasspathVMObject.cpp vmkit/trunk/lib/JnJVM/Classpath/ClasspathVMRuntime.cpp vmkit/trunk/lib/JnJVM/Classpath/ClasspathVMStackWalker.cpp vmkit/trunk/lib/JnJVM/Classpath/ClasspathVMSystem.cpp vmkit/trunk/lib/JnJVM/Classpath/ClasspathVMSystemProperties.cpp vmkit/trunk/lib/JnJVM/Classpath/ClasspathVMThread.cpp vmkit/trunk/lib/JnJVM/Classpath/ClasspathVMThrowable.cpp vmkit/trunk/lib/JnJVM/Classpath/Makefile.am vmkit/trunk/lib/JnJVM/LLVMRuntime/Makefile.am vmkit/trunk/lib/JnJVM/Main.cpp vmkit/trunk/lib/JnJVM/Makefile.am vmkit/trunk/lib/JnJVM/README vmkit/trunk/lib/JnJVM/TODO vmkit/trunk/lib/JnJVM/VMCore/Makefile.am vmkit/trunk/lib/Mvm/Allocator/.cvsignore vmkit/trunk/lib/Mvm/Allocator/Makefile.am vmkit/trunk/lib/Mvm/Allocator/README vmkit/trunk/lib/Mvm/Allocator/main.cpp vmkit/trunk/lib/Mvm/BoehmGC/Makefile.am vmkit/trunk/lib/Mvm/CommonThread/Makefile.am vmkit/trunk/lib/Mvm/CommonThread/main.cpp vmkit/trunk/lib/Mvm/GCMmap2/Makefile.am vmkit/trunk/lib/Mvm/GCMmap2/main.cpp vmkit/trunk/lib/Mvm/Main.cpp vmkit/trunk/lib/Mvm/Makefile.am vmkit/trunk/lib/Mvm/VTOffset.cpp vmkit/trunk/lib/N3/Main.cpp vmkit/trunk/lib/N3/Makefile.am vmkit/trunk/lib/N3/README vmkit/trunk/lib/N3/VMCore/Makefile.am vmkit/trunk/lib/N3/pnet-0.7.4.patch vmkit/trunk/vmkit-llvm-ppc.patch vmkit/trunk/vmkit-llvm-x86.patch Modified: vmkit/trunk/lib/JnJVM/Classpath/Classpath.cpp vmkit/trunk/lib/JnJVM/VMCore/JavaArray.h vmkit/trunk/lib/JnJVM/VMCore/JavaBacktrace.cpp vmkit/trunk/lib/JnJVM/VMCore/JavaJIT.cpp vmkit/trunk/lib/JnJVM/VMCore/JavaJITOpcodes.cpp vmkit/trunk/lib/JnJVM/VMCore/JavaRuntimeJIT.cpp vmkit/trunk/lib/JnJVM/VMCore/Jnjvm.cpp vmkit/trunk/lib/JnJVM/VMCore/JnjvmModule.cpp vmkit/trunk/lib/JnJVM/VMCore/JnjvmModuleProvider.cpp vmkit/trunk/lib/JnJVM/VMCore/LockedMap.h vmkit/trunk/lib/JnJVM/VMCore/ServiceDomain.cpp vmkit/trunk/lib/Mvm/GCMmap2/gccollector.h vmkit/trunk/lib/N3/VMCore/Assembly.cpp vmkit/trunk/lib/N3/VMCore/Assembly.h vmkit/trunk/lib/N3/VMCore/BackTrace.cpp vmkit/trunk/lib/N3/VMCore/CLIJit.cpp vmkit/trunk/lib/N3/VMCore/LockedMap.h vmkit/trunk/lib/N3/VMCore/PNetLib.cpp vmkit/trunk/lib/N3/VMCore/VMArray.h vmkit/trunk/lib/N3/VMCore/VirtualTables.cpp Removed: vmkit/trunk/AUTHORS URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/AUTHORS?rev=52707&view=auto ============================================================================== --- vmkit/trunk/AUTHORS (original) +++ vmkit/trunk/AUTHORS (removed) @@ -1,29 +0,0 @@ -This file is a partial list of people who have contributed to the VMKit -project. If you have contributed a patch or made some other contribution to -VMKit, please submit a patch to this file to add yourself, and it will be -done! - -The list is sorted by name and formatted to allow easy grepping and -beautification by scripts. The fields are: name (N), email (E), web-address -(W), PGP key ID and fingerprint (P), description (D), and snail-mail address -(S). - -N: Bertil Folliot -E: bertil.folliot at lip6.fr -W: http://www-src.lip6.fr/homepages/Bertil.Folliot/ -D: Provider of much wisdom - -N: Nicolas Geoffray -E: nicolas.geoffray at lip6.fr -W: http://www-src.lip6.fr/homepages/Nicolas.Geoffray/ -D: Port of JnJVM to LLVM -D: Architect of N3 - -N: Sylvain Marechal -E: sylvain.marechal at lip6.fr -D: Original autoconf support - -N: Gael Thomas -E: gael.thomas at lip6.fr -W: http://www-src.lip6.fr/homepages/Gael.Thomas/ -D: Primary architect of JnJVM Added: vmkit/trunk/CREDITS.TXT URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/CREDITS.TXT?rev=52708&view=auto ============================================================================== --- vmkit/trunk/CREDITS.TXT (added) +++ vmkit/trunk/CREDITS.TXT Wed Jun 25 04:59:39 2008 @@ -0,0 +1,29 @@ +This file is a partial list of people who have contributed to the VMKit +project. If you have contributed a patch or made some other contribution to +VMKit, please submit a patch to this file to add yourself, and it will be +done! + +The list is sorted by name and formatted to allow easy grepping and +beautification by scripts. The fields are: name (N), email (E), web-address +(W), PGP key ID and fingerprint (P), description (D), and snail-mail address +(S). + +N: Bertil Folliot +E: bertil.folliot at lip6.fr +W: http://www-src.lip6.fr/homepages/Bertil.Folliot/ +D: Provider of much wisdom + +N: Nicolas Geoffray +E: nicolas.geoffray at lip6.fr +W: http://www-src.lip6.fr/homepages/Nicolas.Geoffray/ +D: Port of JnJVM to LLVM +D: Architect of N3 + +N: Sylvain Marechal +E: sylvain.marechal at lip6.fr +D: Original autoconf support + +N: Gael Thomas +E: gael.thomas at lip6.fr +W: http://www-src.lip6.fr/homepages/Gael.Thomas/ +D: Primary architect of JnJVM Removed: vmkit/trunk/ChangeLog URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/ChangeLog?rev=52707&view=auto ============================================================================== (empty) Added: vmkit/trunk/Makefile URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/Makefile?rev=52708&view=auto ============================================================================== --- vmkit/trunk/Makefile (added) +++ vmkit/trunk/Makefile Wed Jun 25 04:59:39 2008 @@ -0,0 +1,26 @@ +#===- ./Makefile -------------------------------------------*- Makefile -*--===# +# +# The vmkit project +# +# This file is distributed under the University of Illinois Open Source +# License. See LICENSE.TXT for details. +# +#===------------------------------------------------------------------------===# + +LEVEL := . + +# Top-Level vmkit Build Stages: +# +DIRS := lib tools +EXTRA_DIST=include + +include $(LEVEL)/Makefile.common + +#------------------------------------------------------------------------ +# Make sure the generated headers are up-to-date. This must be kept in +# sync with the AC_CONFIG_HEADER invocations in autoconf/configure.ac +#------------------------------------------------------------------------ +FilesToConfig := \ + include/llvm/Config/config.h \ + lib/JnJVM/Classpath/Classpath.h \ +FilesToConfigPATH := $(addprefix $(LLVM_OBJ_ROOT)/,$(FilesToConfig)) Propchange: vmkit/trunk/Makefile ------------------------------------------------------------------------------ svn:executable = * Removed: vmkit/trunk/Makefile.am URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/Makefile.am?rev=52707&view=auto ============================================================================== --- vmkit/trunk/Makefile.am (original) +++ vmkit/trunk/Makefile.am (removed) @@ -1,9 +0,0 @@ -SUBDIRS = lib/Mvm lib/JnJVM -DIST_SUBDIRS = lib/Mvm lib/JnJVM - -if WITH_N3 -SUBDIRS += lib/N3 -DIST_SUBDIRS += lib/N3 -endif - -EXTRA_DIST = Added: vmkit/trunk/Makefile.common.in URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/Makefile.common.in?rev=52708&view=auto ============================================================================== --- vmkit/trunk/Makefile.common.in (added) +++ vmkit/trunk/Makefile.common.in Wed Jun 25 04:59:39 2008 @@ -0,0 +1,44 @@ +# Set the name of the project here +PROJECT_NAME := vmkit +PROJ_VERSION := 0.1 + +# Set this variable to the top of the LLVM source tree. +LLVM_SRC_ROOT = @LLVM_SRC@ + +# Set this variable to the top level directory where LLVM was built +# (this is *not* the same as OBJ_ROOT as defined in LLVM's Makefile.config). +LLVM_OBJ_ROOT = @LLVM_OBJ@ + +# Set the directory root of this project's source files +PROJ_SRC_ROOT := $(subst //,/, at abs_top_srcdir@) + +# Set the root directory of this project's object files +PROJ_OBJ_ROOT := $(subst //,/, at abs_top_objdir@) + +# Set the root directory of this project's install prefix +PROJ_INSTALL_ROOT := @prefix@ + +REQUIRES_EH := 1 + +# Include LLVM's Master Makefile. +include $(LLVM_OBJ_ROOT)/Makefile.common + +CXX.Flags += @GC_FLAGS@ -Wno-variadic-macros -fno-omit-frame-pointer + +# GNU Classpath flags +CLASSPATH_FLAGS = -I at classpathinclude@ + +# Pnet location +PNETLIB = @pnetlocalprefix@ + +# GC configuration +LIBS += -lz +GCLIB = @GC_LIBS@ +GC_MULTI_MMAP = @GC_MULTI_MMAP@ +GC_SINGLE_MMAP = @GC_SINGLE_MMAP@ +GC_BOEHM = @GC_BOEHM@ +GC_MMAP2 = @GC_MMAP2@ + +ifeq ($(GCLIB), BoehmGC) + LIBS += -lgc +endif Propchange: vmkit/trunk/Makefile.common.in ------------------------------------------------------------------------------ svn:executable = * Added: vmkit/trunk/Makefile.config.in URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/Makefile.config.in?rev=52708&view=auto ============================================================================== --- vmkit/trunk/Makefile.config.in (added) +++ vmkit/trunk/Makefile.config.in Wed Jun 25 04:59:39 2008 @@ -0,0 +1 @@ +GCLIB = @GC_LIBS@ Propchange: vmkit/trunk/Makefile.config.in ------------------------------------------------------------------------------ svn:executable = * Removed: vmkit/trunk/NEWS URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/NEWS?rev=52707&view=auto ============================================================================== --- vmkit/trunk/NEWS (original) +++ vmkit/trunk/NEWS (removed) @@ -1,7 +0,0 @@ -(April 11, 2008) -* Interface with boehm-gc - -(March 21, 2008) - -* VMKit goes public! -* Usage of the University of Illinois Open source License Removed: vmkit/trunk/README URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/README?rev=52707&view=auto ============================================================================== --- vmkit/trunk/README (original) +++ vmkit/trunk/README (removed) @@ -1,72 +0,0 @@ -//===---------------------------------------------------------------------===// -// General notes -//===---------------------------------------------------------------------===// - -VMKit is the composition of three libraries: -1) MVM: mostly a garbage collector -2) JnJVM: a Java Virtual Machine implemented with MVM and LLVM -3) N3: a CLI implementation with MVM and LLVM - -JnJVM and N3 work on Linux/x86 (note that you may have to disable SSE on some -architecture), and mostly work on Linux/PPC (there are some errors with -floating points). Portage to Darwin has been done some time ago, so it should -not be too hard. - -JnJVM and N3 use GCC's unwinding library (libgcc_s.so). - -There are mainly two options in the ./configure script ---with-gnu-classpath-local-prefix: the local build of GNU classpath ---with-pnet-local-prefix: the local build of PNET ---with-llvm: the local build of LLVM ---with-gc: user either boehm or single-mmap - -Running make on the root tree will produce three executables: -1) lib/Mvm/main: a command line tool to load virtual machines dynamically -2) lib/JnJVM/main: running the JnJVM like any other JVM -3) lib/N3/main: running N3 like CLR - -JnJVM and N3 have their own README notes. - - -//===---------------------------------------------------------------------===// -// Target specific LLVM patches (not required) -//===---------------------------------------------------------------------===// - -If you experience problems, you can apply the patches for your corresponding -arch. I'd be interested to get some info on your specific problem if the -patch fixes it. - -Patch for PowerPC: -- Bugfix for handling some external symbols (FIXME: does this still happen?) -- Thread safety when doing native code patching (TODO: submit to llvm-dev) -- CFI instructions for callbacks (TODO: find a correct macro to enable this) -- Emit a hand-made frame table for stubs (TODO: submit to llvm-dev) - -Patch for X86 -- Disable SSE (It can sigsegv on some x86 archs. Having test cases would be - nice) -- Enable CFI instructions for callbacks (TODO: find a correct macro to enable - by default) - - -//===---------------------------------------------------------------------===// -// TODOs -//===---------------------------------------------------------------------===// - -- A compiler/system dependency interface -- A better autoconf support -- Remove old, historical references and files -- Currently old object are allocated by MVM'GC. Make some classes - hand-allocated. -- Port to Darwin -- Improve exception handling performance: it's currently ugly and inefficient - -//===---------------------------------------------------------------------===// -// Disclaimer -//===---------------------------------------------------------------------===// - -JnJVM, N3 and MVM were developed with "having functional virtual machines as -quick as possible" in mind. The usage of mixed C/C++ and the absence of clean -interfaces, is due to the initial developers lazyness. But now that the VMs -run, things should go better. - Added: vmkit/trunk/README.txt URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/README.txt?rev=52708&view=auto ============================================================================== --- vmkit/trunk/README.txt (added) +++ vmkit/trunk/README.txt Wed Jun 25 04:59:39 2008 @@ -0,0 +1,56 @@ +//===---------------------------------------------------------------------===// +// General notes +//===---------------------------------------------------------------------===// + +VMKit is the composition of three libraries: +1) MVM: mostly a garbage collector +2) JnJVM: a Java Virtual Machine implemented with MVM and LLVM +3) N3: a CLI implementation with MVM and LLVM + +JnJVM and N3 work on Linux/x86 (note that you may have to disable SSE on some +architecture), and mostly work on Linux/PPC (there are some errors with +floating points). Portage to Darwin needs to investigate why exceptions +do not work. + +JnJVM and N3 use GCC's unwinding library (libgcc_s.so). + +There are mainly two options in the ./configure script +--with-gnu-classpath-local-prefix: the local build of GNU classpath +--with-pnet-local-prefix: the local build of PNET +--with-llvmsrc: the local build of LLVM +--with-gc: user either boehm or single-mmap + +Running make on the root tree will produce two "tools": +1) Debug|Release/bin/jnjvm: running the JnJVM like any other JVM +2) Debug|Release/bin/n3: running N3 like CLR + +JnJVM and N3 have their own README notes. + + +//===---------------------------------------------------------------------===// +// Target specific LLVM patches (not required) +//===---------------------------------------------------------------------===// + +If you experience problems, you can apply the patches for your corresponding +arch. I'd be interested to get some info on your specific problem if the +patch fixes it. + +Patch for PowerPC: +- Bugfix for handling some external symbols (FIXME: does this still happen?) +- Thread safety when doing native code patching (TODO: submit to llvm-dev) +- CFI instructions for callbacks (TODO: find a correct macro to enable this) +- Emit a hand-made frame table for stubs (TODO: submit to llvm-dev) + +Patch for X86 +- Disable SSE (It can sigsegv on some x86 archs. Having test cases would be + nice) +- Enable CFI instructions for callbacks (TODO: find a correct macro to enable + by default) + + +//===---------------------------------------------------------------------===// +// TODOs +//===---------------------------------------------------------------------===// + +- A compiler/system dependency interface +- Port to Darwin Added: vmkit/trunk/autoconf/AutoRegen.sh URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/autoconf/AutoRegen.sh?rev=52708&view=auto ============================================================================== --- vmkit/trunk/autoconf/AutoRegen.sh (added) +++ vmkit/trunk/autoconf/AutoRegen.sh Wed Jun 25 04:59:39 2008 @@ -0,0 +1,52 @@ +#!/bin/sh +die () { + echo "$@" 1>&2 + exit 1 +} +test -d autoconf && test -f autoconf/configure.ac && cd autoconf +test -f configure.ac || die "Can't find 'autoconf' dir; please cd into it first" +autoconf --version | egrep '2\.[5-6][0-9]' > /dev/null +if test $? -ne 0 ; then + die "Your autoconf was not detected as being 2.5x or 2.6x" +fi +cwd=`pwd` +if test -d ../../../autoconf/m4 ; then + cd ../../../autoconf/m4 + llvm_m4=`pwd` + llvm_src_root=../../.. + llvm_obj_root=../../.. + cd $cwd +elif test -d ../../llvm/autoconf/m4 ; then + cd ../../llvm/autoconf/m4 + llvm_m4=`pwd` + llvm_src_root=../.. + llvm_obj_root=../.. + cd $cwd +else + while true ; do + echo "LLVM source root not found." + read -p "Enter full path to LLVM source:" + if test -d "$REPLY/autoconf/m4" ; then + llvm_src_root="$REPLY" + llvm_m4="$REPLY/autoconf/m4" + read -p "Enter full path to LLVM objects (empty for same as source):" + if test -d "$REPLY" ; then + llvm_obj_root="$REPLY" + else + llvm_obj_root="$llvm_src_root" + fi + break + fi + done +fi +# Patch the LLVM_ROOT in configure.ac, if it needs it +cp configure.ac configure.bak +sed -e "s#^LLVM_SRC_ROOT=.*#LLVM_SRC_ROOT=\"$llvm_src_root\"#" \ + -e "s#^LLVM_OBJ_ROOT=.*#LLVM_OBJ_ROOT=\"$llvm_obj_root\"#" configure.bak > configure.ac +echo "Regenerating aclocal.m4 with aclocal" +rm -f aclocal.m4 +aclocal -I $llvm_m4 -I "$llvm_m4/.." || die "aclocal failed" +echo "Regenerating configure with autoconf 2.5x or 2.6x" +autoconf --warnings=all -o ../configure configure.ac || die "autoconf failed" +cd .. +exit 0 Propchange: vmkit/trunk/autoconf/AutoRegen.sh ------------------------------------------------------------------------------ svn:executable = * Added: vmkit/trunk/autoconf/config.guess URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/autoconf/config.guess?rev=52708&view=auto ============================================================================== --- vmkit/trunk/autoconf/config.guess (added) +++ vmkit/trunk/autoconf/config.guess Wed Jun 25 04:59:39 2008 @@ -0,0 +1,1447 @@ +#! /bin/sh +# Attempt to guess a canonical system name. +# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, +# 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. + +timestamp='2004-09-07' + +# This file is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# Originally written by Per Bothner . +# Please send patches to . Submit a context +# diff and a properly formatted ChangeLog entry. +# +# This script attempts to guess a canonical system name similar to +# config.sub. If it succeeds, it prints the system name on stdout, and +# exits with 0. Otherwise, it exits with 1. +# +# The plan is that this can be called by configure scripts if you +# don't specify an explicit build system type. + +me=`echo "$0" | sed -e 's,.*/,,'` + +usage="\ +Usage: $0 [OPTION] + +Output the configuration name of the system \`$me' is run on. + +Operation modes: + -h, --help print this help, then exit + -t, --time-stamp print date of last modification, then exit + -v, --version print version number, then exit + +Report bugs and patches to ." + +version="\ +GNU config.guess ($timestamp) + +Originally written by Per Bothner. +Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004 +Free Software Foundation, Inc. + +This is free software; see the source for copying conditions. There is NO +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." + +help=" +Try \`$me --help' for more information." + +# Parse command line +while test $# -gt 0 ; do + case $1 in + --time-stamp | --time* | -t ) + echo "$timestamp" ; exit 0 ;; + --version | -v ) + echo "$version" ; exit 0 ;; + --help | --h* | -h ) + echo "$usage"; exit 0 ;; + -- ) # Stop option processing + shift; break ;; + - ) # Use stdin as input. + break ;; + -* ) + echo "$me: invalid option $1$help" >&2 + exit 1 ;; + * ) + break ;; + esac +done + +if test $# != 0; then + echo "$me: too many arguments$help" >&2 + exit 1 +fi + +trap 'exit 1' 1 2 15 + +# CC_FOR_BUILD -- compiler used by this script. Note that the use of a +# compiler to aid in system detection is discouraged as it requires +# temporary files to be created and, as you can see below, it is a +# headache to deal with in a portable fashion. + +# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still +# use `HOST_CC' if defined, but it is deprecated. + +# Portable tmp directory creation inspired by the Autoconf team. + +set_cc_for_build=' +trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ; +trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ; +: ${TMPDIR=/tmp} ; + { tmp=`(umask 077 && mktemp -d -q "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || + { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } || + { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } || + { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ; +dummy=$tmp/dummy ; +tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ; +case $CC_FOR_BUILD,$HOST_CC,$CC in + ,,) echo "int x;" > $dummy.c ; + for c in cc gcc c89 c99 ; do + if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then + CC_FOR_BUILD="$c"; break ; + fi ; + done ; + if test x"$CC_FOR_BUILD" = x ; then + CC_FOR_BUILD=no_compiler_found ; + fi + ;; + ,,*) CC_FOR_BUILD=$CC ;; + ,*,*) CC_FOR_BUILD=$HOST_CC ;; +esac ;' + +# This is needed to find uname on a Pyramid OSx when run in the BSD universe. +# (ghazi at noc.rutgers.edu 1994-08-24) +if (test -f /.attbin/uname) >/dev/null 2>&1 ; then + PATH=$PATH:/.attbin ; export PATH +fi + +UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown +UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown +UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown +UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown + +# Note: order is significant - the case branches are not exclusive. + +case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in + *:NetBSD:*:*) + # NetBSD (nbsd) targets should (where applicable) match one or + # more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*, + # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently + # switched to ELF, *-*-netbsd* would select the old + # object file format. This provides both forward + # compatibility and a consistent mechanism for selecting the + # object file format. + # + # Note: NetBSD doesn't particularly care about the vendor + # portion of the name. We always set it to "unknown". + sysctl="sysctl -n hw.machine_arch" + UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \ + /usr/sbin/$sysctl 2>/dev/null || echo unknown)` + case "${UNAME_MACHINE_ARCH}" in + armeb) machine=armeb-unknown ;; + arm*) machine=arm-unknown ;; + sh3el) machine=shl-unknown ;; + sh3eb) machine=sh-unknown ;; + *) machine=${UNAME_MACHINE_ARCH}-unknown ;; + esac + # The Operating System including object format, if it has switched + # to ELF recently, or will in the future. + case "${UNAME_MACHINE_ARCH}" in + arm*|i386|m68k|ns32k|sh3*|sparc|vax) + eval $set_cc_for_build + if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ + | grep __ELF__ >/dev/null + then + # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). + # Return netbsd for either. FIX? + os=netbsd + else + os=netbsdelf + fi + ;; + *) + os=netbsd + ;; + esac + # The OS release + # Debian GNU/NetBSD machines have a different userland, and + # thus, need a distinct triplet. However, they do not need + # kernel version information, so it can be replaced with a + # suitable tag, in the style of linux-gnu. + case "${UNAME_VERSION}" in + Debian*) + release='-gnu' + ;; + *) + release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` + ;; + esac + # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: + # contains redundant information, the shorter form: + # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. + echo "${machine}-${os}${release}" + exit 0 ;; + amd64:OpenBSD:*:*) + echo x86_64-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + amiga:OpenBSD:*:*) + echo m68k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + cats:OpenBSD:*:*) + echo arm-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + hp300:OpenBSD:*:*) + echo m68k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + luna88k:OpenBSD:*:*) + echo m88k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + mac68k:OpenBSD:*:*) + echo m68k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + macppc:OpenBSD:*:*) + echo powerpc-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + mvme68k:OpenBSD:*:*) + echo m68k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + mvme88k:OpenBSD:*:*) + echo m88k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + mvmeppc:OpenBSD:*:*) + echo powerpc-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + sgi:OpenBSD:*:*) + echo mips64-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + sun3:OpenBSD:*:*) + echo m68k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + *:OpenBSD:*:*) + echo ${UNAME_MACHINE}-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + *:ekkoBSD:*:*) + echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE} + exit 0 ;; + macppc:MirBSD:*:*) + echo powerppc-unknown-mirbsd${UNAME_RELEASE} + exit 0 ;; + *:MirBSD:*:*) + echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE} + exit 0 ;; + alpha:OSF1:*:*) + case $UNAME_RELEASE in + *4.0) + UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` + ;; + *5.*) + UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'` + ;; + esac + # According to Compaq, /usr/sbin/psrinfo has been available on + # OSF/1 and Tru64 systems produced since 1995. I hope that + # covers most systems running today. This code pipes the CPU + # types through head -n 1, so we only detect the type of CPU 0. + ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1` + case "$ALPHA_CPU_TYPE" in + "EV4 (21064)") + UNAME_MACHINE="alpha" ;; + "EV4.5 (21064)") + UNAME_MACHINE="alpha" ;; + "LCA4 (21066/21068)") + UNAME_MACHINE="alpha" ;; + "EV5 (21164)") + UNAME_MACHINE="alphaev5" ;; + "EV5.6 (21164A)") + UNAME_MACHINE="alphaev56" ;; + "EV5.6 (21164PC)") + UNAME_MACHINE="alphapca56" ;; + "EV5.7 (21164PC)") + UNAME_MACHINE="alphapca57" ;; + "EV6 (21264)") + UNAME_MACHINE="alphaev6" ;; + "EV6.7 (21264A)") + UNAME_MACHINE="alphaev67" ;; + "EV6.8CB (21264C)") + UNAME_MACHINE="alphaev68" ;; + "EV6.8AL (21264B)") + UNAME_MACHINE="alphaev68" ;; + "EV6.8CX (21264D)") + UNAME_MACHINE="alphaev68" ;; + "EV6.9A (21264/EV69A)") + UNAME_MACHINE="alphaev69" ;; + "EV7 (21364)") + UNAME_MACHINE="alphaev7" ;; + "EV7.9 (21364A)") + UNAME_MACHINE="alphaev79" ;; + esac + # A Pn.n version is a patched version. + # A Vn.n version is a released version. + # A Tn.n version is a released field test version. + # A Xn.n version is an unreleased experimental baselevel. + # 1.2 uses "1.2" for uname -r. + echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` + exit 0 ;; + Alpha\ *:Windows_NT*:*) + # How do we know it's Interix rather than the generic POSIX subsystem? + # Should we change UNAME_MACHINE based on the output of uname instead + # of the specific Alpha model? + echo alpha-pc-interix + exit 0 ;; + 21064:Windows_NT:50:3) + echo alpha-dec-winnt3.5 + exit 0 ;; + Amiga*:UNIX_System_V:4.0:*) + echo m68k-unknown-sysv4 + exit 0;; + *:[Aa]miga[Oo][Ss]:*:*) + echo ${UNAME_MACHINE}-unknown-amigaos + exit 0 ;; + *:[Mm]orph[Oo][Ss]:*:*) + echo ${UNAME_MACHINE}-unknown-morphos + exit 0 ;; + *:OS/390:*:*) + echo i370-ibm-openedition + exit 0 ;; + *:OS400:*:*) + echo powerpc-ibm-os400 + exit 0 ;; + arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) + echo arm-acorn-riscix${UNAME_RELEASE} + exit 0;; + SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) + echo hppa1.1-hitachi-hiuxmpp + exit 0;; + Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) + # akee at wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. + if test "`(/bin/universe) 2>/dev/null`" = att ; then + echo pyramid-pyramid-sysv3 + else + echo pyramid-pyramid-bsd + fi + exit 0 ;; + NILE*:*:*:dcosx) + echo pyramid-pyramid-svr4 + exit 0 ;; + DRS?6000:unix:4.0:6*) + echo sparc-icl-nx6 + exit 0 ;; + DRS?6000:UNIX_SV:4.2*:7*) + case `/usr/bin/uname -p` in + sparc) echo sparc-icl-nx7 && exit 0 ;; + esac ;; + sun4H:SunOS:5.*:*) + echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit 0 ;; + sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) + echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit 0 ;; + i86pc:SunOS:5.*:*) + echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit 0 ;; + sun4*:SunOS:6*:*) + # According to config.sub, this is the proper way to canonicalize + # SunOS6. Hard to guess exactly what SunOS6 will be like, but + # it's likely to be more like Solaris than SunOS4. + echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit 0 ;; + sun4*:SunOS:*:*) + case "`/usr/bin/arch -k`" in + Series*|S4*) + UNAME_RELEASE=`uname -v` + ;; + esac + # Japanese Language versions have a version number like `4.1.3-JL'. + echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'` + exit 0 ;; + sun3*:SunOS:*:*) + echo m68k-sun-sunos${UNAME_RELEASE} + exit 0 ;; + sun*:*:4.2BSD:*) + UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` + test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 + case "`/bin/arch`" in + sun3) + echo m68k-sun-sunos${UNAME_RELEASE} + ;; + sun4) + echo sparc-sun-sunos${UNAME_RELEASE} + ;; + esac + exit 0 ;; + aushp:SunOS:*:*) + echo sparc-auspex-sunos${UNAME_RELEASE} + exit 0 ;; + # The situation for MiNT is a little confusing. The machine name + # can be virtually everything (everything which is not + # "atarist" or "atariste" at least should have a processor + # > m68000). The system name ranges from "MiNT" over "FreeMiNT" + # to the lowercase version "mint" (or "freemint"). Finally + # the system name "TOS" denotes a system which is actually not + # MiNT. But MiNT is downward compatible to TOS, so this should + # be no problem. + atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) + echo m68k-atari-mint${UNAME_RELEASE} + exit 0 ;; + atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) + echo m68k-atari-mint${UNAME_RELEASE} + exit 0 ;; + *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) + echo m68k-atari-mint${UNAME_RELEASE} + exit 0 ;; + milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) + echo m68k-milan-mint${UNAME_RELEASE} + exit 0 ;; + hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) + echo m68k-hades-mint${UNAME_RELEASE} + exit 0 ;; + *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) + echo m68k-unknown-mint${UNAME_RELEASE} + exit 0 ;; + m68k:machten:*:*) + echo m68k-apple-machten${UNAME_RELEASE} + exit 0 ;; + powerpc:machten:*:*) + echo powerpc-apple-machten${UNAME_RELEASE} + exit 0 ;; + RISC*:Mach:*:*) + echo mips-dec-mach_bsd4.3 + exit 0 ;; + RISC*:ULTRIX:*:*) + echo mips-dec-ultrix${UNAME_RELEASE} + exit 0 ;; + VAX*:ULTRIX*:*:*) + echo vax-dec-ultrix${UNAME_RELEASE} + exit 0 ;; + 2020:CLIX:*:* | 2430:CLIX:*:*) + echo clipper-intergraph-clix${UNAME_RELEASE} + exit 0 ;; + mips:*:*:UMIPS | mips:*:*:RISCos) + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c +#ifdef __cplusplus +#include /* for printf() prototype */ + int main (int argc, char *argv[]) { +#else + int main (argc, argv) int argc; char *argv[]; { +#endif + #if defined (host_mips) && defined (MIPSEB) + #if defined (SYSTYPE_SYSV) + printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0); + #endif + #if defined (SYSTYPE_SVR4) + printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0); + #endif + #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) + printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0); + #endif + #endif + exit (-1); + } +EOF + $CC_FOR_BUILD -o $dummy $dummy.c \ + && $dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \ + && exit 0 + echo mips-mips-riscos${UNAME_RELEASE} + exit 0 ;; + Motorola:PowerMAX_OS:*:*) + echo powerpc-motorola-powermax + exit 0 ;; + Motorola:*:4.3:PL8-*) + echo powerpc-harris-powermax + exit 0 ;; + Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*) + echo powerpc-harris-powermax + exit 0 ;; + Night_Hawk:Power_UNIX:*:*) + echo powerpc-harris-powerunix + exit 0 ;; + m88k:CX/UX:7*:*) + echo m88k-harris-cxux7 + exit 0 ;; + m88k:*:4*:R4*) + echo m88k-motorola-sysv4 + exit 0 ;; + m88k:*:3*:R3*) + echo m88k-motorola-sysv3 + exit 0 ;; + AViiON:dgux:*:*) + # DG/UX returns AViiON for all architectures + UNAME_PROCESSOR=`/usr/bin/uname -p` + if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ] + then + if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \ + [ ${TARGET_BINARY_INTERFACE}x = x ] + then + echo m88k-dg-dgux${UNAME_RELEASE} + else + echo m88k-dg-dguxbcs${UNAME_RELEASE} + fi + else + echo i586-dg-dgux${UNAME_RELEASE} + fi + exit 0 ;; + M88*:DolphinOS:*:*) # DolphinOS (SVR3) + echo m88k-dolphin-sysv3 + exit 0 ;; + M88*:*:R3*:*) + # Delta 88k system running SVR3 + echo m88k-motorola-sysv3 + exit 0 ;; + XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) + echo m88k-tektronix-sysv3 + exit 0 ;; + Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) + echo m68k-tektronix-bsd + exit 0 ;; + *:IRIX*:*:*) + echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` + exit 0 ;; + ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. + echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id + exit 0 ;; # Note that: echo "'`uname -s`'" gives 'AIX ' + i*86:AIX:*:*) + echo i386-ibm-aix + exit 0 ;; + ia64:AIX:*:*) + if [ -x /usr/bin/oslevel ] ; then + IBM_REV=`/usr/bin/oslevel` + else + IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} + fi + echo ${UNAME_MACHINE}-ibm-aix${IBM_REV} + exit 0 ;; + *:AIX:2:3) + if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #include + + main() + { + if (!__power_pc()) + exit(1); + puts("powerpc-ibm-aix3.2.5"); + exit(0); + } +EOF + $CC_FOR_BUILD -o $dummy $dummy.c && $dummy && exit 0 + echo rs6000-ibm-aix3.2.5 + elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then + echo rs6000-ibm-aix3.2.4 + else + echo rs6000-ibm-aix3.2 + fi + exit 0 ;; + *:AIX:*:[45]) + IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` + if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then + IBM_ARCH=rs6000 + else + IBM_ARCH=powerpc + fi + if [ -x /usr/bin/oslevel ] ; then + IBM_REV=`/usr/bin/oslevel` + else + IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} + fi + echo ${IBM_ARCH}-ibm-aix${IBM_REV} + exit 0 ;; + *:AIX:*:*) + echo rs6000-ibm-aix + exit 0 ;; + ibmrt:4.4BSD:*|romp-ibm:BSD:*) + echo romp-ibm-bsd4.4 + exit 0 ;; + ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and + echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to + exit 0 ;; # report: romp-ibm BSD 4.3 + *:BOSX:*:*) + echo rs6000-bull-bosx + exit 0 ;; + DPX/2?00:B.O.S.:*:*) + echo m68k-bull-sysv3 + exit 0 ;; + 9000/[34]??:4.3bsd:1.*:*) + echo m68k-hp-bsd + exit 0 ;; + hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) + echo m68k-hp-bsd4.4 + exit 0 ;; + 9000/[34678]??:HP-UX:*:*) + HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` + case "${UNAME_MACHINE}" in + 9000/31? ) HP_ARCH=m68000 ;; + 9000/[34]?? ) HP_ARCH=m68k ;; + 9000/[678][0-9][0-9]) + if [ -x /usr/bin/getconf ]; then + sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` + sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` + case "${sc_cpu_version}" in + 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 + 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 + 532) # CPU_PA_RISC2_0 + case "${sc_kernel_bits}" in + 32) HP_ARCH="hppa2.0n" ;; + 64) HP_ARCH="hppa2.0w" ;; + '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20 + esac ;; + esac + fi + if [ "${HP_ARCH}" = "" ]; then + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + + #define _HPUX_SOURCE + #include + #include + + int main () + { + #if defined(_SC_KERNEL_BITS) + long bits = sysconf(_SC_KERNEL_BITS); + #endif + long cpu = sysconf (_SC_CPU_VERSION); + + switch (cpu) + { + case CPU_PA_RISC1_0: puts ("hppa1.0"); break; + case CPU_PA_RISC1_1: puts ("hppa1.1"); break; + case CPU_PA_RISC2_0: + #if defined(_SC_KERNEL_BITS) + switch (bits) + { + case 64: puts ("hppa2.0w"); break; + case 32: puts ("hppa2.0n"); break; + default: puts ("hppa2.0"); break; + } break; + #else /* !defined(_SC_KERNEL_BITS) */ + puts ("hppa2.0"); break; + #endif + default: puts ("hppa1.0"); break; + } + exit (0); + } +EOF + (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy` + test -z "$HP_ARCH" && HP_ARCH=hppa + fi ;; + esac + if [ ${HP_ARCH} = "hppa2.0w" ] + then + # avoid double evaluation of $set_cc_for_build + test -n "$CC_FOR_BUILD" || eval $set_cc_for_build + if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E -) | grep __LP64__ >/dev/null + then + HP_ARCH="hppa2.0w" + else + HP_ARCH="hppa64" + fi + fi + echo ${HP_ARCH}-hp-hpux${HPUX_REV} + exit 0 ;; + ia64:HP-UX:*:*) + HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` + echo ia64-hp-hpux${HPUX_REV} + exit 0 ;; + 3050*:HI-UX:*:*) + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #include + int + main () + { + long cpu = sysconf (_SC_CPU_VERSION); + /* The order matters, because CPU_IS_HP_MC68K erroneously returns + true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct + results, however. */ + if (CPU_IS_PA_RISC (cpu)) + { + switch (cpu) + { + case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; + case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; + case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; + default: puts ("hppa-hitachi-hiuxwe2"); break; + } + } + else if (CPU_IS_HP_MC68K (cpu)) + puts ("m68k-hitachi-hiuxwe2"); + else puts ("unknown-hitachi-hiuxwe2"); + exit (0); + } +EOF + $CC_FOR_BUILD -o $dummy $dummy.c && $dummy && exit 0 + echo unknown-hitachi-hiuxwe2 + exit 0 ;; + 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) + echo hppa1.1-hp-bsd + exit 0 ;; + 9000/8??:4.3bsd:*:*) + echo hppa1.0-hp-bsd + exit 0 ;; + *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) + echo hppa1.0-hp-mpeix + exit 0 ;; + hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) + echo hppa1.1-hp-osf + exit 0 ;; + hp8??:OSF1:*:*) + echo hppa1.0-hp-osf + exit 0 ;; + i*86:OSF1:*:*) + if [ -x /usr/sbin/sysversion ] ; then + echo ${UNAME_MACHINE}-unknown-osf1mk + else + echo ${UNAME_MACHINE}-unknown-osf1 + fi + exit 0 ;; + parisc*:Lites*:*:*) + echo hppa1.1-hp-lites + exit 0 ;; + C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) + echo c1-convex-bsd + exit 0 ;; + C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) + if getsysinfo -f scalar_acc + then echo c32-convex-bsd + else echo c2-convex-bsd + fi + exit 0 ;; + C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) + echo c34-convex-bsd + exit 0 ;; + C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) + echo c38-convex-bsd + exit 0 ;; + C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) + echo c4-convex-bsd + exit 0 ;; + CRAY*Y-MP:*:*:*) + echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit 0 ;; + CRAY*[A-Z]90:*:*:*) + echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \ + | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ + -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ + -e 's/\.[^.]*$/.X/' + exit 0 ;; + CRAY*TS:*:*:*) + echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit 0 ;; + CRAY*T3E:*:*:*) + echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit 0 ;; + CRAY*SV1:*:*:*) + echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit 0 ;; + *:UNICOS/mp:*:*) + echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit 0 ;; + F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) + FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` + FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` + FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` + echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" + exit 0 ;; + 5000:UNIX_System_V:4.*:*) + FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` + FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'` + echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" + exit 0 ;; + i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) + echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} + exit 0 ;; + sparc*:BSD/OS:*:*) + echo sparc-unknown-bsdi${UNAME_RELEASE} + exit 0 ;; + *:BSD/OS:*:*) + echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} + exit 0 ;; + *:FreeBSD:*:*) + echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` + exit 0 ;; + i*:CYGWIN*:*) + echo ${UNAME_MACHINE}-pc-cygwin + exit 0 ;; + i*:MINGW*:*) + echo ${UNAME_MACHINE}-pc-mingw32 + exit 0 ;; + i*:PW*:*) + echo ${UNAME_MACHINE}-pc-pw32 + exit 0 ;; + x86:Interix*:[34]*) + echo i586-pc-interix${UNAME_RELEASE}|sed -e 's/\..*//' + exit 0 ;; + [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*) + echo i${UNAME_MACHINE}-pc-mks + exit 0 ;; + i*:Windows_NT*:* | Pentium*:Windows_NT*:*) + # How do we know it's Interix rather than the generic POSIX subsystem? + # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we + # UNAME_MACHINE based on the output of uname instead of i386? + echo i586-pc-interix + exit 0 ;; + i*:UWIN*:*) + echo ${UNAME_MACHINE}-pc-uwin + exit 0 ;; + p*:CYGWIN*:*) + echo powerpcle-unknown-cygwin + exit 0 ;; + prep*:SunOS:5.*:*) + echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit 0 ;; + *:GNU:*:*) + # the GNU system + echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` + exit 0 ;; + *:GNU/*:*:*) + # other systems with GNU libc and userland + echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu + exit 0 ;; + i*86:Minix:*:*) + echo ${UNAME_MACHINE}-pc-minix + exit 0 ;; + arm*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit 0 ;; + cris:Linux:*:*) + echo cris-axis-linux-gnu + exit 0 ;; + crisv32:Linux:*:*) + echo crisv32-axis-linux-gnu + exit 0 ;; + frv:Linux:*:*) + echo frv-unknown-linux-gnu + exit 0 ;; + ia64:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit 0 ;; + m32r*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit 0 ;; + m68*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit 0 ;; + mips:Linux:*:*) + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #undef CPU + #undef mips + #undef mipsel + #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) + CPU=mipsel + #else + #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) + CPU=mips + #else + CPU= + #endif + #endif +EOF + eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=` + test x"${CPU}" != x && echo "${CPU}-unknown-linux-gnu" && exit 0 + ;; + mips64:Linux:*:*) + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #undef CPU + #undef mips64 + #undef mips64el + #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) + CPU=mips64el + #else + #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) + CPU=mips64 + #else + CPU= + #endif + #endif +EOF + eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=` + test x"${CPU}" != x && echo "${CPU}-unknown-linux-gnu" && exit 0 + ;; + ppc:Linux:*:*) + echo powerpc-unknown-linux-gnu + exit 0 ;; + ppc64:Linux:*:*) + echo powerpc64-unknown-linux-gnu + exit 0 ;; + alpha:Linux:*:*) + case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in + EV5) UNAME_MACHINE=alphaev5 ;; + EV56) UNAME_MACHINE=alphaev56 ;; + PCA56) UNAME_MACHINE=alphapca56 ;; + PCA57) UNAME_MACHINE=alphapca56 ;; + EV6) UNAME_MACHINE=alphaev6 ;; + EV67) UNAME_MACHINE=alphaev67 ;; + EV68*) UNAME_MACHINE=alphaev68 ;; + esac + objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null + if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi + echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} + exit 0 ;; + parisc:Linux:*:* | hppa:Linux:*:*) + # Look for CPU level + case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in + PA7*) echo hppa1.1-unknown-linux-gnu ;; + PA8*) echo hppa2.0-unknown-linux-gnu ;; + *) echo hppa-unknown-linux-gnu ;; + esac + exit 0 ;; + parisc64:Linux:*:* | hppa64:Linux:*:*) + echo hppa64-unknown-linux-gnu + exit 0 ;; + s390:Linux:*:* | s390x:Linux:*:*) + echo ${UNAME_MACHINE}-ibm-linux + exit 0 ;; + sh64*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit 0 ;; + sh*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit 0 ;; + sparc:Linux:*:* | sparc64:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit 0 ;; + x86_64:Linux:*:*) + echo x86_64-unknown-linux-gnu + exit 0 ;; + i*86:Linux:*:*) + # The BFD linker knows what the default object file format is, so + # first see if it will tell us. cd to the root directory to prevent + # problems with other programs or directories called `ld' in the path. + # Set LC_ALL=C to ensure ld outputs messages in English. + ld_supported_targets=`cd /; LC_ALL=C ld --help 2>&1 \ + | sed -ne '/supported targets:/!d + s/[ ][ ]*/ /g + s/.*supported targets: *// + s/ .*// + p'` + case "$ld_supported_targets" in + elf32-i386) + TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu" + ;; + a.out-i386-linux) + echo "${UNAME_MACHINE}-pc-linux-gnuaout" + exit 0 ;; + coff-i386) + echo "${UNAME_MACHINE}-pc-linux-gnucoff" + exit 0 ;; + "") + # Either a pre-BFD a.out linker (linux-gnuoldld) or + # one that does not give us useful --help. + echo "${UNAME_MACHINE}-pc-linux-gnuoldld" + exit 0 ;; + esac + # Determine whether the default compiler is a.out or elf + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #include + #ifdef __ELF__ + # ifdef __GLIBC__ + # if __GLIBC__ >= 2 + LIBC=gnu + # else + LIBC=gnulibc1 + # endif + # else + LIBC=gnulibc1 + # endif + #else + #ifdef __INTEL_COMPILER + LIBC=gnu + #else + LIBC=gnuaout + #endif + #endif + #ifdef __dietlibc__ + LIBC=dietlibc + #endif +EOF + eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=` + test x"${LIBC}" != x && echo "${UNAME_MACHINE}-pc-linux-${LIBC}" && exit 0 + test x"${TENTATIVE}" != x && echo "${TENTATIVE}" && exit 0 + ;; + i*86:DYNIX/ptx:4*:*) + # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. + # earlier versions are messed up and put the nodename in both + # sysname and nodename. + echo i386-sequent-sysv4 + exit 0 ;; + i*86:UNIX_SV:4.2MP:2.*) + # Unixware is an offshoot of SVR4, but it has its own version + # number series starting with 2... + # I am not positive that other SVR4 systems won't match this, + # I just have to hope. -- rms. + # Use sysv4.2uw... so that sysv4* matches it. + echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} + exit 0 ;; + i*86:OS/2:*:*) + # If we were able to find `uname', then EMX Unix compatibility + # is probably installed. + echo ${UNAME_MACHINE}-pc-os2-emx + exit 0 ;; + i*86:XTS-300:*:STOP) + echo ${UNAME_MACHINE}-unknown-stop + exit 0 ;; + i*86:atheos:*:*) + echo ${UNAME_MACHINE}-unknown-atheos + exit 0 ;; + i*86:syllable:*:*) + echo ${UNAME_MACHINE}-pc-syllable + exit 0 ;; + i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*) + echo i386-unknown-lynxos${UNAME_RELEASE} + exit 0 ;; + i*86:*DOS:*:*) + echo ${UNAME_MACHINE}-pc-msdosdjgpp + exit 0 ;; + i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*) + UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'` + if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then + echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL} + else + echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL} + fi + exit 0 ;; + i*86:*:5:[78]*) + case `/bin/uname -X | grep "^Machine"` in + *486*) UNAME_MACHINE=i486 ;; + *Pentium) UNAME_MACHINE=i586 ;; + *Pent*|*Celeron) UNAME_MACHINE=i686 ;; + esac + echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} + exit 0 ;; + i*86:*:3.2:*) + if test -f /usr/options/cb.name; then + UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then + UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')` + (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486 + (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \ + && UNAME_MACHINE=i586 + (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \ + && UNAME_MACHINE=i686 + (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \ + && UNAME_MACHINE=i686 + echo ${UNAME_MACHINE}-pc-sco$UNAME_REL + else + echo ${UNAME_MACHINE}-pc-sysv32 + fi + exit 0 ;; + pc:*:*:*) + # Left here for compatibility: + # uname -m prints for DJGPP always 'pc', but it prints nothing about + # the processor, so we play safe by assuming i386. + echo i386-pc-msdosdjgpp + exit 0 ;; + Intel:Mach:3*:*) + echo i386-pc-mach3 + exit 0 ;; + paragon:*:*:*) + echo i860-intel-osf1 + exit 0 ;; + i860:*:4.*:*) # i860-SVR4 + if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then + echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4 + else # Add other i860-SVR4 vendors below as they are discovered. + echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4 + fi + exit 0 ;; + mini*:CTIX:SYS*5:*) + # "miniframe" + echo m68010-convergent-sysv + exit 0 ;; + mc68k:UNIX:SYSTEM5:3.51m) + echo m68k-convergent-sysv + exit 0 ;; + M680?0:D-NIX:5.3:*) + echo m68k-diab-dnix + exit 0 ;; + M68*:*:R3V[5678]*:*) + test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;; + 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0) + OS_REL='' + test -r /etc/.relid \ + && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` + /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ + && echo i486-ncr-sysv4.3${OS_REL} && exit 0 + /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ + && echo i586-ncr-sysv4.3${OS_REL} && exit 0 ;; + 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) + /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ + && echo i486-ncr-sysv4 && exit 0 ;; + m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) + echo m68k-unknown-lynxos${UNAME_RELEASE} + exit 0 ;; + mc68030:UNIX_System_V:4.*:*) + echo m68k-atari-sysv4 + exit 0 ;; + TSUNAMI:LynxOS:2.*:*) + echo sparc-unknown-lynxos${UNAME_RELEASE} + exit 0 ;; + rs6000:LynxOS:2.*:*) + echo rs6000-unknown-lynxos${UNAME_RELEASE} + exit 0 ;; + PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*) + echo powerpc-unknown-lynxos${UNAME_RELEASE} + exit 0 ;; + SM[BE]S:UNIX_SV:*:*) + echo mips-dde-sysv${UNAME_RELEASE} + exit 0 ;; + RM*:ReliantUNIX-*:*:*) + echo mips-sni-sysv4 + exit 0 ;; + RM*:SINIX-*:*:*) + echo mips-sni-sysv4 + exit 0 ;; + *:SINIX-*:*:*) + if uname -p 2>/dev/null >/dev/null ; then + UNAME_MACHINE=`(uname -p) 2>/dev/null` + echo ${UNAME_MACHINE}-sni-sysv4 + else + echo ns32k-sni-sysv + fi + exit 0 ;; + PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort + # says + echo i586-unisys-sysv4 + exit 0 ;; + *:UNIX_System_V:4*:FTX*) + # From Gerald Hewes . + # How about differentiating between stratus architectures? -djm + echo hppa1.1-stratus-sysv4 + exit 0 ;; + *:*:*:FTX*) + # From seanf at swdc.stratus.com. + echo i860-stratus-sysv4 + exit 0 ;; + *:VOS:*:*) + # From Paul.Green at stratus.com. + echo hppa1.1-stratus-vos + exit 0 ;; + mc68*:A/UX:*:*) + echo m68k-apple-aux${UNAME_RELEASE} + exit 0 ;; + news*:NEWS-OS:6*:*) + echo mips-sony-newsos6 + exit 0 ;; + R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) + if [ -d /usr/nec ]; then + echo mips-nec-sysv${UNAME_RELEASE} + else + echo mips-unknown-sysv${UNAME_RELEASE} + fi + exit 0 ;; + BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. + echo powerpc-be-beos + exit 0 ;; + BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. + echo powerpc-apple-beos + exit 0 ;; + BePC:BeOS:*:*) # BeOS running on Intel PC compatible. + echo i586-pc-beos + exit 0 ;; + SX-4:SUPER-UX:*:*) + echo sx4-nec-superux${UNAME_RELEASE} + exit 0 ;; + SX-5:SUPER-UX:*:*) + echo sx5-nec-superux${UNAME_RELEASE} + exit 0 ;; + SX-6:SUPER-UX:*:*) + echo sx6-nec-superux${UNAME_RELEASE} + exit 0 ;; + Power*:Rhapsody:*:*) + echo powerpc-apple-rhapsody${UNAME_RELEASE} + exit 0 ;; + *:Rhapsody:*:*) + echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} + exit 0 ;; + *:Darwin:*:*) + UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown + case $UNAME_PROCESSOR in + *86) UNAME_PROCESSOR=i686 ;; + unknown) UNAME_PROCESSOR=powerpc ;; + esac + echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} + exit 0 ;; + *:procnto*:*:* | *:QNX:[0123456789]*:*) + UNAME_PROCESSOR=`uname -p` + if test "$UNAME_PROCESSOR" = "x86"; then + UNAME_PROCESSOR=i386 + UNAME_MACHINE=pc + fi + echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE} + exit 0 ;; + *:QNX:*:4*) + echo i386-pc-qnx + exit 0 ;; + NSR-?:NONSTOP_KERNEL:*:*) + echo nsr-tandem-nsk${UNAME_RELEASE} + exit 0 ;; + *:NonStop-UX:*:*) + echo mips-compaq-nonstopux + exit 0 ;; + BS2000:POSIX*:*:*) + echo bs2000-siemens-sysv + exit 0 ;; + DS/*:UNIX_System_V:*:*) + echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE} + exit 0 ;; + *:Plan9:*:*) + # "uname -m" is not consistent, so use $cputype instead. 386 + # is converted to i386 for consistency with other x86 + # operating systems. + if test "$cputype" = "386"; then + UNAME_MACHINE=i386 + else + UNAME_MACHINE="$cputype" + fi + echo ${UNAME_MACHINE}-unknown-plan9 + exit 0 ;; + *:TOPS-10:*:*) + echo pdp10-unknown-tops10 + exit 0 ;; + *:TENEX:*:*) + echo pdp10-unknown-tenex + exit 0 ;; + KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) + echo pdp10-dec-tops20 + exit 0 ;; + XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) + echo pdp10-xkl-tops20 + exit 0 ;; + *:TOPS-20:*:*) + echo pdp10-unknown-tops20 + exit 0 ;; + *:ITS:*:*) + echo pdp10-unknown-its + exit 0 ;; + SEI:*:*:SEIUX) + echo mips-sei-seiux${UNAME_RELEASE} + exit 0 ;; + *:DragonFly:*:*) + echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` + exit 0 ;; + *:*VMS:*:*) + UNAME_MACHINE=`(uname -p) 2>/dev/null` + case "${UNAME_MACHINE}" in + A*) echo alpha-dec-vms && exit 0 ;; + I*) echo ia64-dec-vms && exit 0 ;; + V*) echo vax-dec-vms && exit 0 ;; + esac +esac + +#echo '(No uname command or uname output not recognized.)' 1>&2 +#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2 + +eval $set_cc_for_build +cat >$dummy.c < +# include +#endif +main () +{ +#if defined (sony) +#if defined (MIPSEB) + /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed, + I don't know.... */ + printf ("mips-sony-bsd\n"); exit (0); +#else +#include + printf ("m68k-sony-newsos%s\n", +#ifdef NEWSOS4 + "4" +#else + "" +#endif + ); exit (0); +#endif +#endif + +#if defined (__arm) && defined (__acorn) && defined (__unix) + printf ("arm-acorn-riscix"); exit (0); +#endif + +#if defined (hp300) && !defined (hpux) + printf ("m68k-hp-bsd\n"); exit (0); +#endif + +#if defined (NeXT) +#if !defined (__ARCHITECTURE__) +#define __ARCHITECTURE__ "m68k" +#endif + int version; + version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; + if (version < 4) + printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); + else + printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version); + exit (0); +#endif + +#if defined (MULTIMAX) || defined (n16) +#if defined (UMAXV) + printf ("ns32k-encore-sysv\n"); exit (0); +#else +#if defined (CMU) + printf ("ns32k-encore-mach\n"); exit (0); +#else + printf ("ns32k-encore-bsd\n"); exit (0); +#endif +#endif +#endif + +#if defined (__386BSD__) + printf ("i386-pc-bsd\n"); exit (0); +#endif + +#if defined (sequent) +#if defined (i386) + printf ("i386-sequent-dynix\n"); exit (0); +#endif +#if defined (ns32000) + printf ("ns32k-sequent-dynix\n"); exit (0); +#endif +#endif + +#if defined (_SEQUENT_) + struct utsname un; + + uname(&un); + + if (strncmp(un.version, "V2", 2) == 0) { + printf ("i386-sequent-ptx2\n"); exit (0); + } + if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ + printf ("i386-sequent-ptx1\n"); exit (0); + } + printf ("i386-sequent-ptx\n"); exit (0); + +#endif + +#if defined (vax) +# if !defined (ultrix) +# include +# if defined (BSD) +# if BSD == 43 + printf ("vax-dec-bsd4.3\n"); exit (0); +# else +# if BSD == 199006 + printf ("vax-dec-bsd4.3reno\n"); exit (0); +# else + printf ("vax-dec-bsd\n"); exit (0); +# endif +# endif +# else + printf ("vax-dec-bsd\n"); exit (0); +# endif +# else + printf ("vax-dec-ultrix\n"); exit (0); +# endif +#endif + +#if defined (alliant) && defined (i860) + printf ("i860-alliant-bsd\n"); exit (0); +#endif + + exit (1); +} +EOF + +$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && $dummy && exit 0 + +# Apollos put the system type in the environment. + +test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit 0; } + +# Convex versions that predate uname can use getsysinfo(1) + +if [ -x /usr/convex/getsysinfo ] +then + case `getsysinfo -f cpu_type` in + c1*) + echo c1-convex-bsd + exit 0 ;; + c2*) + if getsysinfo -f scalar_acc + then echo c32-convex-bsd + else echo c2-convex-bsd + fi + exit 0 ;; + c34*) + echo c34-convex-bsd + exit 0 ;; + c38*) + echo c38-convex-bsd + exit 0 ;; + c4*) + echo c4-convex-bsd + exit 0 ;; + esac +fi + +cat >&2 < in order to provide the needed +information to handle your system. + +config.guess timestamp = $timestamp + +uname -m = `(uname -m) 2>/dev/null || echo unknown` +uname -r = `(uname -r) 2>/dev/null || echo unknown` +uname -s = `(uname -s) 2>/dev/null || echo unknown` +uname -v = `(uname -v) 2>/dev/null || echo unknown` + +/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null` +/bin/uname -X = `(/bin/uname -X) 2>/dev/null` + +hostinfo = `(hostinfo) 2>/dev/null` +/bin/universe = `(/bin/universe) 2>/dev/null` +/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null` +/bin/arch = `(/bin/arch) 2>/dev/null` +/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null` +/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null` + +UNAME_MACHINE = ${UNAME_MACHINE} +UNAME_RELEASE = ${UNAME_RELEASE} +UNAME_SYSTEM = ${UNAME_SYSTEM} +UNAME_VERSION = ${UNAME_VERSION} +EOF + +exit 1 + +# Local variables: +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "timestamp='" +# time-stamp-format: "%:y-%02m-%02d" +# time-stamp-end: "'" +# End: Propchange: vmkit/trunk/autoconf/config.guess ------------------------------------------------------------------------------ svn:executable = * Added: vmkit/trunk/autoconf/config.sub URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/autoconf/config.sub?rev=52708&view=auto ============================================================================== --- vmkit/trunk/autoconf/config.sub (added) +++ vmkit/trunk/autoconf/config.sub Wed Jun 25 04:59:39 2008 @@ -0,0 +1,1555 @@ +#! /bin/sh +# Configuration validation subroutine script. +# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, +# 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. + +timestamp='2004-08-29' + +# This file is (in principle) common to ALL GNU software. +# The presence of a machine in this file suggests that SOME GNU software +# can handle that machine. It does not imply ALL GNU software can. +# +# This file is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, +# Boston, MA 02111-1307, USA. + +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# Please send patches to . Submit a context +# diff and a properly formatted ChangeLog entry. +# +# Configuration subroutine to validate and canonicalize a configuration type. +# Supply the specified configuration type as an argument. +# If it is invalid, we print an error message on stderr and exit with code 1. +# Otherwise, we print the canonical config type on stdout and succeed. + +# This file is supposed to be the same for all GNU packages +# and recognize all the CPU types, system types and aliases +# that are meaningful with *any* GNU software. +# Each package is responsible for reporting which valid configurations +# it does not support. The user should be able to distinguish +# a failure to support a valid configuration from a meaningless +# configuration. + +# The goal of this file is to map all the various variations of a given +# machine specification into a single specification in the form: +# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM +# or in some cases, the newer four-part form: +# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM +# It is wrong to echo any other type of specification. + +me=`echo "$0" | sed -e 's,.*/,,'` + +usage="\ +Usage: $0 [OPTION] CPU-MFR-OPSYS + $0 [OPTION] ALIAS + +Canonicalize a configuration name. + +Operation modes: + -h, --help print this help, then exit + -t, --time-stamp print date of last modification, then exit + -v, --version print version number, then exit + +Report bugs and patches to ." + +version="\ +GNU config.sub ($timestamp) + +Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004 +Free Software Foundation, Inc. + +This is free software; see the source for copying conditions. There is NO +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." + +help=" +Try \`$me --help' for more information." + +# Parse command line +while test $# -gt 0 ; do + case $1 in + --time-stamp | --time* | -t ) + echo "$timestamp" ; exit 0 ;; + --version | -v ) + echo "$version" ; exit 0 ;; + --help | --h* | -h ) + echo "$usage"; exit 0 ;; + -- ) # Stop option processing + shift; break ;; + - ) # Use stdin as input. + break ;; + -* ) + echo "$me: invalid option $1$help" + exit 1 ;; + + *local*) + # First pass through any local machine types. + echo $1 + exit 0;; + + * ) + break ;; + esac +done + +case $# in + 0) echo "$me: missing argument$help" >&2 + exit 1;; + 1) ;; + *) echo "$me: too many arguments$help" >&2 + exit 1;; +esac + +# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). +# Here we must recognize all the valid KERNEL-OS combinations. +maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` +case $maybe_os in + nto-qnx* | linux-gnu* | linux-dietlibc | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | \ + kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | storm-chaos* | os2-emx* | rtmk-nova*) + os=-$maybe_os + basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` + ;; + *) + basic_machine=`echo $1 | sed 's/-[^-]*$//'` + if [ $basic_machine != $1 ] + then os=`echo $1 | sed 's/.*-/-/'` + else os=; fi + ;; +esac + +### Let's recognize common machines as not being operating systems so +### that things like config.sub decstation-3100 work. We also +### recognize some manufacturers as not being operating systems, so we +### can provide default operating systems below. +case $os in + -sun*os*) + # Prevent following clause from handling this invalid input. + ;; + -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \ + -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \ + -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \ + -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ + -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ + -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ + -apple | -axis | -knuth | -cray) + os= + basic_machine=$1 + ;; + -sim | -cisco | -oki | -wec | -winbond) + os= + basic_machine=$1 + ;; + -scout) + ;; + -wrs) + os=-vxworks + basic_machine=$1 + ;; + -chorusos*) + os=-chorusos + basic_machine=$1 + ;; + -chorusrdb) + os=-chorusrdb + basic_machine=$1 + ;; + -hiux*) + os=-hiuxwe2 + ;; + -sco5) + os=-sco3.2v5 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco4) + os=-sco3.2v4 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco3.2.[4-9]*) + os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco3.2v[4-9]*) + # Don't forget version if it is 3.2v4 or newer. + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco*) + os=-sco3.2v2 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -udk*) + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -isc) + os=-isc2.2 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -clix*) + basic_machine=clipper-intergraph + ;; + -isc*) + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -lynx*) + os=-lynxos + ;; + -ptx*) + basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'` + ;; + -windowsnt*) + os=`echo $os | sed -e 's/windowsnt/winnt/'` + ;; + -psos*) + os=-psos + ;; + -mint | -mint[0-9]*) + basic_machine=m68k-atari + os=-mint + ;; +esac + +# Decode aliases for certain CPU-COMPANY combinations. +case $basic_machine in + # Recognize the basic CPU types without company name. + # Some are omitted here because they have special meanings below. + 1750a | 580 \ + | a29k \ + | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ + | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ + | am33_2.0 \ + | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr \ + | c4x | clipper \ + | d10v | d30v | dlx | dsp16xx \ + | fr30 | frv \ + | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ + | i370 | i860 | i960 | ia64 \ + | ip2k | iq2000 \ + | m32r | m32rle | m68000 | m68k | m88k | mcore \ + | mips | mipsbe | mipseb | mipsel | mipsle \ + | mips16 \ + | mips64 | mips64el \ + | mips64vr | mips64vrel \ + | mips64orion | mips64orionel \ + | mips64vr4100 | mips64vr4100el \ + | mips64vr4300 | mips64vr4300el \ + | mips64vr5000 | mips64vr5000el \ + | mipsisa32 | mipsisa32el \ + | mipsisa32r2 | mipsisa32r2el \ + | mipsisa64 | mipsisa64el \ + | mipsisa64r2 | mipsisa64r2el \ + | mipsisa64sb1 | mipsisa64sb1el \ + | mipsisa64sr71k | mipsisa64sr71kel \ + | mipstx39 | mipstx39el \ + | mn10200 | mn10300 \ + | msp430 \ + | ns16k | ns32k \ + | openrisc | or32 \ + | pdp10 | pdp11 | pj | pjl \ + | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \ + | pyramid \ + | sh | sh[1234] | sh[23]e | sh[34]eb | shbe | shle | sh[1234]le | sh3ele \ + | sh64 | sh64le \ + | sparc | sparc64 | sparc86x | sparclet | sparclite | sparcv8 | sparcv9 | sparcv9b \ + | strongarm \ + | tahoe | thumb | tic4x | tic80 | tron \ + | v850 | v850e \ + | we32k \ + | x86 | xscale | xstormy16 | xtensa \ + | z8k) + basic_machine=$basic_machine-unknown + ;; + m6811 | m68hc11 | m6812 | m68hc12) + # Motorola 68HC11/12. + basic_machine=$basic_machine-unknown + os=-none + ;; + m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k) + ;; + + # We use `pc' rather than `unknown' + # because (1) that's what they normally are, and + # (2) the word "unknown" tends to confuse beginning users. + i*86 | x86_64) + basic_machine=$basic_machine-pc + ;; + # Object if more than one company name word. + *-*-*) + echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 + exit 1 + ;; + # Recognize the basic CPU types with company name. + 580-* \ + | a29k-* \ + | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ + | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ + | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \ + | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ + | avr-* \ + | bs2000-* \ + | c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \ + | clipper-* | craynv-* | cydra-* \ + | d10v-* | d30v-* | dlx-* \ + | elxsi-* \ + | f30[01]-* | f700-* | fr30-* | frv-* | fx80-* \ + | h8300-* | h8500-* \ + | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ + | i*86-* | i860-* | i960-* | ia64-* \ + | ip2k-* | iq2000-* \ + | m32r-* | m32rle-* \ + | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ + | m88110-* | m88k-* | mcore-* \ + | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ + | mips16-* \ + | mips64-* | mips64el-* \ + | mips64vr-* | mips64vrel-* \ + | mips64orion-* | mips64orionel-* \ + | mips64vr4100-* | mips64vr4100el-* \ + | mips64vr4300-* | mips64vr4300el-* \ + | mips64vr5000-* | mips64vr5000el-* \ + | mipsisa32-* | mipsisa32el-* \ + | mipsisa32r2-* | mipsisa32r2el-* \ + | mipsisa64-* | mipsisa64el-* \ + | mipsisa64r2-* | mipsisa64r2el-* \ + | mipsisa64sb1-* | mipsisa64sb1el-* \ + | mipsisa64sr71k-* | mipsisa64sr71kel-* \ + | mipstx39-* | mipstx39el-* \ + | mmix-* \ + | msp430-* \ + | none-* | np1-* | ns16k-* | ns32k-* \ + | orion-* \ + | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ + | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \ + | pyramid-* \ + | romp-* | rs6000-* \ + | sh-* | sh[1234]-* | sh[23]e-* | sh[34]eb-* | shbe-* \ + | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ + | sparc-* | sparc64-* | sparc86x-* | sparclet-* | sparclite-* \ + | sparcv8-* | sparcv9-* | sparcv9b-* | strongarm-* | sv1-* | sx?-* \ + | tahoe-* | thumb-* \ + | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ + | tron-* \ + | v850-* | v850e-* | vax-* \ + | we32k-* \ + | x86-* | x86_64-* | xps100-* | xscale-* | xstormy16-* \ + | xtensa-* \ + | ymp-* \ + | z8k-*) + ;; + # Recognize the various machine names and aliases which stand + # for a CPU type and a company and sometimes even an OS. + 386bsd) + basic_machine=i386-unknown + os=-bsd + ;; + 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) + basic_machine=m68000-att + ;; + 3b*) + basic_machine=we32k-att + ;; + a29khif) + basic_machine=a29k-amd + os=-udi + ;; + abacus) + basic_machine=abacus-unknown + ;; + adobe68k) + basic_machine=m68010-adobe + os=-scout + ;; + alliant | fx80) + basic_machine=fx80-alliant + ;; + altos | altos3068) + basic_machine=m68k-altos + ;; + am29k) + basic_machine=a29k-none + os=-bsd + ;; + amd64) + basic_machine=x86_64-pc + ;; + amd64-*) + basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + amdahl) + basic_machine=580-amdahl + os=-sysv + ;; + amiga | amiga-*) + basic_machine=m68k-unknown + ;; + amigaos | amigados) + basic_machine=m68k-unknown + os=-amigaos + ;; + amigaunix | amix) + basic_machine=m68k-unknown + os=-sysv4 + ;; + apollo68) + basic_machine=m68k-apollo + os=-sysv + ;; + apollo68bsd) + basic_machine=m68k-apollo + os=-bsd + ;; + aux) + basic_machine=m68k-apple + os=-aux + ;; + balance) + basic_machine=ns32k-sequent + os=-dynix + ;; + c90) + basic_machine=c90-cray + os=-unicos + ;; + convex-c1) + basic_machine=c1-convex + os=-bsd + ;; + convex-c2) + basic_machine=c2-convex + os=-bsd + ;; + convex-c32) + basic_machine=c32-convex + os=-bsd + ;; + convex-c34) + basic_machine=c34-convex + os=-bsd + ;; + convex-c38) + basic_machine=c38-convex + os=-bsd + ;; + cray | j90) + basic_machine=j90-cray + os=-unicos + ;; + craynv) + basic_machine=craynv-cray + os=-unicosmp + ;; + cr16c) + basic_machine=cr16c-unknown + os=-elf + ;; + crds | unos) + basic_machine=m68k-crds + ;; + crisv32 | crisv32-* | etraxfs*) + basic_machine=crisv32-axis + ;; + cris | cris-* | etrax*) + basic_machine=cris-axis + ;; + crx) + basic_machine=crx-unknown + os=-elf + ;; + da30 | da30-*) + basic_machine=m68k-da30 + ;; + decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) + basic_machine=mips-dec + ;; + decsystem10* | dec10*) + basic_machine=pdp10-dec + os=-tops10 + ;; + decsystem20* | dec20*) + basic_machine=pdp10-dec + os=-tops20 + ;; + delta | 3300 | motorola-3300 | motorola-delta \ + | 3300-motorola | delta-motorola) + basic_machine=m68k-motorola + ;; + delta88) + basic_machine=m88k-motorola + os=-sysv3 + ;; + dpx20 | dpx20-*) + basic_machine=rs6000-bull + os=-bosx + ;; + dpx2* | dpx2*-bull) + basic_machine=m68k-bull + os=-sysv3 + ;; + ebmon29k) + basic_machine=a29k-amd + os=-ebmon + ;; + elxsi) + basic_machine=elxsi-elxsi + os=-bsd + ;; + encore | umax | mmax) + basic_machine=ns32k-encore + ;; + es1800 | OSE68k | ose68k | ose | OSE) + basic_machine=m68k-ericsson + os=-ose + ;; + fx2800) + basic_machine=i860-alliant + ;; + genix) + basic_machine=ns32k-ns + ;; + gmicro) + basic_machine=tron-gmicro + os=-sysv + ;; + go32) + basic_machine=i386-pc + os=-go32 + ;; + h3050r* | hiux*) + basic_machine=hppa1.1-hitachi + os=-hiuxwe2 + ;; + h8300hms) + basic_machine=h8300-hitachi + os=-hms + ;; + h8300xray) + basic_machine=h8300-hitachi + os=-xray + ;; + h8500hms) + basic_machine=h8500-hitachi + os=-hms + ;; + harris) + basic_machine=m88k-harris + os=-sysv3 + ;; + hp300-*) + basic_machine=m68k-hp + ;; + hp300bsd) + basic_machine=m68k-hp + os=-bsd + ;; + hp300hpux) + basic_machine=m68k-hp + os=-hpux + ;; + hp3k9[0-9][0-9] | hp9[0-9][0-9]) + basic_machine=hppa1.0-hp + ;; + hp9k2[0-9][0-9] | hp9k31[0-9]) + basic_machine=m68000-hp + ;; + hp9k3[2-9][0-9]) + basic_machine=m68k-hp + ;; + hp9k6[0-9][0-9] | hp6[0-9][0-9]) + basic_machine=hppa1.0-hp + ;; + hp9k7[0-79][0-9] | hp7[0-79][0-9]) + basic_machine=hppa1.1-hp + ;; + hp9k78[0-9] | hp78[0-9]) + # FIXME: really hppa2.0-hp + basic_machine=hppa1.1-hp + ;; + hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) + # FIXME: really hppa2.0-hp + basic_machine=hppa1.1-hp + ;; + hp9k8[0-9][13679] | hp8[0-9][13679]) + basic_machine=hppa1.1-hp + ;; + hp9k8[0-9][0-9] | hp8[0-9][0-9]) + basic_machine=hppa1.0-hp + ;; + hppa-next) + os=-nextstep3 + ;; + hppaosf) + basic_machine=hppa1.1-hp + os=-osf + ;; + hppro) + basic_machine=hppa1.1-hp + os=-proelf + ;; + i370-ibm* | ibm*) + basic_machine=i370-ibm + ;; +# I'm not sure what "Sysv32" means. Should this be sysv3.2? + i*86v32) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-sysv32 + ;; + i*86v4*) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-sysv4 + ;; + i*86v) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-sysv + ;; + i*86sol2) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-solaris2 + ;; + i386mach) + basic_machine=i386-mach + os=-mach + ;; + i386-vsta | vsta) + basic_machine=i386-unknown + os=-vsta + ;; + iris | iris4d) + basic_machine=mips-sgi + case $os in + -irix*) + ;; + *) + os=-irix4 + ;; + esac + ;; + isi68 | isi) + basic_machine=m68k-isi + os=-sysv + ;; + m88k-omron*) + basic_machine=m88k-omron + ;; + magnum | m3230) + basic_machine=mips-mips + os=-sysv + ;; + merlin) + basic_machine=ns32k-utek + os=-sysv + ;; + mingw32) + basic_machine=i386-pc + os=-mingw32 + ;; + miniframe) + basic_machine=m68000-convergent + ;; + *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*) + basic_machine=m68k-atari + os=-mint + ;; + mips3*-*) + basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` + ;; + mips3*) + basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown + ;; + monitor) + basic_machine=m68k-rom68k + os=-coff + ;; + morphos) + basic_machine=powerpc-unknown + os=-morphos + ;; + msdos) + basic_machine=i386-pc + os=-msdos + ;; + mvs) + basic_machine=i370-ibm + os=-mvs + ;; + ncr3000) + basic_machine=i486-ncr + os=-sysv4 + ;; + netbsd386) + basic_machine=i386-unknown + os=-netbsd + ;; + netwinder) + basic_machine=armv4l-rebel + os=-linux + ;; + news | news700 | news800 | news900) + basic_machine=m68k-sony + os=-newsos + ;; + news1000) + basic_machine=m68030-sony + os=-newsos + ;; + news-3600 | risc-news) + basic_machine=mips-sony + os=-newsos + ;; + necv70) + basic_machine=v70-nec + os=-sysv + ;; + next | m*-next ) + basic_machine=m68k-next + case $os in + -nextstep* ) + ;; + -ns2*) + os=-nextstep2 + ;; + *) + os=-nextstep3 + ;; + esac + ;; + nh3000) + basic_machine=m68k-harris + os=-cxux + ;; + nh[45]000) + basic_machine=m88k-harris + os=-cxux + ;; + nindy960) + basic_machine=i960-intel + os=-nindy + ;; + mon960) + basic_machine=i960-intel + os=-mon960 + ;; + nonstopux) + basic_machine=mips-compaq + os=-nonstopux + ;; + np1) + basic_machine=np1-gould + ;; + nsr-tandem) + basic_machine=nsr-tandem + ;; + op50n-* | op60c-*) + basic_machine=hppa1.1-oki + os=-proelf + ;; + or32 | or32-*) + basic_machine=or32-unknown + os=-coff + ;; + os400) + basic_machine=powerpc-ibm + os=-os400 + ;; + OSE68000 | ose68000) + basic_machine=m68000-ericsson + os=-ose + ;; + os68k) + basic_machine=m68k-none + os=-os68k + ;; + pa-hitachi) + basic_machine=hppa1.1-hitachi + os=-hiuxwe2 + ;; + paragon) + basic_machine=i860-intel + os=-osf + ;; + pbd) + basic_machine=sparc-tti + ;; + pbb) + basic_machine=m68k-tti + ;; + pc532 | pc532-*) + basic_machine=ns32k-pc532 + ;; + pentium | p5 | k5 | k6 | nexgen | viac3) + basic_machine=i586-pc + ;; + pentiumpro | p6 | 6x86 | athlon | athlon_*) + basic_machine=i686-pc + ;; + pentiumii | pentium2 | pentiumiii | pentium3) + basic_machine=i686-pc + ;; + pentium4) + basic_machine=i786-pc + ;; + pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) + basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pentiumpro-* | p6-* | 6x86-* | athlon-*) + basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*) + basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pentium4-*) + basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pn) + basic_machine=pn-gould + ;; + power) basic_machine=power-ibm + ;; + ppc) basic_machine=powerpc-unknown + ;; + ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ppcle | powerpclittle | ppc-le | powerpc-little) + basic_machine=powerpcle-unknown + ;; + ppcle-* | powerpclittle-*) + basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ppc64) basic_machine=powerpc64-unknown + ;; + ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ppc64le | powerpc64little | ppc64-le | powerpc64-little) + basic_machine=powerpc64le-unknown + ;; + ppc64le-* | powerpc64little-*) + basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ps2) + basic_machine=i386-ibm + ;; + pw32) + basic_machine=i586-unknown + os=-pw32 + ;; + rom68k) + basic_machine=m68k-rom68k + os=-coff + ;; + rm[46]00) + basic_machine=mips-siemens + ;; + rtpc | rtpc-*) + basic_machine=romp-ibm + ;; + s390 | s390-*) + basic_machine=s390-ibm + ;; + s390x | s390x-*) + basic_machine=s390x-ibm + ;; + sa29200) + basic_machine=a29k-amd + os=-udi + ;; + sb1) + basic_machine=mipsisa64sb1-unknown + ;; + sb1el) + basic_machine=mipsisa64sb1el-unknown + ;; + sei) + basic_machine=mips-sei + os=-seiux + ;; + sequent) + basic_machine=i386-sequent + ;; + sh) + basic_machine=sh-hitachi + os=-hms + ;; + sh64) + basic_machine=sh64-unknown + ;; + sparclite-wrs | simso-wrs) + basic_machine=sparclite-wrs + os=-vxworks + ;; + sps7) + basic_machine=m68k-bull + os=-sysv2 + ;; + spur) + basic_machine=spur-unknown + ;; + st2000) + basic_machine=m68k-tandem + ;; + stratus) + basic_machine=i860-stratus + os=-sysv4 + ;; + sun2) + basic_machine=m68000-sun + ;; + sun2os3) + basic_machine=m68000-sun + os=-sunos3 + ;; + sun2os4) + basic_machine=m68000-sun + os=-sunos4 + ;; + sun3os3) + basic_machine=m68k-sun + os=-sunos3 + ;; + sun3os4) + basic_machine=m68k-sun + os=-sunos4 + ;; + sun4os3) + basic_machine=sparc-sun + os=-sunos3 + ;; + sun4os4) + basic_machine=sparc-sun + os=-sunos4 + ;; + sun4sol2) + basic_machine=sparc-sun + os=-solaris2 + ;; + sun3 | sun3-*) + basic_machine=m68k-sun + ;; + sun4) + basic_machine=sparc-sun + ;; + sun386 | sun386i | roadrunner) + basic_machine=i386-sun + ;; + sv1) + basic_machine=sv1-cray + os=-unicos + ;; + symmetry) + basic_machine=i386-sequent + os=-dynix + ;; + t3e) + basic_machine=alphaev5-cray + os=-unicos + ;; + t90) + basic_machine=t90-cray + os=-unicos + ;; + tic54x | c54x*) + basic_machine=tic54x-unknown + os=-coff + ;; + tic55x | c55x*) + basic_machine=tic55x-unknown + os=-coff + ;; + tic6x | c6x*) + basic_machine=tic6x-unknown + os=-coff + ;; + tx39) + basic_machine=mipstx39-unknown + ;; + tx39el) + basic_machine=mipstx39el-unknown + ;; + toad1) + basic_machine=pdp10-xkl + os=-tops20 + ;; + tower | tower-32) + basic_machine=m68k-ncr + ;; + tpf) + basic_machine=s390x-ibm + os=-tpf + ;; + udi29k) + basic_machine=a29k-amd + os=-udi + ;; + ultra3) + basic_machine=a29k-nyu + os=-sym1 + ;; + v810 | necv810) + basic_machine=v810-nec + os=-none + ;; + vaxv) + basic_machine=vax-dec + os=-sysv + ;; + vms) + basic_machine=vax-dec + os=-vms + ;; + vpp*|vx|vx-*) + basic_machine=f301-fujitsu + ;; + vxworks960) + basic_machine=i960-wrs + os=-vxworks + ;; + vxworks68) + basic_machine=m68k-wrs + os=-vxworks + ;; + vxworks29k) + basic_machine=a29k-wrs + os=-vxworks + ;; + w65*) + basic_machine=w65-wdc + os=-none + ;; + w89k-*) + basic_machine=hppa1.1-winbond + os=-proelf + ;; + xps | xps100) + basic_machine=xps100-honeywell + ;; + ymp) + basic_machine=ymp-cray + os=-unicos + ;; + z8k-*-coff) + basic_machine=z8k-unknown + os=-sim + ;; + none) + basic_machine=none-none + os=-none + ;; + +# Here we handle the default manufacturer of certain CPU types. It is in +# some cases the only manufacturer, in others, it is the most popular. + w89k) + basic_machine=hppa1.1-winbond + ;; + op50n) + basic_machine=hppa1.1-oki + ;; + op60c) + basic_machine=hppa1.1-oki + ;; + romp) + basic_machine=romp-ibm + ;; + mmix) + basic_machine=mmix-knuth + ;; + rs6000) + basic_machine=rs6000-ibm + ;; + vax) + basic_machine=vax-dec + ;; + pdp10) + # there are many clones, so DEC is not a safe bet + basic_machine=pdp10-unknown + ;; + pdp11) + basic_machine=pdp11-dec + ;; + we32k) + basic_machine=we32k-att + ;; + sh3 | sh4 | sh[34]eb | sh[1234]le | sh[23]ele) + basic_machine=sh-unknown + ;; + sh64) + basic_machine=sh64-unknown + ;; + sparc | sparcv8 | sparcv9 | sparcv9b) + basic_machine=sparc-sun + ;; + cydra) + basic_machine=cydra-cydrome + ;; + orion) + basic_machine=orion-highlevel + ;; + orion105) + basic_machine=clipper-highlevel + ;; + mac | mpw | mac-mpw) + basic_machine=m68k-apple + ;; + pmac | pmac-mpw) + basic_machine=powerpc-apple + ;; + *-unknown) + # Make sure to match an already-canonicalized machine name. + ;; + *) + echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 + exit 1 + ;; +esac + +# Here we canonicalize certain aliases for manufacturers. +case $basic_machine in + *-digital*) + basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'` + ;; + *-commodore*) + basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'` + ;; + *) + ;; +esac + +# Decode manufacturer-specific aliases for certain operating systems. + +if [ x"$os" != x"" ] +then +case $os in + # First match some system type aliases + # that might get confused with valid system types. + # -solaris* is a basic system type, with this one exception. + -solaris1 | -solaris1.*) + os=`echo $os | sed -e 's|solaris1|sunos4|'` + ;; + -solaris) + os=-solaris2 + ;; + -svr4*) + os=-sysv4 + ;; + -unixware*) + os=-sysv4.2uw + ;; + -gnu/linux*) + os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` + ;; + # First accept the basic system types. + # The portable systems comes first. + # Each alternative MUST END IN A *, to match a version number. + # -sysv* is not here because it comes later, after sysvr4. + -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ + | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\ + | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \ + | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ + | -aos* \ + | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ + | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ + | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* | -openbsd* \ + | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \ + | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ + | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ + | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ + | -chorusos* | -chorusrdb* \ + | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ + | -mingw32* | -linux-gnu* | -linux-uclibc* | -uxpv* | -beos* | -mpeix* | -udk* \ + | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ + | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ + | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ + | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ + | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ + | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly*) + # Remember, each alternative MUST END IN *, to match a version number. + ;; + -qnx*) + case $basic_machine in + x86-* | i*86-*) + ;; + *) + os=-nto$os + ;; + esac + ;; + -nto-qnx*) + ;; + -nto*) + os=`echo $os | sed -e 's|nto|nto-qnx|'` + ;; + -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ + | -windows* | -osx | -abug | -netware* | -os9* | -beos* \ + | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) + ;; + -mac*) + os=`echo $os | sed -e 's|mac|macos|'` + ;; + -linux-dietlibc) + os=-linux-dietlibc + ;; + -linux*) + os=`echo $os | sed -e 's|linux|linux-gnu|'` + ;; + -sunos5*) + os=`echo $os | sed -e 's|sunos5|solaris2|'` + ;; + -sunos6*) + os=`echo $os | sed -e 's|sunos6|solaris3|'` + ;; + -opened*) + os=-openedition + ;; + -os400*) + os=-os400 + ;; + -wince*) + os=-wince + ;; + -osfrose*) + os=-osfrose + ;; + -osf*) + os=-osf + ;; + -utek*) + os=-bsd + ;; + -dynix*) + os=-bsd + ;; + -acis*) + os=-aos + ;; + -atheos*) + os=-atheos + ;; + -syllable*) + os=-syllable + ;; + -386bsd) + os=-bsd + ;; + -ctix* | -uts*) + os=-sysv + ;; + -nova*) + os=-rtmk-nova + ;; + -ns2 ) + os=-nextstep2 + ;; + -nsk*) + os=-nsk + ;; + # Preserve the version number of sinix5. + -sinix5.*) + os=`echo $os | sed -e 's|sinix|sysv|'` + ;; + -sinix*) + os=-sysv4 + ;; + -tpf*) + os=-tpf + ;; + -triton*) + os=-sysv3 + ;; + -oss*) + os=-sysv3 + ;; + -svr4) + os=-sysv4 + ;; + -svr3) + os=-sysv3 + ;; + -sysvr4) + os=-sysv4 + ;; + # This must come after -sysvr4. + -sysv*) + ;; + -ose*) + os=-ose + ;; + -es1800*) + os=-ose + ;; + -xenix) + os=-xenix + ;; + -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) + os=-mint + ;; + -aros*) + os=-aros + ;; + -kaos*) + os=-kaos + ;; + -none) + ;; + *) + # Get rid of the `-' at the beginning of $os. + os=`echo $os | sed 's/[^-]*-//'` + echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2 + exit 1 + ;; +esac +else + +# Here we handle the default operating systems that come with various machines. +# The value should be what the vendor currently ships out the door with their +# machine or put another way, the most popular os provided with the machine. + +# Note that if you're going to try to match "-MANUFACTURER" here (say, +# "-sun"), then you have to tell the case statement up towards the top +# that MANUFACTURER isn't an operating system. Otherwise, code above +# will signal an error saying that MANUFACTURER isn't an operating +# system, and we'll never get to this point. + +case $basic_machine in + *-acorn) + os=-riscix1.2 + ;; + arm*-rebel) + os=-linux + ;; + arm*-semi) + os=-aout + ;; + c4x-* | tic4x-*) + os=-coff + ;; + # This must come before the *-dec entry. + pdp10-*) + os=-tops20 + ;; + pdp11-*) + os=-none + ;; + *-dec | vax-*) + os=-ultrix4.2 + ;; + m68*-apollo) + os=-domain + ;; + i386-sun) + os=-sunos4.0.2 + ;; + m68000-sun) + os=-sunos3 + # This also exists in the configure program, but was not the + # default. + # os=-sunos4 + ;; + m68*-cisco) + os=-aout + ;; + mips*-cisco) + os=-elf + ;; + mips*-*) + os=-elf + ;; + or32-*) + os=-coff + ;; + *-tti) # must be before sparc entry or we get the wrong os. + os=-sysv3 + ;; + sparc-* | *-sun) + os=-sunos4.1.1 + ;; + *-be) + os=-beos + ;; + *-ibm) + os=-aix + ;; + *-knuth) + os=-mmixware + ;; + *-wec) + os=-proelf + ;; + *-winbond) + os=-proelf + ;; + *-oki) + os=-proelf + ;; + *-hp) + os=-hpux + ;; + *-hitachi) + os=-hiux + ;; + i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) + os=-sysv + ;; + *-cbm) + os=-amigaos + ;; + *-dg) + os=-dgux + ;; + *-dolphin) + os=-sysv3 + ;; + m68k-ccur) + os=-rtu + ;; + m88k-omron*) + os=-luna + ;; + *-next ) + os=-nextstep + ;; + *-sequent) + os=-ptx + ;; + *-crds) + os=-unos + ;; + *-ns) + os=-genix + ;; + i370-*) + os=-mvs + ;; + *-next) + os=-nextstep3 + ;; + *-gould) + os=-sysv + ;; + *-highlevel) + os=-bsd + ;; + *-encore) + os=-bsd + ;; + *-sgi) + os=-irix + ;; + *-siemens) + os=-sysv4 + ;; + *-masscomp) + os=-rtu + ;; + f30[01]-fujitsu | f700-fujitsu) + os=-uxpv + ;; + *-rom68k) + os=-coff + ;; + *-*bug) + os=-coff + ;; + *-apple) + os=-macos + ;; + *-atari*) + os=-mint + ;; + *) + os=-none + ;; +esac +fi + +# Here we handle the case where we know the os, and the CPU type, but not the +# manufacturer. We pick the logical manufacturer. +vendor=unknown +case $basic_machine in + *-unknown) + case $os in + -riscix*) + vendor=acorn + ;; + -sunos*) + vendor=sun + ;; + -aix*) + vendor=ibm + ;; + -beos*) + vendor=be + ;; + -hpux*) + vendor=hp + ;; + -mpeix*) + vendor=hp + ;; + -hiux*) + vendor=hitachi + ;; + -unos*) + vendor=crds + ;; + -dgux*) + vendor=dg + ;; + -luna*) + vendor=omron + ;; + -genix*) + vendor=ns + ;; + -mvs* | -opened*) + vendor=ibm + ;; + -os400*) + vendor=ibm + ;; + -ptx*) + vendor=sequent + ;; + -tpf*) + vendor=ibm + ;; + -vxsim* | -vxworks* | -windiss*) + vendor=wrs + ;; + -aux*) + vendor=apple + ;; + -hms*) + vendor=hitachi + ;; + -mpw* | -macos*) + vendor=apple + ;; + -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) + vendor=atari + ;; + -vos*) + vendor=stratus + ;; + esac + basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"` + ;; +esac + +echo $basic_machine$os +exit 0 + +# Local variables: +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "timestamp='" +# time-stamp-format: "%:y-%02m-%02d" +# time-stamp-end: "'" +# End: Propchange: vmkit/trunk/autoconf/config.sub ------------------------------------------------------------------------------ svn:executable = * Added: vmkit/trunk/autoconf/configure.ac URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/autoconf/configure.ac?rev=52708&view=auto ============================================================================== --- vmkit/trunk/autoconf/configure.ac (added) +++ vmkit/trunk/autoconf/configure.ac Wed Jun 25 04:59:39 2008 @@ -0,0 +1,486 @@ +dnl === configure.ac --------------------------------------------------------=== +dnl The vmkit project +dnl +dnl This file is distributed under the University of Illinois Open Source +dnl License. See LICENSE.TXT for details. +dnl +dnl===-----------------------------------------------------------------------=== +dnl This is the VMKit configuration script. It is processed by the autoconf +dnl program to produce a script named configure. This script contains the +dnl configuration checks that VMKit needs in order to support multiple platforms. +dnl This file is composed of 10 sections per the recommended organization of +dnl autoconf input defined in the autoconf documentation. As this file evolves, +dnl please keep the various types of checks within their sections. The sections +dnl are as follows: +dnl +dnl SECTION 1: Initialization & Setup +dnl SECTION 2: Architecture, target, and host checks +dnl SECTION 3: Command line arguments for the configure script. +dnl SECTION 4: Check for programs we need and that they are the right version +dnl SECTION 5: Check for libraries +dnl SECTION 6: Check for header files +dnl SECTION 7: Check for types and structures +dnl SECTION 8: Check for specific functions needed +dnl SECTION 9: Additional checks, variables, etc. +dnl SECTION 10: Specify the output files and generate it +dnl +dnl===-----------------------------------------------------------------------=== +dnl=== +dnl=== SECTION 1: Initialization & Setup +dnl=== +dnl===-----------------------------------------------------------------------=== +dnl Initialize autoconf and define the package name, version number and +dnl email address for reporting bugs. +AC_INIT([vmkit],[0.0.1],[nicolas.geoffray at lip6.fr]) + +dnl Provide a copyright substitution and ensure the copyright notice is included +dnl in the output of --version option of the generated configure script. +AC_SUBST(VMKIT_COPYRIGHT,["Copyright (c) 2003-2008 Universite Pierre et Marie Curie."]) +AC_COPYRIGHT([Copyright (c) 2003-2008 Universite Pierre et Marie Curie.]) + +dnl Indicate that we require autoconf 2.59 or later. Ths is needed because we +dnl use some autoconf macros only available in 2.59. +AC_PREREQ(2.59) + +dnl Verify that the source directory is valid. This makes sure that we are +dnl configuring VMKit and not some other package (it validates --srcdir argument) +AC_CONFIG_SRCDIR([lib/Mvm/Object.cpp]) + + +dnl Quit if the source directory has already been configured. +dnl NOTE: This relies upon undocumented autoconf behavior. +if test ${srcdir} != "." ; then + if test -f ${srcdir}/include/mvm/Config/config.h ; then + AC_MSG_ERROR([Already configured in ${srcdir}]) + fi +fi + +dnl Place all of the extra autoconf files into the config subdirectory. Tell +dnl various tools where the m4 autoconf macros are. +AC_CONFIG_AUX_DIR([$LLVM_SRC_ROOT/autoconf]) + +dnl Tell autoconf that this is an LLVM project being configured +dnl This provides the --with-llvmsrc and --with-llvmobj options +LLVM_CONFIG_PROJECT($LLVM_SRC_ROOT,$LLVM_OBJ_ROOT) + + +dnl===-----------------------------------------------------------------------=== +dnl=== +dnl=== SECTION 2: Architecture, target, and host checks +dnl=== +dnl===-----------------------------------------------------------------------=== + +dnl Check the target for which we're compiling and the host that will do the +dnl compilations. This will tell us which LLVM compiler will be used for +dnl compiling SSA into object code. This needs to be done early because +dnl following tests depend on it. +AC_CANONICAL_TARGET + +dnl Determine the platform type and cache its value. This helps us configure +dnl the System library to the correct build platform. +AC_CACHE_CHECK([type of operating system we're going to host on], + [vmkit_cv_os_type], +[case $host in + *-*-aix*) + AC_MSG_ERROR([Good luck porting vmkit to your host!]) + vmkit_cv_os_type="AIX" + vmkit_cv_platform_type="Unix" ;; + *-*-irix*) + AC_MSG_ERROR([Good luck porting vmkit to your host!]) + vmkit_cv_os_type="IRIX" + vmkit_cv_platform_type="Unix" ;; + *-*-cygwin*) + AC_MSG_ERROR([Good luck porting vmkit to your host!]) + vmkit_cv_os_type="Cygwin" + vmkit_cv_platform_type="Unix" ;; + *-*-darwin*) + DYLIB_EXTENSION="dylib" + vmkit_cv_os_type="Darwin" + vmkit_cv_platform_type="Unix" ;; + *-*-freebsd*) + AC_MSG_ERROR([Good luck porting vmkit to your host!]) + vmkit_cv_os_type="FreeBSD" + vmkit_cv_platform_type="Unix" ;; + *-*-openbsd*) + AC_MSG_ERROR([Good luck porting vmkit to your host!]) + vmkit_cv_os_type="OpenBSD" + vmkit_cv_platform_type="Unix" ;; + *-*-netbsd*) + AC_MSG_ERROR([Good luck porting vmkit to your host!]) + vmkit_cv_os_type="NetBSD" + vmkit_cv_platform_type="Unix" ;; + *-*-hpux*) + AC_MSG_ERROR([Good luck porting vmkit to your host!]) + vmkit_cv_os_type="HP-UX" + vmkit_cv_platform_type="Unix" ;; + *-*-interix*) + AC_MSG_ERROR([Good luck porting vmkit to your host!]) + vmkit_cv_os_type="Interix" + vmkit_cv_platform_type="Unix" ;; + *-*-linux*) + DYLIB_EXTENSION="so" + vmkit_cv_os_type="Linux" + vmkit_cv_platform_type="Unix" ;; + *-*-solaris*) + AC_MSG_ERROR([Good luck porting vmkit to your host!]) + vmkit_cv_os_type="SunOS" + vmkit_cv_platform_type="Unix" ;; + *-*-win32*) + AC_MSG_ERROR([Good luck porting vmkit to your host!]) + vmkit_cv_os_type="Win32" + vmkit_cv_platform_type="Win32" ;; + *-*-mingw*) + AC_MSG_ERROR([Good luck porting vmkit to your host!]) + vmkit_cv_os_type="MingW" + vmkit_cv_platform_type="Win32" ;; + *) + AC_MSG_ERROR([Good luck porting vmkit to your host!]) + vmkit_cv_os_type="Unknown" + vmkit_cv_platform_type="Unknown" ;; +esac]) + +dnl Make sure we aren't attempting to configure for an unknown system + +AC_SUBST([DYLIB_EXTENSION]) + +dnl===-----------------------------------------------------------------------=== +dnl=== +dnl=== SECTION 3: Command line arguments for the configure script. +dnl=== +dnl===-----------------------------------------------------------------------=== + +AC_ARG_WITH(thread, + [AS_HELP_STRING(--with-thread=something, + [Thread type ('common' or 'no')])], + [thread=$withval],[thread=common] +) + +AS_IF([test "x$thread" != "xno"], + [AC_CHECK_HEADER([pthread.h],, + [AC_MSG_WARN(phtread include NOT found)]) + AC_CHECK_LIB(pthread, pthread_create, [], + [AC_MSG_ERROR([pthread library not found])]) + ] +) + +if test "x$thread" = xcommon; then + AC_DEFINE([HAVE_PTHREAD], [1], [Using pthread library]) +fi + +dnl ************************************************************************** +dnl VVM GC type +dnl ************************************************************************** +AC_ARG_WITH(gc, + [AS_HELP_STRING(--with-gc=something, + [GC type ('single-mmap' 'multi-mmap' or 'boehm')])], + [[gc=$withval]], + [[ echo Using mmap2 as vvm gc type. + gc=single-mmap + ]] +) + +if test "x$gc" = "xboehm"; then + GC_FLAGS ="-I$PWD/lib/Mvm/BoehmGC -DGC_THREADS" + AC_DEFINE([USE_GC_BOEHM], [1], [Using the boehm gc]) + AC_SUBST(GC_MMAP2, [0]) + AC_SUBST(GC_BOEHM, [1]) + GC_LIBS=BoehmGC + case $target_os in + *linux*) + GC_FLAGS="-I$PWD/lib/Mvm/BoehmGC -DGC_THREADS -DGC_LINUX_THREADS" + ;; + esac +else + GC_LIBS=GCMmap2 + if test "x$gc" = "xmulti-mmap"; then + GC_FLAGS="-I$PWD/lib/Mvm/GCMmap2 -DWITH_TRACER -DMULTIPLE_GC" + AC_SUBST([GC_MULTI_MMAP], [1]) + AC_SUBST([GC_SINGLE_MMAP], [0]) + else + GC_FLAGS="-I$PWD/lib/Mvm/GCMmap2 -DWITH_TRACER" + AC_SUBST([GC_MULTI_MMAP], [0]) + AC_SUBST([GC_SINGLE_MMAP], [1]) + fi + AC_DEFINE([USE_GC_MMAP2], [1], [Using the gcmmap2]) + AC_SUBST(GC_MMAP2, [1]) + AC_SUBST(GC_BOEHM, [0]) +fi + +AC_SUBST([GC_FLAGS]) +AC_SUBST([GC_LIBS]) + +dnl ************************************************************************** +dnl Virtual Machine type +dnl ************************************************************************** +AC_ARG_WITH(vm-type, + [AS_HELP_STRING(--with-vm-type=something, + [VM type ('single' 'multi' or 'service')])], + [[vmtype=$withval]], + [[ echo Using single as vm type. + vmtype=single + ]] +) + +if test "x$vmtype" = "xmulti"; then + CFLAGS="$CFLAGS -DMULTIPLE_VM" + CXXFLAGS="$CXXFLAGS -DMULTIPLE_VM" +else + if test "x$vmtype" = "xservice"; then + CFLAGS="$CFLAGS -DMULTIPLE_VM -DSERVICE_GC -DMULTIPLE_GC -DSERVICE_VM -I$PWD/lib/Mvm/Allocator" + CXXFLAGS="$CXXFLAGS -DMULTIPLE_VM -DSERVICE_GC -DMULTIPLE_GC -DSERVICE_VM -I$PWD/lib/Mvm/Allocator" + fi +fi + +AM_CONDITIONAL([SERVICE_BUILD], [test "x$vmtype" = "xservice"]) +AM_CONDITIONAL([ISOLATE_BUILD], [test "x$vmtype" = "xmulti"]) + +dnl ************************************************************************** +dnl GNU CLASSPATH installation prefix +dnl ************************************************************************** + +gnuclasspathversion=0.93; + +AC_ARG_WITH(gnu-classpath-local-prefix, + [AS_HELP_STRING(--with-gnu-classpath-local-prefix=something, + [GNU CLASSPATH local prefix (no default)])], + [[gnuclasspathlocalprefix=$withval]], + [[ echo Not using GNU CLASSPATH local prefix. + gnuclasspathlocalprefix='' + ]] +) + +AC_ARG_WITH(gnu-classpath-installation-prefix, + [AS_HELP_STRING(--with-gnu-classpath-installation-prefix=something, + [GNU CLASSPATH installation prefix (default is '/usr/local/classpath')])], + [[gnuclasspathinstallationprefix=$withval]], + [[gnuclasspathinstallationprefix=/usr/local/classpath]] +) + +if test "x${gnuclasspathlocalprefix}" = x; then + echo Using ${gnuclasspathinstallationprefix} as GNU CLASSPATH installation prefix; + classpathglibj=${gnuclasspathinstallationprefix}/share/classpath/glibj.zip; + classpathlibs=${gnuclasspathinstallationprefix}/lib/classpath/; + classpathinclude=${gnuclasspathlocalprefix}/include; +else + echo Using ${gnuclasspathlocalprefix} as GNU CLASSPATH local prefix; + classpathglibj=${gnuclasspathlocalprefix}/lib/; + classpathlibs=${gnuclasspathlocalprefix}/lib/; + classpathinclude=${gnuclasspathlocalprefix}/include; +fi + + +AC_SUBST([classpathglibj]) +AC_SUBST([classpathlibs]) +AC_SUBST([classpathinclude]) +AC_SUBST([gnuclasspathversion]) + +dnl ************************************************************************** +dnl Local PNet directory +dnl ************************************************************************** +AC_ARG_WITH(pnet-local-prefix, + [AS_HELP_STRING(--with-pnet-local-prefix=something, + [PNET local prefix (no default)])], + [[pnetlocalprefix=$withval]], + [[ echo Not using PNETlocal prefix. + pnetlocalprefix='' + ]] +) + +AM_CONDITIONAL([WITH_N3], [test "x$pnetlocalprefix" != "x"]) +if test "x$pnetlocalprefix" != x; then + echo Using ${pnetlocalprefix} as PNET local prefix; + AC_DEFINE([WITH_N3], [1], [Compiling N3]) +fi + +AC_SUBST([pnetlocalprefix]) + +dnl===-----------------------------------------------------------------------=== +dnl=== +dnl=== SECTION 4: Check for programs we need and that they are the right version +dnl=== +dnl===-----------------------------------------------------------------------=== + +dnl Check for compilation tools +AC_PROG_CPP +AC_PROG_CC(gcc) +AC_PROG_CXX(g++) + +AC_PROG_NM +AC_SUBST(NM) + +dnl Check for the tools that the makefiles require +AC_PROG_LN_S +AC_PATH_PROG(CMP, [cmp], [cmp]) +AC_PATH_PROG(CP, [cp], [cp]) +AC_PATH_PROG(DATE, [date], [date]) +AC_PATH_PROG(FIND, [find], [find]) +AC_PATH_PROG(GREP, [grep], [grep]) +AC_PATH_PROG(MKDIR,[mkdir],[mkdir]) +AC_PATH_PROG(MV, [mv], [mv]) +AC_PROG_RANLIB +AC_PATH_PROG(RM, [rm], [rm]) +AC_PATH_PROG(SED, [sed], [sed]) +AC_PATH_PROG(TAR, [tar], [gtar]) +AC_PATH_PROG(BINPWD,[pwd], [pwd]) +AC_PATH_PROG(CAT,[cat], [cat]) + +AC_PATH_PROG(LLVMAS,[llvm-as], [llvm-as]) +AC_PATH_PROG(LLC,[llc], [llc]) + +dnl Find the install program +AC_PROG_INSTALL + +if test "$WITH_LLVMGCCDIR" = "default" ; then + LLVMGCC="llvm-gcc${EXEEXT}" + LLVMGXX="llvm-g++${EXEEXT}" + AC_PATH_PROG(LLVMGCC, $LLVMGCC, []) + AC_PATH_PROG(LLVMGXX, $LLVMGXX, []) +else + if test -z "$LLVMGCC"; then + LLVMGCC="$WITH_LLVMGCCDIR/bin/llvm-gcc${EXEEXT}" + fi + if test -z "$LLVMGXX"; then + LLVMGXX="$WITH_LLVMGCCDIR/bin/llvm-g++${EXEEXT}" + fi + AC_SUBST(LLVMGCC,$LLVMGCC) + AC_SUBST(LLVMGXX,$LLVMGXX) +fi + +AC_MSG_CHECKING([tool compatibility]) + +dnl Ensure that compilation tools are GCC or a GNU compatible compiler such as +dnl ICC; we use GCC specific options in the makefiles so the compiler needs +dnl to support those options. +dnl "icc" emits gcc signatures +dnl "icc -no-gcc" emits no gcc signature BUT is still compatible +ICC=no +IXX=no +case $CC in + icc*|icpc*) + ICC=yes + IXX=yes + ;; + *) + ;; +esac + +if test "$GCC" != "yes" && test "$ICC" != "yes" +then + AC_MSG_ERROR([gcc|icc required but not found]) +fi + +dnl Ensure that compilation tools are GCC; we use GCC specific extensions +if test "$GXX" != "yes" && test "$IXX" != "yes" +then + AC_MSG_ERROR([g++|icc required but not found]) +fi + +dnl Verify that GCC is version 3.0 or higher +if test "$GCC" = "yes" +then + AC_COMPILE_IFELSE([[#if !defined(__GNUC__) || __GNUC__ < 3 +#error Unsupported GCC version +#endif +]], [], [AC_MSG_ERROR([gcc 3.x required, but you have a lower version])]) +fi + +dnl Tool compatibility is okay if we make it here. +AC_MSG_RESULT([ok]) + + +dnl===-----------------------------------------------------------------------=== +dnl=== +dnl=== SECTION 5: Check for libraries +dnl=== +dnl===-----------------------------------------------------------------------=== + +AC_CHECK_LIB(z, inflate, [], \ + [AC_MSG_ERROR([You need to install the zlib package (z).])] +) + +if test "x$gc" = "xboehm"; then +AC_CHECK_LIB(gc, GC_malloc, [], \ + [AC_MSG_ERROR([You need to install the boehm-gc package (gc).])] +) +fi + +dnl===-----------------------------------------------------------------------=== +dnl=== +dnl=== SECTION 6: Check for header files +dnl=== +dnl===-----------------------------------------------------------------------=== + +AC_CHECK_HEADER([zlib.h], [], \ + AC_MSG_ERROR([You need to install the zlib devel package (zlib.h).]) +) + +if test "x$gc" = "xboehm"; then + AC_CHECK_HEADER([gc/gc.h], [], \ + AC_MSG_ERROR([You need to install the boehm-gc devel package (gc/gc.h).]) + ) +fi + + +nl===-----------------------------------------------------------------------=== +dnl=== +dnl=== SECTION 7: Check for types and structures +dnl=== +dnl===-----------------------------------------------------------------------=== + +AC_TYPE_PID_T +AC_TYPE_SIZE_T +AC_TYPE_SIGNAL +AC_STRUCT_TM +AC_CHECK_TYPES([int64_t],,AC_MSG_ERROR([Type int64_t required but not found])) +AC_CHECK_TYPES([uint64_t],, + AC_CHECK_TYPES([u_int64_t],, + AC_MSG_ERROR([Type uint64_t or u_int64_t required but not found]))) + +dnl===-----------------------------------------------------------------------=== +dnl=== +dnl=== SECTION 8: Check for specific functions needed +dnl=== +dnl===-----------------------------------------------------------------------=== + +AC_CHECK_FUNCS([setjmp longjmp]) + + +dnl===-----------------------------------------------------------------------=== +dnl=== +dnl=== SECTION 9: Additional checks, variables, etc. +dnl=== +dnl===-----------------------------------------------------------------------=== + +dnl===-----------------------------------------------------------------------=== +dnl=== +dnl=== SECTION 10: Specify the output files and generate it +dnl=== +dnl===-----------------------------------------------------------------------=== + +dnl Configure header files +dnl WARNING: dnl If you add or remove any of the following config headers, then +dnl you MUST also update Makefile.rules so that the variable FilesToConfig +dnl contains the same list of files as AC_CONFIG_HEADERS below. This ensures the +dnl files can be updated automatically when their *.in sources change. +AC_CONFIG_HEADERS([include/mvm/Config/config.h]) + +dnl Verify that the source directory is valid +AC_CONFIG_SRCDIR(["Makefile.common.in"]) + +dnl Configure a common Makefile +AC_CONFIG_FILES(Makefile.common) +AC_CONFIG_FILES(Makefile.config) +AC_CONFIG_FILES([lib/JnJVM/Classpath/Classpath.h]) + +dnl Do special configuration of Makefiles +AC_CONFIG_MAKEFILE(Makefile) +AC_CONFIG_MAKEFILE(lib/Makefile) + + +dnl ************************************************************************** +dnl LLVM Installation Prefix +dnl ************************************************************************** +dnl LLVMDYLIB="`$llvmprefix/Release/bin/llvm-config --ldflags all` `$llvmprefix/Release/bin/llvm-config --libs all`" +dnl AC_SUBST([LLVMDYLIB]) + +AC_OUTPUT Added: vmkit/trunk/autoconf/install-sh URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/autoconf/install-sh?rev=52708&view=auto ============================================================================== --- vmkit/trunk/autoconf/install-sh (added) +++ vmkit/trunk/autoconf/install-sh Wed Jun 25 04:59:39 2008 @@ -0,0 +1,322 @@ +#!/bin/sh +# install - install a program, script, or datafile + +scriptversion=2004-09-10.20 + +# This originates from X11R5 (mit/util/scripts/install.sh), which was +# later released in X11R6 (xc/config/util/install.sh) with the +# following copyright and license. +# +# Copyright (C) 1994 X Consortium +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC- +# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +# +# Except as contained in this notice, the name of the X Consortium shall not +# be used in advertising or otherwise to promote the sale, use or other deal- +# ings in this Software without prior written authorization from the X Consor- +# tium. +# +# +# FSF changes to this file are in the public domain. +# +# Calling this script install-sh is preferred over install.sh, to prevent +# `make' implicit rules from creating a file called install from it +# when there is no Makefile. +# +# This script is compatible with the BSD install script, but was written +# from scratch. It can only install one file at a time, a restriction +# shared with many OS's install programs. + +# set DOITPROG to echo to test this script + +# Don't use :- since 4.3BSD and earlier shells don't like it. +doit="${DOITPROG-}" + +# put in absolute paths if you don't have them in your path; or use env. vars. + +mvprog="${MVPROG-mv}" +cpprog="${CPPROG-cp}" +chmodprog="${CHMODPROG-chmod}" +chownprog="${CHOWNPROG-chown}" +chgrpprog="${CHGRPPROG-chgrp}" +stripprog="${STRIPPROG-strip}" +rmprog="${RMPROG-rm}" +mkdirprog="${MKDIRPROG-mkdir}" + +chmodcmd="$chmodprog 0755" +chowncmd= +chgrpcmd= +stripcmd= +rmcmd="$rmprog -f" +mvcmd="$mvprog" +src= +dst= +dir_arg= +dstarg= +no_target_directory= + +usage="Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE + or: $0 [OPTION]... SRCFILES... DIRECTORY + or: $0 [OPTION]... -t DIRECTORY SRCFILES... + or: $0 [OPTION]... -d DIRECTORIES... + +In the 1st form, copy SRCFILE to DSTFILE. +In the 2nd and 3rd, copy all SRCFILES to DIRECTORY. +In the 4th, create DIRECTORIES. + +Options: +-c (ignored) +-d create directories instead of installing files. +-g GROUP $chgrpprog installed files to GROUP. +-m MODE $chmodprog installed files to MODE. +-o USER $chownprog installed files to USER. +-s $stripprog installed files. +-t DIRECTORY install into DIRECTORY. +-T report an error if DSTFILE is a directory. +--help display this help and exit. +--version display version info and exit. + +Environment variables override the default commands: + CHGRPPROG CHMODPROG CHOWNPROG CPPROG MKDIRPROG MVPROG RMPROG STRIPPROG +" + +while test -n "$1"; do + case $1 in + -c) shift + continue;; + + -d) dir_arg=true + shift + continue;; + + -g) chgrpcmd="$chgrpprog $2" + shift + shift + continue;; + + --help) echo "$usage"; exit 0;; + + -m) chmodcmd="$chmodprog $2" + shift + shift + continue;; + + -o) chowncmd="$chownprog $2" + shift + shift + continue;; + + -s) stripcmd=$stripprog + shift + continue;; + + -t) dstarg=$2 + shift + shift + continue;; + + -T) no_target_directory=true + shift + continue;; + + --version) echo "$0 $scriptversion"; exit 0;; + + *) # When -d is used, all remaining arguments are directories to create. + # When -t is used, the destination is already specified. + test -n "$dir_arg$dstarg" && break + # Otherwise, the last argument is the destination. Remove it from $@. + for arg + do + if test -n "$dstarg"; then + # $@ is not empty: it contains at least $arg. + set fnord "$@" "$dstarg" + shift # fnord + fi + shift # arg + dstarg=$arg + done + break;; + esac +done + +if test -z "$1"; then + if test -z "$dir_arg"; then + echo "$0: no input file specified." >&2 + exit 1 + fi + # It's OK to call `install-sh -d' without argument. + # This can happen when creating conditional directories. + exit 0 +fi + +for src +do + # Protect names starting with `-'. + case $src in + -*) src=./$src ;; + esac + + if test -n "$dir_arg"; then + dst=$src + src= + + if test -d "$dst"; then + mkdircmd=: + chmodcmd= + else + mkdircmd=$mkdirprog + fi + else + # Waiting for this to be detected by the "$cpprog $src $dsttmp" command + # might cause directories to be created, which would be especially bad + # if $src (and thus $dsttmp) contains '*'. + if test ! -f "$src" && test ! -d "$src"; then + echo "$0: $src does not exist." >&2 + exit 1 + fi + + if test -z "$dstarg"; then + echo "$0: no destination specified." >&2 + exit 1 + fi + + dst=$dstarg + # Protect names starting with `-'. + case $dst in + -*) dst=./$dst ;; + esac + + # If destination is a directory, append the input filename; won't work + # if double slashes aren't ignored. + if test -d "$dst"; then + if test -n "$no_target_directory"; then + echo "$0: $dstarg: Is a directory" >&2 + exit 1 + fi + dst=$dst/`basename "$src"` + fi + fi + + # This sed command emulates the dirname command. + dstdir=`echo "$dst" | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'` + + # Make sure that the destination directory exists. + + # Skip lots of stat calls in the usual case. + if test ! -d "$dstdir"; then + defaultIFS=' + ' + IFS="${IFS-$defaultIFS}" + + oIFS=$IFS + # Some sh's can't handle IFS=/ for some reason. + IFS='%' + set - `echo "$dstdir" | sed -e 's@/@%@g' -e 's@^%@/@'` + IFS=$oIFS + + pathcomp= + + while test $# -ne 0 ; do + pathcomp=$pathcomp$1 + shift + if test ! -d "$pathcomp"; then + $mkdirprog "$pathcomp" + # mkdir can fail with a `File exist' error in case several + # install-sh are creating the directory concurrently. This + # is OK. + test -d "$pathcomp" || exit + fi + pathcomp=$pathcomp/ + done + fi + + if test -n "$dir_arg"; then + $doit $mkdircmd "$dst" \ + && { test -z "$chowncmd" || $doit $chowncmd "$dst"; } \ + && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } \ + && { test -z "$stripcmd" || $doit $stripcmd "$dst"; } \ + && { test -z "$chmodcmd" || $doit $chmodcmd "$dst"; } + + else + dstfile=`basename "$dst"` + + # Make a couple of temp file names in the proper directory. + dsttmp=$dstdir/_inst.$$_ + rmtmp=$dstdir/_rm.$$_ + + # Trap to clean up those temp files at exit. + trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0 + trap '(exit $?); exit' 1 2 13 15 + + # Copy the file name to the temp name. + $doit $cpprog "$src" "$dsttmp" && + + # and set any options; do chmod last to preserve setuid bits. + # + # If any of these fail, we abort the whole thing. If we want to + # ignore errors from any of these, just make sure not to ignore + # errors from the above "$doit $cpprog $src $dsttmp" command. + # + { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } \ + && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } \ + && { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } \ + && { test -z "$chmodcmd" || $doit $chmodcmd "$dsttmp"; } && + + # Now rename the file to the real destination. + { $doit $mvcmd -f "$dsttmp" "$dstdir/$dstfile" 2>/dev/null \ + || { + # The rename failed, perhaps because mv can't rename something else + # to itself, or perhaps because mv is so ancient that it does not + # support -f. + + # Now remove or move aside any old file at destination location. + # We try this two ways since rm can't unlink itself on some + # systems and the destination file might be busy for other + # reasons. In this case, the final cleanup might fail but the new + # file should still install successfully. + { + if test -f "$dstdir/$dstfile"; then + $doit $rmcmd -f "$dstdir/$dstfile" 2>/dev/null \ + || $doit $mvcmd -f "$dstdir/$dstfile" "$rmtmp" 2>/dev/null \ + || { + echo "$0: cannot unlink or rename $dstdir/$dstfile" >&2 + (exit 1); exit + } + else + : + fi + } && + + # Now rename the file to the real destination. + $doit $mvcmd "$dsttmp" "$dstdir/$dstfile" + } + } + fi || { (exit 1); exit; } +done + +# The final little trick to "correctly" pass the exit status to the exit trap. +{ + (exit 0); exit +} + +# Local variables: +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "scriptversion=" +# time-stamp-format: "%:y-%02m-%02d.%02H" +# time-stamp-end: "$" +# End: Removed: vmkit/trunk/autogen.sh URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/autogen.sh?rev=52707&view=auto ============================================================================== --- vmkit/trunk/autogen.sh (original) +++ vmkit/trunk/autogen.sh (removed) @@ -1,4 +0,0 @@ -#!/bin/sh - -autoreconf -vfi - Added: vmkit/trunk/configure URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/configure?rev=52708&view=auto ============================================================================== --- vmkit/trunk/configure (added) +++ vmkit/trunk/configure Wed Jun 25 04:59:39 2008 @@ -0,0 +1,8352 @@ +#! /bin/sh +# Guess values for system-dependent variables and create Makefiles. +# Generated by GNU Autoconf 2.61 for vmkit 0.0.1. +# +# Report bugs to . +# +# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, +# 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. +# This configure script is free software; the Free Software Foundation +# gives unlimited permission to copy, distribute and modify it. +# +# Copyright (c) 2003-2008 Universite Pierre et Marie Curie. +## --------------------- ## +## M4sh Initialization. ## +## --------------------- ## + +# Be more Bourne compatible +DUALCASE=1; export DUALCASE # for MKS sh +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then + emulate sh + NULLCMD=: + # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' + setopt NO_GLOB_SUBST +else + case `(set -o) 2>/dev/null` in + *posix*) set -o posix ;; +esac + +fi + + + + +# PATH needs CR +# Avoid depending upon Character Ranges. +as_cr_letters='abcdefghijklmnopqrstuvwxyz' +as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' +as_cr_Letters=$as_cr_letters$as_cr_LETTERS +as_cr_digits='0123456789' +as_cr_alnum=$as_cr_Letters$as_cr_digits + +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + echo "#! /bin/sh" >conf$$.sh + echo "exit 0" >>conf$$.sh + chmod +x conf$$.sh + if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then + PATH_SEPARATOR=';' + else + PATH_SEPARATOR=: + fi + rm -f conf$$.sh +fi + +# Support unset when possible. +if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then + as_unset=unset +else + as_unset=false +fi + + +# IFS +# We need space, tab and new line, in precisely that order. Quoting is +# there to prevent editors from complaining about space-tab. +# (If _AS_PATH_WALK were called with IFS unset, it would disable word +# splitting by setting IFS to empty value.) +as_nl=' +' +IFS=" "" $as_nl" + +# Find who we are. Look in the path if we contain no directory separator. +case $0 in + *[\\/]* ) as_myself=$0 ;; + *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break +done +IFS=$as_save_IFS + + ;; +esac +# We did not find ourselves, most probably we were run as `sh COMMAND' +# in which case we are not to be found in the path. +if test "x$as_myself" = x; then + as_myself=$0 +fi +if test ! -f "$as_myself"; then + echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 + { (exit 1); exit 1; } +fi + +# Work around bugs in pre-3.0 UWIN ksh. +for as_var in ENV MAIL MAILPATH +do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var +done +PS1='$ ' +PS2='> ' +PS4='+ ' + +# NLS nuisances. +for as_var in \ + LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ + LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ + LC_TELEPHONE LC_TIME +do + if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then + eval $as_var=C; export $as_var + else + ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var + fi +done + +# Required to use basename. +if expr a : '\(a\)' >/dev/null 2>&1 && + test "X`expr 00001 : '.*\(...\)'`" = X001; then + as_expr=expr +else + as_expr=false +fi + +if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then + as_basename=basename +else + as_basename=false +fi + + +# Name of the executable. +as_me=`$as_basename -- "$0" || +$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)' \| . 2>/dev/null || +echo X/"$0" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ + s//\1/ + q + } + /^X\/\(\/\/\)$/{ + s//\1/ + q + } + /^X\/\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + +# CDPATH. +$as_unset CDPATH + + +if test "x$CONFIG_SHELL" = x; then + if (eval ":") 2>/dev/null; then + as_have_required=yes +else + as_have_required=no +fi + + if test $as_have_required = yes && (eval ": +(as_func_return () { + (exit \$1) +} +as_func_success () { + as_func_return 0 +} +as_func_failure () { + as_func_return 1 +} +as_func_ret_success () { + return 0 +} +as_func_ret_failure () { + return 1 +} + +exitcode=0 +if as_func_success; then + : +else + exitcode=1 + echo as_func_success failed. +fi + +if as_func_failure; then + exitcode=1 + echo as_func_failure succeeded. +fi + +if as_func_ret_success; then + : +else + exitcode=1 + echo as_func_ret_success failed. +fi + +if as_func_ret_failure; then + exitcode=1 + echo as_func_ret_failure succeeded. +fi + +if ( set x; as_func_ret_success y && test x = \"\$1\" ); then + : +else + exitcode=1 + echo positional parameters were not saved. +fi + +test \$exitcode = 0) || { (exit 1); exit 1; } + +( + as_lineno_1=\$LINENO + as_lineno_2=\$LINENO + test \"x\$as_lineno_1\" != \"x\$as_lineno_2\" && + test \"x\`expr \$as_lineno_1 + 1\`\" = \"x\$as_lineno_2\") || { (exit 1); exit 1; } +") 2> /dev/null; then + : +else + as_candidate_shells= + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + case $as_dir in + /*) + for as_base in sh bash ksh sh5; do + as_candidate_shells="$as_candidate_shells $as_dir/$as_base" + done;; + esac +done +IFS=$as_save_IFS + + + for as_shell in $as_candidate_shells $SHELL; do + # Try only shells that exist, to save several forks. + if { test -f "$as_shell" || test -f "$as_shell.exe"; } && + { ("$as_shell") 2> /dev/null <<\_ASEOF +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then + emulate sh + NULLCMD=: + # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' + setopt NO_GLOB_SUBST +else + case `(set -o) 2>/dev/null` in + *posix*) set -o posix ;; +esac + +fi + + +: +_ASEOF +}; then + CONFIG_SHELL=$as_shell + as_have_required=yes + if { "$as_shell" 2> /dev/null <<\_ASEOF +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then + emulate sh + NULLCMD=: + # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' + setopt NO_GLOB_SUBST +else + case `(set -o) 2>/dev/null` in + *posix*) set -o posix ;; +esac + +fi + + +: +(as_func_return () { + (exit $1) +} +as_func_success () { + as_func_return 0 +} +as_func_failure () { + as_func_return 1 +} +as_func_ret_success () { + return 0 +} +as_func_ret_failure () { + return 1 +} + +exitcode=0 +if as_func_success; then + : +else + exitcode=1 + echo as_func_success failed. +fi + +if as_func_failure; then + exitcode=1 + echo as_func_failure succeeded. +fi + +if as_func_ret_success; then + : +else + exitcode=1 + echo as_func_ret_success failed. +fi + +if as_func_ret_failure; then + exitcode=1 + echo as_func_ret_failure succeeded. +fi + +if ( set x; as_func_ret_success y && test x = "$1" ); then + : +else + exitcode=1 + echo positional parameters were not saved. +fi + +test $exitcode = 0) || { (exit 1); exit 1; } + +( + as_lineno_1=$LINENO + as_lineno_2=$LINENO + test "x$as_lineno_1" != "x$as_lineno_2" && + test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2") || { (exit 1); exit 1; } + +_ASEOF +}; then + break +fi + +fi + + done + + if test "x$CONFIG_SHELL" != x; then + for as_var in BASH_ENV ENV + do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var + done + export CONFIG_SHELL + exec "$CONFIG_SHELL" "$as_myself" ${1+"$@"} +fi + + + if test $as_have_required = no; then + echo This script requires a shell more modern than all the + echo shells that I found on your system. Please install a + echo modern shell, or manually run the script under such a + echo shell if you do have one. + { (exit 1); exit 1; } +fi + + +fi + +fi + + + +(eval "as_func_return () { + (exit \$1) +} +as_func_success () { + as_func_return 0 +} +as_func_failure () { + as_func_return 1 +} +as_func_ret_success () { + return 0 +} +as_func_ret_failure () { + return 1 +} + +exitcode=0 +if as_func_success; then + : +else + exitcode=1 + echo as_func_success failed. +fi + +if as_func_failure; then + exitcode=1 + echo as_func_failure succeeded. +fi + +if as_func_ret_success; then + : +else + exitcode=1 + echo as_func_ret_success failed. +fi + +if as_func_ret_failure; then + exitcode=1 + echo as_func_ret_failure succeeded. +fi + +if ( set x; as_func_ret_success y && test x = \"\$1\" ); then + : +else + exitcode=1 + echo positional parameters were not saved. +fi + +test \$exitcode = 0") || { + echo No shell found that supports shell functions. + echo Please tell autoconf at gnu.org about your system, + echo including any error possibly output before this + echo message +} + + + + as_lineno_1=$LINENO + as_lineno_2=$LINENO + test "x$as_lineno_1" != "x$as_lineno_2" && + test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2" || { + + # Create $as_me.lineno as a copy of $as_myself, but with $LINENO + # uniformly replaced by the line number. The first 'sed' inserts a + # line-number line after each line using $LINENO; the second 'sed' + # does the real work. The second script uses 'N' to pair each + # line-number line with the line containing $LINENO, and appends + # trailing '-' during substitution so that $LINENO is not a special + # case at line end. + # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the + # scripts with optimization help from Paolo Bonzini. Blame Lee + # E. McMahon (1931-1989) for sed's syntax. :-) + sed -n ' + p + /[$]LINENO/= + ' <$as_myself | + sed ' + s/[$]LINENO.*/&-/ + t lineno + b + :lineno + N + :loop + s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ + t loop + s/-\n.*// + ' >$as_me.lineno && + chmod +x "$as_me.lineno" || + { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2 + { (exit 1); exit 1; }; } + + # Don't try to exec as it changes $[0], causing all sort of problems + # (the dirname of $[0] is not the place where we might find the + # original and so on. Autoconf is especially sensitive to this). + . "./$as_me.lineno" + # Exit status is that of the last command. + exit +} + + +if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then + as_dirname=dirname +else + as_dirname=false +fi + +ECHO_C= ECHO_N= ECHO_T= +case `echo -n x` in +-n*) + case `echo 'x\c'` in + *c*) ECHO_T=' ';; # ECHO_T is single tab character. + *) ECHO_C='\c';; + esac;; +*) + ECHO_N='-n';; +esac + +if expr a : '\(a\)' >/dev/null 2>&1 && + test "X`expr 00001 : '.*\(...\)'`" = X001; then + as_expr=expr +else + as_expr=false +fi + +rm -f conf$$ conf$$.exe conf$$.file +if test -d conf$$.dir; then + rm -f conf$$.dir/conf$$.file +else + rm -f conf$$.dir + mkdir conf$$.dir +fi +echo >conf$$.file +if ln -s conf$$.file conf$$ 2>/dev/null; then + as_ln_s='ln -s' + # ... but there are two gotchas: + # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. + # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. + # In both cases, we have to default to `cp -p'. + ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || + as_ln_s='cp -p' +elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln +else + as_ln_s='cp -p' +fi +rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file +rmdir conf$$.dir 2>/dev/null + +if mkdir -p . 2>/dev/null; then + as_mkdir_p=: +else + test -d ./-p && rmdir ./-p + as_mkdir_p=false +fi + +if test -x / >/dev/null 2>&1; then + as_test_x='test -x' +else + if ls -dL / >/dev/null 2>&1; then + as_ls_L_option=L + else + as_ls_L_option= + fi + as_test_x=' + eval sh -c '\'' + if test -d "$1"; then + test -d "$1/."; + else + case $1 in + -*)set "./$1";; + esac; + case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in + ???[sx]*):;;*)false;;esac;fi + '\'' sh + ' +fi +as_executable_p=$as_test_x + +# Sed expression to map a string onto a valid CPP name. +as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" + +# Sed expression to map a string onto a valid variable name. +as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" + + + +exec 7<&0 &1 + +# Name of the host. +# hostname on some systems (SVR3.2, Linux) returns a bogus exit status, +# so uname gets run too. +ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` + +# +# Initializations. +# +ac_default_prefix=/usr/local +ac_clean_files= +ac_config_libobj_dir=. +LIBOBJS= +cross_compiling=no +subdirs= +MFLAGS= +MAKEFLAGS= +SHELL=${CONFIG_SHELL-/bin/sh} + +# Identity of this package. +PACKAGE_NAME='vmkit' +PACKAGE_TARNAME='vmkit' +PACKAGE_VERSION='0.0.1' +PACKAGE_STRING='vmkit 0.0.1' +PACKAGE_BUGREPORT='nicolas.geoffray at lip6.fr' + +ac_unique_file="lib/Mvm/Object.cpp" +# Factoring default headers for most tests. +ac_includes_default="\ +#include +#ifdef HAVE_SYS_TYPES_H +# include +#endif +#ifdef HAVE_SYS_STAT_H +# include +#endif +#ifdef STDC_HEADERS +# include +# include +#else +# ifdef HAVE_STDLIB_H +# include +# endif +#endif +#ifdef HAVE_STRING_H +# if !defined STDC_HEADERS && defined HAVE_MEMORY_H +# include +# endif +# include +#endif +#ifdef HAVE_STRINGS_H +# include +#endif +#ifdef HAVE_INTTYPES_H +# include +#endif +#ifdef HAVE_STDINT_H +# include +#endif +#ifdef HAVE_UNISTD_H +# include +#endif" + +ac_unique_file=""Makefile.common.in"" +ac_subst_vars='SHELL +PATH_SEPARATOR +PACKAGE_NAME +PACKAGE_TARNAME +PACKAGE_VERSION +PACKAGE_STRING +PACKAGE_BUGREPORT +exec_prefix +prefix +program_transform_name +bindir +sbindir +libexecdir +datarootdir +datadir +sysconfdir +sharedstatedir +localstatedir +includedir +oldincludedir +docdir +infodir +htmldir +dvidir +pdfdir +psdir +libdir +localedir +mandir +DEFS +ECHO_C +ECHO_N +ECHO_T +LIBS +build_alias +host_alias +target_alias +VMKIT_COPYRIGHT +LLVM_SRC +LLVM_OBJ +build +build_cpu +build_vendor +build_os +host +host_cpu +host_vendor +host_os +target +target_cpu +target_vendor +target_os +DYLIB_EXTENSION +CC +CFLAGS +LDFLAGS +CPPFLAGS +ac_ct_CC +EXEEXT +OBJEXT +CPP +GREP +EGREP +GC_MMAP2 +GC_BOEHM +GC_MULTI_MMAP +GC_SINGLE_MMAP +GC_FLAGS +GC_LIBS +SERVICE_BUILD_TRUE +SERVICE_BUILD_FALSE +ISOLATE_BUILD_TRUE +ISOLATE_BUILD_FALSE +classpathglibj +classpathlibs +classpathinclude +gnuclasspathversion +WITH_N3_TRUE +WITH_N3_FALSE +pnetlocalprefix +CXX +CXXFLAGS +ac_ct_CXX +NM +LN_S +CMP +CP +DATE +FIND +MKDIR +MV +RANLIB +RM +SED +TAR +BINPWD +CAT +LLVMAS +LLC +INSTALL_PROGRAM +INSTALL_SCRIPT +INSTALL_DATA +LLVMGCC +LLVMGXX +LIBOBJS +LTLIBOBJS' +ac_subst_files='' + ac_precious_vars='build_alias +host_alias +target_alias +CC +CFLAGS +LDFLAGS +LIBS +CPPFLAGS +CPP +CXX +CXXFLAGS +CCC' + + +# Initialize some variables set by options. +ac_init_help= +ac_init_version=false +# The variables have the same names as the options, with +# dashes changed to underlines. +cache_file=/dev/null +exec_prefix=NONE +no_create= +no_recursion= +prefix=NONE +program_prefix=NONE +program_suffix=NONE +program_transform_name=s,x,x, +silent= +site= +srcdir= +verbose= +x_includes=NONE +x_libraries=NONE + +# Installation directory options. +# These are left unexpanded so users can "make install exec_prefix=/foo" +# and all the variables that are supposed to be based on exec_prefix +# by default will actually change. +# Use braces instead of parens because sh, perl, etc. also accept them. +# (The list follows the same order as the GNU Coding Standards.) +bindir='${exec_prefix}/bin' +sbindir='${exec_prefix}/sbin' +libexecdir='${exec_prefix}/libexec' +datarootdir='${prefix}/share' +datadir='${datarootdir}' +sysconfdir='${prefix}/etc' +sharedstatedir='${prefix}/com' +localstatedir='${prefix}/var' +includedir='${prefix}/include' +oldincludedir='/usr/include' +docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' +infodir='${datarootdir}/info' +htmldir='${docdir}' +dvidir='${docdir}' +pdfdir='${docdir}' +psdir='${docdir}' +libdir='${exec_prefix}/lib' +localedir='${datarootdir}/locale' +mandir='${datarootdir}/man' + +ac_prev= +ac_dashdash= +for ac_option +do + # If the previous option needs an argument, assign it. + if test -n "$ac_prev"; then + eval $ac_prev=\$ac_option + ac_prev= + continue + fi + + case $ac_option in + *=*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; + *) ac_optarg=yes ;; + esac + + # Accept the important Cygnus configure options, so we can diagnose typos. + + case $ac_dashdash$ac_option in + --) + ac_dashdash=yes ;; + + -bindir | --bindir | --bindi | --bind | --bin | --bi) + ac_prev=bindir ;; + -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) + bindir=$ac_optarg ;; + + -build | --build | --buil | --bui | --bu) + ac_prev=build_alias ;; + -build=* | --build=* | --buil=* | --bui=* | --bu=*) + build_alias=$ac_optarg ;; + + -cache-file | --cache-file | --cache-fil | --cache-fi \ + | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) + ac_prev=cache_file ;; + -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ + | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) + cache_file=$ac_optarg ;; + + --config-cache | -C) + cache_file=config.cache ;; + + -datadir | --datadir | --datadi | --datad) + ac_prev=datadir ;; + -datadir=* | --datadir=* | --datadi=* | --datad=*) + datadir=$ac_optarg ;; + + -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \ + | --dataroo | --dataro | --datar) + ac_prev=datarootdir ;; + -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \ + | --dataroot=* | --dataroo=* | --dataro=* | --datar=*) + datarootdir=$ac_optarg ;; + + -disable-* | --disable-*) + ac_feature=`expr "x$ac_option" : 'x-*disable-\(.*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_feature" : ".*[^-._$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid feature name: $ac_feature" >&2 + { (exit 1); exit 1; }; } + ac_feature=`echo $ac_feature | sed 's/[-.]/_/g'` + eval enable_$ac_feature=no ;; + + -docdir | --docdir | --docdi | --doc | --do) + ac_prev=docdir ;; + -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*) + docdir=$ac_optarg ;; + + -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv) + ac_prev=dvidir ;; + -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*) + dvidir=$ac_optarg ;; + + -enable-* | --enable-*) + ac_feature=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_feature" : ".*[^-._$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid feature name: $ac_feature" >&2 + { (exit 1); exit 1; }; } + ac_feature=`echo $ac_feature | sed 's/[-.]/_/g'` + eval enable_$ac_feature=\$ac_optarg ;; + + -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ + | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ + | --exec | --exe | --ex) + ac_prev=exec_prefix ;; + -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ + | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ + | --exec=* | --exe=* | --ex=*) + exec_prefix=$ac_optarg ;; + + -gas | --gas | --ga | --g) + # Obsolete; use --with-gas. + with_gas=yes ;; + + -help | --help | --hel | --he | -h) + ac_init_help=long ;; + -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) + ac_init_help=recursive ;; + -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) + ac_init_help=short ;; + + -host | --host | --hos | --ho) + ac_prev=host_alias ;; + -host=* | --host=* | --hos=* | --ho=*) + host_alias=$ac_optarg ;; + + -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht) + ac_prev=htmldir ;; + -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \ + | --ht=*) + htmldir=$ac_optarg ;; + + -includedir | --includedir | --includedi | --included | --include \ + | --includ | --inclu | --incl | --inc) + ac_prev=includedir ;; + -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ + | --includ=* | --inclu=* | --incl=* | --inc=*) + includedir=$ac_optarg ;; + + -infodir | --infodir | --infodi | --infod | --info | --inf) + ac_prev=infodir ;; + -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) + infodir=$ac_optarg ;; + + -libdir | --libdir | --libdi | --libd) + ac_prev=libdir ;; + -libdir=* | --libdir=* | --libdi=* | --libd=*) + libdir=$ac_optarg ;; + + -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ + | --libexe | --libex | --libe) + ac_prev=libexecdir ;; + -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ + | --libexe=* | --libex=* | --libe=*) + libexecdir=$ac_optarg ;; + + -localedir | --localedir | --localedi | --localed | --locale) + ac_prev=localedir ;; + -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*) + localedir=$ac_optarg ;; + + -localstatedir | --localstatedir | --localstatedi | --localstated \ + | --localstate | --localstat | --localsta | --localst | --locals) + ac_prev=localstatedir ;; + -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ + | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*) + localstatedir=$ac_optarg ;; + + -mandir | --mandir | --mandi | --mand | --man | --ma | --m) + ac_prev=mandir ;; + -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) + mandir=$ac_optarg ;; + + -nfp | --nfp | --nf) + # Obsolete; use --without-fp. + with_fp=no ;; + + -no-create | --no-create | --no-creat | --no-crea | --no-cre \ + | --no-cr | --no-c | -n) + no_create=yes ;; + + -no-recursion | --no-recursion | --no-recursio | --no-recursi \ + | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) + no_recursion=yes ;; + + -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ + | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ + | --oldin | --oldi | --old | --ol | --o) + ac_prev=oldincludedir ;; + -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ + | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ + | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) + oldincludedir=$ac_optarg ;; + + -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) + ac_prev=prefix ;; + -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) + prefix=$ac_optarg ;; + + -program-prefix | --program-prefix | --program-prefi | --program-pref \ + | --program-pre | --program-pr | --program-p) + ac_prev=program_prefix ;; + -program-prefix=* | --program-prefix=* | --program-prefi=* \ + | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) + program_prefix=$ac_optarg ;; + + -program-suffix | --program-suffix | --program-suffi | --program-suff \ + | --program-suf | --program-su | --program-s) + ac_prev=program_suffix ;; + -program-suffix=* | --program-suffix=* | --program-suffi=* \ + | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) + program_suffix=$ac_optarg ;; + + -program-transform-name | --program-transform-name \ + | --program-transform-nam | --program-transform-na \ + | --program-transform-n | --program-transform- \ + | --program-transform | --program-transfor \ + | --program-transfo | --program-transf \ + | --program-trans | --program-tran \ + | --progr-tra | --program-tr | --program-t) + ac_prev=program_transform_name ;; + -program-transform-name=* | --program-transform-name=* \ + | --program-transform-nam=* | --program-transform-na=* \ + | --program-transform-n=* | --program-transform-=* \ + | --program-transform=* | --program-transfor=* \ + | --program-transfo=* | --program-transf=* \ + | --program-trans=* | --program-tran=* \ + | --progr-tra=* | --program-tr=* | --program-t=*) + program_transform_name=$ac_optarg ;; + + -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd) + ac_prev=pdfdir ;; + -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*) + pdfdir=$ac_optarg ;; + + -psdir | --psdir | --psdi | --psd | --ps) + ac_prev=psdir ;; + -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*) + psdir=$ac_optarg ;; + + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil) + silent=yes ;; + + -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) + ac_prev=sbindir ;; + -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ + | --sbi=* | --sb=*) + sbindir=$ac_optarg ;; + + -sharedstatedir | --sharedstatedir | --sharedstatedi \ + | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ + | --sharedst | --shareds | --shared | --share | --shar \ + | --sha | --sh) + ac_prev=sharedstatedir ;; + -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ + | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ + | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ + | --sha=* | --sh=*) + sharedstatedir=$ac_optarg ;; + + -site | --site | --sit) + ac_prev=site ;; + -site=* | --site=* | --sit=*) + site=$ac_optarg ;; + + -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) + ac_prev=srcdir ;; + -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) + srcdir=$ac_optarg ;; + + -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ + | --syscon | --sysco | --sysc | --sys | --sy) + ac_prev=sysconfdir ;; + -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ + | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) + sysconfdir=$ac_optarg ;; + + -target | --target | --targe | --targ | --tar | --ta | --t) + ac_prev=target_alias ;; + -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) + target_alias=$ac_optarg ;; + + -v | -verbose | --verbose | --verbos | --verbo | --verb) + verbose=yes ;; + + -version | --version | --versio | --versi | --vers | -V) + ac_init_version=: ;; + + -with-* | --with-*) + ac_package=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_package" : ".*[^-._$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid package name: $ac_package" >&2 + { (exit 1); exit 1; }; } + ac_package=`echo $ac_package | sed 's/[-.]/_/g'` + eval with_$ac_package=\$ac_optarg ;; + + -without-* | --without-*) + ac_package=`expr "x$ac_option" : 'x-*without-\(.*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_package" : ".*[^-._$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid package name: $ac_package" >&2 + { (exit 1); exit 1; }; } + ac_package=`echo $ac_package | sed 's/[-.]/_/g'` + eval with_$ac_package=no ;; + + --x) + # Obsolete; use --with-x. + with_x=yes ;; + + -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ + | --x-incl | --x-inc | --x-in | --x-i) + ac_prev=x_includes ;; + -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ + | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) + x_includes=$ac_optarg ;; + + -x-libraries | --x-libraries | --x-librarie | --x-librari \ + | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) + ac_prev=x_libraries ;; + -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ + | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) + x_libraries=$ac_optarg ;; + + -*) { echo "$as_me: error: unrecognized option: $ac_option +Try \`$0 --help' for more information." >&2 + { (exit 1); exit 1; }; } + ;; + + *=*) + ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` + # Reject names that are not valid shell variable names. + expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid variable name: $ac_envvar" >&2 + { (exit 1); exit 1; }; } + eval $ac_envvar=\$ac_optarg + export $ac_envvar ;; + + *) + # FIXME: should be removed in autoconf 3.0. + echo "$as_me: WARNING: you should use --build, --host, --target" >&2 + expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && + echo "$as_me: WARNING: invalid host type: $ac_option" >&2 + : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option} + ;; + + esac +done + +if test -n "$ac_prev"; then + ac_option=--`echo $ac_prev | sed 's/_/-/g'` + { echo "$as_me: error: missing argument to $ac_option" >&2 + { (exit 1); exit 1; }; } +fi + +# Be sure to have absolute directory names. +for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ + datadir sysconfdir sharedstatedir localstatedir includedir \ + oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ + libdir localedir mandir +do + eval ac_val=\$$ac_var + case $ac_val in + [\\/$]* | ?:[\\/]* ) continue;; + NONE | '' ) case $ac_var in *prefix ) continue;; esac;; + esac + { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 + { (exit 1); exit 1; }; } +done + +# There might be people who depend on the old broken behavior: `$host' +# used to hold the argument of --host etc. +# FIXME: To remove some day. +build=$build_alias +host=$host_alias +target=$target_alias + +# FIXME: To remove some day. +if test "x$host_alias" != x; then + if test "x$build_alias" = x; then + cross_compiling=maybe + echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host. + If a cross compiler is detected then cross compile mode will be used." >&2 + elif test "x$build_alias" != "x$host_alias"; then + cross_compiling=yes + fi +fi + +ac_tool_prefix= +test -n "$host_alias" && ac_tool_prefix=$host_alias- + +test "$silent" = yes && exec 6>/dev/null + + +ac_pwd=`pwd` && test -n "$ac_pwd" && +ac_ls_di=`ls -di .` && +ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` || + { echo "$as_me: error: Working directory cannot be determined" >&2 + { (exit 1); exit 1; }; } +test "X$ac_ls_di" = "X$ac_pwd_ls_di" || + { echo "$as_me: error: pwd does not report name of working directory" >&2 + { (exit 1); exit 1; }; } + + +# Find the source files, if location was not specified. +if test -z "$srcdir"; then + ac_srcdir_defaulted=yes + # Try the directory containing this script, then the parent directory. + ac_confdir=`$as_dirname -- "$0" || +$as_expr X"$0" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$0" : 'X\(//\)[^/]' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)' \| . 2>/dev/null || +echo X"$0" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + srcdir=$ac_confdir + if test ! -r "$srcdir/$ac_unique_file"; then + srcdir=.. + fi +else + ac_srcdir_defaulted=no +fi +if test ! -r "$srcdir/$ac_unique_file"; then + test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .." + { echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2 + { (exit 1); exit 1; }; } +fi +ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work" +ac_abs_confdir=`( + cd "$srcdir" && test -r "./$ac_unique_file" || { echo "$as_me: error: $ac_msg" >&2 + { (exit 1); exit 1; }; } + pwd)` +# When building in place, set srcdir=. +if test "$ac_abs_confdir" = "$ac_pwd"; then + srcdir=. +fi +# Remove unnecessary trailing slashes from srcdir. +# Double slashes in file names in object file debugging info +# mess up M-x gdb in Emacs. +case $srcdir in +*/) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;; +esac +for ac_var in $ac_precious_vars; do + eval ac_env_${ac_var}_set=\${${ac_var}+set} + eval ac_env_${ac_var}_value=\$${ac_var} + eval ac_cv_env_${ac_var}_set=\${${ac_var}+set} + eval ac_cv_env_${ac_var}_value=\$${ac_var} +done + +# +# Report the --help message. +# +if test "$ac_init_help" = "long"; then + # Omit some internal or obsolete options to make the list less imposing. + # This message is too long to be a string in the A/UX 3.1 sh. + cat <<_ACEOF +\`configure' configures vmkit 0.0.1 to adapt to many kinds of systems. + +Usage: $0 [OPTION]... [VAR=VALUE]... + +To assign environment variables (e.g., CC, CFLAGS...), specify them as +VAR=VALUE. See below for descriptions of some of the useful variables. + +Defaults for the options are specified in brackets. + +Configuration: + -h, --help display this help and exit + --help=short display options specific to this package + --help=recursive display the short help of all the included packages + -V, --version display version information and exit + -q, --quiet, --silent do not print \`checking...' messages + --cache-file=FILE cache test results in FILE [disabled] + -C, --config-cache alias for \`--cache-file=config.cache' + -n, --no-create do not create output files + --srcdir=DIR find the sources in DIR [configure dir or \`..'] + +Installation directories: + --prefix=PREFIX install architecture-independent files in PREFIX + [$ac_default_prefix] + --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX + [PREFIX] + +By default, \`make install' will install all the files in +\`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify +an installation prefix other than \`$ac_default_prefix' using \`--prefix', +for instance \`--prefix=\$HOME'. + +For better control, use the options below. + +Fine tuning of the installation directories: + --bindir=DIR user executables [EPREFIX/bin] + --sbindir=DIR system admin executables [EPREFIX/sbin] + --libexecdir=DIR program executables [EPREFIX/libexec] + --sysconfdir=DIR read-only single-machine data [PREFIX/etc] + --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] + --localstatedir=DIR modifiable single-machine data [PREFIX/var] + --libdir=DIR object code libraries [EPREFIX/lib] + --includedir=DIR C header files [PREFIX/include] + --oldincludedir=DIR C header files for non-gcc [/usr/include] + --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] + --datadir=DIR read-only architecture-independent data [DATAROOTDIR] + --infodir=DIR info documentation [DATAROOTDIR/info] + --localedir=DIR locale-dependent data [DATAROOTDIR/locale] + --mandir=DIR man documentation [DATAROOTDIR/man] + --docdir=DIR documentation root [DATAROOTDIR/doc/vmkit] + --htmldir=DIR html documentation [DOCDIR] + --dvidir=DIR dvi documentation [DOCDIR] + --pdfdir=DIR pdf documentation [DOCDIR] + --psdir=DIR ps documentation [DOCDIR] +_ACEOF + + cat <<\_ACEOF + +System types: + --build=BUILD configure for building on BUILD [guessed] + --host=HOST cross-compile to build programs to run on HOST [BUILD] + --target=TARGET configure for building compilers for TARGET [HOST] +_ACEOF +fi + +if test -n "$ac_init_help"; then + case $ac_init_help in + short | recursive ) echo "Configuration of vmkit 0.0.1:";; + esac + cat <<\_ACEOF + +Optional Packages: + --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] + --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) + --with-llvmsrc Location of LLVM Source Code + --with-llvmobj Location of LLVM Object Code + --with-thread=something Thread type ('common' or 'no') + --with-gc=something GC type ('single-mmap' 'multi-mmap' or 'boehm') + --with-vm-type=something + VM type ('single' 'multi' or 'service') + --with-gnu-classpath-local-prefix=something + GNU CLASSPATH local prefix (no default) + --with-gnu-classpath-installation-prefix=something + GNU CLASSPATH installation prefix (default is + '/usr/local/classpath') + --with-pnet-local-prefix=something + PNET local prefix (no default) + +Some influential environment variables: + CC C compiler command + CFLAGS C compiler flags + LDFLAGS linker flags, e.g. -L if you have libraries in a + nonstandard directory + LIBS libraries to pass to the linker, e.g. -l + CPPFLAGS C/C++/Objective C preprocessor flags, e.g. -I if + you have headers in a nonstandard directory + CPP C preprocessor + CXX C++ compiler command + CXXFLAGS C++ compiler flags + +Use these variables to override the choices made by `configure' or to help +it to find libraries and programs with nonstandard names/locations. + +Report bugs to . +_ACEOF +ac_status=$? +fi + +if test "$ac_init_help" = "recursive"; then + # If there are subdirs, report their specific --help. + for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue + test -d "$ac_dir" || continue + ac_builddir=. + +case "$ac_dir" in +.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; +*) + ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` + # A ".." for each directory in $ac_dir_suffix. + ac_top_builddir_sub=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,/..,g;s,/,,'` + case $ac_top_builddir_sub in + "") ac_top_builddir_sub=. ac_top_build_prefix= ;; + *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; + esac ;; +esac +ac_abs_top_builddir=$ac_pwd +ac_abs_builddir=$ac_pwd$ac_dir_suffix +# for backward compatibility: +ac_top_builddir=$ac_top_build_prefix + +case $srcdir in + .) # We are building in place. + ac_srcdir=. + ac_top_srcdir=$ac_top_builddir_sub + ac_abs_top_srcdir=$ac_pwd ;; + [\\/]* | ?:[\\/]* ) # Absolute name. + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir + ac_abs_top_srcdir=$srcdir ;; + *) # Relative name. + ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_build_prefix$srcdir + ac_abs_top_srcdir=$ac_pwd/$srcdir ;; +esac +ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix + + cd "$ac_dir" || { ac_status=$?; continue; } + # Check for guested configure. + if test -f "$ac_srcdir/configure.gnu"; then + echo && + $SHELL "$ac_srcdir/configure.gnu" --help=recursive + elif test -f "$ac_srcdir/configure"; then + echo && + $SHELL "$ac_srcdir/configure" --help=recursive + else + echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 + fi || ac_status=$? + cd "$ac_pwd" || { ac_status=$?; break; } + done +fi + +test -n "$ac_init_help" && exit $ac_status +if $ac_init_version; then + cat <<\_ACEOF +vmkit configure 0.0.1 +generated by GNU Autoconf 2.61 + +Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, +2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. +This configure script is free software; the Free Software Foundation +gives unlimited permission to copy, distribute and modify it. + +Copyright (c) 2003-2008 Universite Pierre et Marie Curie. +_ACEOF + exit +fi +cat >config.log <<_ACEOF +This file contains any messages produced by compilers while +running configure, to aid debugging if configure makes a mistake. + +It was created by vmkit $as_me 0.0.1, which was +generated by GNU Autoconf 2.61. Invocation command line was + + $ $0 $@ + +_ACEOF +exec 5>>config.log +{ +cat <<_ASUNAME +## --------- ## +## Platform. ## +## --------- ## + +hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` +uname -m = `(uname -m) 2>/dev/null || echo unknown` +uname -r = `(uname -r) 2>/dev/null || echo unknown` +uname -s = `(uname -s) 2>/dev/null || echo unknown` +uname -v = `(uname -v) 2>/dev/null || echo unknown` + +/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` +/bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` + +/bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` +/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` +/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` +/usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown` +/bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` +/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` +/bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` + +_ASUNAME + +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + echo "PATH: $as_dir" +done +IFS=$as_save_IFS + +} >&5 + +cat >&5 <<_ACEOF + + +## ----------- ## +## Core tests. ## +## ----------- ## + +_ACEOF + + +# Keep a trace of the command line. +# Strip out --no-create and --no-recursion so they do not pile up. +# Strip out --silent because we don't want to record it for future runs. +# Also quote any args containing shell meta-characters. +# Make two passes to allow for proper duplicate-argument suppression. +ac_configure_args= +ac_configure_args0= +ac_configure_args1= +ac_must_keep_next=false +for ac_pass in 1 2 +do + for ac_arg + do + case $ac_arg in + -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil) + continue ;; + *\'*) + ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; + esac + case $ac_pass in + 1) ac_configure_args0="$ac_configure_args0 '$ac_arg'" ;; + 2) + ac_configure_args1="$ac_configure_args1 '$ac_arg'" + if test $ac_must_keep_next = true; then + ac_must_keep_next=false # Got value, back to normal. + else + case $ac_arg in + *=* | --config-cache | -C | -disable-* | --disable-* \ + | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ + | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ + | -with-* | --with-* | -without-* | --without-* | --x) + case "$ac_configure_args0 " in + "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; + esac + ;; + -* ) ac_must_keep_next=true ;; + esac + fi + ac_configure_args="$ac_configure_args '$ac_arg'" + ;; + esac + done +done +$as_unset ac_configure_args0 || test "${ac_configure_args0+set}" != set || { ac_configure_args0=; export ac_configure_args0; } +$as_unset ac_configure_args1 || test "${ac_configure_args1+set}" != set || { ac_configure_args1=; export ac_configure_args1; } + +# When interrupted or exit'd, cleanup temporary files, and complete +# config.log. We remove comments because anyway the quotes in there +# would cause problems or look ugly. +# WARNING: Use '\'' to represent an apostrophe within the trap. +# WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug. +trap 'exit_status=$? + # Save into config.log some information that might help in debugging. + { + echo + + cat <<\_ASBOX +## ---------------- ## +## Cache variables. ## +## ---------------- ## +_ASBOX + echo + # The following way of writing the cache mishandles newlines in values, +( + for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do + eval ac_val=\$$ac_var + case $ac_val in #( + *${as_nl}*) + case $ac_var in #( + *_cv_*) { echo "$as_me:$LINENO: WARNING: Cache variable $ac_var contains a newline." >&5 +echo "$as_me: WARNING: Cache variable $ac_var contains a newline." >&2;} ;; + esac + case $ac_var in #( + _ | IFS | as_nl) ;; #( + *) $as_unset $ac_var ;; + esac ;; + esac + done + (set) 2>&1 | + case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #( + *${as_nl}ac_space=\ *) + sed -n \ + "s/'\''/'\''\\\\'\'''\''/g; + s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p" + ;; #( + *) + sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" + ;; + esac | + sort +) + echo + + cat <<\_ASBOX +## ----------------- ## +## Output variables. ## +## ----------------- ## +_ASBOX + echo + for ac_var in $ac_subst_vars + do + eval ac_val=\$$ac_var + case $ac_val in + *\'\''*) ac_val=`echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; + esac + echo "$ac_var='\''$ac_val'\''" + done | sort + echo + + if test -n "$ac_subst_files"; then + cat <<\_ASBOX +## ------------------- ## +## File substitutions. ## +## ------------------- ## +_ASBOX + echo + for ac_var in $ac_subst_files + do + eval ac_val=\$$ac_var + case $ac_val in + *\'\''*) ac_val=`echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; + esac + echo "$ac_var='\''$ac_val'\''" + done | sort + echo + fi + + if test -s confdefs.h; then + cat <<\_ASBOX +## ----------- ## +## confdefs.h. ## +## ----------- ## +_ASBOX + echo + cat confdefs.h + echo + fi + test "$ac_signal" != 0 && + echo "$as_me: caught signal $ac_signal" + echo "$as_me: exit $exit_status" + } >&5 + rm -f core *.core core.conftest.* && + rm -f -r conftest* confdefs* conf$$* $ac_clean_files && + exit $exit_status +' 0 +for ac_signal in 1 2 13 15; do + trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal +done +ac_signal=0 + +# confdefs.h avoids OS command line length limits that DEFS can exceed. +rm -f -r conftest* confdefs.h + +# Predefined preprocessor variables. + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_NAME "$PACKAGE_NAME" +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_TARNAME "$PACKAGE_TARNAME" +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_VERSION "$PACKAGE_VERSION" +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_STRING "$PACKAGE_STRING" +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" +_ACEOF + + +# Let the site file select an alternate cache file if it wants to. +# Prefer explicitly selected file to automatically selected ones. +if test -n "$CONFIG_SITE"; then + set x "$CONFIG_SITE" +elif test "x$prefix" != xNONE; then + set x "$prefix/share/config.site" "$prefix/etc/config.site" +else + set x "$ac_default_prefix/share/config.site" \ + "$ac_default_prefix/etc/config.site" +fi +shift +for ac_site_file +do + if test -r "$ac_site_file"; then + { echo "$as_me:$LINENO: loading site script $ac_site_file" >&5 +echo "$as_me: loading site script $ac_site_file" >&6;} + sed 's/^/| /' "$ac_site_file" >&5 + . "$ac_site_file" + fi +done + +if test -r "$cache_file"; then + # Some versions of bash will fail to source /dev/null (special + # files actually), so we avoid doing that. + if test -f "$cache_file"; then + { echo "$as_me:$LINENO: loading cache $cache_file" >&5 +echo "$as_me: loading cache $cache_file" >&6;} + case $cache_file in + [\\/]* | ?:[\\/]* ) . "$cache_file";; + *) . "./$cache_file";; + esac + fi +else + { echo "$as_me:$LINENO: creating cache $cache_file" >&5 +echo "$as_me: creating cache $cache_file" >&6;} + >$cache_file +fi + +# Check that the precious variables saved in the cache have kept the same +# value. +ac_cache_corrupted=false +for ac_var in $ac_precious_vars; do + eval ac_old_set=\$ac_cv_env_${ac_var}_set + eval ac_new_set=\$ac_env_${ac_var}_set + eval ac_old_val=\$ac_cv_env_${ac_var}_value + eval ac_new_val=\$ac_env_${ac_var}_value + case $ac_old_set,$ac_new_set in + set,) + { echo "$as_me:$LINENO: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 +echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} + ac_cache_corrupted=: ;; + ,set) + { echo "$as_me:$LINENO: error: \`$ac_var' was not set in the previous run" >&5 +echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} + ac_cache_corrupted=: ;; + ,);; + *) + if test "x$ac_old_val" != "x$ac_new_val"; then + { echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5 +echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} + { echo "$as_me:$LINENO: former value: $ac_old_val" >&5 +echo "$as_me: former value: $ac_old_val" >&2;} + { echo "$as_me:$LINENO: current value: $ac_new_val" >&5 +echo "$as_me: current value: $ac_new_val" >&2;} + ac_cache_corrupted=: + fi;; + esac + # Pass precious variables to config.status. + if test "$ac_new_set" = set; then + case $ac_new_val in + *\'*) ac_arg=$ac_var=`echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; + *) ac_arg=$ac_var=$ac_new_val ;; + esac + case " $ac_configure_args " in + *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. + *) ac_configure_args="$ac_configure_args '$ac_arg'" ;; + esac + fi +done +if $ac_cache_corrupted; then + { echo "$as_me:$LINENO: error: changes in the environment can compromise the build" >&5 +echo "$as_me: error: changes in the environment can compromise the build" >&2;} + { { echo "$as_me:$LINENO: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5 +echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;} + { (exit 1); exit 1; }; } +fi + + + + + + + + + + + + + + + + + + + + + + + + + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + + +VMKIT_COPYRIGHT="Copyright (c) 2003-2008 Universite Pierre et Marie Curie." + + + + + + + + +if test ${srcdir} != "." ; then + if test -f ${srcdir}/include/mvm/Config/config.h ; then + { { echo "$as_me:$LINENO: error: Already configured in ${srcdir}" >&5 +echo "$as_me: error: Already configured in ${srcdir}" >&2;} + { (exit 1); exit 1; }; } + fi +fi + +ac_aux_dir= +for ac_dir in $LLVM_SRC_ROOT/autoconf "$srcdir"/$LLVM_SRC_ROOT/autoconf; do + if test -f "$ac_dir/install-sh"; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install-sh -c" + break + elif test -f "$ac_dir/install.sh"; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install.sh -c" + break + elif test -f "$ac_dir/shtool"; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/shtool install -c" + break + fi +done +if test -z "$ac_aux_dir"; then + { { echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in $LLVM_SRC_ROOT/autoconf \"$srcdir\"/$LLVM_SRC_ROOT/autoconf" >&5 +echo "$as_me: error: cannot find install-sh or install.sh in $LLVM_SRC_ROOT/autoconf \"$srcdir\"/$LLVM_SRC_ROOT/autoconf" >&2;} + { (exit 1); exit 1; }; } +fi + +# These three variables are undocumented and unsupported, +# and are intended to be withdrawn in a future Autoconf release. +# They can cause serious problems if a builder's source tree is in a directory +# whose full name contains unusual characters. +ac_config_guess="$SHELL $ac_aux_dir/config.guess" # Please don't use this var. +ac_config_sub="$SHELL $ac_aux_dir/config.sub" # Please don't use this var. +ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var. + + + + +# Check whether --with-llvmsrc was given. +if test "${with_llvmsrc+set}" = set; then + withval=$with_llvmsrc; llvm_src="$withval" +else + llvm_src="$LLVM_SRC_ROOT" +fi + + LLVM_SRC=$llvm_src + + +# Check whether --with-llvmobj was given. +if test "${with_llvmobj+set}" = set; then + withval=$with_llvmobj; llvm_obj="$withval" +else + llvm_obj="$LLVM_OBJ_ROOT" +fi + + LLVM_OBJ=$llvm_obj + + ac_config_commands="$ac_config_commands setup" + + + + + +# Make sure we can run config.sub. +$SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 || + { { echo "$as_me:$LINENO: error: cannot run $SHELL $ac_aux_dir/config.sub" >&5 +echo "$as_me: error: cannot run $SHELL $ac_aux_dir/config.sub" >&2;} + { (exit 1); exit 1; }; } + +{ echo "$as_me:$LINENO: checking build system type" >&5 +echo $ECHO_N "checking build system type... $ECHO_C" >&6; } +if test "${ac_cv_build+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_build_alias=$build_alias +test "x$ac_build_alias" = x && + ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"` +test "x$ac_build_alias" = x && + { { echo "$as_me:$LINENO: error: cannot guess build type; you must specify one" >&5 +echo "$as_me: error: cannot guess build type; you must specify one" >&2;} + { (exit 1); exit 1; }; } +ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` || + { { echo "$as_me:$LINENO: error: $SHELL $ac_aux_dir/config.sub $ac_build_alias failed" >&5 +echo "$as_me: error: $SHELL $ac_aux_dir/config.sub $ac_build_alias failed" >&2;} + { (exit 1); exit 1; }; } + +fi +{ echo "$as_me:$LINENO: result: $ac_cv_build" >&5 +echo "${ECHO_T}$ac_cv_build" >&6; } +case $ac_cv_build in +*-*-*) ;; +*) { { echo "$as_me:$LINENO: error: invalid value of canonical build" >&5 +echo "$as_me: error: invalid value of canonical build" >&2;} + { (exit 1); exit 1; }; };; +esac +build=$ac_cv_build +ac_save_IFS=$IFS; IFS='-' +set x $ac_cv_build +shift +build_cpu=$1 +build_vendor=$2 +shift; shift +# Remember, the first character of IFS is used to create $*, +# except with old shells: +build_os=$* +IFS=$ac_save_IFS +case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac + + +{ echo "$as_me:$LINENO: checking host system type" >&5 +echo $ECHO_N "checking host system type... $ECHO_C" >&6; } +if test "${ac_cv_host+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test "x$host_alias" = x; then + ac_cv_host=$ac_cv_build +else + ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` || + { { echo "$as_me:$LINENO: error: $SHELL $ac_aux_dir/config.sub $host_alias failed" >&5 +echo "$as_me: error: $SHELL $ac_aux_dir/config.sub $host_alias failed" >&2;} + { (exit 1); exit 1; }; } +fi + +fi +{ echo "$as_me:$LINENO: result: $ac_cv_host" >&5 +echo "${ECHO_T}$ac_cv_host" >&6; } +case $ac_cv_host in +*-*-*) ;; +*) { { echo "$as_me:$LINENO: error: invalid value of canonical host" >&5 +echo "$as_me: error: invalid value of canonical host" >&2;} + { (exit 1); exit 1; }; };; +esac +host=$ac_cv_host +ac_save_IFS=$IFS; IFS='-' +set x $ac_cv_host +shift +host_cpu=$1 +host_vendor=$2 +shift; shift +# Remember, the first character of IFS is used to create $*, +# except with old shells: +host_os=$* +IFS=$ac_save_IFS +case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac + + +{ echo "$as_me:$LINENO: checking target system type" >&5 +echo $ECHO_N "checking target system type... $ECHO_C" >&6; } +if test "${ac_cv_target+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test "x$target_alias" = x; then + ac_cv_target=$ac_cv_host +else + ac_cv_target=`$SHELL "$ac_aux_dir/config.sub" $target_alias` || + { { echo "$as_me:$LINENO: error: $SHELL $ac_aux_dir/config.sub $target_alias failed" >&5 +echo "$as_me: error: $SHELL $ac_aux_dir/config.sub $target_alias failed" >&2;} + { (exit 1); exit 1; }; } +fi + +fi +{ echo "$as_me:$LINENO: result: $ac_cv_target" >&5 +echo "${ECHO_T}$ac_cv_target" >&6; } +case $ac_cv_target in +*-*-*) ;; +*) { { echo "$as_me:$LINENO: error: invalid value of canonical target" >&5 +echo "$as_me: error: invalid value of canonical target" >&2;} + { (exit 1); exit 1; }; };; +esac +target=$ac_cv_target +ac_save_IFS=$IFS; IFS='-' +set x $ac_cv_target +shift +target_cpu=$1 +target_vendor=$2 +shift; shift +# Remember, the first character of IFS is used to create $*, +# except with old shells: +target_os=$* +IFS=$ac_save_IFS +case $target_os in *\ *) target_os=`echo "$target_os" | sed 's/ /-/g'`;; esac + + +# The aliases save the names the user supplied, while $host etc. +# will get canonicalized. +test -n "$target_alias" && + test "$program_prefix$program_suffix$program_transform_name" = \ + NONENONEs,x,x, && + program_prefix=${target_alias}- + +{ echo "$as_me:$LINENO: checking type of operating system we're going to host on" >&5 +echo $ECHO_N "checking type of operating system we're going to host on... $ECHO_C" >&6; } +if test "${vmkit_cv_os_type+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + case $host in + *-*-aix*) + { { echo "$as_me:$LINENO: error: Good luck porting vmkit to your host!" >&5 +echo "$as_me: error: Good luck porting vmkit to your host!" >&2;} + { (exit 1); exit 1; }; } + vmkit_cv_os_type="AIX" + vmkit_cv_platform_type="Unix" ;; + *-*-irix*) + { { echo "$as_me:$LINENO: error: Good luck porting vmkit to your host!" >&5 +echo "$as_me: error: Good luck porting vmkit to your host!" >&2;} + { (exit 1); exit 1; }; } + vmkit_cv_os_type="IRIX" + vmkit_cv_platform_type="Unix" ;; + *-*-cygwin*) + { { echo "$as_me:$LINENO: error: Good luck porting vmkit to your host!" >&5 +echo "$as_me: error: Good luck porting vmkit to your host!" >&2;} + { (exit 1); exit 1; }; } + vmkit_cv_os_type="Cygwin" + vmkit_cv_platform_type="Unix" ;; + *-*-darwin*) + DYLIB_EXTENSION="dylib" + vmkit_cv_os_type="Darwin" + vmkit_cv_platform_type="Unix" ;; + *-*-freebsd*) + { { echo "$as_me:$LINENO: error: Good luck porting vmkit to your host!" >&5 +echo "$as_me: error: Good luck porting vmkit to your host!" >&2;} + { (exit 1); exit 1; }; } + vmkit_cv_os_type="FreeBSD" + vmkit_cv_platform_type="Unix" ;; + *-*-openbsd*) + { { echo "$as_me:$LINENO: error: Good luck porting vmkit to your host!" >&5 +echo "$as_me: error: Good luck porting vmkit to your host!" >&2;} + { (exit 1); exit 1; }; } + vmkit_cv_os_type="OpenBSD" + vmkit_cv_platform_type="Unix" ;; + *-*-netbsd*) + { { echo "$as_me:$LINENO: error: Good luck porting vmkit to your host!" >&5 +echo "$as_me: error: Good luck porting vmkit to your host!" >&2;} + { (exit 1); exit 1; }; } + vmkit_cv_os_type="NetBSD" + vmkit_cv_platform_type="Unix" ;; + *-*-hpux*) + { { echo "$as_me:$LINENO: error: Good luck porting vmkit to your host!" >&5 +echo "$as_me: error: Good luck porting vmkit to your host!" >&2;} + { (exit 1); exit 1; }; } + vmkit_cv_os_type="HP-UX" + vmkit_cv_platform_type="Unix" ;; + *-*-interix*) + { { echo "$as_me:$LINENO: error: Good luck porting vmkit to your host!" >&5 +echo "$as_me: error: Good luck porting vmkit to your host!" >&2;} + { (exit 1); exit 1; }; } + vmkit_cv_os_type="Interix" + vmkit_cv_platform_type="Unix" ;; + *-*-linux*) + DYLIB_EXTENSION="so" + vmkit_cv_os_type="Linux" + vmkit_cv_platform_type="Unix" ;; + *-*-solaris*) + { { echo "$as_me:$LINENO: error: Good luck porting vmkit to your host!" >&5 +echo "$as_me: error: Good luck porting vmkit to your host!" >&2;} + { (exit 1); exit 1; }; } + vmkit_cv_os_type="SunOS" + vmkit_cv_platform_type="Unix" ;; + *-*-win32*) + { { echo "$as_me:$LINENO: error: Good luck porting vmkit to your host!" >&5 +echo "$as_me: error: Good luck porting vmkit to your host!" >&2;} + { (exit 1); exit 1; }; } + vmkit_cv_os_type="Win32" + vmkit_cv_platform_type="Win32" ;; + *-*-mingw*) + { { echo "$as_me:$LINENO: error: Good luck porting vmkit to your host!" >&5 +echo "$as_me: error: Good luck porting vmkit to your host!" >&2;} + { (exit 1); exit 1; }; } + vmkit_cv_os_type="MingW" + vmkit_cv_platform_type="Win32" ;; + *) + { { echo "$as_me:$LINENO: error: Good luck porting vmkit to your host!" >&5 +echo "$as_me: error: Good luck porting vmkit to your host!" >&2;} + { (exit 1); exit 1; }; } + vmkit_cv_os_type="Unknown" + vmkit_cv_platform_type="Unknown" ;; +esac +fi +{ echo "$as_me:$LINENO: result: $vmkit_cv_os_type" >&5 +echo "${ECHO_T}$vmkit_cv_os_type" >&6; } + + + + + + +# Check whether --with-thread was given. +if test "${with_thread+set}" = set; then + withval=$with_thread; thread=$withval +else + thread=common + +fi + + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. +set dummy ${ac_tool_prefix}gcc; ac_word=$2 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_CC="${ac_tool_prefix}gcc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_CC"; then + ac_ct_CC=$CC + # Extract the first word of "gcc", so it can be a program name with args. +set dummy gcc; ac_word=$2 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_prog_ac_ct_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_CC="gcc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + { echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 +echo "${ECHO_T}$ac_ct_CC" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + if test "x$ac_ct_CC" = x; then + CC="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools +whose name does not start with the host triplet. If you think this +configuration is useful to you, please write to autoconf at gnu.org." >&5 +echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools +whose name does not start with the host triplet. If you think this +configuration is useful to you, please write to autoconf at gnu.org." >&2;} +ac_tool_warned=yes ;; +esac + CC=$ac_ct_CC + fi +else + CC="$ac_cv_prog_CC" +fi + +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. +set dummy ${ac_tool_prefix}cc; ac_word=$2 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_CC="${ac_tool_prefix}cc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + + fi +fi +if test -z "$CC"; then + # Extract the first word of "cc", so it can be a program name with args. +set dummy cc; ac_word=$2 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + ac_prog_rejected=no +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then + ac_prog_rejected=yes + continue + fi + ac_cv_prog_CC="cc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + +if test $ac_prog_rejected = yes; then + # We found a bogon in the path, so make sure we never use it. + set dummy $ac_cv_prog_CC + shift + if test $# != 0; then + # We chose a different compiler from the bogus one. + # However, it has the same basename, so the bogon will be chosen + # first if we set CC to just the basename; use the full file name. + shift + ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" + fi +fi +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + +fi +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + for ac_prog in cl.exe + do + # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. +set dummy $ac_tool_prefix$ac_prog; ac_word=$2 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_CC="$ac_tool_prefix$ac_prog" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + + test -n "$CC" && break + done +fi +if test -z "$CC"; then + ac_ct_CC=$CC + for ac_prog in cl.exe +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_prog_ac_ct_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_CC="$ac_prog" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + { echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 +echo "${ECHO_T}$ac_ct_CC" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + + test -n "$ac_ct_CC" && break +done + + if test "x$ac_ct_CC" = x; then + CC="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools +whose name does not start with the host triplet. If you think this +configuration is useful to you, please write to autoconf at gnu.org." >&5 +echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools +whose name does not start with the host triplet. If you think this +configuration is useful to you, please write to autoconf at gnu.org." >&2;} +ac_tool_warned=yes ;; +esac + CC=$ac_ct_CC + fi +fi + +fi + + +test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH +See \`config.log' for more details." >&5 +echo "$as_me: error: no acceptable C compiler found in \$PATH +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } + +# Provide some information about the compiler. +echo "$as_me:$LINENO: checking for C compiler version" >&5 +ac_compiler=`set X $ac_compile; echo $2` +{ (ac_try="$ac_compiler --version >&5" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compiler --version >&5") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } +{ (ac_try="$ac_compiler -v >&5" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compiler -v >&5") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } +{ (ac_try="$ac_compiler -V >&5" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compiler -V >&5") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } + +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +ac_clean_files_save=$ac_clean_files +ac_clean_files="$ac_clean_files a.out a.exe b.out" +# Try to create an executable without -o first, disregard a.out. +# It will help us diagnose broken compilers, and finding out an intuition +# of exeext. +{ echo "$as_me:$LINENO: checking for C compiler default output file name" >&5 +echo $ECHO_N "checking for C compiler default output file name... $ECHO_C" >&6; } +ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` +# +# List of possible output files, starting from the most likely. +# The algorithm is not robust to junk in `.', hence go to wildcards (a.*) +# only as a last resort. b.out is created by i960 compilers. +ac_files='a_out.exe a.exe conftest.exe a.out conftest a.* conftest.* b.out' +# +# The IRIX 6 linker writes into existing files which may not be +# executable, retaining their permissions. Remove them first so a +# subsequent execution test works. +ac_rmfiles= +for ac_file in $ac_files +do + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.o | *.obj ) ;; + * ) ac_rmfiles="$ac_rmfiles $ac_file";; + esac +done +rm -f $ac_rmfiles + +if { (ac_try="$ac_link_default" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link_default") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + # Autoconf-2.13 could set the ac_cv_exeext variable to `no'. +# So ignore a value of `no', otherwise this would lead to `EXEEXT = no' +# in a Makefile. We should not override ac_cv_exeext if it was cached, +# so that the user can short-circuit this test for compilers unknown to +# Autoconf. +for ac_file in $ac_files '' +do + test -f "$ac_file" || continue + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.o | *.obj ) + ;; + [ab].out ) + # We found the default executable, but exeext='' is most + # certainly right. + break;; + *.* ) + if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no; + then :; else + ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` + fi + # We set ac_cv_exeext here because the later test for it is not + # safe: cross compilers may not add the suffix if given an `-o' + # argument, so we may need to know it at that point already. + # Even if this section looks crufty: it has the advantage of + # actually working. + break;; + * ) + break;; + esac +done +test "$ac_cv_exeext" = no && ac_cv_exeext= + +else + ac_file='' +fi + +{ echo "$as_me:$LINENO: result: $ac_file" >&5 +echo "${ECHO_T}$ac_file" >&6; } +if test -z "$ac_file"; then + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +{ { echo "$as_me:$LINENO: error: C compiler cannot create executables +See \`config.log' for more details." >&5 +echo "$as_me: error: C compiler cannot create executables +See \`config.log' for more details." >&2;} + { (exit 77); exit 77; }; } +fi + +ac_exeext=$ac_cv_exeext + +# Check that the compiler produces executables we can run. If not, either +# the compiler is broken, or we cross compile. +{ echo "$as_me:$LINENO: checking whether the C compiler works" >&5 +echo $ECHO_N "checking whether the C compiler works... $ECHO_C" >&6; } +# FIXME: These cross compiler hacks should be removed for Autoconf 3.0 +# If not cross compiling, check that we can run a simple program. +if test "$cross_compiling" != yes; then + if { ac_try='./$ac_file' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + cross_compiling=no + else + if test "$cross_compiling" = maybe; then + cross_compiling=yes + else + { { echo "$as_me:$LINENO: error: cannot run C compiled programs. +If you meant to cross compile, use \`--host'. +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot run C compiled programs. +If you meant to cross compile, use \`--host'. +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } + fi + fi +fi +{ echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } + +rm -f a.out a.exe conftest$ac_cv_exeext b.out +ac_clean_files=$ac_clean_files_save +# Check that the compiler produces executables we can run. If not, either +# the compiler is broken, or we cross compile. +{ echo "$as_me:$LINENO: checking whether we are cross compiling" >&5 +echo $ECHO_N "checking whether we are cross compiling... $ECHO_C" >&6; } +{ echo "$as_me:$LINENO: result: $cross_compiling" >&5 +echo "${ECHO_T}$cross_compiling" >&6; } + +{ echo "$as_me:$LINENO: checking for suffix of executables" >&5 +echo $ECHO_N "checking for suffix of executables... $ECHO_C" >&6; } +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + # If both `conftest.exe' and `conftest' are `present' (well, observable) +# catch `conftest.exe'. For instance with Cygwin, `ls conftest' will +# work properly (i.e., refer to `conftest.exe'), while it won't with +# `rm'. +for ac_file in conftest.exe conftest conftest.*; do + test -f "$ac_file" || continue + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.o | *.obj ) ;; + *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` + break;; + * ) break;; + esac +done +else + { { echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot compute suffix of executables: cannot compile and link +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } +fi + +rm -f conftest$ac_cv_exeext +{ echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5 +echo "${ECHO_T}$ac_cv_exeext" >&6; } + +rm -f conftest.$ac_ext +EXEEXT=$ac_cv_exeext +ac_exeext=$EXEEXT +{ echo "$as_me:$LINENO: checking for suffix of object files" >&5 +echo $ECHO_N "checking for suffix of object files... $ECHO_C" >&6; } +if test "${ac_cv_objext+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.o conftest.obj +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + for ac_file in conftest.o conftest.obj conftest.*; do + test -f "$ac_file" || continue; + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf ) ;; + *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` + break;; + esac +done +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +{ { echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot compute suffix of object files: cannot compile +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } +fi + +rm -f conftest.$ac_cv_objext conftest.$ac_ext +fi +{ echo "$as_me:$LINENO: result: $ac_cv_objext" >&5 +echo "${ECHO_T}$ac_cv_objext" >&6; } +OBJEXT=$ac_cv_objext +ac_objext=$OBJEXT +{ echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5 +echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6; } +if test "${ac_cv_c_compiler_gnu+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ +#ifndef __GNUC__ + choke me +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_compiler_gnu=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_compiler_gnu=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +ac_cv_c_compiler_gnu=$ac_compiler_gnu + +fi +{ echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5 +echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6; } +GCC=`test $ac_compiler_gnu = yes && echo yes` +ac_test_CFLAGS=${CFLAGS+set} +ac_save_CFLAGS=$CFLAGS +{ echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5 +echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6; } +if test "${ac_cv_prog_cc_g+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_save_c_werror_flag=$ac_c_werror_flag + ac_c_werror_flag=yes + ac_cv_prog_cc_g=no + CFLAGS="-g" + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_cv_prog_cc_g=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + CFLAGS="" + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + : +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_c_werror_flag=$ac_save_c_werror_flag + CFLAGS="-g" + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_cv_prog_cc_g=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + ac_c_werror_flag=$ac_save_c_werror_flag +fi +{ echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5 +echo "${ECHO_T}$ac_cv_prog_cc_g" >&6; } +if test "$ac_test_CFLAGS" = set; then + CFLAGS=$ac_save_CFLAGS +elif test $ac_cv_prog_cc_g = yes; then + if test "$GCC" = yes; then + CFLAGS="-g -O2" + else + CFLAGS="-g" + fi +else + if test "$GCC" = yes; then + CFLAGS="-O2" + else + CFLAGS= + fi +fi +{ echo "$as_me:$LINENO: checking for $CC option to accept ISO C89" >&5 +echo $ECHO_N "checking for $CC option to accept ISO C89... $ECHO_C" >&6; } +if test "${ac_cv_prog_cc_c89+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_prog_cc_c89=no +ac_save_CC=$CC +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +#include +#include +#include +/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ +struct buf { int x; }; +FILE * (*rcsopen) (struct buf *, struct stat *, int); +static char *e (p, i) + char **p; + int i; +{ + return p[i]; +} +static char *f (char * (*g) (char **, int), char **p, ...) +{ + char *s; + va_list v; + va_start (v,p); + s = g (p, va_arg (v,int)); + va_end (v); + return s; +} + +/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has + function prototypes and stuff, but not '\xHH' hex character constants. + These don't provoke an error unfortunately, instead are silently treated + as 'x'. The following induces an error, until -std is added to get + proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an + array size at least. It's necessary to write '\x00'==0 to get something + that's true only with -std. */ +int osf4_cc_array ['\x00' == 0 ? 1 : -1]; + +/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters + inside strings and character constants. */ +#define FOO(x) 'x' +int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; + +int test (int i, double x); +struct s1 {int (*f) (int a);}; +struct s2 {int (*f) (double a);}; +int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); +int argc; +char **argv; +int +main () +{ +return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; + ; + return 0; +} +_ACEOF +for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ + -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" +do + CC="$ac_save_CC $ac_arg" + rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_cv_prog_cc_c89=$ac_arg +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + +fi + +rm -f core conftest.err conftest.$ac_objext + test "x$ac_cv_prog_cc_c89" != "xno" && break +done +rm -f conftest.$ac_ext +CC=$ac_save_CC + +fi +# AC_CACHE_VAL +case "x$ac_cv_prog_cc_c89" in + x) + { echo "$as_me:$LINENO: result: none needed" >&5 +echo "${ECHO_T}none needed" >&6; } ;; + xno) + { echo "$as_me:$LINENO: result: unsupported" >&5 +echo "${ECHO_T}unsupported" >&6; } ;; + *) + CC="$CC $ac_cv_prog_cc_c89" + { echo "$as_me:$LINENO: result: $ac_cv_prog_cc_c89" >&5 +echo "${ECHO_T}$ac_cv_prog_cc_c89" >&6; } ;; +esac + + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +{ echo "$as_me:$LINENO: checking how to run the C preprocessor" >&5 +echo $ECHO_N "checking how to run the C preprocessor... $ECHO_C" >&6; } +# On Suns, sometimes $CPP names a directory. +if test -n "$CPP" && test -d "$CPP"; then + CPP= +fi +if test -z "$CPP"; then + if test "${ac_cv_prog_CPP+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + # Double quotes because CPP needs to be expanded + for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" + do + ac_preproc_ok=false +for ac_c_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # Prefer to if __STDC__ is defined, since + # exists even on freestanding compilers. + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. "Syntax error" is here to catch this case. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#ifdef __STDC__ +# include +#else +# include +#endif + Syntax error +_ACEOF +if { (ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then + : +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + # Broken: fails on valid input. +continue +fi + +rm -f conftest.err conftest.$ac_ext + + # OK, works on sane cases. Now check whether nonexistent headers + # can be detected and how. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +_ACEOF +if { (ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then + # Broken: success on invalid input. +continue +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + # Passes both tests. +ac_preproc_ok=: +break +fi + +rm -f conftest.err conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.err conftest.$ac_ext +if $ac_preproc_ok; then + break +fi + + done + ac_cv_prog_CPP=$CPP + +fi + CPP=$ac_cv_prog_CPP +else + ac_cv_prog_CPP=$CPP +fi +{ echo "$as_me:$LINENO: result: $CPP" >&5 +echo "${ECHO_T}$CPP" >&6; } +ac_preproc_ok=false +for ac_c_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # Prefer to if __STDC__ is defined, since + # exists even on freestanding compilers. + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. "Syntax error" is here to catch this case. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#ifdef __STDC__ +# include +#else +# include +#endif + Syntax error +_ACEOF +if { (ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then + : +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + # Broken: fails on valid input. +continue +fi + +rm -f conftest.err conftest.$ac_ext + + # OK, works on sane cases. Now check whether nonexistent headers + # can be detected and how. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +_ACEOF +if { (ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then + # Broken: success on invalid input. +continue +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + # Passes both tests. +ac_preproc_ok=: +break +fi + +rm -f conftest.err conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.err conftest.$ac_ext +if $ac_preproc_ok; then + : +else + { { echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check +See \`config.log' for more details." >&5 +echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } +fi + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + +{ echo "$as_me:$LINENO: checking for grep that handles long lines and -e" >&5 +echo $ECHO_N "checking for grep that handles long lines and -e... $ECHO_C" >&6; } +if test "${ac_cv_path_GREP+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + # Extract the first word of "grep ggrep" to use in msg output +if test -z "$GREP"; then +set dummy grep ggrep; ac_prog_name=$2 +if test "${ac_cv_path_GREP+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_path_GREP_found=false +# Loop through the user's path and test for each of PROGNAME-LIST +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_prog in grep ggrep; do + for ac_exec_ext in '' $ac_executable_extensions; do + ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext" + { test -f "$ac_path_GREP" && $as_test_x "$ac_path_GREP"; } || continue + # Check for GNU ac_path_GREP and select it if it is found. + # Check for GNU $ac_path_GREP +case `"$ac_path_GREP" --version 2>&1` in +*GNU*) + ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;; +*) + ac_count=0 + echo $ECHO_N "0123456789$ECHO_C" >"conftest.in" + while : + do + cat "conftest.in" "conftest.in" >"conftest.tmp" + mv "conftest.tmp" "conftest.in" + cp "conftest.in" "conftest.nl" + echo 'GREP' >> "conftest.nl" + "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break + diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break + ac_count=`expr $ac_count + 1` + if test $ac_count -gt ${ac_path_GREP_max-0}; then + # Best one so far, save it but keep looking for a better one + ac_cv_path_GREP="$ac_path_GREP" + ac_path_GREP_max=$ac_count + fi + # 10*(2^10) chars as input seems more than enough + test $ac_count -gt 10 && break + done + rm -f conftest.in conftest.tmp conftest.nl conftest.out;; +esac + + + $ac_path_GREP_found && break 3 + done +done + +done +IFS=$as_save_IFS + + +fi + +GREP="$ac_cv_path_GREP" +if test -z "$GREP"; then + { { echo "$as_me:$LINENO: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&5 +echo "$as_me: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&2;} + { (exit 1); exit 1; }; } +fi + +else + ac_cv_path_GREP=$GREP +fi + + +fi +{ echo "$as_me:$LINENO: result: $ac_cv_path_GREP" >&5 +echo "${ECHO_T}$ac_cv_path_GREP" >&6; } + GREP="$ac_cv_path_GREP" + + +{ echo "$as_me:$LINENO: checking for egrep" >&5 +echo $ECHO_N "checking for egrep... $ECHO_C" >&6; } +if test "${ac_cv_path_EGREP+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 + then ac_cv_path_EGREP="$GREP -E" + else + # Extract the first word of "egrep" to use in msg output +if test -z "$EGREP"; then +set dummy egrep; ac_prog_name=$2 +if test "${ac_cv_path_EGREP+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_path_EGREP_found=false +# Loop through the user's path and test for each of PROGNAME-LIST +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_prog in egrep; do + for ac_exec_ext in '' $ac_executable_extensions; do + ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext" + { test -f "$ac_path_EGREP" && $as_test_x "$ac_path_EGREP"; } || continue + # Check for GNU ac_path_EGREP and select it if it is found. + # Check for GNU $ac_path_EGREP +case `"$ac_path_EGREP" --version 2>&1` in +*GNU*) + ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;; +*) + ac_count=0 + echo $ECHO_N "0123456789$ECHO_C" >"conftest.in" + while : + do + cat "conftest.in" "conftest.in" >"conftest.tmp" + mv "conftest.tmp" "conftest.in" + cp "conftest.in" "conftest.nl" + echo 'EGREP' >> "conftest.nl" + "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break + diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break + ac_count=`expr $ac_count + 1` + if test $ac_count -gt ${ac_path_EGREP_max-0}; then + # Best one so far, save it but keep looking for a better one + ac_cv_path_EGREP="$ac_path_EGREP" + ac_path_EGREP_max=$ac_count + fi + # 10*(2^10) chars as input seems more than enough + test $ac_count -gt 10 && break + done + rm -f conftest.in conftest.tmp conftest.nl conftest.out;; +esac + + + $ac_path_EGREP_found && break 3 + done +done + +done +IFS=$as_save_IFS + + +fi + +EGREP="$ac_cv_path_EGREP" +if test -z "$EGREP"; then + { { echo "$as_me:$LINENO: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&5 +echo "$as_me: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&2;} + { (exit 1); exit 1; }; } +fi + +else + ac_cv_path_EGREP=$EGREP +fi + + + fi +fi +{ echo "$as_me:$LINENO: result: $ac_cv_path_EGREP" >&5 +echo "${ECHO_T}$ac_cv_path_EGREP" >&6; } + EGREP="$ac_cv_path_EGREP" + + +{ echo "$as_me:$LINENO: checking for ANSI C header files" >&5 +echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6; } +if test "${ac_cv_header_stdc+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +#include +#include +#include + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_cv_header_stdc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_header_stdc=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +if test $ac_cv_header_stdc = yes; then + # SunOS 4.x string.h does not declare mem*, contrary to ANSI. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "memchr" >/dev/null 2>&1; then + : +else + ac_cv_header_stdc=no +fi +rm -f conftest* + +fi + +if test $ac_cv_header_stdc = yes; then + # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "free" >/dev/null 2>&1; then + : +else + ac_cv_header_stdc=no +fi +rm -f conftest* + +fi + +if test $ac_cv_header_stdc = yes; then + # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. + if test "$cross_compiling" = yes; then + : +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +#include +#if ((' ' & 0x0FF) == 0x020) +# define ISLOWER(c) ('a' <= (c) && (c) <= 'z') +# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) +#else +# define ISLOWER(c) \ + (('a' <= (c) && (c) <= 'i') \ + || ('j' <= (c) && (c) <= 'r') \ + || ('s' <= (c) && (c) <= 'z')) +# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) +#endif + +#define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) +int +main () +{ + int i; + for (i = 0; i < 256; i++) + if (XOR (islower (i), ISLOWER (i)) + || toupper (i) != TOUPPER (i)) + return 2; + return 0; +} +_ACEOF +rm -f conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + : +else + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +( exit $ac_status ) +ac_cv_header_stdc=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi + + +fi +fi +{ echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5 +echo "${ECHO_T}$ac_cv_header_stdc" >&6; } +if test $ac_cv_header_stdc = yes; then + +cat >>confdefs.h <<\_ACEOF +#define STDC_HEADERS 1 +_ACEOF + +fi + +# On IRIX 5.3, sys/types and inttypes.h are conflicting. + + + + + + + + + +for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ + inttypes.h stdint.h unistd.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +{ echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default + +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + eval "$as_ac_Header=yes" +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + eval "$as_ac_Header=no" +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +ac_res=`eval echo '${'$as_ac_Header'}'` + { echo "$as_me:$LINENO: result: $ac_res" >&5 +echo "${ECHO_T}$ac_res" >&6; } +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + +if test "x$thread" != "xno"; then + if test "${ac_cv_header_pthread_h+set}" = set; then + { echo "$as_me:$LINENO: checking for pthread.h" >&5 +echo $ECHO_N "checking for pthread.h... $ECHO_C" >&6; } +if test "${ac_cv_header_pthread_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +{ echo "$as_me:$LINENO: result: $ac_cv_header_pthread_h" >&5 +echo "${ECHO_T}$ac_cv_header_pthread_h" >&6; } +else + # Is the header compilable? +{ echo "$as_me:$LINENO: checking pthread.h usability" >&5 +echo $ECHO_N "checking pthread.h usability... $ECHO_C" >&6; } +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_compiler=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6; } + +# Is the header present? +{ echo "$as_me:$LINENO: checking pthread.h presence" >&5 +echo $ECHO_N "checking pthread.h presence... $ECHO_C" >&6; } +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +_ACEOF +if { (ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then + ac_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi + +rm -f conftest.err conftest.$ac_ext +{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6; } + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in + yes:no: ) + { echo "$as_me:$LINENO: WARNING: pthread.h: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: pthread.h: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: pthread.h: proceeding with the compiler's result" >&5 +echo "$as_me: WARNING: pthread.h: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes + ;; + no:yes:* ) + { echo "$as_me:$LINENO: WARNING: pthread.h: present but cannot be compiled" >&5 +echo "$as_me: WARNING: pthread.h: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: pthread.h: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: pthread.h: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: pthread.h: see the Autoconf documentation" >&5 +echo "$as_me: WARNING: pthread.h: see the Autoconf documentation" >&2;} + { echo "$as_me:$LINENO: WARNING: pthread.h: section \"Present But Cannot Be Compiled\"" >&5 +echo "$as_me: WARNING: pthread.h: section \"Present But Cannot Be Compiled\"" >&2;} + { echo "$as_me:$LINENO: WARNING: pthread.h: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: pthread.h: proceeding with the preprocessor's result" >&2;} + { echo "$as_me:$LINENO: WARNING: pthread.h: in the future, the compiler will take precedence" >&5 +echo "$as_me: WARNING: pthread.h: in the future, the compiler will take precedence" >&2;} + ( cat <<\_ASBOX +## --------------------------------------- ## +## Report this to nicolas.geoffray at lip6.fr ## +## --------------------------------------- ## +_ASBOX + ) | sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +{ echo "$as_me:$LINENO: checking for pthread.h" >&5 +echo $ECHO_N "checking for pthread.h... $ECHO_C" >&6; } +if test "${ac_cv_header_pthread_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_header_pthread_h=$ac_header_preproc +fi +{ echo "$as_me:$LINENO: result: $ac_cv_header_pthread_h" >&5 +echo "${ECHO_T}$ac_cv_header_pthread_h" >&6; } + +fi +if test $ac_cv_header_pthread_h = yes; then + : +else + { echo "$as_me:$LINENO: WARNING: phtread include NOT found" >&5 +echo "$as_me: WARNING: phtread include NOT found" >&2;} +fi + + + +{ echo "$as_me:$LINENO: checking for pthread_create in -lpthread" >&5 +echo $ECHO_N "checking for pthread_create in -lpthread... $ECHO_C" >&6; } +if test "${ac_cv_lib_pthread_pthread_create+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lpthread $LIBS" +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char pthread_create (); +int +main () +{ +return pthread_create (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then + ac_cv_lib_pthread_pthread_create=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_lib_pthread_pthread_create=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ echo "$as_me:$LINENO: result: $ac_cv_lib_pthread_pthread_create" >&5 +echo "${ECHO_T}$ac_cv_lib_pthread_pthread_create" >&6; } +if test $ac_cv_lib_pthread_pthread_create = yes; then + cat >>confdefs.h <<_ACEOF +#define HAVE_LIBPTHREAD 1 +_ACEOF + + LIBS="-lpthread $LIBS" + +else + { { echo "$as_me:$LINENO: error: pthread library not found" >&5 +echo "$as_me: error: pthread library not found" >&2;} + { (exit 1); exit 1; }; } +fi + + + +fi + + +if test "x$thread" = xcommon; then + +cat >>confdefs.h <<\_ACEOF +#define HAVE_PTHREAD 1 +_ACEOF + +fi + + +# Check whether --with-gc was given. +if test "${with_gc+set}" = set; then + withval=$with_gc; gc=$withval +else + echo Using mmap2 as vvm gc type. + gc=single-mmap + + +fi + + +if test "x$gc" = "xboehm"; then + GC_FLAGS ="-I$PWD/lib/Mvm/BoehmGC -DGC_THREADS" + +cat >>confdefs.h <<\_ACEOF +#define USE_GC_BOEHM 1 +_ACEOF + + GC_MMAP2=0 + + GC_BOEHM=1 + + GC_LIBS=BoehmGC + case $target_os in + *linux*) + GC_FLAGS="-I$PWD/lib/Mvm/BoehmGC -DGC_THREADS -DGC_LINUX_THREADS" + ;; + esac +else + GC_LIBS=GCMmap2 + if test "x$gc" = "xmulti-mmap"; then + GC_FLAGS="-I$PWD/lib/Mvm/GCMmap2 -DWITH_TRACER -DMULTIPLE_GC" + GC_MULTI_MMAP=1 + + GC_SINGLE_MMAP=0 + + else + GC_FLAGS="-I$PWD/lib/Mvm/GCMmap2 -DWITH_TRACER" + GC_MULTI_MMAP=0 + + GC_SINGLE_MMAP=1 + + fi + +cat >>confdefs.h <<\_ACEOF +#define USE_GC_MMAP2 1 +_ACEOF + + GC_MMAP2=1 + + GC_BOEHM=0 + +fi + + + + + +# Check whether --with-vm-type was given. +if test "${with_vm_type+set}" = set; then + withval=$with_vm_type; vmtype=$withval +else + echo Using single as vm type. + vmtype=single + + +fi + + +if test "x$vmtype" = "xmulti"; then + CFLAGS="$CFLAGS -DMULTIPLE_VM" + CXXFLAGS="$CXXFLAGS -DMULTIPLE_VM" +else + if test "x$vmtype" = "xservice"; then + CFLAGS="$CFLAGS -DMULTIPLE_VM -DSERVICE_GC -DMULTIPLE_GC -DSERVICE_VM -I$PWD/lib/Mvm/Allocator" + CXXFLAGS="$CXXFLAGS -DMULTIPLE_VM -DSERVICE_GC -DMULTIPLE_GC -DSERVICE_VM -I$PWD/lib/Mvm/Allocator" + fi +fi + + + +if test "x$vmtype" = "xservice"; then + SERVICE_BUILD_TRUE= + SERVICE_BUILD_FALSE='#' +else + SERVICE_BUILD_TRUE='#' + SERVICE_BUILD_FALSE= +fi + + + +if test "x$vmtype" = "xmulti"; then + ISOLATE_BUILD_TRUE= + ISOLATE_BUILD_FALSE='#' +else + ISOLATE_BUILD_TRUE='#' + ISOLATE_BUILD_FALSE= +fi + + + +gnuclasspathversion=0.93; + + +# Check whether --with-gnu-classpath-local-prefix was given. +if test "${with_gnu_classpath_local_prefix+set}" = set; then + withval=$with_gnu_classpath_local_prefix; gnuclasspathlocalprefix=$withval +else + echo Not using GNU CLASSPATH local prefix. + gnuclasspathlocalprefix='' + + +fi + + + +# Check whether --with-gnu-classpath-installation-prefix was given. +if test "${with_gnu_classpath_installation_prefix+set}" = set; then + withval=$with_gnu_classpath_installation_prefix; gnuclasspathinstallationprefix=$withval +else + gnuclasspathinstallationprefix=/usr/local/classpath + +fi + + +if test "x${gnuclasspathlocalprefix}" = x; then + echo Using ${gnuclasspathinstallationprefix} as GNU CLASSPATH installation prefix; + classpathglibj=${gnuclasspathinstallationprefix}/share/classpath/glibj.zip; + classpathlibs=${gnuclasspathinstallationprefix}/lib/classpath/; + classpathinclude=${gnuclasspathlocalprefix}/include; +else + echo Using ${gnuclasspathlocalprefix} as GNU CLASSPATH local prefix; + classpathglibj=${gnuclasspathlocalprefix}/lib/; + classpathlibs=${gnuclasspathlocalprefix}/lib/; + classpathinclude=${gnuclasspathlocalprefix}/include; +fi + + + + + + + + +# Check whether --with-pnet-local-prefix was given. +if test "${with_pnet_local_prefix+set}" = set; then + withval=$with_pnet_local_prefix; pnetlocalprefix=$withval +else + echo Not using PNETlocal prefix. + pnetlocalprefix='' + + +fi + + + + +if test "x$pnetlocalprefix" != "x"; then + WITH_N3_TRUE= + WITH_N3_FALSE='#' +else + WITH_N3_TRUE='#' + WITH_N3_FALSE= +fi + +if test "x$pnetlocalprefix" != x; then + echo Using ${pnetlocalprefix} as PNET local prefix; + +cat >>confdefs.h <<\_ACEOF +#define WITH_N3 1 +_ACEOF + +fi + + + + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +{ echo "$as_me:$LINENO: checking how to run the C preprocessor" >&5 +echo $ECHO_N "checking how to run the C preprocessor... $ECHO_C" >&6; } +# On Suns, sometimes $CPP names a directory. +if test -n "$CPP" && test -d "$CPP"; then + CPP= +fi +if test -z "$CPP"; then + if test "${ac_cv_prog_CPP+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + # Double quotes because CPP needs to be expanded + for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" + do + ac_preproc_ok=false +for ac_c_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # Prefer to if __STDC__ is defined, since + # exists even on freestanding compilers. + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. "Syntax error" is here to catch this case. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#ifdef __STDC__ +# include +#else +# include +#endif + Syntax error +_ACEOF +if { (ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then + : +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + # Broken: fails on valid input. +continue +fi + +rm -f conftest.err conftest.$ac_ext + + # OK, works on sane cases. Now check whether nonexistent headers + # can be detected and how. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +_ACEOF +if { (ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then + # Broken: success on invalid input. +continue +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + # Passes both tests. +ac_preproc_ok=: +break +fi + +rm -f conftest.err conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.err conftest.$ac_ext +if $ac_preproc_ok; then + break +fi + + done + ac_cv_prog_CPP=$CPP + +fi + CPP=$ac_cv_prog_CPP +else + ac_cv_prog_CPP=$CPP +fi +{ echo "$as_me:$LINENO: result: $CPP" >&5 +echo "${ECHO_T}$CPP" >&6; } +ac_preproc_ok=false +for ac_c_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # Prefer to if __STDC__ is defined, since + # exists even on freestanding compilers. + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. "Syntax error" is here to catch this case. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#ifdef __STDC__ +# include +#else +# include +#endif + Syntax error +_ACEOF +if { (ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then + : +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + # Broken: fails on valid input. +continue +fi + +rm -f conftest.err conftest.$ac_ext + + # OK, works on sane cases. Now check whether nonexistent headers + # can be detected and how. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +_ACEOF +if { (ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then + # Broken: success on invalid input. +continue +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + # Passes both tests. +ac_preproc_ok=: +break +fi + +rm -f conftest.err conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.err conftest.$ac_ext +if $ac_preproc_ok; then + : +else + { { echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check +See \`config.log' for more details." >&5 +echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } +fi + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +if test -n "$ac_tool_prefix"; then + for ac_prog in gcc + do + # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. +set dummy $ac_tool_prefix$ac_prog; ac_word=$2 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_CC="$ac_tool_prefix$ac_prog" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + + test -n "$CC" && break + done +fi +if test -z "$CC"; then + ac_ct_CC=$CC + for ac_prog in gcc +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_prog_ac_ct_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_CC="$ac_prog" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + { echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 +echo "${ECHO_T}$ac_ct_CC" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + + test -n "$ac_ct_CC" && break +done + + if test "x$ac_ct_CC" = x; then + CC="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools +whose name does not start with the host triplet. If you think this +configuration is useful to you, please write to autoconf at gnu.org." >&5 +echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools +whose name does not start with the host triplet. If you think this +configuration is useful to you, please write to autoconf at gnu.org." >&2;} +ac_tool_warned=yes ;; +esac + CC=$ac_ct_CC + fi +fi + + +test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH +See \`config.log' for more details." >&5 +echo "$as_me: error: no acceptable C compiler found in \$PATH +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } + +# Provide some information about the compiler. +echo "$as_me:$LINENO: checking for C compiler version" >&5 +ac_compiler=`set X $ac_compile; echo $2` +{ (ac_try="$ac_compiler --version >&5" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compiler --version >&5") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } +{ (ac_try="$ac_compiler -v >&5" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compiler -v >&5") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } +{ (ac_try="$ac_compiler -V >&5" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compiler -V >&5") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } + +{ echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5 +echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6; } +if test "${ac_cv_c_compiler_gnu+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ +#ifndef __GNUC__ + choke me +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_compiler_gnu=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_compiler_gnu=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +ac_cv_c_compiler_gnu=$ac_compiler_gnu + +fi +{ echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5 +echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6; } +GCC=`test $ac_compiler_gnu = yes && echo yes` +ac_test_CFLAGS=${CFLAGS+set} +ac_save_CFLAGS=$CFLAGS +{ echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5 +echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6; } +if test "${ac_cv_prog_cc_g+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_save_c_werror_flag=$ac_c_werror_flag + ac_c_werror_flag=yes + ac_cv_prog_cc_g=no + CFLAGS="-g" + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_cv_prog_cc_g=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + CFLAGS="" + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + : +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_c_werror_flag=$ac_save_c_werror_flag + CFLAGS="-g" + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_cv_prog_cc_g=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + ac_c_werror_flag=$ac_save_c_werror_flag +fi +{ echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5 +echo "${ECHO_T}$ac_cv_prog_cc_g" >&6; } +if test "$ac_test_CFLAGS" = set; then + CFLAGS=$ac_save_CFLAGS +elif test $ac_cv_prog_cc_g = yes; then + if test "$GCC" = yes; then + CFLAGS="-g -O2" + else + CFLAGS="-g" + fi +else + if test "$GCC" = yes; then + CFLAGS="-O2" + else + CFLAGS= + fi +fi +{ echo "$as_me:$LINENO: checking for $CC option to accept ISO C89" >&5 +echo $ECHO_N "checking for $CC option to accept ISO C89... $ECHO_C" >&6; } +if test "${ac_cv_prog_cc_c89+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_prog_cc_c89=no +ac_save_CC=$CC +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +#include +#include +#include +/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ +struct buf { int x; }; +FILE * (*rcsopen) (struct buf *, struct stat *, int); +static char *e (p, i) + char **p; + int i; +{ + return p[i]; +} +static char *f (char * (*g) (char **, int), char **p, ...) +{ + char *s; + va_list v; + va_start (v,p); + s = g (p, va_arg (v,int)); + va_end (v); + return s; +} + +/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has + function prototypes and stuff, but not '\xHH' hex character constants. + These don't provoke an error unfortunately, instead are silently treated + as 'x'. The following induces an error, until -std is added to get + proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an + array size at least. It's necessary to write '\x00'==0 to get something + that's true only with -std. */ +int osf4_cc_array ['\x00' == 0 ? 1 : -1]; + +/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters + inside strings and character constants. */ +#define FOO(x) 'x' +int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; + +int test (int i, double x); +struct s1 {int (*f) (int a);}; +struct s2 {int (*f) (double a);}; +int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); +int argc; +char **argv; +int +main () +{ +return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; + ; + return 0; +} +_ACEOF +for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ + -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" +do + CC="$ac_save_CC $ac_arg" + rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_cv_prog_cc_c89=$ac_arg +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + +fi + +rm -f core conftest.err conftest.$ac_objext + test "x$ac_cv_prog_cc_c89" != "xno" && break +done +rm -f conftest.$ac_ext +CC=$ac_save_CC + +fi +# AC_CACHE_VAL +case "x$ac_cv_prog_cc_c89" in + x) + { echo "$as_me:$LINENO: result: none needed" >&5 +echo "${ECHO_T}none needed" >&6; } ;; + xno) + { echo "$as_me:$LINENO: result: unsupported" >&5 +echo "${ECHO_T}unsupported" >&6; } ;; + *) + CC="$CC $ac_cv_prog_cc_c89" + { echo "$as_me:$LINENO: result: $ac_cv_prog_cc_c89" >&5 +echo "${ECHO_T}$ac_cv_prog_cc_c89" >&6; } ;; +esac + + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + +ac_ext=cpp +ac_cpp='$CXXCPP $CPPFLAGS' +ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_cxx_compiler_gnu +if test -z "$CXX"; then + if test -n "$CCC"; then + CXX=$CCC + else + if test -n "$ac_tool_prefix"; then + for ac_prog in g++ + do + # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. +set dummy $ac_tool_prefix$ac_prog; ac_word=$2 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_prog_CXX+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CXX"; then + ac_cv_prog_CXX="$CXX" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_CXX="$ac_tool_prefix$ac_prog" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + +fi +fi +CXX=$ac_cv_prog_CXX +if test -n "$CXX"; then + { echo "$as_me:$LINENO: result: $CXX" >&5 +echo "${ECHO_T}$CXX" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + + test -n "$CXX" && break + done +fi +if test -z "$CXX"; then + ac_ct_CXX=$CXX + for ac_prog in g++ +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_prog_ac_ct_CXX+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_CXX"; then + ac_cv_prog_ac_ct_CXX="$ac_ct_CXX" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_CXX="$ac_prog" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + +fi +fi +ac_ct_CXX=$ac_cv_prog_ac_ct_CXX +if test -n "$ac_ct_CXX"; then + { echo "$as_me:$LINENO: result: $ac_ct_CXX" >&5 +echo "${ECHO_T}$ac_ct_CXX" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + + test -n "$ac_ct_CXX" && break +done + + if test "x$ac_ct_CXX" = x; then + CXX="g++" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools +whose name does not start with the host triplet. If you think this +configuration is useful to you, please write to autoconf at gnu.org." >&5 +echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools +whose name does not start with the host triplet. If you think this +configuration is useful to you, please write to autoconf at gnu.org." >&2;} +ac_tool_warned=yes ;; +esac + CXX=$ac_ct_CXX + fi +fi + + fi +fi +# Provide some information about the compiler. +echo "$as_me:$LINENO: checking for C++ compiler version" >&5 +ac_compiler=`set X $ac_compile; echo $2` +{ (ac_try="$ac_compiler --version >&5" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compiler --version >&5") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } +{ (ac_try="$ac_compiler -v >&5" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compiler -v >&5") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } +{ (ac_try="$ac_compiler -V >&5" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compiler -V >&5") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } + +{ echo "$as_me:$LINENO: checking whether we are using the GNU C++ compiler" >&5 +echo $ECHO_N "checking whether we are using the GNU C++ compiler... $ECHO_C" >&6; } +if test "${ac_cv_cxx_compiler_gnu+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ +#ifndef __GNUC__ + choke me +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_cxx_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_compiler_gnu=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_compiler_gnu=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +ac_cv_cxx_compiler_gnu=$ac_compiler_gnu + +fi +{ echo "$as_me:$LINENO: result: $ac_cv_cxx_compiler_gnu" >&5 +echo "${ECHO_T}$ac_cv_cxx_compiler_gnu" >&6; } +GXX=`test $ac_compiler_gnu = yes && echo yes` +ac_test_CXXFLAGS=${CXXFLAGS+set} +ac_save_CXXFLAGS=$CXXFLAGS +{ echo "$as_me:$LINENO: checking whether $CXX accepts -g" >&5 +echo $ECHO_N "checking whether $CXX accepts -g... $ECHO_C" >&6; } +if test "${ac_cv_prog_cxx_g+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_save_cxx_werror_flag=$ac_cxx_werror_flag + ac_cxx_werror_flag=yes + ac_cv_prog_cxx_g=no + CXXFLAGS="-g" + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_cxx_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_cv_prog_cxx_g=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + CXXFLAGS="" + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_cxx_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + : +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cxx_werror_flag=$ac_save_cxx_werror_flag + CXXFLAGS="-g" + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_cxx_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_cv_prog_cxx_g=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + ac_cxx_werror_flag=$ac_save_cxx_werror_flag +fi +{ echo "$as_me:$LINENO: result: $ac_cv_prog_cxx_g" >&5 +echo "${ECHO_T}$ac_cv_prog_cxx_g" >&6; } +if test "$ac_test_CXXFLAGS" = set; then + CXXFLAGS=$ac_save_CXXFLAGS +elif test $ac_cv_prog_cxx_g = yes; then + if test "$GXX" = yes; then + CXXFLAGS="-g -O2" + else + CXXFLAGS="-g" + fi +else + if test "$GXX" = yes; then + CXXFLAGS="-O2" + else + CXXFLAGS= + fi +fi +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + +{ echo "$as_me:$LINENO: checking for BSD-compatible nm" >&5 +echo $ECHO_N "checking for BSD-compatible nm... $ECHO_C" >&6; } +if test "${lt_cv_path_NM+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$NM"; then + # Let the user override the test. + lt_cv_path_NM="$NM" +else + lt_nm_to_check="${ac_tool_prefix}nm" + if test -n "$ac_tool_prefix" && test "$build" = "$host"; then + lt_nm_to_check="$lt_nm_to_check nm" + fi + for lt_tmp_nm in $lt_nm_to_check; do + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do + IFS="$lt_save_ifs" + test -z "$ac_dir" && ac_dir=. + tmp_nm="$ac_dir/$lt_tmp_nm" + if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext" ; then + # Check to see if the nm accepts a BSD-compat flag. + # Adding the `sed 1q' prevents false positives on HP-UX, which says: + # nm: unknown option "B" ignored + # Tru64's nm complains that /dev/null is an invalid object file + case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in + */dev/null* | *'Invalid file or object type'*) + lt_cv_path_NM="$tmp_nm -B" + break + ;; + *) + case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in + */dev/null*) + lt_cv_path_NM="$tmp_nm -p" + break + ;; + *) + lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but + continue # so that we can try to find one that supports BSD flags + ;; + esac + ;; + esac + fi + done + IFS="$lt_save_ifs" + done + test -z "$lt_cv_path_NM" && lt_cv_path_NM=nm +fi +fi +{ echo "$as_me:$LINENO: result: $lt_cv_path_NM" >&5 +echo "${ECHO_T}$lt_cv_path_NM" >&6; } +NM="$lt_cv_path_NM" + + + +{ echo "$as_me:$LINENO: checking whether ln -s works" >&5 +echo $ECHO_N "checking whether ln -s works... $ECHO_C" >&6; } +LN_S=$as_ln_s +if test "$LN_S" = "ln -s"; then + { echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } +else + { echo "$as_me:$LINENO: result: no, using $LN_S" >&5 +echo "${ECHO_T}no, using $LN_S" >&6; } +fi + +# Extract the first word of "cmp", so it can be a program name with args. +set dummy cmp; ac_word=$2 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_path_CMP+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + case $CMP in + [\\/]* | ?:[\\/]*) + ac_cv_path_CMP="$CMP" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_path_CMP="$as_dir/$ac_word$ac_exec_ext" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + + test -z "$ac_cv_path_CMP" && ac_cv_path_CMP="cmp" + ;; +esac +fi +CMP=$ac_cv_path_CMP +if test -n "$CMP"; then + { echo "$as_me:$LINENO: result: $CMP" >&5 +echo "${ECHO_T}$CMP" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + +# Extract the first word of "cp", so it can be a program name with args. +set dummy cp; ac_word=$2 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_path_CP+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + case $CP in + [\\/]* | ?:[\\/]*) + ac_cv_path_CP="$CP" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_path_CP="$as_dir/$ac_word$ac_exec_ext" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + + test -z "$ac_cv_path_CP" && ac_cv_path_CP="cp" + ;; +esac +fi +CP=$ac_cv_path_CP +if test -n "$CP"; then + { echo "$as_me:$LINENO: result: $CP" >&5 +echo "${ECHO_T}$CP" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + +# Extract the first word of "date", so it can be a program name with args. +set dummy date; ac_word=$2 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_path_DATE+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + case $DATE in + [\\/]* | ?:[\\/]*) + ac_cv_path_DATE="$DATE" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_path_DATE="$as_dir/$ac_word$ac_exec_ext" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + + test -z "$ac_cv_path_DATE" && ac_cv_path_DATE="date" + ;; +esac +fi +DATE=$ac_cv_path_DATE +if test -n "$DATE"; then + { echo "$as_me:$LINENO: result: $DATE" >&5 +echo "${ECHO_T}$DATE" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + +# Extract the first word of "find", so it can be a program name with args. +set dummy find; ac_word=$2 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_path_FIND+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + case $FIND in + [\\/]* | ?:[\\/]*) + ac_cv_path_FIND="$FIND" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_path_FIND="$as_dir/$ac_word$ac_exec_ext" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + + test -z "$ac_cv_path_FIND" && ac_cv_path_FIND="find" + ;; +esac +fi +FIND=$ac_cv_path_FIND +if test -n "$FIND"; then + { echo "$as_me:$LINENO: result: $FIND" >&5 +echo "${ECHO_T}$FIND" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + +# Extract the first word of "grep", so it can be a program name with args. +set dummy grep; ac_word=$2 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_path_GREP+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + case $GREP in + [\\/]* | ?:[\\/]*) + ac_cv_path_GREP="$GREP" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_path_GREP="$as_dir/$ac_word$ac_exec_ext" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + + test -z "$ac_cv_path_GREP" && ac_cv_path_GREP="grep" + ;; +esac +fi +GREP=$ac_cv_path_GREP +if test -n "$GREP"; then + { echo "$as_me:$LINENO: result: $GREP" >&5 +echo "${ECHO_T}$GREP" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + +# Extract the first word of "mkdir", so it can be a program name with args. +set dummy mkdir; ac_word=$2 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_path_MKDIR+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + case $MKDIR in + [\\/]* | ?:[\\/]*) + ac_cv_path_MKDIR="$MKDIR" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_path_MKDIR="$as_dir/$ac_word$ac_exec_ext" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + + test -z "$ac_cv_path_MKDIR" && ac_cv_path_MKDIR="mkdir" + ;; +esac +fi +MKDIR=$ac_cv_path_MKDIR +if test -n "$MKDIR"; then + { echo "$as_me:$LINENO: result: $MKDIR" >&5 +echo "${ECHO_T}$MKDIR" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + +# Extract the first word of "mv", so it can be a program name with args. +set dummy mv; ac_word=$2 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_path_MV+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + case $MV in + [\\/]* | ?:[\\/]*) + ac_cv_path_MV="$MV" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_path_MV="$as_dir/$ac_word$ac_exec_ext" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + + test -z "$ac_cv_path_MV" && ac_cv_path_MV="mv" + ;; +esac +fi +MV=$ac_cv_path_MV +if test -n "$MV"; then + { echo "$as_me:$LINENO: result: $MV" >&5 +echo "${ECHO_T}$MV" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. +set dummy ${ac_tool_prefix}ranlib; ac_word=$2 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_prog_RANLIB+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$RANLIB"; then + ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + +fi +fi +RANLIB=$ac_cv_prog_RANLIB +if test -n "$RANLIB"; then + { echo "$as_me:$LINENO: result: $RANLIB" >&5 +echo "${ECHO_T}$RANLIB" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_RANLIB"; then + ac_ct_RANLIB=$RANLIB + # Extract the first word of "ranlib", so it can be a program name with args. +set dummy ranlib; ac_word=$2 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_prog_ac_ct_RANLIB+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_RANLIB"; then + ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_RANLIB="ranlib" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + +fi +fi +ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB +if test -n "$ac_ct_RANLIB"; then + { echo "$as_me:$LINENO: result: $ac_ct_RANLIB" >&5 +echo "${ECHO_T}$ac_ct_RANLIB" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + if test "x$ac_ct_RANLIB" = x; then + RANLIB=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools +whose name does not start with the host triplet. If you think this +configuration is useful to you, please write to autoconf at gnu.org." >&5 +echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools +whose name does not start with the host triplet. If you think this +configuration is useful to you, please write to autoconf at gnu.org." >&2;} +ac_tool_warned=yes ;; +esac + RANLIB=$ac_ct_RANLIB + fi +else + RANLIB="$ac_cv_prog_RANLIB" +fi + +# Extract the first word of "rm", so it can be a program name with args. +set dummy rm; ac_word=$2 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_path_RM+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + case $RM in + [\\/]* | ?:[\\/]*) + ac_cv_path_RM="$RM" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_path_RM="$as_dir/$ac_word$ac_exec_ext" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + + test -z "$ac_cv_path_RM" && ac_cv_path_RM="rm" + ;; +esac +fi +RM=$ac_cv_path_RM +if test -n "$RM"; then + { echo "$as_me:$LINENO: result: $RM" >&5 +echo "${ECHO_T}$RM" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + +# Extract the first word of "sed", so it can be a program name with args. +set dummy sed; ac_word=$2 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_path_SED+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + case $SED in + [\\/]* | ?:[\\/]*) + ac_cv_path_SED="$SED" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_path_SED="$as_dir/$ac_word$ac_exec_ext" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + + test -z "$ac_cv_path_SED" && ac_cv_path_SED="sed" + ;; +esac +fi +SED=$ac_cv_path_SED +if test -n "$SED"; then + { echo "$as_me:$LINENO: result: $SED" >&5 +echo "${ECHO_T}$SED" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + +# Extract the first word of "tar", so it can be a program name with args. +set dummy tar; ac_word=$2 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_path_TAR+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + case $TAR in + [\\/]* | ?:[\\/]*) + ac_cv_path_TAR="$TAR" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_path_TAR="$as_dir/$ac_word$ac_exec_ext" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + + test -z "$ac_cv_path_TAR" && ac_cv_path_TAR="gtar" + ;; +esac +fi +TAR=$ac_cv_path_TAR +if test -n "$TAR"; then + { echo "$as_me:$LINENO: result: $TAR" >&5 +echo "${ECHO_T}$TAR" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + +# Extract the first word of "pwd", so it can be a program name with args. +set dummy pwd; ac_word=$2 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_path_BINPWD+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + case $BINPWD in + [\\/]* | ?:[\\/]*) + ac_cv_path_BINPWD="$BINPWD" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_path_BINPWD="$as_dir/$ac_word$ac_exec_ext" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + + test -z "$ac_cv_path_BINPWD" && ac_cv_path_BINPWD="pwd" + ;; +esac +fi +BINPWD=$ac_cv_path_BINPWD +if test -n "$BINPWD"; then + { echo "$as_me:$LINENO: result: $BINPWD" >&5 +echo "${ECHO_T}$BINPWD" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + +# Extract the first word of "cat", so it can be a program name with args. +set dummy cat; ac_word=$2 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_path_CAT+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + case $CAT in + [\\/]* | ?:[\\/]*) + ac_cv_path_CAT="$CAT" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_path_CAT="$as_dir/$ac_word$ac_exec_ext" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + + test -z "$ac_cv_path_CAT" && ac_cv_path_CAT="cat" + ;; +esac +fi +CAT=$ac_cv_path_CAT +if test -n "$CAT"; then + { echo "$as_me:$LINENO: result: $CAT" >&5 +echo "${ECHO_T}$CAT" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + + +# Extract the first word of "llvm-as", so it can be a program name with args. +set dummy llvm-as; ac_word=$2 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_path_LLVMAS+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + case $LLVMAS in + [\\/]* | ?:[\\/]*) + ac_cv_path_LLVMAS="$LLVMAS" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_path_LLVMAS="$as_dir/$ac_word$ac_exec_ext" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + + test -z "$ac_cv_path_LLVMAS" && ac_cv_path_LLVMAS="llvm-as" + ;; +esac +fi +LLVMAS=$ac_cv_path_LLVMAS +if test -n "$LLVMAS"; then + { echo "$as_me:$LINENO: result: $LLVMAS" >&5 +echo "${ECHO_T}$LLVMAS" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + +# Extract the first word of "llc", so it can be a program name with args. +set dummy llc; ac_word=$2 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_path_LLC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + case $LLC in + [\\/]* | ?:[\\/]*) + ac_cv_path_LLC="$LLC" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_path_LLC="$as_dir/$ac_word$ac_exec_ext" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + + test -z "$ac_cv_path_LLC" && ac_cv_path_LLC="llc" + ;; +esac +fi +LLC=$ac_cv_path_LLC +if test -n "$LLC"; then + { echo "$as_me:$LINENO: result: $LLC" >&5 +echo "${ECHO_T}$LLC" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + + +# Find a good install program. We prefer a C program (faster), +# so one script is as good as another. But avoid the broken or +# incompatible versions: +# SysV /etc/install, /usr/sbin/install +# SunOS /usr/etc/install +# IRIX /sbin/install +# AIX /bin/install +# AmigaOS /C/install, which installs bootblocks on floppy discs +# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag +# AFS /usr/afsws/bin/install, which mishandles nonexistent args +# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" +# OS/2's system install, which has a completely different semantic +# ./install, which can be erroneously created by make from ./install.sh. +{ echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5 +echo $ECHO_N "checking for a BSD-compatible install... $ECHO_C" >&6; } +if test -z "$INSTALL"; then +if test "${ac_cv_path_install+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + # Account for people who put trailing slashes in PATH elements. +case $as_dir/ in + ./ | .// | /cC/* | \ + /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ + ?:\\/os2\\/install\\/* | ?:\\/OS2\\/INSTALL\\/* | \ + /usr/ucb/* ) ;; + *) + # OSF1 and SCO ODT 3.0 have their own names for install. + # Don't use installbsd from OSF since it installs stuff as root + # by default. + for ac_prog in ginstall scoinst install; do + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; }; then + if test $ac_prog = install && + grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then + # AIX install. It has an incompatible calling convention. + : + elif test $ac_prog = install && + grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then + # program-specific install script used by HP pwplus--don't use. + : + else + ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" + break 3 + fi + fi + done + done + ;; +esac +done +IFS=$as_save_IFS + + +fi + if test "${ac_cv_path_install+set}" = set; then + INSTALL=$ac_cv_path_install + else + # As a last resort, use the slow shell script. Don't cache a + # value for INSTALL within a source directory, because that will + # break other packages using the cache if that directory is + # removed, or if the value is a relative name. + INSTALL=$ac_install_sh + fi +fi +{ echo "$as_me:$LINENO: result: $INSTALL" >&5 +echo "${ECHO_T}$INSTALL" >&6; } + +# Use test -z because SunOS4 sh mishandles braces in ${var-val}. +# It thinks the first close brace ends the variable substitution. +test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' + +test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' + +test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' + + +if test "$WITH_LLVMGCCDIR" = "default" ; then + LLVMGCC="llvm-gcc${EXEEXT}" + LLVMGXX="llvm-g++${EXEEXT}" + # Extract the first word of "$LLVMGCC", so it can be a program name with args. +set dummy $LLVMGCC; ac_word=$2 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_path_LLVMGCC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + case $LLVMGCC in + [\\/]* | ?:[\\/]*) + ac_cv_path_LLVMGCC="$LLVMGCC" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_path_LLVMGCC="$as_dir/$ac_word$ac_exec_ext" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + + ;; +esac +fi +LLVMGCC=$ac_cv_path_LLVMGCC +if test -n "$LLVMGCC"; then + { echo "$as_me:$LINENO: result: $LLVMGCC" >&5 +echo "${ECHO_T}$LLVMGCC" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + + # Extract the first word of "$LLVMGXX", so it can be a program name with args. +set dummy $LLVMGXX; ac_word=$2 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_path_LLVMGXX+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + case $LLVMGXX in + [\\/]* | ?:[\\/]*) + ac_cv_path_LLVMGXX="$LLVMGXX" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_path_LLVMGXX="$as_dir/$ac_word$ac_exec_ext" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + + ;; +esac +fi +LLVMGXX=$ac_cv_path_LLVMGXX +if test -n "$LLVMGXX"; then + { echo "$as_me:$LINENO: result: $LLVMGXX" >&5 +echo "${ECHO_T}$LLVMGXX" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + +else + if test -z "$LLVMGCC"; then + LLVMGCC="$WITH_LLVMGCCDIR/bin/llvm-gcc${EXEEXT}" + fi + if test -z "$LLVMGXX"; then + LLVMGXX="$WITH_LLVMGCCDIR/bin/llvm-g++${EXEEXT}" + fi + LLVMGCC=$LLVMGCC + + LLVMGXX=$LLVMGXX + +fi + +{ echo "$as_me:$LINENO: checking tool compatibility" >&5 +echo $ECHO_N "checking tool compatibility... $ECHO_C" >&6; } + +ICC=no +IXX=no +case $CC in + icc*|icpc*) + ICC=yes + IXX=yes + ;; + *) + ;; +esac + +if test "$GCC" != "yes" && test "$ICC" != "yes" +then + { { echo "$as_me:$LINENO: error: gcc|icc required but not found" >&5 +echo "$as_me: error: gcc|icc required but not found" >&2;} + { (exit 1); exit 1; }; } +fi + +if test "$GXX" != "yes" && test "$IXX" != "yes" +then + { { echo "$as_me:$LINENO: error: g++|icc required but not found" >&5 +echo "$as_me: error: g++|icc required but not found" >&2;} + { (exit 1); exit 1; }; } +fi + +if test "$GCC" = "yes" +then + cat >conftest.$ac_ext <<_ACEOF +#if !defined(__GNUC__) || __GNUC__ < 3 +#error Unsupported GCC version +#endif + +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + : +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + { { echo "$as_me:$LINENO: error: gcc 3.x required, but you have a lower version" >&5 +echo "$as_me: error: gcc 3.x required, but you have a lower version" >&2;} + { (exit 1); exit 1; }; } +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi + +{ echo "$as_me:$LINENO: result: ok" >&5 +echo "${ECHO_T}ok" >&6; } + + + + +{ echo "$as_me:$LINENO: checking for inflate in -lz" >&5 +echo $ECHO_N "checking for inflate in -lz... $ECHO_C" >&6; } +if test "${ac_cv_lib_z_inflate+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lz $LIBS" +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char inflate (); +int +main () +{ +return inflate (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then + ac_cv_lib_z_inflate=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_lib_z_inflate=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ echo "$as_me:$LINENO: result: $ac_cv_lib_z_inflate" >&5 +echo "${ECHO_T}$ac_cv_lib_z_inflate" >&6; } +if test $ac_cv_lib_z_inflate = yes; then + cat >>confdefs.h <<_ACEOF +#define HAVE_LIBZ 1 +_ACEOF + + LIBS="-lz $LIBS" + +else + \ + { { echo "$as_me:$LINENO: error: You need to install the zlib package (z)." >&5 +echo "$as_me: error: You need to install the zlib package (z)." >&2;} + { (exit 1); exit 1; }; } + +fi + + +if test "x$gc" = "xboehm"; then + +{ echo "$as_me:$LINENO: checking for GC_malloc in -lgc" >&5 +echo $ECHO_N "checking for GC_malloc in -lgc... $ECHO_C" >&6; } +if test "${ac_cv_lib_gc_GC_malloc+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lgc $LIBS" +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char GC_malloc (); +int +main () +{ +return GC_malloc (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then + ac_cv_lib_gc_GC_malloc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_lib_gc_GC_malloc=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ echo "$as_me:$LINENO: result: $ac_cv_lib_gc_GC_malloc" >&5 +echo "${ECHO_T}$ac_cv_lib_gc_GC_malloc" >&6; } +if test $ac_cv_lib_gc_GC_malloc = yes; then + cat >>confdefs.h <<_ACEOF +#define HAVE_LIBGC 1 +_ACEOF + + LIBS="-lgc $LIBS" + +else + \ + { { echo "$as_me:$LINENO: error: You need to install the boehm-gc package (gc)." >&5 +echo "$as_me: error: You need to install the boehm-gc package (gc)." >&2;} + { (exit 1); exit 1; }; } + +fi + +fi + + +if test "${ac_cv_header_zlib_h+set}" = set; then + { echo "$as_me:$LINENO: checking for zlib.h" >&5 +echo $ECHO_N "checking for zlib.h... $ECHO_C" >&6; } +if test "${ac_cv_header_zlib_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +{ echo "$as_me:$LINENO: result: $ac_cv_header_zlib_h" >&5 +echo "${ECHO_T}$ac_cv_header_zlib_h" >&6; } +else + # Is the header compilable? +{ echo "$as_me:$LINENO: checking zlib.h usability" >&5 +echo $ECHO_N "checking zlib.h usability... $ECHO_C" >&6; } +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_compiler=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6; } + +# Is the header present? +{ echo "$as_me:$LINENO: checking zlib.h presence" >&5 +echo $ECHO_N "checking zlib.h presence... $ECHO_C" >&6; } +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +_ACEOF +if { (ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then + ac_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi + +rm -f conftest.err conftest.$ac_ext +{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6; } + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in + yes:no: ) + { echo "$as_me:$LINENO: WARNING: zlib.h: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: zlib.h: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: zlib.h: proceeding with the compiler's result" >&5 +echo "$as_me: WARNING: zlib.h: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes + ;; + no:yes:* ) + { echo "$as_me:$LINENO: WARNING: zlib.h: present but cannot be compiled" >&5 +echo "$as_me: WARNING: zlib.h: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: zlib.h: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: zlib.h: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: zlib.h: see the Autoconf documentation" >&5 +echo "$as_me: WARNING: zlib.h: see the Autoconf documentation" >&2;} + { echo "$as_me:$LINENO: WARNING: zlib.h: section \"Present But Cannot Be Compiled\"" >&5 +echo "$as_me: WARNING: zlib.h: section \"Present But Cannot Be Compiled\"" >&2;} + { echo "$as_me:$LINENO: WARNING: zlib.h: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: zlib.h: proceeding with the preprocessor's result" >&2;} + { echo "$as_me:$LINENO: WARNING: zlib.h: in the future, the compiler will take precedence" >&5 +echo "$as_me: WARNING: zlib.h: in the future, the compiler will take precedence" >&2;} + ( cat <<\_ASBOX +## --------------------------------------- ## +## Report this to nicolas.geoffray at lip6.fr ## +## --------------------------------------- ## +_ASBOX + ) | sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +{ echo "$as_me:$LINENO: checking for zlib.h" >&5 +echo $ECHO_N "checking for zlib.h... $ECHO_C" >&6; } +if test "${ac_cv_header_zlib_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_header_zlib_h=$ac_header_preproc +fi +{ echo "$as_me:$LINENO: result: $ac_cv_header_zlib_h" >&5 +echo "${ECHO_T}$ac_cv_header_zlib_h" >&6; } + +fi +if test $ac_cv_header_zlib_h = yes; then + : +else + \ + { { echo "$as_me:$LINENO: error: You need to install the zlib devel package (zlib.h)." >&5 +echo "$as_me: error: You need to install the zlib devel package (zlib.h)." >&2;} + { (exit 1); exit 1; }; } + +fi + + + +if test "x$gc" = "xboehm"; then + if test "${ac_cv_header_gc_gc_h+set}" = set; then + { echo "$as_me:$LINENO: checking for gc/gc.h" >&5 +echo $ECHO_N "checking for gc/gc.h... $ECHO_C" >&6; } +if test "${ac_cv_header_gc_gc_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +{ echo "$as_me:$LINENO: result: $ac_cv_header_gc_gc_h" >&5 +echo "${ECHO_T}$ac_cv_header_gc_gc_h" >&6; } +else + # Is the header compilable? +{ echo "$as_me:$LINENO: checking gc/gc.h usability" >&5 +echo $ECHO_N "checking gc/gc.h usability... $ECHO_C" >&6; } +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_compiler=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6; } + +# Is the header present? +{ echo "$as_me:$LINENO: checking gc/gc.h presence" >&5 +echo $ECHO_N "checking gc/gc.h presence... $ECHO_C" >&6; } +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +_ACEOF +if { (ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then + ac_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi + +rm -f conftest.err conftest.$ac_ext +{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6; } + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in + yes:no: ) + { echo "$as_me:$LINENO: WARNING: gc/gc.h: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: gc/gc.h: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: gc/gc.h: proceeding with the compiler's result" >&5 +echo "$as_me: WARNING: gc/gc.h: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes + ;; + no:yes:* ) + { echo "$as_me:$LINENO: WARNING: gc/gc.h: present but cannot be compiled" >&5 +echo "$as_me: WARNING: gc/gc.h: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: gc/gc.h: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: gc/gc.h: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: gc/gc.h: see the Autoconf documentation" >&5 +echo "$as_me: WARNING: gc/gc.h: see the Autoconf documentation" >&2;} + { echo "$as_me:$LINENO: WARNING: gc/gc.h: section \"Present But Cannot Be Compiled\"" >&5 +echo "$as_me: WARNING: gc/gc.h: section \"Present But Cannot Be Compiled\"" >&2;} + { echo "$as_me:$LINENO: WARNING: gc/gc.h: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: gc/gc.h: proceeding with the preprocessor's result" >&2;} + { echo "$as_me:$LINENO: WARNING: gc/gc.h: in the future, the compiler will take precedence" >&5 +echo "$as_me: WARNING: gc/gc.h: in the future, the compiler will take precedence" >&2;} + ( cat <<\_ASBOX +## --------------------------------------- ## +## Report this to nicolas.geoffray at lip6.fr ## +## --------------------------------------- ## +_ASBOX + ) | sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +{ echo "$as_me:$LINENO: checking for gc/gc.h" >&5 +echo $ECHO_N "checking for gc/gc.h... $ECHO_C" >&6; } +if test "${ac_cv_header_gc_gc_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_header_gc_gc_h=$ac_header_preproc +fi +{ echo "$as_me:$LINENO: result: $ac_cv_header_gc_gc_h" >&5 +echo "${ECHO_T}$ac_cv_header_gc_gc_h" >&6; } + +fi +if test $ac_cv_header_gc_gc_h = yes; then + : +else + \ + { { echo "$as_me:$LINENO: error: You need to install the boehm-gc devel package (gc/gc.h)." >&5 +echo "$as_me: error: You need to install the boehm-gc devel package (gc/gc.h)." >&2;} + { (exit 1); exit 1; }; } + +fi + + +fi + + +nl===-----------------------------------------------------------------------=== + +{ echo "$as_me:$LINENO: checking for pid_t" >&5 +echo $ECHO_N "checking for pid_t... $ECHO_C" >&6; } +if test "${ac_cv_type_pid_t+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +typedef pid_t ac__type_new_; +int +main () +{ +if ((ac__type_new_ *) 0) + return 0; +if (sizeof (ac__type_new_)) + return 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_cv_type_pid_t=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_type_pid_t=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ echo "$as_me:$LINENO: result: $ac_cv_type_pid_t" >&5 +echo "${ECHO_T}$ac_cv_type_pid_t" >&6; } +if test $ac_cv_type_pid_t = yes; then + : +else + +cat >>confdefs.h <<_ACEOF +#define pid_t int +_ACEOF + +fi + +{ echo "$as_me:$LINENO: checking for size_t" >&5 +echo $ECHO_N "checking for size_t... $ECHO_C" >&6; } +if test "${ac_cv_type_size_t+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +typedef size_t ac__type_new_; +int +main () +{ +if ((ac__type_new_ *) 0) + return 0; +if (sizeof (ac__type_new_)) + return 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_cv_type_size_t=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_type_size_t=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ echo "$as_me:$LINENO: result: $ac_cv_type_size_t" >&5 +echo "${ECHO_T}$ac_cv_type_size_t" >&6; } +if test $ac_cv_type_size_t = yes; then + : +else + +cat >>confdefs.h <<_ACEOF +#define size_t unsigned int +_ACEOF + +fi + +{ echo "$as_me:$LINENO: checking return type of signal handlers" >&5 +echo $ECHO_N "checking return type of signal handlers... $ECHO_C" >&6; } +if test "${ac_cv_type_signal+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +#include + +int +main () +{ +return *(signal (0, 0)) (0) == 1; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_cv_type_signal=int +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_type_signal=void +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ echo "$as_me:$LINENO: result: $ac_cv_type_signal" >&5 +echo "${ECHO_T}$ac_cv_type_signal" >&6; } + +cat >>confdefs.h <<_ACEOF +#define RETSIGTYPE $ac_cv_type_signal +_ACEOF + + +{ echo "$as_me:$LINENO: checking whether struct tm is in sys/time.h or time.h" >&5 +echo $ECHO_N "checking whether struct tm is in sys/time.h or time.h... $ECHO_C" >&6; } +if test "${ac_cv_struct_tm+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +#include + +int +main () +{ +struct tm tm; + int *p = &tm.tm_sec; + return !p; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_cv_struct_tm=time.h +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_struct_tm=sys/time.h +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ echo "$as_me:$LINENO: result: $ac_cv_struct_tm" >&5 +echo "${ECHO_T}$ac_cv_struct_tm" >&6; } +if test $ac_cv_struct_tm = sys/time.h; then + +cat >>confdefs.h <<\_ACEOF +#define TM_IN_SYS_TIME 1 +_ACEOF + +fi + +{ echo "$as_me:$LINENO: checking for int64_t" >&5 +echo $ECHO_N "checking for int64_t... $ECHO_C" >&6; } +if test "${ac_cv_type_int64_t+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +typedef int64_t ac__type_new_; +int +main () +{ +if ((ac__type_new_ *) 0) + return 0; +if (sizeof (ac__type_new_)) + return 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_cv_type_int64_t=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_type_int64_t=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ echo "$as_me:$LINENO: result: $ac_cv_type_int64_t" >&5 +echo "${ECHO_T}$ac_cv_type_int64_t" >&6; } +if test $ac_cv_type_int64_t = yes; then + +cat >>confdefs.h <<_ACEOF +#define HAVE_INT64_T 1 +_ACEOF + + +else + { { echo "$as_me:$LINENO: error: Type int64_t required but not found" >&5 +echo "$as_me: error: Type int64_t required but not found" >&2;} + { (exit 1); exit 1; }; } +fi + +{ echo "$as_me:$LINENO: checking for uint64_t" >&5 +echo $ECHO_N "checking for uint64_t... $ECHO_C" >&6; } +if test "${ac_cv_type_uint64_t+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +typedef uint64_t ac__type_new_; +int +main () +{ +if ((ac__type_new_ *) 0) + return 0; +if (sizeof (ac__type_new_)) + return 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_cv_type_uint64_t=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_type_uint64_t=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ echo "$as_me:$LINENO: result: $ac_cv_type_uint64_t" >&5 +echo "${ECHO_T}$ac_cv_type_uint64_t" >&6; } +if test $ac_cv_type_uint64_t = yes; then + +cat >>confdefs.h <<_ACEOF +#define HAVE_UINT64_T 1 +_ACEOF + + +else + { echo "$as_me:$LINENO: checking for u_int64_t" >&5 +echo $ECHO_N "checking for u_int64_t... $ECHO_C" >&6; } +if test "${ac_cv_type_u_int64_t+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +typedef u_int64_t ac__type_new_; +int +main () +{ +if ((ac__type_new_ *) 0) + return 0; +if (sizeof (ac__type_new_)) + return 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_cv_type_u_int64_t=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_type_u_int64_t=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ echo "$as_me:$LINENO: result: $ac_cv_type_u_int64_t" >&5 +echo "${ECHO_T}$ac_cv_type_u_int64_t" >&6; } +if test $ac_cv_type_u_int64_t = yes; then + +cat >>confdefs.h <<_ACEOF +#define HAVE_U_INT64_T 1 +_ACEOF + + +else + { { echo "$as_me:$LINENO: error: Type uint64_t or u_int64_t required but not found" >&5 +echo "$as_me: error: Type uint64_t or u_int64_t required but not found" >&2;} + { (exit 1); exit 1; }; } +fi + +fi + + + + + +for ac_func in setjmp longjmp +do +as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` +{ echo "$as_me:$LINENO: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6; } +if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* Define $ac_func to an innocuous variant, in case declares $ac_func. + For example, HP-UX 11i declares gettimeofday. */ +#define $ac_func innocuous_$ac_func + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef $ac_func + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char $ac_func (); +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined __stub_$ac_func || defined __stub___$ac_func +choke me +#endif + +int +main () +{ +return $ac_func (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then + eval "$as_ac_var=yes" +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + eval "$as_ac_var=no" +fi + +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext +fi +ac_res=`eval echo '${'$as_ac_var'}'` + { echo "$as_me:$LINENO: result: $ac_res" >&5 +echo "${ECHO_T}$ac_res" >&6; } +if test `eval echo '${'$as_ac_var'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF + +fi +done + + + + + +ac_config_headers="$ac_config_headers include/mvm/Config/config.h" + + + + +ac_config_files="$ac_config_files Makefile.common" + +ac_config_files="$ac_config_files Makefile.config" + +ac_config_files="$ac_config_files lib/JnJVM/Classpath/Classpath.h" + + +ac_config_commands="$ac_config_commands Makefile" + + +ac_config_commands="$ac_config_commands lib/Makefile" + + + + + +cat >confcache <<\_ACEOF +# This file is a shell script that caches the results of configure +# tests run on this system so they can be shared between configure +# scripts and configure runs, see configure's option --config-cache. +# It is not useful on other systems. If it contains results you don't +# want to keep, you may remove or edit it. +# +# config.status only pays attention to the cache file if you give it +# the --recheck option to rerun configure. +# +# `ac_cv_env_foo' variables (set or unset) will be overridden when +# loading this file, other *unset* `ac_cv_foo' will be assigned the +# following values. + +_ACEOF + +# The following way of writing the cache mishandles newlines in values, +# but we know of no workaround that is simple, portable, and efficient. +# So, we kill variables containing newlines. +# Ultrix sh set writes to stderr and can't be redirected directly, +# and sets the high bit in the cache file unless we assign to the vars. +( + for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do + eval ac_val=\$$ac_var + case $ac_val in #( + *${as_nl}*) + case $ac_var in #( + *_cv_*) { echo "$as_me:$LINENO: WARNING: Cache variable $ac_var contains a newline." >&5 +echo "$as_me: WARNING: Cache variable $ac_var contains a newline." >&2;} ;; + esac + case $ac_var in #( + _ | IFS | as_nl) ;; #( + *) $as_unset $ac_var ;; + esac ;; + esac + done + + (set) 2>&1 | + case $as_nl`(ac_space=' '; set) 2>&1` in #( + *${as_nl}ac_space=\ *) + # `set' does not quote correctly, so add quotes (double-quote + # substitution turns \\\\ into \\, and sed turns \\ into \). + sed -n \ + "s/'/'\\\\''/g; + s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" + ;; #( + *) + # `set' quotes correctly as required by POSIX, so do not add quotes. + sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" + ;; + esac | + sort +) | + sed ' + /^ac_cv_env_/b end + t clear + :clear + s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ + t end + s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ + :end' >>confcache +if diff "$cache_file" confcache >/dev/null 2>&1; then :; else + if test -w "$cache_file"; then + test "x$cache_file" != "x/dev/null" && + { echo "$as_me:$LINENO: updating cache $cache_file" >&5 +echo "$as_me: updating cache $cache_file" >&6;} + cat confcache >$cache_file + else + { echo "$as_me:$LINENO: not updating unwritable cache $cache_file" >&5 +echo "$as_me: not updating unwritable cache $cache_file" >&6;} + fi +fi +rm -f confcache + +test "x$prefix" = xNONE && prefix=$ac_default_prefix +# Let make expand exec_prefix. +test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' + +DEFS=-DHAVE_CONFIG_H + +ac_libobjs= +ac_ltlibobjs= +for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue + # 1. Remove the extension, and $U if already installed. + ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' + ac_i=`echo "$ac_i" | sed "$ac_script"` + # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR + # will be set to the directory where LIBOBJS objects are built. + ac_libobjs="$ac_libobjs \${LIBOBJDIR}$ac_i\$U.$ac_objext" + ac_ltlibobjs="$ac_ltlibobjs \${LIBOBJDIR}$ac_i"'$U.lo' +done +LIBOBJS=$ac_libobjs + +LTLIBOBJS=$ac_ltlibobjs + + +if test -z "${SERVICE_BUILD_TRUE}" && test -z "${SERVICE_BUILD_FALSE}"; then + { { echo "$as_me:$LINENO: error: conditional \"SERVICE_BUILD\" was never defined. +Usually this means the macro was only invoked conditionally." >&5 +echo "$as_me: error: conditional \"SERVICE_BUILD\" was never defined. +Usually this means the macro was only invoked conditionally." >&2;} + { (exit 1); exit 1; }; } +fi +if test -z "${ISOLATE_BUILD_TRUE}" && test -z "${ISOLATE_BUILD_FALSE}"; then + { { echo "$as_me:$LINENO: error: conditional \"ISOLATE_BUILD\" was never defined. +Usually this means the macro was only invoked conditionally." >&5 +echo "$as_me: error: conditional \"ISOLATE_BUILD\" was never defined. +Usually this means the macro was only invoked conditionally." >&2;} + { (exit 1); exit 1; }; } +fi +if test -z "${WITH_N3_TRUE}" && test -z "${WITH_N3_FALSE}"; then + { { echo "$as_me:$LINENO: error: conditional \"WITH_N3\" was never defined. +Usually this means the macro was only invoked conditionally." >&5 +echo "$as_me: error: conditional \"WITH_N3\" was never defined. +Usually this means the macro was only invoked conditionally." >&2;} + { (exit 1); exit 1; }; } +fi + +: ${CONFIG_STATUS=./config.status} +ac_clean_files_save=$ac_clean_files +ac_clean_files="$ac_clean_files $CONFIG_STATUS" +{ echo "$as_me:$LINENO: creating $CONFIG_STATUS" >&5 +echo "$as_me: creating $CONFIG_STATUS" >&6;} +cat >$CONFIG_STATUS <<_ACEOF +#! $SHELL +# Generated by $as_me. +# Run this file to recreate the current configuration. +# Compiler output produced by configure, useful for debugging +# configure, is in config.log if it exists. + +debug=false +ac_cs_recheck=false +ac_cs_silent=false +SHELL=\${CONFIG_SHELL-$SHELL} +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF +## --------------------- ## +## M4sh Initialization. ## +## --------------------- ## + +# Be more Bourne compatible +DUALCASE=1; export DUALCASE # for MKS sh +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then + emulate sh + NULLCMD=: + # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' + setopt NO_GLOB_SUBST +else + case `(set -o) 2>/dev/null` in + *posix*) set -o posix ;; +esac + +fi + + + + +# PATH needs CR +# Avoid depending upon Character Ranges. +as_cr_letters='abcdefghijklmnopqrstuvwxyz' +as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' +as_cr_Letters=$as_cr_letters$as_cr_LETTERS +as_cr_digits='0123456789' +as_cr_alnum=$as_cr_Letters$as_cr_digits + +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + echo "#! /bin/sh" >conf$$.sh + echo "exit 0" >>conf$$.sh + chmod +x conf$$.sh + if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then + PATH_SEPARATOR=';' + else + PATH_SEPARATOR=: + fi + rm -f conf$$.sh +fi + +# Support unset when possible. +if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then + as_unset=unset +else + as_unset=false +fi + + +# IFS +# We need space, tab and new line, in precisely that order. Quoting is +# there to prevent editors from complaining about space-tab. +# (If _AS_PATH_WALK were called with IFS unset, it would disable word +# splitting by setting IFS to empty value.) +as_nl=' +' +IFS=" "" $as_nl" + +# Find who we are. Look in the path if we contain no directory separator. +case $0 in + *[\\/]* ) as_myself=$0 ;; + *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break +done +IFS=$as_save_IFS + + ;; +esac +# We did not find ourselves, most probably we were run as `sh COMMAND' +# in which case we are not to be found in the path. +if test "x$as_myself" = x; then + as_myself=$0 +fi +if test ! -f "$as_myself"; then + echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 + { (exit 1); exit 1; } +fi + +# Work around bugs in pre-3.0 UWIN ksh. +for as_var in ENV MAIL MAILPATH +do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var +done +PS1='$ ' +PS2='> ' +PS4='+ ' + +# NLS nuisances. +for as_var in \ + LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ + LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ + LC_TELEPHONE LC_TIME +do + if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then + eval $as_var=C; export $as_var + else + ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var + fi +done + +# Required to use basename. +if expr a : '\(a\)' >/dev/null 2>&1 && + test "X`expr 00001 : '.*\(...\)'`" = X001; then + as_expr=expr +else + as_expr=false +fi + +if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then + as_basename=basename +else + as_basename=false +fi + + +# Name of the executable. +as_me=`$as_basename -- "$0" || +$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)' \| . 2>/dev/null || +echo X/"$0" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ + s//\1/ + q + } + /^X\/\(\/\/\)$/{ + s//\1/ + q + } + /^X\/\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + +# CDPATH. +$as_unset CDPATH + + + + as_lineno_1=$LINENO + as_lineno_2=$LINENO + test "x$as_lineno_1" != "x$as_lineno_2" && + test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2" || { + + # Create $as_me.lineno as a copy of $as_myself, but with $LINENO + # uniformly replaced by the line number. The first 'sed' inserts a + # line-number line after each line using $LINENO; the second 'sed' + # does the real work. The second script uses 'N' to pair each + # line-number line with the line containing $LINENO, and appends + # trailing '-' during substitution so that $LINENO is not a special + # case at line end. + # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the + # scripts with optimization help from Paolo Bonzini. Blame Lee + # E. McMahon (1931-1989) for sed's syntax. :-) + sed -n ' + p + /[$]LINENO/= + ' <$as_myself | + sed ' + s/[$]LINENO.*/&-/ + t lineno + b + :lineno + N + :loop + s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ + t loop + s/-\n.*// + ' >$as_me.lineno && + chmod +x "$as_me.lineno" || + { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2 + { (exit 1); exit 1; }; } + + # Don't try to exec as it changes $[0], causing all sort of problems + # (the dirname of $[0] is not the place where we might find the + # original and so on. Autoconf is especially sensitive to this). + . "./$as_me.lineno" + # Exit status is that of the last command. + exit +} + + +if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then + as_dirname=dirname +else + as_dirname=false +fi + +ECHO_C= ECHO_N= ECHO_T= +case `echo -n x` in +-n*) + case `echo 'x\c'` in + *c*) ECHO_T=' ';; # ECHO_T is single tab character. + *) ECHO_C='\c';; + esac;; +*) + ECHO_N='-n';; +esac + +if expr a : '\(a\)' >/dev/null 2>&1 && + test "X`expr 00001 : '.*\(...\)'`" = X001; then + as_expr=expr +else + as_expr=false +fi + +rm -f conf$$ conf$$.exe conf$$.file +if test -d conf$$.dir; then + rm -f conf$$.dir/conf$$.file +else + rm -f conf$$.dir + mkdir conf$$.dir +fi +echo >conf$$.file +if ln -s conf$$.file conf$$ 2>/dev/null; then + as_ln_s='ln -s' + # ... but there are two gotchas: + # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. + # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. + # In both cases, we have to default to `cp -p'. + ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || + as_ln_s='cp -p' +elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln +else + as_ln_s='cp -p' +fi +rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file +rmdir conf$$.dir 2>/dev/null + +if mkdir -p . 2>/dev/null; then + as_mkdir_p=: +else + test -d ./-p && rmdir ./-p + as_mkdir_p=false +fi + +if test -x / >/dev/null 2>&1; then + as_test_x='test -x' +else + if ls -dL / >/dev/null 2>&1; then + as_ls_L_option=L + else + as_ls_L_option= + fi + as_test_x=' + eval sh -c '\'' + if test -d "$1"; then + test -d "$1/."; + else + case $1 in + -*)set "./$1";; + esac; + case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in + ???[sx]*):;;*)false;;esac;fi + '\'' sh + ' +fi +as_executable_p=$as_test_x + +# Sed expression to map a string onto a valid CPP name. +as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" + +# Sed expression to map a string onto a valid variable name. +as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" + + +exec 6>&1 + +# Save the log message, to keep $[0] and so on meaningful, and to +# report actual input values of CONFIG_FILES etc. instead of their +# values after options handling. +ac_log=" +This file was extended by vmkit $as_me 0.0.1, which was +generated by GNU Autoconf 2.61. Invocation command line was + + CONFIG_FILES = $CONFIG_FILES + CONFIG_HEADERS = $CONFIG_HEADERS + CONFIG_LINKS = $CONFIG_LINKS + CONFIG_COMMANDS = $CONFIG_COMMANDS + $ $0 $@ + +on `(hostname || uname -n) 2>/dev/null | sed 1q` +" + +_ACEOF + +cat >>$CONFIG_STATUS <<_ACEOF +# Files that config.status was made for. +config_files="$ac_config_files" +config_headers="$ac_config_headers" +config_commands="$ac_config_commands" + +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF +ac_cs_usage="\ +\`$as_me' instantiates files from templates according to the +current configuration. + +Usage: $0 [OPTIONS] [FILE]... + + -h, --help print this help, then exit + -V, --version print version number and configuration settings, then exit + -q, --quiet do not print progress messages + -d, --debug don't remove temporary files + --recheck update $as_me by reconfiguring in the same conditions + --file=FILE[:TEMPLATE] + instantiate the configuration file FILE + --header=FILE[:TEMPLATE] + instantiate the configuration header FILE + +Configuration files: +$config_files + +Configuration headers: +$config_headers + +Configuration commands: +$config_commands + +Report bugs to ." + +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF +ac_cs_version="\\ +vmkit config.status 0.0.1 +configured by $0, generated by GNU Autoconf 2.61, + with options \\"`echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\" + +Copyright (C) 2006 Free Software Foundation, Inc. +This config.status script is free software; the Free Software Foundation +gives unlimited permission to copy, distribute and modify it." + +ac_pwd='$ac_pwd' +srcdir='$srcdir' +INSTALL='$INSTALL' +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF +# If no file are specified by the user, then we need to provide default +# value. By we need to know if files were specified by the user. +ac_need_defaults=: +while test $# != 0 +do + case $1 in + --*=*) + ac_option=`expr "X$1" : 'X\([^=]*\)='` + ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'` + ac_shift=: + ;; + *) + ac_option=$1 + ac_optarg=$2 + ac_shift=shift + ;; + esac + + case $ac_option in + # Handling of the options. + -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) + ac_cs_recheck=: ;; + --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) + echo "$ac_cs_version"; exit ;; + --debug | --debu | --deb | --de | --d | -d ) + debug=: ;; + --file | --fil | --fi | --f ) + $ac_shift + CONFIG_FILES="$CONFIG_FILES $ac_optarg" + ac_need_defaults=false;; + --header | --heade | --head | --hea ) + $ac_shift + CONFIG_HEADERS="$CONFIG_HEADERS $ac_optarg" + ac_need_defaults=false;; + --he | --h) + # Conflict between --help and --header + { echo "$as_me: error: ambiguous option: $1 +Try \`$0 --help' for more information." >&2 + { (exit 1); exit 1; }; };; + --help | --hel | -h ) + echo "$ac_cs_usage"; exit ;; + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil | --si | --s) + ac_cs_silent=: ;; + + # This is an error. + -*) { echo "$as_me: error: unrecognized option: $1 +Try \`$0 --help' for more information." >&2 + { (exit 1); exit 1; }; } ;; + + *) ac_config_targets="$ac_config_targets $1" + ac_need_defaults=false ;; + + esac + shift +done + +ac_configure_extra_args= + +if $ac_cs_silent; then + exec 6>/dev/null + ac_configure_extra_args="$ac_configure_extra_args --silent" +fi + +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF +if \$ac_cs_recheck; then + echo "running CONFIG_SHELL=$SHELL $SHELL $0 "$ac_configure_args \$ac_configure_extra_args " --no-create --no-recursion" >&6 + CONFIG_SHELL=$SHELL + export CONFIG_SHELL + exec $SHELL "$0"$ac_configure_args \$ac_configure_extra_args --no-create --no-recursion +fi + +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF +exec 5>>config.log +{ + echo + sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX +## Running $as_me. ## +_ASBOX + echo "$ac_log" +} >&5 + +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF +# +# INIT-COMMANDS +# +llvm_src="${LLVM_SRC}" + +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF + +# Handling of arguments. +for ac_config_target in $ac_config_targets +do + case $ac_config_target in + "setup") CONFIG_COMMANDS="$CONFIG_COMMANDS setup" ;; + "include/mvm/Config/config.h") CONFIG_HEADERS="$CONFIG_HEADERS include/mvm/Config/config.h" ;; + "Makefile.common") CONFIG_FILES="$CONFIG_FILES Makefile.common" ;; + "Makefile.config") CONFIG_FILES="$CONFIG_FILES Makefile.config" ;; + "lib/JnJVM/Classpath/Classpath.h") CONFIG_FILES="$CONFIG_FILES lib/JnJVM/Classpath/Classpath.h" ;; + "Makefile") CONFIG_COMMANDS="$CONFIG_COMMANDS Makefile" ;; + "lib/Makefile") CONFIG_COMMANDS="$CONFIG_COMMANDS lib/Makefile" ;; + + *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5 +echo "$as_me: error: invalid argument: $ac_config_target" >&2;} + { (exit 1); exit 1; }; };; + esac +done + + +# If the user did not use the arguments to specify the items to instantiate, +# then the envvar interface is used. Set only those that are not. +# We use the long form for the default assignment because of an extremely +# bizarre bug on SunOS 4.1.3. +if $ac_need_defaults; then + test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files + test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers + test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands +fi + +# Have a temporary directory for convenience. Make it in the build tree +# simply because there is no reason against having it here, and in addition, +# creating and moving files from /tmp can sometimes cause problems. +# Hook for its removal unless debugging. +# Note that there is a small window in which the directory will not be cleaned: +# after its creation but before its name has been assigned to `$tmp'. +$debug || +{ + tmp= + trap 'exit_status=$? + { test -z "$tmp" || test ! -d "$tmp" || rm -fr "$tmp"; } && exit $exit_status +' 0 + trap '{ (exit 1); exit 1; }' 1 2 13 15 +} +# Create a (secure) tmp directory for tmp files. + +{ + tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && + test -n "$tmp" && test -d "$tmp" +} || +{ + tmp=./conf$$-$RANDOM + (umask 077 && mkdir "$tmp") +} || +{ + echo "$me: cannot create a temporary directory in ." >&2 + { (exit 1); exit 1; } +} + +# +# Set up the sed scripts for CONFIG_FILES section. +# + +# No need to generate the scripts if there are no CONFIG_FILES. +# This happens for instance when ./config.status config.h +if test -n "$CONFIG_FILES"; then + +_ACEOF + + + +ac_delim='%!_!# ' +for ac_last_try in false false false false false :; do + cat >conf$$subs.sed <<_ACEOF +SHELL!$SHELL$ac_delim +PATH_SEPARATOR!$PATH_SEPARATOR$ac_delim +PACKAGE_NAME!$PACKAGE_NAME$ac_delim +PACKAGE_TARNAME!$PACKAGE_TARNAME$ac_delim +PACKAGE_VERSION!$PACKAGE_VERSION$ac_delim +PACKAGE_STRING!$PACKAGE_STRING$ac_delim +PACKAGE_BUGREPORT!$PACKAGE_BUGREPORT$ac_delim +exec_prefix!$exec_prefix$ac_delim +prefix!$prefix$ac_delim +program_transform_name!$program_transform_name$ac_delim +bindir!$bindir$ac_delim +sbindir!$sbindir$ac_delim +libexecdir!$libexecdir$ac_delim +datarootdir!$datarootdir$ac_delim +datadir!$datadir$ac_delim +sysconfdir!$sysconfdir$ac_delim +sharedstatedir!$sharedstatedir$ac_delim +localstatedir!$localstatedir$ac_delim +includedir!$includedir$ac_delim +oldincludedir!$oldincludedir$ac_delim +docdir!$docdir$ac_delim +infodir!$infodir$ac_delim +htmldir!$htmldir$ac_delim +dvidir!$dvidir$ac_delim +pdfdir!$pdfdir$ac_delim +psdir!$psdir$ac_delim +libdir!$libdir$ac_delim +localedir!$localedir$ac_delim +mandir!$mandir$ac_delim +DEFS!$DEFS$ac_delim +ECHO_C!$ECHO_C$ac_delim +ECHO_N!$ECHO_N$ac_delim +ECHO_T!$ECHO_T$ac_delim +LIBS!$LIBS$ac_delim +build_alias!$build_alias$ac_delim +host_alias!$host_alias$ac_delim +target_alias!$target_alias$ac_delim +VMKIT_COPYRIGHT!$VMKIT_COPYRIGHT$ac_delim +LLVM_SRC!$LLVM_SRC$ac_delim +LLVM_OBJ!$LLVM_OBJ$ac_delim +build!$build$ac_delim +build_cpu!$build_cpu$ac_delim +build_vendor!$build_vendor$ac_delim +build_os!$build_os$ac_delim +host!$host$ac_delim +host_cpu!$host_cpu$ac_delim +host_vendor!$host_vendor$ac_delim +host_os!$host_os$ac_delim +target!$target$ac_delim +target_cpu!$target_cpu$ac_delim +target_vendor!$target_vendor$ac_delim +target_os!$target_os$ac_delim +DYLIB_EXTENSION!$DYLIB_EXTENSION$ac_delim +CC!$CC$ac_delim +CFLAGS!$CFLAGS$ac_delim +LDFLAGS!$LDFLAGS$ac_delim +CPPFLAGS!$CPPFLAGS$ac_delim +ac_ct_CC!$ac_ct_CC$ac_delim +EXEEXT!$EXEEXT$ac_delim +OBJEXT!$OBJEXT$ac_delim +CPP!$CPP$ac_delim +GREP!$GREP$ac_delim +EGREP!$EGREP$ac_delim +GC_MMAP2!$GC_MMAP2$ac_delim +GC_BOEHM!$GC_BOEHM$ac_delim +GC_MULTI_MMAP!$GC_MULTI_MMAP$ac_delim +GC_SINGLE_MMAP!$GC_SINGLE_MMAP$ac_delim +GC_FLAGS!$GC_FLAGS$ac_delim +GC_LIBS!$GC_LIBS$ac_delim +SERVICE_BUILD_TRUE!$SERVICE_BUILD_TRUE$ac_delim +SERVICE_BUILD_FALSE!$SERVICE_BUILD_FALSE$ac_delim +ISOLATE_BUILD_TRUE!$ISOLATE_BUILD_TRUE$ac_delim +ISOLATE_BUILD_FALSE!$ISOLATE_BUILD_FALSE$ac_delim +classpathglibj!$classpathglibj$ac_delim +classpathlibs!$classpathlibs$ac_delim +classpathinclude!$classpathinclude$ac_delim +gnuclasspathversion!$gnuclasspathversion$ac_delim +WITH_N3_TRUE!$WITH_N3_TRUE$ac_delim +WITH_N3_FALSE!$WITH_N3_FALSE$ac_delim +pnetlocalprefix!$pnetlocalprefix$ac_delim +CXX!$CXX$ac_delim +CXXFLAGS!$CXXFLAGS$ac_delim +ac_ct_CXX!$ac_ct_CXX$ac_delim +NM!$NM$ac_delim +LN_S!$LN_S$ac_delim +CMP!$CMP$ac_delim +CP!$CP$ac_delim +DATE!$DATE$ac_delim +FIND!$FIND$ac_delim +MKDIR!$MKDIR$ac_delim +MV!$MV$ac_delim +RANLIB!$RANLIB$ac_delim +RM!$RM$ac_delim +SED!$SED$ac_delim +TAR!$TAR$ac_delim +BINPWD!$BINPWD$ac_delim +CAT!$CAT$ac_delim +_ACEOF + + if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 97; then + break + elif $ac_last_try; then + { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5 +echo "$as_me: error: could not make $CONFIG_STATUS" >&2;} + { (exit 1); exit 1; }; } + else + ac_delim="$ac_delim!$ac_delim _$ac_delim!! " + fi +done + +ac_eof=`sed -n '/^CEOF[0-9]*$/s/CEOF/0/p' conf$$subs.sed` +if test -n "$ac_eof"; then + ac_eof=`echo "$ac_eof" | sort -nru | sed 1q` + ac_eof=`expr $ac_eof + 1` +fi + +cat >>$CONFIG_STATUS <<_ACEOF +cat >"\$tmp/subs-1.sed" <<\CEOF$ac_eof +/@[a-zA-Z_][a-zA-Z_0-9]*@/!b +_ACEOF +sed ' +s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g +s/^/s,@/; s/!/@,|#_!!_#|/ +:n +t n +s/'"$ac_delim"'$/,g/; t +s/$/\\/; p +N; s/^.*\n//; s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g; b n +' >>$CONFIG_STATUS >$CONFIG_STATUS <<_ACEOF +CEOF$ac_eof +_ACEOF + + +ac_delim='%!_!# ' +for ac_last_try in false false false false false :; do + cat >conf$$subs.sed <<_ACEOF +LLVMAS!$LLVMAS$ac_delim +LLC!$LLC$ac_delim +INSTALL_PROGRAM!$INSTALL_PROGRAM$ac_delim +INSTALL_SCRIPT!$INSTALL_SCRIPT$ac_delim +INSTALL_DATA!$INSTALL_DATA$ac_delim +LLVMGCC!$LLVMGCC$ac_delim +LLVMGXX!$LLVMGXX$ac_delim +LIBOBJS!$LIBOBJS$ac_delim +LTLIBOBJS!$LTLIBOBJS$ac_delim +_ACEOF + + if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 9; then + break + elif $ac_last_try; then + { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5 +echo "$as_me: error: could not make $CONFIG_STATUS" >&2;} + { (exit 1); exit 1; }; } + else + ac_delim="$ac_delim!$ac_delim _$ac_delim!! " + fi +done + +ac_eof=`sed -n '/^CEOF[0-9]*$/s/CEOF/0/p' conf$$subs.sed` +if test -n "$ac_eof"; then + ac_eof=`echo "$ac_eof" | sort -nru | sed 1q` + ac_eof=`expr $ac_eof + 1` +fi + +cat >>$CONFIG_STATUS <<_ACEOF +cat >"\$tmp/subs-2.sed" <<\CEOF$ac_eof +/@[a-zA-Z_][a-zA-Z_0-9]*@/!b end +_ACEOF +sed ' +s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g +s/^/s,@/; s/!/@,|#_!!_#|/ +:n +t n +s/'"$ac_delim"'$/,g/; t +s/$/\\/; p +N; s/^.*\n//; s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g; b n +' >>$CONFIG_STATUS >$CONFIG_STATUS <<_ACEOF +:end +s/|#_!!_#|//g +CEOF$ac_eof +_ACEOF + + +# VPATH may cause trouble with some makes, so we remove $(srcdir), +# ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and +# trailing colons and then remove the whole line if VPATH becomes empty +# (actually we leave an empty line to preserve line numbers). +if test "x$srcdir" = x.; then + ac_vpsub='/^[ ]*VPATH[ ]*=/{ +s/:*\$(srcdir):*/:/ +s/:*\${srcdir}:*/:/ +s/:*@srcdir@:*/:/ +s/^\([^=]*=[ ]*\):*/\1/ +s/:*$// +s/^[^=]*=[ ]*$// +}' +fi + +cat >>$CONFIG_STATUS <<\_ACEOF +fi # test -n "$CONFIG_FILES" + + +for ac_tag in :F $CONFIG_FILES :H $CONFIG_HEADERS :C $CONFIG_COMMANDS +do + case $ac_tag in + :[FHLC]) ac_mode=$ac_tag; continue;; + esac + case $ac_mode$ac_tag in + :[FHL]*:*);; + :L* | :C*:*) { { echo "$as_me:$LINENO: error: Invalid tag $ac_tag." >&5 +echo "$as_me: error: Invalid tag $ac_tag." >&2;} + { (exit 1); exit 1; }; };; + :[FH]-) ac_tag=-:-;; + :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; + esac + ac_save_IFS=$IFS + IFS=: + set x $ac_tag + IFS=$ac_save_IFS + shift + ac_file=$1 + shift + + case $ac_mode in + :L) ac_source=$1;; + :[FH]) + ac_file_inputs= + for ac_f + do + case $ac_f in + -) ac_f="$tmp/stdin";; + *) # Look for the file first in the build tree, then in the source tree + # (if the path is not absolute). The absolute path cannot be DOS-style, + # because $ac_f cannot contain `:'. + test -f "$ac_f" || + case $ac_f in + [\\/$]*) false;; + *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; + esac || + { { echo "$as_me:$LINENO: error: cannot find input file: $ac_f" >&5 +echo "$as_me: error: cannot find input file: $ac_f" >&2;} + { (exit 1); exit 1; }; };; + esac + ac_file_inputs="$ac_file_inputs $ac_f" + done + + # Let's still pretend it is `configure' which instantiates (i.e., don't + # use $as_me), people would be surprised to read: + # /* config.h. Generated by config.status. */ + configure_input="Generated from "`IFS=: + echo $* | sed 's|^[^:]*/||;s|:[^:]*/|, |g'`" by configure." + if test x"$ac_file" != x-; then + configure_input="$ac_file. $configure_input" + { echo "$as_me:$LINENO: creating $ac_file" >&5 +echo "$as_me: creating $ac_file" >&6;} + fi + + case $ac_tag in + *:-:* | *:-) cat >"$tmp/stdin";; + esac + ;; + esac + + ac_dir=`$as_dirname -- "$ac_file" || +$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$ac_file" : 'X\(//\)[^/]' \| \ + X"$ac_file" : 'X\(//\)$' \| \ + X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || +echo X"$ac_file" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + { as_dir="$ac_dir" + case $as_dir in #( + -*) as_dir=./$as_dir;; + esac + test -d "$as_dir" || { $as_mkdir_p && mkdir -p "$as_dir"; } || { + as_dirs= + while :; do + case $as_dir in #( + *\'*) as_qdir=`echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #( + *) as_qdir=$as_dir;; + esac + as_dirs="'$as_qdir' $as_dirs" + as_dir=`$as_dirname -- "$as_dir" || +$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || +echo X"$as_dir" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + test -d "$as_dir" && break + done + test -z "$as_dirs" || eval "mkdir $as_dirs" + } || test -d "$as_dir" || { { echo "$as_me:$LINENO: error: cannot create directory $as_dir" >&5 +echo "$as_me: error: cannot create directory $as_dir" >&2;} + { (exit 1); exit 1; }; }; } + ac_builddir=. + +case "$ac_dir" in +.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; +*) + ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` + # A ".." for each directory in $ac_dir_suffix. + ac_top_builddir_sub=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,/..,g;s,/,,'` + case $ac_top_builddir_sub in + "") ac_top_builddir_sub=. ac_top_build_prefix= ;; + *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; + esac ;; +esac +ac_abs_top_builddir=$ac_pwd +ac_abs_builddir=$ac_pwd$ac_dir_suffix +# for backward compatibility: +ac_top_builddir=$ac_top_build_prefix + +case $srcdir in + .) # We are building in place. + ac_srcdir=. + ac_top_srcdir=$ac_top_builddir_sub + ac_abs_top_srcdir=$ac_pwd ;; + [\\/]* | ?:[\\/]* ) # Absolute name. + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir + ac_abs_top_srcdir=$srcdir ;; + *) # Relative name. + ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_build_prefix$srcdir + ac_abs_top_srcdir=$ac_pwd/$srcdir ;; +esac +ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix + + + case $ac_mode in + :F) + # + # CONFIG_FILE + # + + case $INSTALL in + [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; + *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;; + esac +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF +# If the template does not know about datarootdir, expand it. +# FIXME: This hack should be removed a few years after 2.60. +ac_datarootdir_hack=; ac_datarootdir_seen= + +case `sed -n '/datarootdir/ { + p + q +} +/@datadir@/p +/@docdir@/p +/@infodir@/p +/@localedir@/p +/@mandir@/p +' $ac_file_inputs` in +*datarootdir*) ac_datarootdir_seen=yes;; +*@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) + { echo "$as_me:$LINENO: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 +echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF + ac_datarootdir_hack=' + s&@datadir@&$datadir&g + s&@docdir@&$docdir&g + s&@infodir@&$infodir&g + s&@localedir@&$localedir&g + s&@mandir@&$mandir&g + s&\\\${datarootdir}&$datarootdir&g' ;; +esac +_ACEOF + +# Neutralize VPATH when `$srcdir' = `.'. +# Shell code in configure.ac might set extrasub. +# FIXME: do we really want to maintain this feature? +cat >>$CONFIG_STATUS <<_ACEOF + sed "$ac_vpsub +$extrasub +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF +:t +/@[a-zA-Z_][a-zA-Z_0-9]*@/!b +s&@configure_input@&$configure_input&;t t +s&@top_builddir@&$ac_top_builddir_sub&;t t +s&@srcdir@&$ac_srcdir&;t t +s&@abs_srcdir@&$ac_abs_srcdir&;t t +s&@top_srcdir@&$ac_top_srcdir&;t t +s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t +s&@builddir@&$ac_builddir&;t t +s&@abs_builddir@&$ac_abs_builddir&;t t +s&@abs_top_builddir@&$ac_abs_top_builddir&;t t +s&@INSTALL@&$ac_INSTALL&;t t +$ac_datarootdir_hack +" $ac_file_inputs | sed -f "$tmp/subs-1.sed" | sed -f "$tmp/subs-2.sed" >$tmp/out + +test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && + { ac_out=`sed -n '/\${datarootdir}/p' "$tmp/out"`; test -n "$ac_out"; } && + { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' "$tmp/out"`; test -z "$ac_out"; } && + { echo "$as_me:$LINENO: WARNING: $ac_file contains a reference to the variable \`datarootdir' +which seems to be undefined. Please make sure it is defined." >&5 +echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' +which seems to be undefined. Please make sure it is defined." >&2;} + + rm -f "$tmp/stdin" + case $ac_file in + -) cat "$tmp/out"; rm -f "$tmp/out";; + *) rm -f "$ac_file"; mv "$tmp/out" $ac_file;; + esac + ;; + :H) + # + # CONFIG_HEADER + # +_ACEOF + +# Transform confdefs.h into a sed script `conftest.defines', that +# substitutes the proper values into config.h.in to produce config.h. +rm -f conftest.defines conftest.tail +# First, append a space to every undef/define line, to ease matching. +echo 's/$/ /' >conftest.defines +# Then, protect against being on the right side of a sed subst, or in +# an unquoted here document, in config.status. If some macros were +# called several times there might be several #defines for the same +# symbol, which is useless. But do not sort them, since the last +# AC_DEFINE must be honored. +ac_word_re=[_$as_cr_Letters][_$as_cr_alnum]* +# These sed commands are passed to sed as "A NAME B PARAMS C VALUE D", where +# NAME is the cpp macro being defined, VALUE is the value it is being given. +# PARAMS is the parameter list in the macro definition--in most cases, it's +# just an empty string. +ac_dA='s,^\\([ #]*\\)[^ ]*\\([ ]*' +ac_dB='\\)[ (].*,\\1define\\2' +ac_dC=' ' +ac_dD=' ,' + +uniq confdefs.h | + sed -n ' + t rset + :rset + s/^[ ]*#[ ]*define[ ][ ]*// + t ok + d + :ok + s/[\\&,]/\\&/g + s/^\('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/ '"$ac_dA"'\1'"$ac_dB"'\2'"${ac_dC}"'\3'"$ac_dD"'/p + s/^\('"$ac_word_re"'\)[ ]*\(.*\)/'"$ac_dA"'\1'"$ac_dB$ac_dC"'\2'"$ac_dD"'/p + ' >>conftest.defines + +# Remove the space that was appended to ease matching. +# Then replace #undef with comments. This is necessary, for +# example, in the case of _POSIX_SOURCE, which is predefined and required +# on some systems where configure will not decide to define it. +# (The regexp can be short, since the line contains either #define or #undef.) +echo 's/ $// +s,^[ #]*u.*,/* & */,' >>conftest.defines + +# Break up conftest.defines: +ac_max_sed_lines=50 + +# First sed command is: sed -f defines.sed $ac_file_inputs >"$tmp/out1" +# Second one is: sed -f defines.sed "$tmp/out1" >"$tmp/out2" +# Third one will be: sed -f defines.sed "$tmp/out2" >"$tmp/out1" +# et cetera. +ac_in='$ac_file_inputs' +ac_out='"$tmp/out1"' +ac_nxt='"$tmp/out2"' + +while : +do + # Write a here document: + cat >>$CONFIG_STATUS <<_ACEOF + # First, check the format of the line: + cat >"\$tmp/defines.sed" <<\\CEOF +/^[ ]*#[ ]*undef[ ][ ]*$ac_word_re[ ]*\$/b def +/^[ ]*#[ ]*define[ ][ ]*$ac_word_re[( ]/b def +b +:def +_ACEOF + sed ${ac_max_sed_lines}q conftest.defines >>$CONFIG_STATUS + echo 'CEOF + sed -f "$tmp/defines.sed"' "$ac_in >$ac_out" >>$CONFIG_STATUS + ac_in=$ac_out; ac_out=$ac_nxt; ac_nxt=$ac_in + sed 1,${ac_max_sed_lines}d conftest.defines >conftest.tail + grep . conftest.tail >/dev/null || break + rm -f conftest.defines + mv conftest.tail conftest.defines +done +rm -f conftest.defines conftest.tail + +echo "ac_result=$ac_in" >>$CONFIG_STATUS +cat >>$CONFIG_STATUS <<\_ACEOF + if test x"$ac_file" != x-; then + echo "/* $configure_input */" >"$tmp/config.h" + cat "$ac_result" >>"$tmp/config.h" + if diff $ac_file "$tmp/config.h" >/dev/null 2>&1; then + { echo "$as_me:$LINENO: $ac_file is unchanged" >&5 +echo "$as_me: $ac_file is unchanged" >&6;} + else + rm -f $ac_file + mv "$tmp/config.h" $ac_file + fi + else + echo "/* $configure_input */" + cat "$ac_result" + fi + rm -f "$tmp/out12" + ;; + + :C) { echo "$as_me:$LINENO: executing $ac_file commands" >&5 +echo "$as_me: executing $ac_file commands" >&6;} + ;; + esac + + + case $ac_file$ac_mode in + "Makefile":C) ${llvm_src}/autoconf/mkinstalldirs `dirname Makefile` + ${SHELL} ${llvm_src}/autoconf/install-sh -c ${srcdir}/Makefile Makefile ;; + "lib/Makefile":C) ${llvm_src}/autoconf/mkinstalldirs `dirname lib/Makefile` + ${SHELL} ${llvm_src}/autoconf/install-sh -c ${srcdir}/lib/Makefile lib/Makefile ;; + + esac +done # for ac_tag + + +{ (exit 0); exit 0; } +_ACEOF +chmod +x $CONFIG_STATUS +ac_clean_files=$ac_clean_files_save + + +# configure is writing to config.log, and then calls config.status. +# config.status does its own redirection, appending to config.log. +# Unfortunately, on DOS this fails, as config.log is still kept open +# by configure, so config.status won't be able to write to it; its +# output is simply discarded. So we exec the FD to /dev/null, +# effectively closing config.log, so it can be properly (re)opened and +# appended to by config.status. When coming back to configure, we +# need to make the FD available again. +if test "$no_create" != yes; then + ac_cs_success=: + ac_config_status_args= + test "$silent" = yes && + ac_config_status_args="$ac_config_status_args --quiet" + exec 5>/dev/null + $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false + exec 5>>config.log + # Use ||, not &&, to avoid exiting from the if with $? = 1, which + # would make configure fail if this is the last instruction. + $ac_cs_success || { (exit 1); exit 1; } +fi + Propchange: vmkit/trunk/configure ------------------------------------------------------------------------------ svn:executable = * Removed: vmkit/trunk/configure.ac URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/configure.ac?rev=52707&view=auto ============================================================================== --- vmkit/trunk/configure.ac (original) +++ vmkit/trunk/configure.ac (removed) @@ -1,339 +0,0 @@ -dnl Process this file with autoconf to produce a configure script - -AC_INIT([vmkit],[0.0.1]) -AC_PREREQ([2.59]) -AC_CONFIG_SRCDIR([lib/Mvm/Main.cpp]) - - -dnl ************************************************************************** -dnl configure date, in version.cc.in -dnl ************************************************************************** -configure_date=`date '+%Y-%m-%d %H:%M:%S'` -AC_SUBST([configure_date]) - -dnl ************************************************************************** -dnl Initialize target_cpu, target_os etc ... -dnl ************************************************************************** -AC_CANONICAL_TARGET - -dnl ************************************************************************** -dnl Add some vars -dnl ************************************************************************** -AM_CONDITIONAL(ARCH_IS_PPC, [test x"$target_cpu" = xpowerpc]) -AM_CONDITIONAL(ARCH_IS_I686, [test x"$target_cpu" = xi686]) - -case $host in - *linux*) is_linux=true;; - *) is_linux=false;; -esac -AM_CONDITIONAL(IS_LINUX, [test x$is_linux = xtrue]) - -dnl ************************************************************************** -dnl Initialize automake with a package version -dnl ************************************************************************** -AM_INIT_AUTOMAKE - -dnl Use config.h instad of -D macros -AM_CONFIG_HEADER(config.h) - -dnl ************************************************************************** -dnl LLVM Installation Prefix -dnl ************************************************************************** -AC_ARG_WITH(llvm, - [AS_HELP_STRING(--with-llvm=something, - [LLVM installation prefix (default is /usr/local/)])], - [[llvmprefix=$withval]], - [[ echo Using /usr/local/ as llvm installation prefix. - llvmprefix=/usr/local/ - ]] -) -LLVMDYLIB="`$llvmprefix/Release/bin/llvm-config --ldflags all` `$llvmprefix/Release/bin/llvm-config --libs all`" - -AC_SUBST([llvmprefix]) - -dnl Force some compilation flags -CXXFLAGS="$CXXFLAGS -fsigned-char -felide-constructors -fno-keep-static-consts -D_REENTRANT -I$PWD/include -I$llvmprefix/include -D__STDC_LIMIT_MACROS -rdynamic" -CFLAGS="$CFLAGS -D_REENTRANT" - - -dnl ************************************************************************** -dnl Checks for programs. -dnl ************************************************************************** -AC_PROG_CXX -AM_PROG_CC_C_O - -dnl ************************************************************************** -dnl check for lex and yacc or bison -dnl ************************************************************************** -AM_PROG_LEX -AC_PROG_YACC - -dnl ************************************************************************** -dnl check for as -dnl ************************************************************************** -AM_PROG_AS - -dnl ************************************************************************** -dnl Checks for header files. -dnl ************************************************************************** -AC_HEADER_STDC - -dnl ************************************************************************** -dnl Checks for header files. -dnl ************************************************************************** -AC_HEADER_STDC - -case $target_os in - *linux*) - dnl libiberty, libopcode and libbfd are part of binutils - AC_CHECK_HEADER([bfd.h], [], \ - AC_MSG_ERROR([You need to install the binutils devel package (bfd.h).]) - ) - AC_CHECK_HEADER([dis-asm.h], [], \ - AC_MSG_ERROR([You need to install the binutils devel package (dis-asm.h).]) - ) - ;; -esac - -AC_CHECK_HEADER([zlib.h], [], \ - AC_MSG_ERROR([You need to install the zlib devel package (zlib.h).]) -) - -dnl ************************************************************************** -dnl Checks for libraries -dnl ************************************************************************** -case $target_os in - *darwin*) - DYLIB_EXTENSION="dylib" - rdynamic="" - ;; - *linux*) - AC_CHECK_LIB(iberty, xexit, [], \ - [AC_MSG_ERROR([You need to install the binutils package (iberty).])] - ) - AC_CHECK_LIB(bfd, bfd_get_arch, [], \ - [AC_MSG_ERROR([You need to install the binutils package (bfd).])], - -liberty - ) - AC_CHECK_LIB(opcodes, disassembler, [], \ - [AC_MSG_ERROR([You need to install the binutils package (opcodes).])], - -lbfd -liberty - ) - - rdynamic="-rdynamic" - DYLIB_EXTENSION="so" - AC_DEFINE([HAVE_DISASSEMBLER], [1], [Using libopcodes]) - - ;; - *) AC_MSG_ERROR([$target_os target is not supported.]);; -esac - -AC_CHECK_LIB(z, inflate, [], \ - [AC_MSG_ERROR([You need to install the zlib package (z).])] -) - -AC_SUBST([rdynamic]) -AC_SUBST([LLVMDYLIB]) -AC_SUBST([DYLIB_EXTENSION]) - -dnl ************************************************************************** -dnl VVM thread type -dnl ************************************************************************** -AC_ARG_WITH(thread, - [AS_HELP_STRING(--with-thread=something, - [Thread type ('common' or 'no')])], - [thread=$withval],[thread=common] -) - -AS_IF([test "x$thread" != "xno"], - [AC_CHECK_HEADER([pthread.h],, - [AC_MSG_WARN(phtread include NOT found)]) - AC_CHECK_LIB(pthread, pthread_create, [], - [AC_MSG_ERROR([pthread library not found])]) - ] -) - -AM_CONDITIONAL([HAVE_PTHREAD], [test "x$thread" != "xno"]) -if test "x$thread" = xcommon; then - AC_DEFINE([HAVE_PTHREAD], [1], [Using pthread library]) -fi - -GCTHREAD_LIBS="$PWD/lib/Mvm/CommonThread/libuvm_common_thread.a" -AC_SUBST([GCTHREAD_LIBS]) - - -dnl ************************************************************************** -dnl Checks for typedefs, structures, and compiler characteristics. -dnl ************************************************************************** -AC_C_CONST - -dnl ************************************************************************** -dnl -dnl ************************************************************************** -AC_LIBTOOL_DLOPEN -AM_PROG_LIBTOOL - - -dnl ************************************************************************** -dnl VVM GC type -dnl ************************************************************************** -AC_ARG_WITH(gc, - [AS_HELP_STRING(--with-gc=something, - [GC type ('single-mmap' 'multi-mmap' or 'boehm')])], - [[gc=$withval]], - [[ echo Using mmap2 as vvm gc type. - gc=single-mmap - ]] -) - -dnl TODO find the libgc.a -if test "x$gc" = "xboehm"; then - AC_CHECK_LIB(gccpp, GC_malloc, [], \ - [AC_MSG_ERROR([You need to install the boehm-gc package (gccpp).])] - ) - AC_CHECK_HEADER([gc/gc.h], [], \ - AC_MSG_ERROR([You need to install the boehm-gc devel package (gc/gc.h).]) - ) - GC_LIBS="-lgccpp -gc $PWD/lib/Mvm/BoehmGC/libuvm_gc_boehm.a" - CFLAGS="$CFLAGS -I$PWD/lib/Mvm/BoehmGC -DGC_THREADS" - CXXFLAGS="$CXXFLAGS -I$PWD/lib/Mvm/BoehmGC -DGC_THREADS" - AC_DEFINE([USE_GC_BOEHM], [1], [Using the boehm gc]) - case $target_os in - *linux*) - CFLAGS="-DGC_LINUX_THREADS" - CXXFLAGS="$CXXFLAGS -DGC_LINUX_THREADS" - ;; - esac -else - if test "x$gc" = "xmulti-mmap"; then - CFLAGS="$CFLAGS -I$PWD/lib/Mvm/GCMmap2 -DWITH_TRACER -DMULTIPLE_GC" - CXXFLAGS="$CXXFLAGS -I$PWD/lib/Mvm/GCMmap2 -DWITH_TRACER -DMULTIPLE_GC" - fi - GC_LIBS="$PWD/lib/Mvm/GCMmap2/libuvm_gc_mmap2.a \ - $PWD/lib/Mvm/Allocator/libuvm_alloc.a" - CFLAGS="$CFLAGS -I$PWD/lib/Mvm/GCMmap2 -DWITH_TRACER" - CXXFLAGS="$CXXFLAGS -I$PWD/lib/Mvm/GCMmap2 -DWITH_TRACER" - AC_DEFINE([USE_GC_MMAP2], [1], [Using the gcmmap2]) -fi - -AC_SUBST([GC_LIBS]) - -AM_CONDITIONAL([GC_BOEHM], [test "x$gc" = "xboehm"]) -AM_CONDITIONAL([GC_MULTI_MMAP], [test "x$gc" = "xmulti-mmap"]) -AM_CONDITIONAL([GC_SINGLE_MMAP], [test "x$gc" = "xsingle-mmap"]) - -dnl ************************************************************************** -dnl Virtual Machine type -dnl ************************************************************************** -AC_ARG_WITH(vm-type, - [AS_HELP_STRING(--with-vm-type=something, - [VM type ('single' 'multi' or 'service')])], - [[vmtype=$withval]], - [[ echo Using single as vm type. - vmtype=single - ]] -) - -if test "x$vmtype" = "xmulti"; then - CFLAGS="$CFLAGS -DMULTIPLE_VM" - CXXFLAGS="$CXXFLAGS -DMULTIPLE_VM" -else - if test "x$vmtype" = "xservice"; then - CFLAGS="$CFLAGS -DMULTIPLE_VM -DSERVICE_GC -DMULTIPLE_GC -DSERVICE_VM -I$PWD/lib/Mvm/Allocator" - CXXFLAGS="$CXXFLAGS -DMULTIPLE_VM -DSERVICE_GC -DMULTIPLE_GC -DSERVICE_VM -I$PWD/lib/Mvm/Allocator" - fi -fi - -AM_CONDITIONAL([SERVICE_BUILD], [test "x$vmtype" = "xservice"]) -AM_CONDITIONAL([ISOLATE_BUILD], [test "x$vmtype" = "xmulti"]) - -dnl ************************************************************************** -dnl GNU CLASSPATH version -dnl ************************************************************************** -AC_ARG_WITH(gnu-classpath-version, - [AS_HELP_STRING(--with-gnu-classpath-version=something, - [GNU CLASSPATH VERSION (default is '0.97.2')])], - [[gnuclasspathversion=$withval]], - [[ echo Using '0.97.2' as GNU CLASSPATH version. - gnuclasspathversion=0.97.2 - ]] -) -gnuclasspathversionuvm=`echo $gnuclasspathversion | $SED s/\\\./-/` -AC_SUBST([gnuclasspathversion]) -AC_SUBST([gnuclasspathversionuvm]) - -dnl ************************************************************************** -dnl GNU CLASSPATH installation prefix -dnl ************************************************************************** -AC_ARG_WITH(gnu-classpath-local-prefix, - [AS_HELP_STRING(--with-gnu-classpath-local-prefix=something, - [GNU CLASSPATH local prefix (no default)])], - [[gnuclasspathlocalprefix=$withval]], - [[ echo Not using GNU CLASSPATH local prefix. - gnuclasspathlocalprefix='' - ]] -) - -AC_ARG_WITH(gnu-classpath-installation-prefix, - [AS_HELP_STRING(--with-gnu-classpath-installation-prefix=something, - [GNU CLASSPATH installation prefix (default is '/usr/local/classpath')])], - [[gnuclasspathinstallationprefix=$withval]], - [[gnuclasspathinstallationprefix=/usr/local/classpath]] -) - -if test "x${gnuclasspathlocalprefix}" = x; then - echo Using ${gnuclasspathinstallationprefix} as GNU CLASSPATH installation prefix; - classpathglibj=${gnuclasspathinstallationprefix}/share/classpath/glibj.zip; - classpathlibs=${gnuclasspathinstallationprefix}/lib/classpath/; - CFLAGS="$CFLAGS -I$gnuclasspathinstallationprefix/include" - CXXFLAGS="$CXXFLAGS -I$gnuclasspathinstallationprefix/include" -else - echo Using ${gnuclasspathlocalprefix} as GNU CLASSPATH local prefix; - classpathglibj=${gnuclasspathlocalprefix}/lib/; - classpathlibs=${gnuclasspathlocalprefix}/lib/; - CFLAGS="$CFLAGS -I$gnuclasspathlocalprefix/include" - CXXFLAGS="$CXXFLAGS -I$gnuclasspathlocalprefix/include" -fi - - -AC_SUBST([classpathglibj]) -AC_SUBST([classpathlibs]) - -dnl ************************************************************************** -dnl Local PNet directory -dnl ************************************************************************** -AC_ARG_WITH(pnet-local-prefix, - [AS_HELP_STRING(--with-pnet-local-prefix=something, - [PNET local prefix (no default)])], - [[pnetlocalprefix=$withval]], - [[ echo Not using PNETlocal prefix. - pnetlocalprefix='' - ]] -) - -AM_CONDITIONAL([WITH_N3], [test "x$pnetlocalprefix" != "x"]) -if test "x$pnetlocalprefix" != x; then - echo Using ${pnetlocalprefix} as PNET local prefix; - AC_DEFINE([WITH_N3], [1], [Compiling N3]) -fi - -AC_SUBST([pnetlocalprefix]) - - - -AC_CONFIG_FILES([ - Makefile - lib/N3/Makefile - lib/N3/VMCore/Makefile - lib/JnJVM/Makefile - lib/JnJVM/Classpath/Makefile - lib/JnJVM/VMCore/Makefile - lib/JnJVM/LLVMRuntime/Makefile - lib/JnJVM/Classpath/Classpath.h - lib/Mvm/Makefile - lib/Mvm/GCMmap2/Makefile - lib/Mvm/BoehmGC/Makefile - lib/Mvm/CommonThread/Makefile - lib/Mvm/Allocator/Makefile -]) -AC_OUTPUT Added: vmkit/trunk/include/mvm/Config/config.h.in URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/include/mvm/Config/config.h.in?rev=52708&view=auto ============================================================================== --- vmkit/trunk/include/mvm/Config/config.h.in (added) +++ vmkit/trunk/include/mvm/Config/config.h.in Wed Jun 25 04:59:39 2008 @@ -0,0 +1,94 @@ +/* include/mvm/Config/config.h.in. Generated from autoconf/configure.ac by autoheader. */ + +/* Define to 1 if the system has the type `int64_t'. */ +#undef HAVE_INT64_T + +/* Define to 1 if you have the header file. */ +#undef HAVE_INTTYPES_H + +/* Define to 1 if you have the `gc' library (-lgc). */ +#undef HAVE_LIBGC + +/* Define to 1 if you have the `pthread' library (-lpthread). */ +#undef HAVE_LIBPTHREAD + +/* Define to 1 if you have the `z' library (-lz). */ +#undef HAVE_LIBZ + +/* Define to 1 if you have the `longjmp' function. */ +#undef HAVE_LONGJMP + +/* Define to 1 if you have the header file. */ +#undef HAVE_MEMORY_H + +/* Using pthread library */ +#undef HAVE_PTHREAD + +/* Define to 1 if you have the `setjmp' function. */ +#undef HAVE_SETJMP + +/* Define to 1 if you have the header file. */ +#undef HAVE_STDINT_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STDLIB_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STRINGS_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STRING_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_STAT_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_TYPES_H + +/* Define to 1 if the system has the type `uint64_t'. */ +#undef HAVE_UINT64_T + +/* Define to 1 if you have the header file. */ +#undef HAVE_UNISTD_H + +/* Define to 1 if the system has the type `u_int64_t'. */ +#undef HAVE_U_INT64_T + +/* Define to the address where bug reports for this package should be sent. */ +#undef PACKAGE_BUGREPORT + +/* Define to the full name of this package. */ +#undef PACKAGE_NAME + +/* Define to the full name and version of this package. */ +#undef PACKAGE_STRING + +/* Define to the one symbol short name of this package. */ +#undef PACKAGE_TARNAME + +/* Define to the version of this package. */ +#undef PACKAGE_VERSION + +/* Define as the return type of signal handlers (`int' or `void'). */ +#undef RETSIGTYPE + +/* Define to 1 if you have the ANSI C header files. */ +#undef STDC_HEADERS + +/* Define to 1 if your declares `struct tm'. */ +#undef TM_IN_SYS_TIME + +/* Using the boehm gc */ +#undef USE_GC_BOEHM + +/* Using the gcmmap2 */ +#undef USE_GC_MMAP2 + +/* Compiling N3 */ +#undef WITH_N3 + +/* Define to `int' if does not define. */ +#undef pid_t + +/* Define to `unsigned int' if does not define. */ +#undef size_t Modified: vmkit/trunk/lib/JnJVM/Classpath/Classpath.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/Classpath/Classpath.cpp?rev=52708&r1=52707&r2=52708&view=diff ============================================================================== --- vmkit/trunk/lib/JnJVM/Classpath/Classpath.cpp (original) +++ vmkit/trunk/lib/JnJVM/Classpath/Classpath.cpp Wed Jun 25 04:59:39 2008 @@ -11,18 +11,18 @@ #include "Classpath.h" -#include "ClasspathConstructor.cpp" -#include "ClasspathMethod.cpp" -#include "ClasspathVMClass.cpp" -#include "ClasspathVMClassLoader.cpp" -#include "ClasspathVMField.cpp" -#include "ClasspathVMObject.cpp" -#include "ClasspathVMRuntime.cpp" -#include "ClasspathVMStackWalker.cpp" -#include "ClasspathVMSystem.cpp" -#include "ClasspathVMSystemProperties.cpp" -#include "ClasspathVMThread.cpp" -#include "ClasspathVMThrowable.cpp" +#include "ClasspathConstructor.cpp.inc" +#include "ClasspathMethod.cpp.inc" +#include "ClasspathVMClass.cpp.inc" +#include "ClasspathVMClassLoader.cpp.inc" +#include "ClasspathVMField.cpp.inc" +#include "ClasspathVMObject.cpp.inc" +#include "ClasspathVMRuntime.cpp.inc" +#include "ClasspathVMStackWalker.cpp.inc" +#include "ClasspathVMSystem.cpp.inc" +#include "ClasspathVMSystemProperties.cpp.inc" +#include "ClasspathVMThread.cpp.inc" +#include "ClasspathVMThrowable.cpp.inc" #include "JavaClass.h" #include "Jnjvm.h" Removed: vmkit/trunk/lib/JnJVM/Classpath/ClasspathConstructor.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/Classpath/ClasspathConstructor.cpp?rev=52707&view=auto ============================================================================== --- vmkit/trunk/lib/JnJVM/Classpath/ClasspathConstructor.cpp (original) +++ vmkit/trunk/lib/JnJVM/Classpath/ClasspathConstructor.cpp (removed) @@ -1,110 +0,0 @@ -//===- ClasspathConstructor.cpp -------------------------------------------===// -//===----------- GNU classpath java/lang/reflect/Constructor --------------===// -// -// JnJVM -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -#include - -#include "types.h" - -#include "JavaArray.h" -#include "JavaClass.h" -#include "JavaObject.h" -#include "JavaTypes.h" -#include "JavaThread.h" -#include "JavaUpcalls.h" -#include "Jnjvm.h" -#include "NativeUtil.h" - -using namespace jnjvm; - -extern "C" { - - -JNIEXPORT jobject JNICALL Java_java_lang_reflect_Constructor_getParameterTypes( -#ifdef NATIVE_JNI -JNIEnv *env, -#endif -jobject cons) { - JavaMethod* meth = (JavaMethod*)(Classpath::constructorSlot->getVirtualInt32Field((JavaObject*)cons)); - JavaObject* loader = meth->classDef->classLoader; - return (jobject)(NativeUtil::getParameterTypes(loader, meth)); -} - -JNIEXPORT jint JNICALL Java_java_lang_reflect_Constructor_getModifiersInternal( -#ifdef NATIVE_JNI -JNIEnv *env, -#endif -jobject cons) { - JavaMethod* meth = (JavaMethod*)(Classpath::constructorSlot->getVirtualInt32Field((JavaObject*)cons)); - return meth->access; -} - -JNIEXPORT jobject JNICALL Java_java_lang_reflect_Constructor_constructNative( -#ifdef NATIVE_JNI -JNIEnv *env, -#endif - jobject _cons, - jobject _args, - jclass Clazz, - jint _meth) { - JavaMethod* meth = (JavaMethod*)_meth; - JavaArray* args = (JavaArray*)_args; - sint32 nbArgs = args ? args->size : 0; - sint32 size = meth->getSignature()->args.size(); - Jnjvm* vm = JavaThread::get()->isolate; - - void** buf = (void**)alloca(size * sizeof(uint64)); - void* _buf = (void*)buf; - sint32 index = 0; - if (nbArgs == size) { - CommonClass* _cl = NativeUtil::resolvedImplClass(Clazz, false); - if (!_cl->isArray) { - Class* cl = (Class*)_cl; - cl->initialiseClass(); - - JavaObject* res = cl->doNew(vm); - JavaObject** ptr = (JavaObject**)(void*)(args->elements); - for (std::vector::iterator i = meth->getSignature()->args.begin(), - e = meth->getSignature()->args.end(); i != e; ++i, ++index) { - NativeUtil::decapsulePrimitive(vm, buf, ptr[index], *i); - } - - JavaObject* excp = 0; - try { - meth->invokeIntSpecialBuf(vm, res, _buf); - }catch(...) { - excp = JavaThread::getJavaException(); - JavaThread::clearException(); - } - if (excp) { - if (excp->classOf->isAssignableFrom(Classpath::newException)) { - JavaThread::get()->isolate->invocationTargetException(excp); - } else { - JavaThread::throwException(excp); - } - } - - return (jobject)res; - } - } - vm->illegalArgumentExceptionForMethod(meth, 0, 0); - return 0; -} - -JNIEXPORT jobjectArray JNICALL Java_java_lang_reflect_Constructor_getExceptionTypes( -#ifdef NATIVE_JNI -JNIEnv *env, -#endif -jobject cons) { - verifyNull(cons); - JavaMethod* meth = (JavaMethod*)Classpath::constructorSlot->getVirtualInt32Field((JavaObject*)cons); - return (jobjectArray)NativeUtil::getExceptionTypes(meth); -} - -} Added: vmkit/trunk/lib/JnJVM/Classpath/ClasspathConstructor.cpp.inc URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/Classpath/ClasspathConstructor.cpp.inc?rev=52708&view=auto ============================================================================== --- vmkit/trunk/lib/JnJVM/Classpath/ClasspathConstructor.cpp.inc (added) +++ vmkit/trunk/lib/JnJVM/Classpath/ClasspathConstructor.cpp.inc Wed Jun 25 04:59:39 2008 @@ -0,0 +1,110 @@ +//===- ClasspathConstructor.cpp -------------------------------------------===// +//===----------- GNU classpath java/lang/reflect/Constructor --------------===// +// +// JnJVM +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#include + +#include "types.h" + +#include "JavaArray.h" +#include "JavaClass.h" +#include "JavaObject.h" +#include "JavaTypes.h" +#include "JavaThread.h" +#include "JavaUpcalls.h" +#include "Jnjvm.h" +#include "NativeUtil.h" + +using namespace jnjvm; + +extern "C" { + + +JNIEXPORT jobject JNICALL Java_java_lang_reflect_Constructor_getParameterTypes( +#ifdef NATIVE_JNI +JNIEnv *env, +#endif +jobject cons) { + JavaMethod* meth = (JavaMethod*)(Classpath::constructorSlot->getVirtualInt32Field((JavaObject*)cons)); + JavaObject* loader = meth->classDef->classLoader; + return (jobject)(NativeUtil::getParameterTypes(loader, meth)); +} + +JNIEXPORT jint JNICALL Java_java_lang_reflect_Constructor_getModifiersInternal( +#ifdef NATIVE_JNI +JNIEnv *env, +#endif +jobject cons) { + JavaMethod* meth = (JavaMethod*)(Classpath::constructorSlot->getVirtualInt32Field((JavaObject*)cons)); + return meth->access; +} + +JNIEXPORT jobject JNICALL Java_java_lang_reflect_Constructor_constructNative( +#ifdef NATIVE_JNI +JNIEnv *env, +#endif + jobject _cons, + jobject _args, + jclass Clazz, + jint _meth) { + JavaMethod* meth = (JavaMethod*)_meth; + JavaArray* args = (JavaArray*)_args; + sint32 nbArgs = args ? args->size : 0; + sint32 size = meth->getSignature()->args.size(); + Jnjvm* vm = JavaThread::get()->isolate; + + void** buf = (void**)alloca(size * sizeof(uint64)); + void* _buf = (void*)buf; + sint32 index = 0; + if (nbArgs == size) { + CommonClass* _cl = NativeUtil::resolvedImplClass(Clazz, false); + if (!_cl->isArray) { + Class* cl = (Class*)_cl; + cl->initialiseClass(); + + JavaObject* res = cl->doNew(vm); + JavaObject** ptr = (JavaObject**)(void*)(args->elements); + for (std::vector::iterator i = meth->getSignature()->args.begin(), + e = meth->getSignature()->args.end(); i != e; ++i, ++index) { + NativeUtil::decapsulePrimitive(vm, buf, ptr[index], *i); + } + + JavaObject* excp = 0; + try { + meth->invokeIntSpecialBuf(vm, res, _buf); + }catch(...) { + excp = JavaThread::getJavaException(); + JavaThread::clearException(); + } + if (excp) { + if (excp->classOf->isAssignableFrom(Classpath::newException)) { + JavaThread::get()->isolate->invocationTargetException(excp); + } else { + JavaThread::throwException(excp); + } + } + + return (jobject)res; + } + } + vm->illegalArgumentExceptionForMethod(meth, 0, 0); + return 0; +} + +JNIEXPORT jobjectArray JNICALL Java_java_lang_reflect_Constructor_getExceptionTypes( +#ifdef NATIVE_JNI +JNIEnv *env, +#endif +jobject cons) { + verifyNull(cons); + JavaMethod* meth = (JavaMethod*)Classpath::constructorSlot->getVirtualInt32Field((JavaObject*)cons); + return (jobjectArray)NativeUtil::getExceptionTypes(meth); +} + +} Removed: vmkit/trunk/lib/JnJVM/Classpath/ClasspathMethod.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/Classpath/ClasspathMethod.cpp?rev=52707&view=auto ============================================================================== --- vmkit/trunk/lib/JnJVM/Classpath/ClasspathMethod.cpp (original) +++ vmkit/trunk/lib/JnJVM/Classpath/ClasspathMethod.cpp (removed) @@ -1,193 +0,0 @@ -//===- ClasspathMethod.cpp ------------------------------------------------===// -//===------------- GNU classpath java/lang/reflect/Method -----------------===// -// -// JnJVM -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -#include - -#include "types.h" - -#include "JavaArray.h" -#include "JavaClass.h" -#include "JavaObject.h" -#include "JavaTypes.h" -#include "JavaThread.h" -#include "JavaUpcalls.h" -#include "Jnjvm.h" -#include "NativeUtil.h" - -using namespace jnjvm; - -extern "C" { - -JNIEXPORT jint JNICALL Java_java_lang_reflect_Method_getModifiersInternal( -#ifdef NATIVE_JNI -JNIEnv *env, -#endif - jobject Meth) { - JavaMethod* meth = (JavaMethod*)Classpath::methodSlot->getVirtualInt32Field((JavaObject*)Meth); - return meth->access; -} - -JNIEXPORT jclass JNICALL Java_java_lang_reflect_Method_getReturnType( -#ifdef NATIVE_JNI -JNIEnv *env, -#endif - jobject Meth) { - JavaMethod* meth = (JavaMethod*)Classpath::methodSlot->getVirtualInt32Field((JavaObject*)Meth); - JavaObject* loader = meth->classDef->classLoader; - return (jclass)NativeUtil::getClassType(loader, meth->getSignature()->ret); -} - - -JNIEXPORT jobject JNICALL Java_java_lang_reflect_Method_getParameterTypes( -#ifdef NATIVE_JNI -JNIEnv *env, -#endif - - jobject Meth) { - JavaMethod* meth = (JavaMethod*)Classpath::methodSlot->getVirtualInt32Field((JavaObject*)Meth); - JavaObject* loader = meth->classDef->classLoader; - return (jobject)(NativeUtil::getParameterTypes(loader, meth)); -} - -JNIEXPORT jobject JNICALL Java_java_lang_reflect_Method_invokeNative( -#ifdef NATIVE_JNI -JNIEnv *env, -#endif - jobject Meth, jobject _obj, jobject _args, jclass Cl, jint _meth) { - - JavaMethod* meth = (JavaMethod*)_meth; - JavaArray* args = (JavaArray*)_args; - sint32 nbArgs = args ? args->size : 0; - sint32 size = meth->getSignature()->args.size(); - Jnjvm* vm = JavaThread::get()->isolate; - JavaObject* obj = (JavaObject*)_obj; - - void** buf = (void**)alloca(size * sizeof(uint64)); - void* _buf = (void*)buf; - sint32 index = 0; - if (nbArgs == size) { - CommonClass* _cl = NativeUtil::resolvedImplClass(Cl, false); - Class* cl = (Class*)_cl; - - if (isVirtual(meth->access)) { - verifyNull(obj); - if (!(obj->classOf->isAssignableFrom(meth->classDef))) { - vm->illegalArgumentExceptionForMethod(meth, meth->classDef, obj->classOf); - } - - } else { - cl->initialiseClass(); - } - - JavaObject** ptr = (JavaObject**)(void*)(args->elements); - for (std::vector::iterator i = meth->getSignature()->args.begin(), - e = meth->getSignature()->args.end(); i != e; ++i, ++index) { - NativeUtil::decapsulePrimitive(vm, buf, ptr[index], *i); - } - - JavaObject* exc = 0; - -#define RUN_METH(TYPE) \ - try{ \ - if (isVirtual(meth->access)) { \ - if (isPublic(meth->access)) { \ - val = meth->invoke##TYPE##VirtualBuf(vm, obj, _buf); \ - } else { \ - val = meth->invoke##TYPE##SpecialBuf(vm, obj, _buf); \ - } \ - } else { \ - val = meth->invoke##TYPE##StaticBuf(vm, _buf); \ - } \ - }catch(...) { \ - exc = JavaThread::getJavaException(); \ - assert(exc && "no exception?"); \ - JavaThread::clearException(); \ - } \ - \ - if (exc) { \ - if (exc->classOf->isAssignableFrom(Classpath::newException)) { \ - JavaThread::get()->isolate->invocationTargetException(exc); \ - } else { \ - JavaThread::throwException(exc); \ - } \ - } \ - - JavaObject* res = 0; - const AssessorDesc* retType = meth->getSignature()->ret->funcs; - if (retType == AssessorDesc::dVoid) { - res = 0; - uint32 val = 0; - RUN_METH(Int); - } else if (retType == AssessorDesc::dBool) { - uint32 val = 0; - RUN_METH(Int); - res = (*Classpath::boolClass)(vm); - Classpath::boolValue->setVirtualInt8Field(res, val); - } else if (retType == AssessorDesc::dByte) { - uint32 val = 0; - RUN_METH(Int); - res = (*Classpath::byteClass)(vm); - Classpath::byteValue->setVirtualInt8Field(res, val); - } else if (retType == AssessorDesc::dChar) { - uint32 val = 0; - RUN_METH(Int); - res = (*Classpath::charClass)(vm); - Classpath::charValue->setVirtualInt16Field(res, val); - } else if (retType == AssessorDesc::dShort) { - uint32 val = 0; - RUN_METH(Int); - res = (*Classpath::shortClass)(vm); - Classpath::shortValue->setVirtualInt16Field(res, val); - } else if (retType == AssessorDesc::dInt) { - uint32 val = 0; - RUN_METH(Int); - res = (*Classpath::intClass)(vm); - Classpath::intValue->setVirtualInt32Field(res, val); - } else if (retType == AssessorDesc::dLong) { - sint64 val = 0; - RUN_METH(Long); - res = (*Classpath::longClass)(vm); - Classpath::longValue->setVirtualLongField(res, val); - } else if (retType == AssessorDesc::dFloat) { - float val = 0; - RUN_METH(Float); - res = (*Classpath::floatClass)(vm); - Classpath::floatValue->setVirtualFloatField(res, val); - } else if (retType == AssessorDesc::dDouble) { - double val = 0; - RUN_METH(Double); - res = (*Classpath::doubleClass)(vm); - Classpath::doubleValue->setVirtualDoubleField(res, val); - } else if (retType == AssessorDesc::dTab || retType == AssessorDesc::dRef) { - JavaObject* val = 0; - RUN_METH(JavaObject); - res = val; - } else { - vm->unknownError("should not be here"); - } - return (jobject)res; - } - vm->illegalArgumentExceptionForMethod(meth, 0, 0); - return 0; -} - -#undef RUN_METH - -JNIEXPORT jobjectArray JNICALL Java_java_lang_reflect_Method_getExceptionTypes( -#ifdef NATIVE_JNI -JNIEnv *env, -#endif - jobject _meth) { - verifyNull(_meth); - JavaMethod* meth = (JavaMethod*)Classpath::methodSlot->getVirtualInt32Field((JavaObject*)_meth); - return (jobjectArray)NativeUtil::getExceptionTypes(meth); -} - -} Added: vmkit/trunk/lib/JnJVM/Classpath/ClasspathMethod.cpp.inc URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/Classpath/ClasspathMethod.cpp.inc?rev=52708&view=auto ============================================================================== --- vmkit/trunk/lib/JnJVM/Classpath/ClasspathMethod.cpp.inc (added) +++ vmkit/trunk/lib/JnJVM/Classpath/ClasspathMethod.cpp.inc Wed Jun 25 04:59:39 2008 @@ -0,0 +1,193 @@ +//===- ClasspathMethod.cpp ------------------------------------------------===// +//===------------- GNU classpath java/lang/reflect/Method -----------------===// +// +// JnJVM +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#include + +#include "types.h" + +#include "JavaArray.h" +#include "JavaClass.h" +#include "JavaObject.h" +#include "JavaTypes.h" +#include "JavaThread.h" +#include "JavaUpcalls.h" +#include "Jnjvm.h" +#include "NativeUtil.h" + +using namespace jnjvm; + +extern "C" { + +JNIEXPORT jint JNICALL Java_java_lang_reflect_Method_getModifiersInternal( +#ifdef NATIVE_JNI +JNIEnv *env, +#endif + jobject Meth) { + JavaMethod* meth = (JavaMethod*)Classpath::methodSlot->getVirtualInt32Field((JavaObject*)Meth); + return meth->access; +} + +JNIEXPORT jclass JNICALL Java_java_lang_reflect_Method_getReturnType( +#ifdef NATIVE_JNI +JNIEnv *env, +#endif + jobject Meth) { + JavaMethod* meth = (JavaMethod*)Classpath::methodSlot->getVirtualInt32Field((JavaObject*)Meth); + JavaObject* loader = meth->classDef->classLoader; + return (jclass)NativeUtil::getClassType(loader, meth->getSignature()->ret); +} + + +JNIEXPORT jobject JNICALL Java_java_lang_reflect_Method_getParameterTypes( +#ifdef NATIVE_JNI +JNIEnv *env, +#endif + + jobject Meth) { + JavaMethod* meth = (JavaMethod*)Classpath::methodSlot->getVirtualInt32Field((JavaObject*)Meth); + JavaObject* loader = meth->classDef->classLoader; + return (jobject)(NativeUtil::getParameterTypes(loader, meth)); +} + +JNIEXPORT jobject JNICALL Java_java_lang_reflect_Method_invokeNative( +#ifdef NATIVE_JNI +JNIEnv *env, +#endif + jobject Meth, jobject _obj, jobject _args, jclass Cl, jint _meth) { + + JavaMethod* meth = (JavaMethod*)_meth; + JavaArray* args = (JavaArray*)_args; + sint32 nbArgs = args ? args->size : 0; + sint32 size = meth->getSignature()->args.size(); + Jnjvm* vm = JavaThread::get()->isolate; + JavaObject* obj = (JavaObject*)_obj; + + void** buf = (void**)alloca(size * sizeof(uint64)); + void* _buf = (void*)buf; + sint32 index = 0; + if (nbArgs == size) { + CommonClass* _cl = NativeUtil::resolvedImplClass(Cl, false); + Class* cl = (Class*)_cl; + + if (isVirtual(meth->access)) { + verifyNull(obj); + if (!(obj->classOf->isAssignableFrom(meth->classDef))) { + vm->illegalArgumentExceptionForMethod(meth, meth->classDef, obj->classOf); + } + + } else { + cl->initialiseClass(); + } + + JavaObject** ptr = (JavaObject**)(void*)(args->elements); + for (std::vector::iterator i = meth->getSignature()->args.begin(), + e = meth->getSignature()->args.end(); i != e; ++i, ++index) { + NativeUtil::decapsulePrimitive(vm, buf, ptr[index], *i); + } + + JavaObject* exc = 0; + +#define RUN_METH(TYPE) \ + try{ \ + if (isVirtual(meth->access)) { \ + if (isPublic(meth->access)) { \ + val = meth->invoke##TYPE##VirtualBuf(vm, obj, _buf); \ + } else { \ + val = meth->invoke##TYPE##SpecialBuf(vm, obj, _buf); \ + } \ + } else { \ + val = meth->invoke##TYPE##StaticBuf(vm, _buf); \ + } \ + }catch(...) { \ + exc = JavaThread::getJavaException(); \ + assert(exc && "no exception?"); \ + JavaThread::clearException(); \ + } \ + \ + if (exc) { \ + if (exc->classOf->isAssignableFrom(Classpath::newException)) { \ + JavaThread::get()->isolate->invocationTargetException(exc); \ + } else { \ + JavaThread::throwException(exc); \ + } \ + } \ + + JavaObject* res = 0; + const AssessorDesc* retType = meth->getSignature()->ret->funcs; + if (retType == AssessorDesc::dVoid) { + res = 0; + uint32 val = 0; + RUN_METH(Int); + } else if (retType == AssessorDesc::dBool) { + uint32 val = 0; + RUN_METH(Int); + res = (*Classpath::boolClass)(vm); + Classpath::boolValue->setVirtualInt8Field(res, val); + } else if (retType == AssessorDesc::dByte) { + uint32 val = 0; + RUN_METH(Int); + res = (*Classpath::byteClass)(vm); + Classpath::byteValue->setVirtualInt8Field(res, val); + } else if (retType == AssessorDesc::dChar) { + uint32 val = 0; + RUN_METH(Int); + res = (*Classpath::charClass)(vm); + Classpath::charValue->setVirtualInt16Field(res, val); + } else if (retType == AssessorDesc::dShort) { + uint32 val = 0; + RUN_METH(Int); + res = (*Classpath::shortClass)(vm); + Classpath::shortValue->setVirtualInt16Field(res, val); + } else if (retType == AssessorDesc::dInt) { + uint32 val = 0; + RUN_METH(Int); + res = (*Classpath::intClass)(vm); + Classpath::intValue->setVirtualInt32Field(res, val); + } else if (retType == AssessorDesc::dLong) { + sint64 val = 0; + RUN_METH(Long); + res = (*Classpath::longClass)(vm); + Classpath::longValue->setVirtualLongField(res, val); + } else if (retType == AssessorDesc::dFloat) { + float val = 0; + RUN_METH(Float); + res = (*Classpath::floatClass)(vm); + Classpath::floatValue->setVirtualFloatField(res, val); + } else if (retType == AssessorDesc::dDouble) { + double val = 0; + RUN_METH(Double); + res = (*Classpath::doubleClass)(vm); + Classpath::doubleValue->setVirtualDoubleField(res, val); + } else if (retType == AssessorDesc::dTab || retType == AssessorDesc::dRef) { + JavaObject* val = 0; + RUN_METH(JavaObject); + res = val; + } else { + vm->unknownError("should not be here"); + } + return (jobject)res; + } + vm->illegalArgumentExceptionForMethod(meth, 0, 0); + return 0; +} + +#undef RUN_METH + +JNIEXPORT jobjectArray JNICALL Java_java_lang_reflect_Method_getExceptionTypes( +#ifdef NATIVE_JNI +JNIEnv *env, +#endif + jobject _meth) { + verifyNull(_meth); + JavaMethod* meth = (JavaMethod*)Classpath::methodSlot->getVirtualInt32Field((JavaObject*)_meth); + return (jobjectArray)NativeUtil::getExceptionTypes(meth); +} + +} Removed: vmkit/trunk/lib/JnJVM/Classpath/ClasspathVMClass.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/Classpath/ClasspathVMClass.cpp?rev=52707&view=auto ============================================================================== --- vmkit/trunk/lib/JnJVM/Classpath/ClasspathVMClass.cpp (original) +++ vmkit/trunk/lib/JnJVM/Classpath/ClasspathVMClass.cpp (removed) @@ -1,431 +0,0 @@ -//===---- ClasspathVMClass.cpp - GNU classpath java/lang/VMClass ----------===// -// -// JnJVM -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -#include - -#include "types.h" - -#include "JavaAccess.h" -#include "JavaArray.h" -#include "JavaClass.h" -#include "JavaConstantPool.h" -#include "JavaObject.h" -#include "JavaString.h" -#include "JavaTypes.h" -#include "JavaThread.h" -#include "JavaUpcalls.h" -#include "Jnjvm.h" -#include "NativeUtil.h" -#include "Reader.h" - -using namespace jnjvm; - -extern "C" { - -JNIEXPORT jboolean JNICALL Java_java_lang_VMClass_isArray( -#ifdef NATIVE_JNI -JNIEnv *env, -jclass clazz, -#endif -jobject klass) { - - CommonClass* cl = - (CommonClass*)Classpath::vmdataClass->getVirtualObjectField((JavaObject*)klass); - - return cl->isArray; - -} - -JNIEXPORT jclass JNICALL Java_java_lang_VMClass_forName( -#ifdef NATIVE_JNI -JNIEnv *env, -jclass clazz, -#endif - - jobject str, - jboolean clinit, - jobject loader) { - - Jnjvm* vm = JavaThread::get()->isolate; - CommonClass* cl = vm->lookupClassFromJavaString((JavaString*)str, - (JavaObject*)loader, true, - false, false); - if (cl != 0) { - if (clinit) { - cl->initialiseClass(); - } - return (jclass)(cl->getClassDelegatee()); - } else { - vm->error(Jnjvm::ClassNotFoundException, "unable to load %s", - ((JavaString*)str)->strToAsciiz()); - return 0; - } -} - -JNIEXPORT jobject JNICALL Java_java_lang_VMClass_getDeclaredConstructors( -#ifdef NATIVE_JNI -JNIEnv *env, - jclass clazz, -#endif - - jclass Cl, - jboolean publicOnly) { - - CommonClass* cl = NativeUtil::resolvedImplClass(Cl, false); - Jnjvm* vm = JavaThread::get()->isolate; - - if (cl->isArray || isInterface(cl->access)) { - return (jobject)ArrayObject::acons(0, Classpath::constructorArrayClass, vm); - } else { - CommonClass::method_map meths = cl->virtualMethods; - std::vector res; - for (CommonClass::method_iterator i = meths.begin(), e = meths.end(); - i != e; ++i) { - JavaMethod* meth = i->second; - if (meth->name == Jnjvm::initName && (!publicOnly || isPublic(meth->access))) { - res.push_back(meth); - } - } - - ArrayObject* ret = ArrayObject::acons(res.size(), Classpath::constructorArrayClass, vm); - sint32 index = 0; - for (std::vector::iterator i = res.begin(), e = res.end(); - i != e; ++i, ++index) { - JavaMethod* meth = *i; - // TODO: check parameter types - JavaObject* tmp = (*Classpath::newConstructor)(vm); - Classpath::initConstructor->invokeIntSpecial(vm, tmp, Cl, meth); - ret->elements[index] = tmp; - } - return (jobject)ret; - } -} - -JNIEXPORT jobject JNICALL Java_java_lang_VMClass_getDeclaredMethods( -#ifdef NATIVE_JNI -JNIEnv *env, - jclass clazz, -#endif - - jclass Cl, - jboolean publicOnly) { - - Jnjvm* vm = JavaThread::get()->isolate; - CommonClass* cl = NativeUtil::resolvedImplClass(Cl, false); - - if (cl->isArray) { - return (jobject)ArrayObject::acons(0, Classpath::methodArrayClass, vm); - } else { - CommonClass::method_map meths = cl->virtualMethods; - std::vector res; - for (CommonClass::method_iterator i = meths.begin(), e = meths.end(); - i != e; ++i) { - JavaMethod* meth = i->second; - if (meth->name != Jnjvm::initName && (!publicOnly || isPublic(meth->access))) { - res.push_back(meth); - } - } - meths = cl->staticMethods; - for (CommonClass::method_iterator i = meths.begin(), e = meths.end(); - i != e; ++i) { - JavaMethod* meth = i->second; - if (meth->name != Jnjvm::clinitName && (!publicOnly || isPublic(meth->access))) { - res.push_back(meth); - } - } - - ArrayObject* ret = ArrayObject::acons(res.size(), Classpath::methodArrayClass, vm); - sint32 index = 0; - for (std::vector::iterator i = res.begin(), e = res.end(); - i != e; ++i, ++index) { - JavaMethod* meth = *i; - // TODO: check parameter types - JavaObject* tmp = (*Classpath::newMethod)(vm); - Classpath::initMethod->invokeIntSpecial(vm, tmp, Cl, - vm->UTF8ToStr(meth->name), meth); - ret->elements[index] = tmp; - } - return (jobject)ret; - } -} - -JNIEXPORT jint JNICALL Java_java_lang_VMClass_getModifiers( -#ifdef NATIVE_JNI -JNIEnv *env, - jclass clazz, -#endif - jclass Cl, - jboolean ignore) { - - CommonClass* cl = NativeUtil::resolvedImplClass(Cl, false); - return cl->access; -} - -JNIEXPORT jobject JNICALL Java_java_lang_VMClass_getName( -#ifdef NATIVE_JNI -JNIEnv *env, - jclass clazz, -#endif - jobject Cl) { - Jnjvm* vm = JavaThread::get()->isolate; - CommonClass* cl = - (CommonClass*)Classpath::vmdataClass->getVirtualObjectField((JavaObject*)Cl); - - const UTF8* iname = cl->name; - const UTF8* res = iname->internalToJava(vm, 0, iname->size); - - return (jobject)(vm->UTF8ToStr(res)); -} - -JNIEXPORT jboolean JNICALL Java_java_lang_VMClass_isPrimitive( -#ifdef NATIVE_JNI -JNIEnv *env, - jclass clazz, -#endif - jclass Cl) { - CommonClass* cl = - (CommonClass*)Classpath::vmdataClass->getVirtualObjectField((JavaObject*)Cl); - - return cl->isPrimitive; -} - -JNIEXPORT jboolean JNICALL Java_java_lang_VMClass_isInterface( -#ifdef NATIVE_JNI -JNIEnv *env, - jclass clazz, -#endif - jclass Cl) { - CommonClass* cl = NativeUtil::resolvedImplClass(Cl, false); - - return isInterface(cl->access); -} - -JNIEXPORT jclass JNICALL Java_java_lang_VMClass_getComponentType( -#ifdef NATIVE_JNI -JNIEnv *env, - jclass clazz, -#endif - jclass Cl) { - CommonClass* cl = - (CommonClass*)Classpath::vmdataClass->getVirtualObjectField((JavaObject*)Cl); - - if (cl->isArray) { - CommonClass* bc = ((ClassArray*)cl)->baseClass(); - return (jclass)(bc->getClassDelegatee()); - } else { - return 0; - } -} - -JNIEXPORT jobject JNICALL Java_java_lang_VMClass_getClassLoader( -#ifdef NATIVE_JNI -JNIEnv *env, -jclass clazz, -#endif -jclass Cl) { - CommonClass* cl = - (CommonClass*)Classpath::vmdataClass->getVirtualObjectField((JavaObject*)Cl); - return (jobject)cl->classLoader; -} - -JNIEXPORT jboolean JNICALL Java_java_lang_VMClass_isAssignableFrom( -#ifdef NATIVE_JNI -JNIEnv *env, -jclass clazz, -#endif -jclass Cl1, jclass Cl2) { - CommonClass* cl1 = - (CommonClass*)Classpath::vmdataClass->getVirtualObjectField((JavaObject*)Cl1); - CommonClass* cl2 = - (CommonClass*)Classpath::vmdataClass->getVirtualObjectField((JavaObject*)Cl2); - - cl2->resolveClass(false); - return cl2->isAssignableFrom(cl1); - -} - -JNIEXPORT jobject JNICALL Java_java_lang_VMClass_getSuperclass( -#ifdef NATIVE_JNI -JNIEnv *env, -jclass clazz, -#endif -jclass Cl) { - CommonClass* cl = - (CommonClass*)Classpath::vmdataClass->getVirtualObjectField((JavaObject*)Cl); - if (isInterface(cl->access)) - return 0; - else { - cl->resolveClass(false); - if (cl->super) return (jobject)JavaThread::get()->isolate->getClassDelegatee(cl->super); - else return 0; - } -} - -JNIEXPORT bool JNICALL Java_java_lang_VMClass_isInstance( -#ifdef NATIVE_JNI -JNIEnv *env, -jclass clazz, -#endif -jclass Cl, jobject obj) { - CommonClass* cl = - (CommonClass*)Classpath::vmdataClass->getVirtualObjectField((JavaObject*)Cl); - return ((JavaObject*)obj)->instanceOf(cl); -} - -JNIEXPORT jobject JNICALL Java_java_lang_VMClass_getDeclaredFields( -#ifdef NATIVE_JNI -JNIEnv *env, -jclass clazz, -#endif -jclass Cl, jboolean publicOnly) { - Jnjvm* vm = JavaThread::get()->isolate; - CommonClass* cl = NativeUtil::resolvedImplClass(Cl, false); - - if (cl->isArray) { - return (jobject)ArrayObject::acons(0, Classpath::fieldArrayClass, vm); - } else { - CommonClass::field_map fields = cl->virtualFields; - std::vector res; - for (CommonClass::field_iterator i = fields.begin(), e = fields.end(); - i != e; ++i) { - JavaField* field = i->second; - if (!publicOnly || isPublic(field->access)) { - res.push_back(field); - } - } - fields = cl->staticFields; - for (CommonClass::field_iterator i = fields.begin(), e = fields.end(); - i != e; ++i) { - JavaField* field = i->second; - if (!publicOnly || isPublic(field->access)) { - res.push_back(field); - } - } - - ArrayObject* ret = ArrayObject::acons(res.size(), - Classpath::fieldArrayClass, vm); - sint32 index = 0; - for (std::vector::iterator i = res.begin(), e = res.end(); - i != e; ++i, ++index) { - JavaField* field = *i; - // TODO: check parameter types - JavaObject* tmp = (*Classpath::newField)(vm); - Classpath::initField->invokeIntSpecial(vm, tmp, Cl, - vm->UTF8ToStr(field->name), field); - ret->elements[index] = tmp; - } - return (jobject)ret; - } -} - -JNIEXPORT jobject JNICALL Java_java_lang_VMClass_getInterfaces( -#ifdef NATIVE_JNI -JNIEnv *env, -jclass clazz, -#endif -jclass Cl) { - Jnjvm* vm = JavaThread::get()->isolate; - CommonClass* cl = NativeUtil::resolvedImplClass(Cl, false); - std::vector & interfaces = cl->interfaces; - ArrayObject* ret = ArrayObject::acons(interfaces.size(), Classpath::classArrayClass, vm); - sint32 index = 0; - for (std::vector::iterator i = interfaces.begin(), e = interfaces.end(); - i != e; ++i, ++index) { - Class* klass = *i; - ret->elements[index] = vm->getClassDelegatee(klass); - } - return (jobject)ret; -} - -static void resolveInnerOuterClasses(Class* cl) { - Attribut* attribut = cl->lookupAttribut(Attribut::innerClassesAttribut); - if (attribut != 0) { - Reader reader(attribut, cl->bytes); - - uint16 nbi = reader.readU2(); - for (uint16 i = 0; i < nbi; ++i) { - uint16 inner = reader.readU2(); - uint16 outer = reader.readU2(); - //uint16 innerName = - reader.readU2(); - uint16 accessFlags = reader.readU2(); - Class* clInner = (Class*)cl->ctpInfo->loadClass(inner); - Class* clOuter = (Class*)cl->ctpInfo->loadClass(outer); - - if (clInner == cl) { - cl->outerClass = clOuter; - } else if (clOuter == cl) { - clInner->innerAccess = accessFlags; - cl->innerClasses.push_back(clInner); - } - } - } - cl->innerOuterResolved = true; -} - - -JNIEXPORT jclass JNICALL Java_java_lang_VMClass_getDeclaringClass( -#ifdef NATIVE_JNI -JNIEnv *env, -jclass clazz, -#endif -jclass Cl) { - Jnjvm* vm = JavaThread::get()->isolate; - Class* cl = (Class*)NativeUtil::resolvedImplClass(Cl, false); - if (!(cl->innerOuterResolved)) - resolveInnerOuterClasses(cl); - if (cl->outerClass) { - return (jclass)vm->getClassDelegatee(cl->outerClass); - } else { - return 0; - } -} - -JNIEXPORT jobject JNICALL Java_java_lang_VMClass_getDeclaredClasses( -#ifdef NATIVE_JNI -JNIEnv *env, -jclass clazz, -#endif -jclass Cl, bool publicOnly) { - Jnjvm* vm = JavaThread::get()->isolate; - Class* cl = (Class*)NativeUtil::resolvedImplClass(Cl, false); - if (!(cl->innerOuterResolved)) - resolveInnerOuterClasses(cl); - ArrayObject* res = ArrayObject::acons(cl->innerClasses.size(), Classpath::constructorArrayClass, vm); - uint32 index = 0; - for (std::vector::iterator i = cl->innerClasses.begin(), - e = cl->innerClasses.end(); i!= e; i++) { - res->elements[index++] = vm->getClassDelegatee(*i); - } - - return (jobject)res; -} - - -JNIEXPORT void JNICALL Java_java_lang_VMClass_throwException( -#ifdef NATIVE_JNI -JNIEnv *env, -jclass clazz, -#endif -jobject throwable) { - JavaThread::throwException((JavaObject*)throwable); -} - -JNIEXPORT jobjectArray Java_java_lang_VMClass_getDeclaredAnnotations( -#ifdef NATIVE_JNI -JNIEnv *env, -jclass clazz, -#endif -jclass Cl) { - // TODO implement me - Jnjvm* vm = JavaThread::get()->isolate; - ArrayObject* res = ArrayObject::acons(0, Classpath::constructorArrayAnnotation, vm); - return (jobjectArray)res; -} -} Added: vmkit/trunk/lib/JnJVM/Classpath/ClasspathVMClass.cpp.inc URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/Classpath/ClasspathVMClass.cpp.inc?rev=52708&view=auto ============================================================================== --- vmkit/trunk/lib/JnJVM/Classpath/ClasspathVMClass.cpp.inc (added) +++ vmkit/trunk/lib/JnJVM/Classpath/ClasspathVMClass.cpp.inc Wed Jun 25 04:59:39 2008 @@ -0,0 +1,431 @@ +//===---- ClasspathVMClass.cpp - GNU classpath java/lang/VMClass ----------===// +// +// JnJVM +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#include + +#include "types.h" + +#include "JavaAccess.h" +#include "JavaArray.h" +#include "JavaClass.h" +#include "JavaConstantPool.h" +#include "JavaObject.h" +#include "JavaString.h" +#include "JavaTypes.h" +#include "JavaThread.h" +#include "JavaUpcalls.h" +#include "Jnjvm.h" +#include "NativeUtil.h" +#include "Reader.h" + +using namespace jnjvm; + +extern "C" { + +JNIEXPORT jboolean JNICALL Java_java_lang_VMClass_isArray( +#ifdef NATIVE_JNI +JNIEnv *env, +jclass clazz, +#endif +jobject klass) { + + CommonClass* cl = + (CommonClass*)Classpath::vmdataClass->getVirtualObjectField((JavaObject*)klass); + + return cl->isArray; + +} + +JNIEXPORT jclass JNICALL Java_java_lang_VMClass_forName( +#ifdef NATIVE_JNI +JNIEnv *env, +jclass clazz, +#endif + + jobject str, + jboolean clinit, + jobject loader) { + + Jnjvm* vm = JavaThread::get()->isolate; + CommonClass* cl = vm->lookupClassFromJavaString((JavaString*)str, + (JavaObject*)loader, true, + false, false); + if (cl != 0) { + if (clinit) { + cl->initialiseClass(); + } + return (jclass)(cl->getClassDelegatee()); + } else { + vm->error(Jnjvm::ClassNotFoundException, "unable to load %s", + ((JavaString*)str)->strToAsciiz()); + return 0; + } +} + +JNIEXPORT jobject JNICALL Java_java_lang_VMClass_getDeclaredConstructors( +#ifdef NATIVE_JNI +JNIEnv *env, + jclass clazz, +#endif + + jclass Cl, + jboolean publicOnly) { + + CommonClass* cl = NativeUtil::resolvedImplClass(Cl, false); + Jnjvm* vm = JavaThread::get()->isolate; + + if (cl->isArray || isInterface(cl->access)) { + return (jobject)ArrayObject::acons(0, Classpath::constructorArrayClass, vm); + } else { + CommonClass::method_map meths = cl->virtualMethods; + std::vector res; + for (CommonClass::method_iterator i = meths.begin(), e = meths.end(); + i != e; ++i) { + JavaMethod* meth = i->second; + if (meth->name == Jnjvm::initName && (!publicOnly || isPublic(meth->access))) { + res.push_back(meth); + } + } + + ArrayObject* ret = ArrayObject::acons(res.size(), Classpath::constructorArrayClass, vm); + sint32 index = 0; + for (std::vector::iterator i = res.begin(), e = res.end(); + i != e; ++i, ++index) { + JavaMethod* meth = *i; + // TODO: check parameter types + JavaObject* tmp = (*Classpath::newConstructor)(vm); + Classpath::initConstructor->invokeIntSpecial(vm, tmp, Cl, meth); + ret->elements[index] = tmp; + } + return (jobject)ret; + } +} + +JNIEXPORT jobject JNICALL Java_java_lang_VMClass_getDeclaredMethods( +#ifdef NATIVE_JNI +JNIEnv *env, + jclass clazz, +#endif + + jclass Cl, + jboolean publicOnly) { + + Jnjvm* vm = JavaThread::get()->isolate; + CommonClass* cl = NativeUtil::resolvedImplClass(Cl, false); + + if (cl->isArray) { + return (jobject)ArrayObject::acons(0, Classpath::methodArrayClass, vm); + } else { + CommonClass::method_map meths = cl->virtualMethods; + std::vector res; + for (CommonClass::method_iterator i = meths.begin(), e = meths.end(); + i != e; ++i) { + JavaMethod* meth = i->second; + if (meth->name != Jnjvm::initName && (!publicOnly || isPublic(meth->access))) { + res.push_back(meth); + } + } + meths = cl->staticMethods; + for (CommonClass::method_iterator i = meths.begin(), e = meths.end(); + i != e; ++i) { + JavaMethod* meth = i->second; + if (meth->name != Jnjvm::clinitName && (!publicOnly || isPublic(meth->access))) { + res.push_back(meth); + } + } + + ArrayObject* ret = ArrayObject::acons(res.size(), Classpath::methodArrayClass, vm); + sint32 index = 0; + for (std::vector::iterator i = res.begin(), e = res.end(); + i != e; ++i, ++index) { + JavaMethod* meth = *i; + // TODO: check parameter types + JavaObject* tmp = (*Classpath::newMethod)(vm); + Classpath::initMethod->invokeIntSpecial(vm, tmp, Cl, + vm->UTF8ToStr(meth->name), meth); + ret->elements[index] = tmp; + } + return (jobject)ret; + } +} + +JNIEXPORT jint JNICALL Java_java_lang_VMClass_getModifiers( +#ifdef NATIVE_JNI +JNIEnv *env, + jclass clazz, +#endif + jclass Cl, + jboolean ignore) { + + CommonClass* cl = NativeUtil::resolvedImplClass(Cl, false); + return cl->access; +} + +JNIEXPORT jobject JNICALL Java_java_lang_VMClass_getName( +#ifdef NATIVE_JNI +JNIEnv *env, + jclass clazz, +#endif + jobject Cl) { + Jnjvm* vm = JavaThread::get()->isolate; + CommonClass* cl = + (CommonClass*)Classpath::vmdataClass->getVirtualObjectField((JavaObject*)Cl); + + const UTF8* iname = cl->name; + const UTF8* res = iname->internalToJava(vm, 0, iname->size); + + return (jobject)(vm->UTF8ToStr(res)); +} + +JNIEXPORT jboolean JNICALL Java_java_lang_VMClass_isPrimitive( +#ifdef NATIVE_JNI +JNIEnv *env, + jclass clazz, +#endif + jclass Cl) { + CommonClass* cl = + (CommonClass*)Classpath::vmdataClass->getVirtualObjectField((JavaObject*)Cl); + + return cl->isPrimitive; +} + +JNIEXPORT jboolean JNICALL Java_java_lang_VMClass_isInterface( +#ifdef NATIVE_JNI +JNIEnv *env, + jclass clazz, +#endif + jclass Cl) { + CommonClass* cl = NativeUtil::resolvedImplClass(Cl, false); + + return isInterface(cl->access); +} + +JNIEXPORT jclass JNICALL Java_java_lang_VMClass_getComponentType( +#ifdef NATIVE_JNI +JNIEnv *env, + jclass clazz, +#endif + jclass Cl) { + CommonClass* cl = + (CommonClass*)Classpath::vmdataClass->getVirtualObjectField((JavaObject*)Cl); + + if (cl->isArray) { + CommonClass* bc = ((ClassArray*)cl)->baseClass(); + return (jclass)(bc->getClassDelegatee()); + } else { + return 0; + } +} + +JNIEXPORT jobject JNICALL Java_java_lang_VMClass_getClassLoader( +#ifdef NATIVE_JNI +JNIEnv *env, +jclass clazz, +#endif +jclass Cl) { + CommonClass* cl = + (CommonClass*)Classpath::vmdataClass->getVirtualObjectField((JavaObject*)Cl); + return (jobject)cl->classLoader; +} + +JNIEXPORT jboolean JNICALL Java_java_lang_VMClass_isAssignableFrom( +#ifdef NATIVE_JNI +JNIEnv *env, +jclass clazz, +#endif +jclass Cl1, jclass Cl2) { + CommonClass* cl1 = + (CommonClass*)Classpath::vmdataClass->getVirtualObjectField((JavaObject*)Cl1); + CommonClass* cl2 = + (CommonClass*)Classpath::vmdataClass->getVirtualObjectField((JavaObject*)Cl2); + + cl2->resolveClass(false); + return cl2->isAssignableFrom(cl1); + +} + +JNIEXPORT jobject JNICALL Java_java_lang_VMClass_getSuperclass( +#ifdef NATIVE_JNI +JNIEnv *env, +jclass clazz, +#endif +jclass Cl) { + CommonClass* cl = + (CommonClass*)Classpath::vmdataClass->getVirtualObjectField((JavaObject*)Cl); + if (isInterface(cl->access)) + return 0; + else { + cl->resolveClass(false); + if (cl->super) return (jobject)JavaThread::get()->isolate->getClassDelegatee(cl->super); + else return 0; + } +} + +JNIEXPORT bool JNICALL Java_java_lang_VMClass_isInstance( +#ifdef NATIVE_JNI +JNIEnv *env, +jclass clazz, +#endif +jclass Cl, jobject obj) { + CommonClass* cl = + (CommonClass*)Classpath::vmdataClass->getVirtualObjectField((JavaObject*)Cl); + return ((JavaObject*)obj)->instanceOf(cl); +} + +JNIEXPORT jobject JNICALL Java_java_lang_VMClass_getDeclaredFields( +#ifdef NATIVE_JNI +JNIEnv *env, +jclass clazz, +#endif +jclass Cl, jboolean publicOnly) { + Jnjvm* vm = JavaThread::get()->isolate; + CommonClass* cl = NativeUtil::resolvedImplClass(Cl, false); + + if (cl->isArray) { + return (jobject)ArrayObject::acons(0, Classpath::fieldArrayClass, vm); + } else { + CommonClass::field_map fields = cl->virtualFields; + std::vector res; + for (CommonClass::field_iterator i = fields.begin(), e = fields.end(); + i != e; ++i) { + JavaField* field = i->second; + if (!publicOnly || isPublic(field->access)) { + res.push_back(field); + } + } + fields = cl->staticFields; + for (CommonClass::field_iterator i = fields.begin(), e = fields.end(); + i != e; ++i) { + JavaField* field = i->second; + if (!publicOnly || isPublic(field->access)) { + res.push_back(field); + } + } + + ArrayObject* ret = ArrayObject::acons(res.size(), + Classpath::fieldArrayClass, vm); + sint32 index = 0; + for (std::vector::iterator i = res.begin(), e = res.end(); + i != e; ++i, ++index) { + JavaField* field = *i; + // TODO: check parameter types + JavaObject* tmp = (*Classpath::newField)(vm); + Classpath::initField->invokeIntSpecial(vm, tmp, Cl, + vm->UTF8ToStr(field->name), field); + ret->elements[index] = tmp; + } + return (jobject)ret; + } +} + +JNIEXPORT jobject JNICALL Java_java_lang_VMClass_getInterfaces( +#ifdef NATIVE_JNI +JNIEnv *env, +jclass clazz, +#endif +jclass Cl) { + Jnjvm* vm = JavaThread::get()->isolate; + CommonClass* cl = NativeUtil::resolvedImplClass(Cl, false); + std::vector & interfaces = cl->interfaces; + ArrayObject* ret = ArrayObject::acons(interfaces.size(), Classpath::classArrayClass, vm); + sint32 index = 0; + for (std::vector::iterator i = interfaces.begin(), e = interfaces.end(); + i != e; ++i, ++index) { + Class* klass = *i; + ret->elements[index] = vm->getClassDelegatee(klass); + } + return (jobject)ret; +} + +static void resolveInnerOuterClasses(Class* cl) { + Attribut* attribut = cl->lookupAttribut(Attribut::innerClassesAttribut); + if (attribut != 0) { + Reader reader(attribut, cl->bytes); + + uint16 nbi = reader.readU2(); + for (uint16 i = 0; i < nbi; ++i) { + uint16 inner = reader.readU2(); + uint16 outer = reader.readU2(); + //uint16 innerName = + reader.readU2(); + uint16 accessFlags = reader.readU2(); + Class* clInner = (Class*)cl->ctpInfo->loadClass(inner); + Class* clOuter = (Class*)cl->ctpInfo->loadClass(outer); + + if (clInner == cl) { + cl->outerClass = clOuter; + } else if (clOuter == cl) { + clInner->innerAccess = accessFlags; + cl->innerClasses.push_back(clInner); + } + } + } + cl->innerOuterResolved = true; +} + + +JNIEXPORT jclass JNICALL Java_java_lang_VMClass_getDeclaringClass( +#ifdef NATIVE_JNI +JNIEnv *env, +jclass clazz, +#endif +jclass Cl) { + Jnjvm* vm = JavaThread::get()->isolate; + Class* cl = (Class*)NativeUtil::resolvedImplClass(Cl, false); + if (!(cl->innerOuterResolved)) + resolveInnerOuterClasses(cl); + if (cl->outerClass) { + return (jclass)vm->getClassDelegatee(cl->outerClass); + } else { + return 0; + } +} + +JNIEXPORT jobject JNICALL Java_java_lang_VMClass_getDeclaredClasses( +#ifdef NATIVE_JNI +JNIEnv *env, +jclass clazz, +#endif +jclass Cl, bool publicOnly) { + Jnjvm* vm = JavaThread::get()->isolate; + Class* cl = (Class*)NativeUtil::resolvedImplClass(Cl, false); + if (!(cl->innerOuterResolved)) + resolveInnerOuterClasses(cl); + ArrayObject* res = ArrayObject::acons(cl->innerClasses.size(), Classpath::constructorArrayClass, vm); + uint32 index = 0; + for (std::vector::iterator i = cl->innerClasses.begin(), + e = cl->innerClasses.end(); i!= e; i++) { + res->elements[index++] = vm->getClassDelegatee(*i); + } + + return (jobject)res; +} + + +JNIEXPORT void JNICALL Java_java_lang_VMClass_throwException( +#ifdef NATIVE_JNI +JNIEnv *env, +jclass clazz, +#endif +jobject throwable) { + JavaThread::throwException((JavaObject*)throwable); +} + +JNIEXPORT jobjectArray Java_java_lang_VMClass_getDeclaredAnnotations( +#ifdef NATIVE_JNI +JNIEnv *env, +jclass clazz, +#endif +jclass Cl) { + // TODO implement me + Jnjvm* vm = JavaThread::get()->isolate; + ArrayObject* res = ArrayObject::acons(0, Classpath::constructorArrayAnnotation, vm); + return (jobjectArray)res; +} +} Removed: vmkit/trunk/lib/JnJVM/Classpath/ClasspathVMClassLoader.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/Classpath/ClasspathVMClassLoader.cpp?rev=52707&view=auto ============================================================================== --- vmkit/trunk/lib/JnJVM/Classpath/ClasspathVMClassLoader.cpp (original) +++ vmkit/trunk/lib/JnJVM/Classpath/ClasspathVMClassLoader.cpp (removed) @@ -1,122 +0,0 @@ -//===- ClasspathVMClassLoader.cpp - GNU classpath java/lang/VMClassLoader -===// -// -// JnJVM -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -#include - -#include "types.h" - -#include "JavaArray.h" -#include "JavaClass.h" -#include "JavaObject.h" -#include "JavaString.h" -#include "JavaTypes.h" -#include "JavaThread.h" -#include "Jnjvm.h" -#include "LockedMap.h" -#include "NativeUtil.h" - -using namespace jnjvm; - -extern "C" { - -JNIEXPORT jobject JNICALL Java_java_lang_VMClassLoader_getPrimitiveClass( -#ifdef NATIVE_JNI -JNIEnv *env, -jclass clazz, -#endif -jchar byteId) { - - AssessorDesc* ass = AssessorDesc::byteIdToPrimitive(byteId); - Jnjvm* vm = JavaThread::get()->isolate; - if (!ass) - vm->unknownError("unknown byte primitive %c", byteId); - - return (jobject)ass->classType->getClassDelegatee(); - -} - -JNIEXPORT jclass JNICALL Java_java_lang_VMClassLoader_findLoadedClass( -#ifdef NATIVE_JNI -JNIEnv *env, -jclass clazz, -#endif - jobject loader, - jobject _name) { - - Jnjvm* vm = JavaThread::get()->isolate; - JavaString* name = (JavaString*)_name; - const UTF8* utf8 = name->strToUTF8(vm); - CommonClass* cl = vm->lookupClass(utf8, (JavaObject*)loader); - - if (cl) return (jclass)(cl->getClassDelegatee()); - else return 0; -} - -JNIEXPORT jclass JNICALL Java_java_lang_VMClassLoader_loadClass( -#ifdef NATIVE_JNI -JNIEnv *env, -jclass clazz, -#endif - jobject _str, - jboolean doResolve) { - JavaString* str = (JavaString*)_str; - Jnjvm* vm = JavaThread::get()->isolate; - - CommonClass* cl = vm->lookupClassFromJavaString(str, 0, doResolve, false, false); - - if (cl != 0) { - return (jclass)cl->getClassDelegatee(); - } else { - return 0; - } -} - -JNIEXPORT jclass JNICALL Java_java_lang_VMClassLoader_defineClass( -#ifdef NATIVE_JNI -JNIEnv *env, -jclass clazz, -#endif - jobject loader, - jobject _str, - jobject bytes, - jint off, - jint len, - jobject pd) { - Jnjvm* vm = JavaThread::get()->isolate; - JavaString* str = (JavaString*)_str; - const UTF8* name = str->value->javaToInternal(vm, str->offset, str->count); - Class* cl = vm->constructClass(name, (JavaObject*)loader); - - if (cl->status == hashed) { - cl->aquire(); - if (cl->status == hashed) { - cl->bytes = (ArrayUInt8*)bytes; - cl->status = loaded; -#ifndef MULTIPLE_VM - cl->delegatee = (JavaObject*)pd; -#else - vm->delegatees->hash(cl, (JavaObject*)pd); -#endif - } - cl->release(); - } - return (jclass)(cl->getClassDelegatee()); -} - -JNIEXPORT void JNICALL Java_java_lang_VMClassLoader_resolveClass( -#ifdef NATIVE_JNI -JNIEnv *env, -jclass clazz, -#endif - jclass Cl) { - verifyNull(Cl); - NativeUtil::resolvedImplClass(Cl, false); -} - -} Added: vmkit/trunk/lib/JnJVM/Classpath/ClasspathVMClassLoader.cpp.inc URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/Classpath/ClasspathVMClassLoader.cpp.inc?rev=52708&view=auto ============================================================================== --- vmkit/trunk/lib/JnJVM/Classpath/ClasspathVMClassLoader.cpp.inc (added) +++ vmkit/trunk/lib/JnJVM/Classpath/ClasspathVMClassLoader.cpp.inc Wed Jun 25 04:59:39 2008 @@ -0,0 +1,122 @@ +//===- ClasspathVMClassLoader.cpp - GNU classpath java/lang/VMClassLoader -===// +// +// JnJVM +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#include + +#include "types.h" + +#include "JavaArray.h" +#include "JavaClass.h" +#include "JavaObject.h" +#include "JavaString.h" +#include "JavaTypes.h" +#include "JavaThread.h" +#include "Jnjvm.h" +#include "LockedMap.h" +#include "NativeUtil.h" + +using namespace jnjvm; + +extern "C" { + +JNIEXPORT jobject JNICALL Java_java_lang_VMClassLoader_getPrimitiveClass( +#ifdef NATIVE_JNI +JNIEnv *env, +jclass clazz, +#endif +jchar byteId) { + + AssessorDesc* ass = AssessorDesc::byteIdToPrimitive(byteId); + Jnjvm* vm = JavaThread::get()->isolate; + if (!ass) + vm->unknownError("unknown byte primitive %c", byteId); + + return (jobject)ass->classType->getClassDelegatee(); + +} + +JNIEXPORT jclass JNICALL Java_java_lang_VMClassLoader_findLoadedClass( +#ifdef NATIVE_JNI +JNIEnv *env, +jclass clazz, +#endif + jobject loader, + jobject _name) { + + Jnjvm* vm = JavaThread::get()->isolate; + JavaString* name = (JavaString*)_name; + const UTF8* utf8 = name->strToUTF8(vm); + CommonClass* cl = vm->lookupClass(utf8, (JavaObject*)loader); + + if (cl) return (jclass)(cl->getClassDelegatee()); + else return 0; +} + +JNIEXPORT jclass JNICALL Java_java_lang_VMClassLoader_loadClass( +#ifdef NATIVE_JNI +JNIEnv *env, +jclass clazz, +#endif + jobject _str, + jboolean doResolve) { + JavaString* str = (JavaString*)_str; + Jnjvm* vm = JavaThread::get()->isolate; + + CommonClass* cl = vm->lookupClassFromJavaString(str, 0, doResolve, false, false); + + if (cl != 0) { + return (jclass)cl->getClassDelegatee(); + } else { + return 0; + } +} + +JNIEXPORT jclass JNICALL Java_java_lang_VMClassLoader_defineClass( +#ifdef NATIVE_JNI +JNIEnv *env, +jclass clazz, +#endif + jobject loader, + jobject _str, + jobject bytes, + jint off, + jint len, + jobject pd) { + Jnjvm* vm = JavaThread::get()->isolate; + JavaString* str = (JavaString*)_str; + const UTF8* name = str->value->javaToInternal(vm, str->offset, str->count); + Class* cl = vm->constructClass(name, (JavaObject*)loader); + + if (cl->status == hashed) { + cl->aquire(); + if (cl->status == hashed) { + cl->bytes = (ArrayUInt8*)bytes; + cl->status = loaded; +#ifndef MULTIPLE_VM + cl->delegatee = (JavaObject*)pd; +#else + vm->delegatees->hash(cl, (JavaObject*)pd); +#endif + } + cl->release(); + } + return (jclass)(cl->getClassDelegatee()); +} + +JNIEXPORT void JNICALL Java_java_lang_VMClassLoader_resolveClass( +#ifdef NATIVE_JNI +JNIEnv *env, +jclass clazz, +#endif + jclass Cl) { + verifyNull(Cl); + NativeUtil::resolvedImplClass(Cl, false); +} + +} Removed: vmkit/trunk/lib/JnJVM/Classpath/ClasspathVMField.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/Classpath/ClasspathVMField.cpp?rev=52707&view=auto ============================================================================== --- vmkit/trunk/lib/JnJVM/Classpath/ClasspathVMField.cpp (original) +++ vmkit/trunk/lib/JnJVM/Classpath/ClasspathVMField.cpp (removed) @@ -1,707 +0,0 @@ -//===- ClasspathVMField.cpp - GNU classpath java/lang/reflect/Field -------===// -// -// JnJVM -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - - -#include "JavaClass.h" -#include "JavaThread.h" -#include "JavaTypes.h" -#include "JavaUpcalls.h" -#include "Jnjvm.h" -#include "NativeUtil.h" - -using namespace jnjvm; - -extern "C" { - -JNIEXPORT jint JNICALL Java_java_lang_reflect_Field_getModifiersInternal( -#ifdef NATIVE_JNI -JNIEnv *env, -#endif -jobject obj) { - JavaField* field = (JavaField*)Classpath::fieldSlot->getVirtualInt32Field((JavaObject*)obj); - return field->access; -} - -JNIEXPORT jclass JNICALL Java_java_lang_reflect_Field_getType( -#ifdef NATIVE_JNI -JNIEnv *env, -#endif -jobject obj) { - JavaField* field = (JavaField*)Classpath::fieldSlot->getVirtualInt32Field((JavaObject*)obj); - JavaObject* loader = field->classDef->classLoader; - CommonClass* cl = field->getSignature()->assocClass(loader); - return (jclass)cl->getClassDelegatee(); -} - -JNIEXPORT jint JNICALL Java_java_lang_reflect_Field_getInt( -#ifdef NATIVE_JNI -JNIEnv *env, -#endif -jobject Field, jobject obj) { - JavaField* field = (JavaField*)Classpath::fieldSlot->getVirtualInt32Field((JavaObject*)Field); - const AssessorDesc* ass = field->getSignature()->funcs; - - if (isStatic(field->access)) - JavaThread::get()->isolate->initialiseClass(field->classDef); - - switch (ass->numId) { - case INT_ID : - return isStatic(field->access) ? - (sint32)field->getStaticInt32Field() : - (sint32)field->getVirtualInt32Field((JavaObject*)obj); - case CHAR_ID : - return isStatic(field->access) ? - (uint32)field->getStaticInt16Field() : - (uint32)field->getVirtualInt16Field((JavaObject*)obj); - case BYTE_ID : - return isStatic(field->access) ? - (sint32)field->getStaticInt8Field() : - (sint32)field->getVirtualInt8Field((JavaObject*)obj); - case SHORT_ID : - return isStatic(field->access) ? - (sint32)field->getStaticInt16Field() : - (sint32)field->getVirtualInt16Field((JavaObject*)obj); - default : - JavaThread::get()->isolate->illegalArgumentException(""); - } - return 0; - -} - -JNIEXPORT jlong JNICALL Java_java_lang_reflect_Field_getLong( -#ifdef NATIVE_JNI -JNIEnv *env, -#endif -jobject Field, jobject obj) { - JavaField* field = (JavaField*)Classpath::fieldSlot->getVirtualInt32Field((JavaObject*)Field); - const AssessorDesc* ass = field->getSignature()->funcs; - - if (isStatic(field->access)) - JavaThread::get()->isolate->initialiseClass(field->classDef); - - switch (ass->numId) { - case INT_ID : - return isStatic(field->access) ? - (sint64)field->getStaticInt32Field() : - (sint64)field->getVirtualInt32Field((JavaObject*)obj); - case CHAR_ID : - return isStatic(field->access) ? - (uint64)field->getStaticInt16Field() : - (uint64)field->getVirtualInt16Field((JavaObject*)obj); - case BYTE_ID : - return isStatic(field->access) ? - (sint64)field->getStaticInt8Field() : - (sint64)field->getVirtualInt8Field((JavaObject*)obj); - case SHORT_ID : - return isStatic(field->access) ? - (sint64)field->getStaticInt16Field() : - (sint64)field->getVirtualInt16Field((JavaObject*)obj); - case LONG_ID : - return isStatic(field->access) ? - (sint64)field->getStaticLongField() : - (sint64)field->getVirtualLongField((JavaObject*)obj); - default: - JavaThread::get()->isolate->illegalArgumentException(""); - } - return 0; -} - -JNIEXPORT jboolean JNICALL Java_java_lang_reflect_Field_getBoolean( -#ifdef NATIVE_JNI -JNIEnv *env, -#endif -jobject Field, jobject obj) { - JavaField* field = (JavaField*)Classpath::fieldSlot->getVirtualInt32Field((JavaObject*)Field); - const AssessorDesc* ass = field->getSignature()->funcs; - - if (isStatic(field->access)) - JavaThread::get()->isolate->initialiseClass(field->classDef); - - switch (ass->numId) { - case BOOL_ID : - return isStatic(field->access) ? - (uint8)field->getStaticInt8Field() : - (uint8)field->getVirtualInt8Field((JavaObject*)obj); - default: - JavaThread::get()->isolate->illegalArgumentException(""); - } - - return 0; - -} - -JNIEXPORT jfloat JNICALL Java_java_lang_reflect_Field_getFloat( -#ifdef NATIVE_JNI -JNIEnv *env, -#endif -jobject Field, jobject obj) { - JavaField* field = (JavaField*)Classpath::fieldSlot->getVirtualInt32Field((JavaObject*)Field); - const AssessorDesc* ass = field->getSignature()->funcs; - - if (isStatic(field->access)) - JavaThread::get()->isolate->initialiseClass(field->classDef); - - switch (ass->numId) { - case BYTE_ID : - return isStatic(field->access) ? - (jfloat)field->getStaticInt8Field() : - (jfloat)field->getVirtualInt8Field((JavaObject*)obj); - case INT_ID : - return isStatic(field->access) ? - (jfloat)field->getStaticInt32Field() : - (jfloat)field->getVirtualInt32Field((JavaObject*)obj); - case SHORT_ID : - return isStatic(field->access) ? - (jfloat)field->getStaticInt16Field() : - (jfloat)field->getVirtualInt16Field((JavaObject*)obj); - case LONG_ID : - return isStatic(field->access) ? - (jfloat)field->getStaticLongField() : - (jfloat)field->getVirtualLongField((JavaObject*)obj); - case CHAR_ID : - return isStatic(field->access) ? - (jfloat)(uint32)field->getStaticInt16Field() : - (jfloat)(uint32)field->getVirtualInt16Field((JavaObject*)obj); - case FLOAT_ID : - return isStatic(field->access) ? - (jfloat)field->getStaticFloatField() : - (jfloat)field->getVirtualFloatField((JavaObject*)obj); - default: - JavaThread::get()->isolate->illegalArgumentException(""); - } - return 0.0; -} - -JNIEXPORT jbyte JNICALL Java_java_lang_reflect_Field_getByte( -#ifdef NATIVE_JNI -JNIEnv *env, -#endif -jobject Field, jobject obj) { - JavaField* field = (JavaField*)Classpath::fieldSlot->getVirtualInt32Field((JavaObject*)Field); - const AssessorDesc* ass = field->getSignature()->funcs; - - if (isStatic(field->access)) - JavaThread::get()->isolate->initialiseClass(field->classDef); - - switch (ass->numId) { - case BYTE_ID : - return isStatic(field->access) ? - (sint8)field->getStaticInt8Field() : - (sint8)field->getVirtualInt8Field((JavaObject*)obj); - default : - JavaThread::get()->isolate->illegalArgumentException(""); - } - - return 0; -} - -JNIEXPORT jchar JNICALL Java_java_lang_reflect_Field_getChar( -#ifdef NATIVE_JNI -JNIEnv *env, -#endif -jobject Field, jobject obj) { - JavaField* field = (JavaField*)Classpath::fieldSlot->getVirtualInt32Field((JavaObject*)Field); - const AssessorDesc* ass = field->getSignature()->funcs; - - if (isStatic(field->access)) - JavaThread::get()->isolate->initialiseClass(field->classDef); - - switch (ass->numId) { - case CHAR_ID : - return isStatic(field->access) ? - (uint16)field->getStaticInt16Field() : - (uint16)field->getVirtualInt16Field((JavaObject*)obj); - default : - JavaThread::get()->isolate->illegalArgumentException(""); - } - - return 0; - -} - -JNIEXPORT jshort JNICALL Java_java_lang_reflect_Field_getShort( -#ifdef NATIVE_JNI -JNIEnv *env, -#endif -jobject Field, jobject obj) { - JavaField* field = (JavaField*)Classpath::fieldSlot->getVirtualInt32Field((JavaObject*)Field); - const AssessorDesc* ass = field->getSignature()->funcs; - - if (isStatic(field->access)) - JavaThread::get()->isolate->initialiseClass(field->classDef); - - switch (ass->numId) { - case SHORT_ID : - return isStatic(field->access) ? - (sint16)field->getStaticInt16Field() : - (sint16)field->getVirtualInt16Field((JavaObject*)obj); - case BYTE_ID : - return isStatic(field->access) ? - (sint16)field->getStaticInt8Field() : - (sint16)field->getVirtualInt8Field((JavaObject*)obj); - default : - JavaThread::get()->isolate->illegalArgumentException(""); - } - - return 0; -} - -JNIEXPORT jdouble JNICALL Java_java_lang_reflect_Field_getDouble( -#ifdef NATIVE_JNI -JNIEnv *env, -#endif -jobject Field, jobject obj) { - JavaField* field = (JavaField*)Classpath::fieldSlot->getVirtualInt32Field((JavaObject*)Field); - const AssessorDesc* ass = field->getSignature()->funcs; - - if (isStatic(field->access)) - JavaThread::get()->isolate->initialiseClass(field->classDef); - - switch (ass->numId) { - case BYTE_ID : - return isStatic(field->access) ? - (jdouble)(sint64)field->getStaticInt8Field() : - (jdouble)(sint64)field->getVirtualInt8Field((JavaObject*)obj); - case INT_ID : - return isStatic(field->access) ? - (jdouble)(sint64)field->getStaticInt32Field() : - (jdouble)(sint64)field->getVirtualInt32Field((JavaObject*)obj); - case SHORT_ID : - return isStatic(field->access) ? - (jdouble)(sint64)field->getStaticInt16Field() : - (jdouble)(sint64)field->getVirtualInt16Field((JavaObject*)obj); - case LONG_ID : - return isStatic(field->access) ? - (jdouble)(sint64)field->getStaticLongField() : - (jdouble)(sint64)field->getVirtualLongField((JavaObject*)obj); - case CHAR_ID : - return isStatic(field->access) ? - (jdouble)(uint64)field->getStaticInt16Field() : - (jdouble)(uint64)field->getVirtualInt16Field((JavaObject*)obj); - case FLOAT_ID : - return isStatic(field->access) ? - (jdouble)field->getStaticFloatField() : - (jdouble)field->getVirtualFloatField((JavaObject*)obj); - case DOUBLE_ID : - return isStatic(field->access) ? - (jdouble)field->getStaticDoubleField() : - (jdouble)field->getVirtualDoubleField((JavaObject*)obj); - default : - JavaThread::get()->isolate->illegalArgumentException(""); - } - return 0.0; -} - -JNIEXPORT jobject JNICALL Java_java_lang_reflect_Field_get( -#ifdef NATIVE_JNI -JNIEnv *env, -#endif -jobject Field, jobject _obj) { - JavaField* field = (JavaField*)Classpath::fieldSlot->getVirtualInt32Field((JavaObject*)Field); - Typedef* type = field->getSignature(); - const AssessorDesc* ass = type->funcs; - JavaObject* obj = (JavaObject*)_obj; - Jnjvm* vm = JavaThread::get()->isolate; - - if (isStatic(field->access)) - JavaThread::get()->isolate->initialiseClass(field->classDef); - - JavaObject* res = 0; - switch (ass->numId) { - case BOOL_ID : { - uint8 val = (isStatic(field->access) ? - field->getStaticInt8Field() : - field->getVirtualInt8Field(obj)); - res = (*Classpath::boolClass)(vm); - Classpath::boolValue->setVirtualInt8Field(res, val); - break; - } - case BYTE_ID : { - sint8 val = (isStatic(field->access) ? - field->getStaticInt8Field() : - field->getVirtualInt8Field(obj)); - res = (*Classpath::byteClass)(vm); - Classpath::byteValue->setVirtualInt8Field(res, val); - break; - } - case CHAR_ID : { - uint16 val = (isStatic(field->access) ? - field->getStaticInt16Field() : - field->getVirtualInt16Field(obj)); - res = (*Classpath::charClass)(vm); - Classpath::charValue->setVirtualInt16Field(res, val); - break; - } - case SHORT_ID : { - sint16 val = (isStatic(field->access) ? - field->getStaticInt16Field() : - field->getVirtualInt16Field(obj)); - res = (*Classpath::shortClass)(vm); - Classpath::shortValue->setVirtualInt16Field(res, val); - break; - } - case INT_ID : { - sint32 val = (isStatic(field->access) ? - field->getStaticInt32Field() : - field->getVirtualInt32Field(obj)); - res = (*Classpath::intClass)(vm); - Classpath::intValue->setVirtualInt32Field(res, val); - break; - } - case LONG_ID : { - sint64 val = (isStatic(field->access) ? - field->getStaticLongField() : - field->getVirtualLongField(obj)); - res = (*Classpath::longClass)(vm); - Classpath::longValue->setVirtualLongField(res, val); - break; - } - case FLOAT_ID : { - float val = (isStatic(field->access) ? - field->getStaticFloatField() : - field->getVirtualFloatField(obj)); - res = (*Classpath::floatClass)(vm); - Classpath::floatValue->setVirtualFloatField(res, val); - break; - } - case DOUBLE_ID : { - double val = (isStatic(field->access) ? - field->getStaticDoubleField() : - field->getVirtualDoubleField(obj)); - res = (*Classpath::doubleClass)(vm); - Classpath::doubleValue->setVirtualDoubleField(res, val); - break; - } - case OBJECT_ID : - case ARRAY_ID : - res = (isStatic(field->access) ? - field->getStaticObjectField() : - field->getVirtualObjectField(obj)); - break; - default: - JavaThread::get()->isolate->unknownError("should not be here"); - } - return (jobject)res; -} - -JNIEXPORT void JNICALL Java_java_lang_reflect_Field_set( -#ifdef NATIVE_JNI -JNIEnv *env, -#endif -jobject Field, jobject obj, jobject val) { - JavaField* field = (JavaField*)Classpath::fieldSlot->getVirtualInt32Field((JavaObject*)Field); - void** buf = (void**)alloca(sizeof(uint64)); - void* _buf = (void*)buf; - NativeUtil::decapsulePrimitive(JavaThread::get()->isolate, buf, (JavaObject*)val, field->getSignature()); - - const AssessorDesc* ass = field->getSignature()->funcs; - - if (isStatic(field->access)) - JavaThread::get()->isolate->initialiseClass(field->classDef); - - switch (ass->numId) { - case BOOL_ID : - return isStatic(field->access) ? - field->setStaticInt8Field(((uint8*)_buf)[0]) : - field->setVirtualInt8Field((JavaObject*)obj, ((uint8*)_buf)[0]); - case BYTE_ID : - return isStatic(field->access) ? - field->setStaticInt8Field(((sint8*)_buf)[0]) : - field->setVirtualInt8Field((JavaObject*)obj, ((sint8*)_buf)[0]); - case CHAR_ID : - return isStatic(field->access) ? - field->setStaticInt16Field(((uint16*)_buf)[0]) : - field->setVirtualInt16Field((JavaObject*)obj, ((uint16*)_buf)[0]); - case SHORT_ID : - return isStatic(field->access) ? - field->setStaticInt16Field(((sint16*)_buf)[0]) : - field->setVirtualInt16Field((JavaObject*)obj, ((sint16*)_buf)[0]); - case INT_ID : - return isStatic(field->access) ? - field->setStaticInt32Field(((sint32*)_buf)[0]) : - field->setVirtualInt32Field((JavaObject*)obj, ((sint32*)_buf)[0]); - case LONG_ID : - return isStatic(field->access) ? - field->setStaticLongField(((sint64*)_buf)[0]) : - field->setVirtualLongField((JavaObject*)obj, ((sint64*)_buf)[0]); - case FLOAT_ID : - return isStatic(field->access) ? - field->setStaticFloatField(((float*)_buf)[0]) : - field->setVirtualFloatField((JavaObject*)obj, ((float*)_buf)[0]); - case DOUBLE_ID : - return isStatic(field->access) ? - field->setStaticDoubleField(((double*)_buf)[0]) : - field->setVirtualDoubleField((JavaObject*)obj, ((double*)_buf)[0]); - case ARRAY_ID : - case OBJECT_ID : - return isStatic(field->access) ? - field->setStaticObjectField(((JavaObject**)_buf)[0]) : - field->setVirtualObjectField((JavaObject*)obj, ((JavaObject**)_buf)[0]); - default : - JavaThread::get()->isolate->unknownError("should not be here"); - } -} - -JNIEXPORT void JNICALL Java_java_lang_reflect_Field_setBoolean( -#ifdef NATIVE_JNI -JNIEnv *env, -#endif -jobject Field, jobject obj, jboolean val) { - JavaField* field = (JavaField*)Classpath::fieldSlot->getVirtualInt32Field((JavaObject*)Field); - const AssessorDesc* ass = field->getSignature()->funcs; - - if (isStatic(field->access)) - JavaThread::get()->isolate->initialiseClass(field->classDef); - - switch (ass->numId) { - case BOOL_ID : - return isStatic(field->access) ? - field->setStaticInt8Field((uint8)val) : - field->setVirtualInt8Field((JavaObject*)obj, (uint8)val); - default : - JavaThread::get()->isolate->illegalArgumentException(""); - } - -} - -JNIEXPORT void JNICALL Java_java_lang_reflect_Field_setByte( -#ifdef NATIVE_JNI -JNIEnv *env, -#endif -jobject Field, jobject _obj, jbyte val) { - JavaField* field = (JavaField*)Classpath::fieldSlot->getVirtualInt32Field((JavaObject*)Field); - const AssessorDesc* ass = field->getSignature()->funcs; - JavaObject* obj = (JavaObject*)_obj; - - if (isStatic(field->access)) - JavaThread::get()->isolate->initialiseClass(field->classDef); - - switch (ass->numId) { - case BYTE_ID : - return isStatic(field->access) ? - field->setStaticInt8Field((sint8)val) : - field->setVirtualInt8Field((JavaObject*)obj, (sint8)val); - case SHORT_ID : - return isStatic(field->access) ? - field->setStaticInt16Field((sint16)val) : - field->setVirtualInt16Field((JavaObject*)obj, (sint16)val); - case INT_ID : - return isStatic(field->access) ? - field->setStaticInt32Field((sint32)val) : - field->setVirtualInt32Field((JavaObject*)obj, (sint32)val); - case LONG_ID : - return isStatic(field->access) ? - field->setStaticLongField((sint64)val) : - field->setVirtualLongField((JavaObject*)obj, (sint64)val); - case FLOAT_ID : - return isStatic(field->access) ? - field->setStaticFloatField((float)val) : - field->setVirtualFloatField((JavaObject*)obj, (float)val); - case DOUBLE_ID : - return isStatic(field->access) ? - field->setStaticDoubleField((double)val) : - field->setVirtualDoubleField((JavaObject*)obj, (double)val); - default : - JavaThread::get()->isolate->illegalArgumentException(""); - } -} - -JNIEXPORT void JNICALL Java_java_lang_reflect_Field_setChar( -#ifdef NATIVE_JNI -JNIEnv *env, -#endif -jobject Field, jobject obj, jchar val) { - JavaField* field = (JavaField*)Classpath::fieldSlot->getVirtualInt32Field((JavaObject*)Field); - const AssessorDesc* ass = field->getSignature()->funcs; - - if (isStatic(field->access)) - JavaThread::get()->isolate->initialiseClass(field->classDef); - - switch (ass->numId) { - case CHAR_ID : - return isStatic(field->access) ? - field->setStaticInt16Field((uint16)val) : - field->setVirtualDoubleField((JavaObject*)obj, (uint16)val); - case INT_ID : - return isStatic(field->access) ? - field->setStaticInt32Field((uint32)val) : - field->setVirtualInt32Field((JavaObject*)obj, (uint32)val); - case LONG_ID : - return isStatic(field->access) ? - field->setStaticLongField((uint64)val) : - field->setVirtualLongField((JavaObject*)obj, (uint64)val); - case FLOAT_ID : - return isStatic(field->access) ? - field->setStaticFloatField((float)(uint32)val) : - field->setVirtualFloatField((JavaObject*)obj, (float)(uint32)val); - case DOUBLE_ID : - return isStatic(field->access) ? - field->setStaticDoubleField((double)(uint64)val) : - field->setVirtualDoubleField((JavaObject*)obj, (double)(uint64)val); - default : - JavaThread::get()->isolate->illegalArgumentException(""); - } -} - -JNIEXPORT void JNICALL Java_java_lang_reflect_Field_setShort( -#ifdef NATIVE_JNI -JNIEnv *env, -#endif -jobject Field, jobject obj, jshort val) { - JavaField* field = (JavaField*)Classpath::fieldSlot->getVirtualInt32Field((JavaObject*)Field); - const AssessorDesc* ass = field->getSignature()->funcs; - - if (isStatic(field->access)) - JavaThread::get()->isolate->initialiseClass(field->classDef); - - switch (ass->numId) { - case SHORT_ID : - return isStatic(field->access) ? - field->setStaticInt16Field((sint16)val) : - field->setVirtualInt16Field((JavaObject*)obj, (sint16)val); - case INT_ID : - return isStatic(field->access) ? - field->setStaticInt32Field((sint32)val) : - field->setVirtualInt32Field((JavaObject*)obj, (sint32)val); - case LONG_ID : - return isStatic(field->access) ? - field->setStaticLongField((sint64)val) : - field->setVirtualLongField((JavaObject*)obj, (sint64)val); - case FLOAT_ID : - return isStatic(field->access) ? - field->setStaticFloatField((float)val) : - field->setVirtualFloatField((JavaObject*)obj, (float)val); - case DOUBLE_ID : - return isStatic(field->access) ? - field->setStaticDoubleField((double)val) : - field->setVirtualDoubleField((JavaObject*)obj, (double)val); - default : - JavaThread::get()->isolate->illegalArgumentException(""); - } -} - -JNIEXPORT void JNICALL Java_java_lang_reflect_Field_setInt( -#ifdef NATIVE_JNI -JNIEnv *env, -#endif -jobject Field, jobject obj, jint val) { - JavaField* field = (JavaField*)Classpath::fieldSlot->getVirtualInt32Field((JavaObject*)Field); - const AssessorDesc* ass = field->getSignature()->funcs; - - if (isStatic(field->access)) - JavaThread::get()->isolate->initialiseClass(field->classDef); - - switch (ass->numId) { - case INT_ID : - return isStatic(field->access) ? - field->setStaticInt32Field((sint32)val) : - field->setVirtualInt32Field((JavaObject*)obj, (sint32)val); - case LONG_ID : - return isStatic(field->access) ? - field->setStaticLongField((sint64)val) : - field->setVirtualLongField((JavaObject*)obj, (sint64)val); - case FLOAT_ID : - return isStatic(field->access) ? - field->setStaticFloatField((float)val) : - field->setVirtualFloatField((JavaObject*)obj, (float)val); - case DOUBLE_ID : - return isStatic(field->access) ? - field->setStaticDoubleField((double)val) : - field->setVirtualDoubleField((JavaObject*)obj, (double)val); - default : - JavaThread::get()->isolate->illegalArgumentException(""); - } -} - -JNIEXPORT void JNICALL Java_java_lang_reflect_Field_setLong( -#ifdef NATIVE_JNI -JNIEnv *env, -#endif -jobject Field, jobject obj, jlong val) { - JavaField* field = (JavaField*)Classpath::fieldSlot->getVirtualInt32Field((JavaObject*)Field); - const AssessorDesc* ass = field->getSignature()->funcs; - - if (isStatic(field->access)) - JavaThread::get()->isolate->initialiseClass(field->classDef); - - switch (ass->numId) { - case LONG_ID : - return isStatic(field->access) ? - field->setStaticLongField((sint64)val) : - field->setVirtualLongField((JavaObject*)obj, (sint64)val); - case FLOAT_ID : - return isStatic(field->access) ? - field->setStaticFloatField((float)val) : - field->setVirtualFloatField((JavaObject*)obj, (float)val); - case DOUBLE_ID : - return isStatic(field->access) ? - field->setStaticDoubleField((double)val) : - field->setVirtualDoubleField((JavaObject*)obj, (double)val); - default : - JavaThread::get()->isolate->illegalArgumentException(""); - } -} - -JNIEXPORT void JNICALL Java_java_lang_reflect_Field_setFloat( -#ifdef NATIVE_JNI -JNIEnv *env, -#endif -jobject Field, jobject obj, jfloat val) { - JavaField* field = (JavaField*)Classpath::fieldSlot->getVirtualInt32Field((JavaObject*)Field); - const AssessorDesc* ass = field->getSignature()->funcs; - - if (isStatic(field->access)) - JavaThread::get()->isolate->initialiseClass(field->classDef); - - switch (ass->numId) { - case FLOAT_ID : - return isStatic(field->access) ? - field->setStaticFloatField((float)val) : - field->setVirtualFloatField((JavaObject*)obj, (float)val); - case DOUBLE_ID : - return isStatic(field->access) ? - field->setStaticDoubleField((double)val) : - field->setVirtualDoubleField((JavaObject*)obj, (double)val); - default : - JavaThread::get()->isolate->illegalArgumentException(""); - } -} - -JNIEXPORT void JNICALL Java_java_lang_reflect_Field_setDouble( -#ifdef NATIVE_JNI -JNIEnv *env, -#endif -jobject Field, jobject obj, jdouble val) { - JavaField* field = (JavaField*)Classpath::fieldSlot->getVirtualInt32Field((JavaObject*)Field); - const AssessorDesc* ass = field->getSignature()->funcs; - - if (isStatic(field->access)) - JavaThread::get()->isolate->initialiseClass(field->classDef); - - switch (ass->numId) { - case DOUBLE_ID : - return isStatic(field->access) ? - field->setStaticDoubleField((double)val) : - field->setVirtualDoubleField((JavaObject*)obj, (double)val); - default : - JavaThread::get()->isolate->illegalArgumentException(""); - } -} - -JNIEXPORT jlong JNICALL Java_sun_misc_Unsafe_objectFieldOffset( -#ifdef NATIVE_JNI -JNIEnv *env, -#endif -JavaObject* Unsafe, -JavaObject* Field) { - JavaField* field = (JavaField*)Classpath::fieldSlot->getVirtualInt32Field((JavaObject*)Field); - return (jlong)field->ptrOffset; -} - -} Added: vmkit/trunk/lib/JnJVM/Classpath/ClasspathVMField.cpp.inc URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/Classpath/ClasspathVMField.cpp.inc?rev=52708&view=auto ============================================================================== --- vmkit/trunk/lib/JnJVM/Classpath/ClasspathVMField.cpp.inc (added) +++ vmkit/trunk/lib/JnJVM/Classpath/ClasspathVMField.cpp.inc Wed Jun 25 04:59:39 2008 @@ -0,0 +1,707 @@ +//===- ClasspathVMField.cpp - GNU classpath java/lang/reflect/Field -------===// +// +// JnJVM +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + + +#include "JavaClass.h" +#include "JavaThread.h" +#include "JavaTypes.h" +#include "JavaUpcalls.h" +#include "Jnjvm.h" +#include "NativeUtil.h" + +using namespace jnjvm; + +extern "C" { + +JNIEXPORT jint JNICALL Java_java_lang_reflect_Field_getModifiersInternal( +#ifdef NATIVE_JNI +JNIEnv *env, +#endif +jobject obj) { + JavaField* field = (JavaField*)Classpath::fieldSlot->getVirtualInt32Field((JavaObject*)obj); + return field->access; +} + +JNIEXPORT jclass JNICALL Java_java_lang_reflect_Field_getType( +#ifdef NATIVE_JNI +JNIEnv *env, +#endif +jobject obj) { + JavaField* field = (JavaField*)Classpath::fieldSlot->getVirtualInt32Field((JavaObject*)obj); + JavaObject* loader = field->classDef->classLoader; + CommonClass* cl = field->getSignature()->assocClass(loader); + return (jclass)cl->getClassDelegatee(); +} + +JNIEXPORT jint JNICALL Java_java_lang_reflect_Field_getInt( +#ifdef NATIVE_JNI +JNIEnv *env, +#endif +jobject Field, jobject obj) { + JavaField* field = (JavaField*)Classpath::fieldSlot->getVirtualInt32Field((JavaObject*)Field); + const AssessorDesc* ass = field->getSignature()->funcs; + + if (isStatic(field->access)) + JavaThread::get()->isolate->initialiseClass(field->classDef); + + switch (ass->numId) { + case INT_ID : + return isStatic(field->access) ? + (sint32)field->getStaticInt32Field() : + (sint32)field->getVirtualInt32Field((JavaObject*)obj); + case CHAR_ID : + return isStatic(field->access) ? + (uint32)field->getStaticInt16Field() : + (uint32)field->getVirtualInt16Field((JavaObject*)obj); + case BYTE_ID : + return isStatic(field->access) ? + (sint32)field->getStaticInt8Field() : + (sint32)field->getVirtualInt8Field((JavaObject*)obj); + case SHORT_ID : + return isStatic(field->access) ? + (sint32)field->getStaticInt16Field() : + (sint32)field->getVirtualInt16Field((JavaObject*)obj); + default : + JavaThread::get()->isolate->illegalArgumentException(""); + } + return 0; + +} + +JNIEXPORT jlong JNICALL Java_java_lang_reflect_Field_getLong( +#ifdef NATIVE_JNI +JNIEnv *env, +#endif +jobject Field, jobject obj) { + JavaField* field = (JavaField*)Classpath::fieldSlot->getVirtualInt32Field((JavaObject*)Field); + const AssessorDesc* ass = field->getSignature()->funcs; + + if (isStatic(field->access)) + JavaThread::get()->isolate->initialiseClass(field->classDef); + + switch (ass->numId) { + case INT_ID : + return isStatic(field->access) ? + (sint64)field->getStaticInt32Field() : + (sint64)field->getVirtualInt32Field((JavaObject*)obj); + case CHAR_ID : + return isStatic(field->access) ? + (uint64)field->getStaticInt16Field() : + (uint64)field->getVirtualInt16Field((JavaObject*)obj); + case BYTE_ID : + return isStatic(field->access) ? + (sint64)field->getStaticInt8Field() : + (sint64)field->getVirtualInt8Field((JavaObject*)obj); + case SHORT_ID : + return isStatic(field->access) ? + (sint64)field->getStaticInt16Field() : + (sint64)field->getVirtualInt16Field((JavaObject*)obj); + case LONG_ID : + return isStatic(field->access) ? + (sint64)field->getStaticLongField() : + (sint64)field->getVirtualLongField((JavaObject*)obj); + default: + JavaThread::get()->isolate->illegalArgumentException(""); + } + return 0; +} + +JNIEXPORT jboolean JNICALL Java_java_lang_reflect_Field_getBoolean( +#ifdef NATIVE_JNI +JNIEnv *env, +#endif +jobject Field, jobject obj) { + JavaField* field = (JavaField*)Classpath::fieldSlot->getVirtualInt32Field((JavaObject*)Field); + const AssessorDesc* ass = field->getSignature()->funcs; + + if (isStatic(field->access)) + JavaThread::get()->isolate->initialiseClass(field->classDef); + + switch (ass->numId) { + case BOOL_ID : + return isStatic(field->access) ? + (uint8)field->getStaticInt8Field() : + (uint8)field->getVirtualInt8Field((JavaObject*)obj); + default: + JavaThread::get()->isolate->illegalArgumentException(""); + } + + return 0; + +} + +JNIEXPORT jfloat JNICALL Java_java_lang_reflect_Field_getFloat( +#ifdef NATIVE_JNI +JNIEnv *env, +#endif +jobject Field, jobject obj) { + JavaField* field = (JavaField*)Classpath::fieldSlot->getVirtualInt32Field((JavaObject*)Field); + const AssessorDesc* ass = field->getSignature()->funcs; + + if (isStatic(field->access)) + JavaThread::get()->isolate->initialiseClass(field->classDef); + + switch (ass->numId) { + case BYTE_ID : + return isStatic(field->access) ? + (jfloat)field->getStaticInt8Field() : + (jfloat)field->getVirtualInt8Field((JavaObject*)obj); + case INT_ID : + return isStatic(field->access) ? + (jfloat)field->getStaticInt32Field() : + (jfloat)field->getVirtualInt32Field((JavaObject*)obj); + case SHORT_ID : + return isStatic(field->access) ? + (jfloat)field->getStaticInt16Field() : + (jfloat)field->getVirtualInt16Field((JavaObject*)obj); + case LONG_ID : + return isStatic(field->access) ? + (jfloat)field->getStaticLongField() : + (jfloat)field->getVirtualLongField((JavaObject*)obj); + case CHAR_ID : + return isStatic(field->access) ? + (jfloat)(uint32)field->getStaticInt16Field() : + (jfloat)(uint32)field->getVirtualInt16Field((JavaObject*)obj); + case FLOAT_ID : + return isStatic(field->access) ? + (jfloat)field->getStaticFloatField() : + (jfloat)field->getVirtualFloatField((JavaObject*)obj); + default: + JavaThread::get()->isolate->illegalArgumentException(""); + } + return 0.0; +} + +JNIEXPORT jbyte JNICALL Java_java_lang_reflect_Field_getByte( +#ifdef NATIVE_JNI +JNIEnv *env, +#endif +jobject Field, jobject obj) { + JavaField* field = (JavaField*)Classpath::fieldSlot->getVirtualInt32Field((JavaObject*)Field); + const AssessorDesc* ass = field->getSignature()->funcs; + + if (isStatic(field->access)) + JavaThread::get()->isolate->initialiseClass(field->classDef); + + switch (ass->numId) { + case BYTE_ID : + return isStatic(field->access) ? + (sint8)field->getStaticInt8Field() : + (sint8)field->getVirtualInt8Field((JavaObject*)obj); + default : + JavaThread::get()->isolate->illegalArgumentException(""); + } + + return 0; +} + +JNIEXPORT jchar JNICALL Java_java_lang_reflect_Field_getChar( +#ifdef NATIVE_JNI +JNIEnv *env, +#endif +jobject Field, jobject obj) { + JavaField* field = (JavaField*)Classpath::fieldSlot->getVirtualInt32Field((JavaObject*)Field); + const AssessorDesc* ass = field->getSignature()->funcs; + + if (isStatic(field->access)) + JavaThread::get()->isolate->initialiseClass(field->classDef); + + switch (ass->numId) { + case CHAR_ID : + return isStatic(field->access) ? + (uint16)field->getStaticInt16Field() : + (uint16)field->getVirtualInt16Field((JavaObject*)obj); + default : + JavaThread::get()->isolate->illegalArgumentException(""); + } + + return 0; + +} + +JNIEXPORT jshort JNICALL Java_java_lang_reflect_Field_getShort( +#ifdef NATIVE_JNI +JNIEnv *env, +#endif +jobject Field, jobject obj) { + JavaField* field = (JavaField*)Classpath::fieldSlot->getVirtualInt32Field((JavaObject*)Field); + const AssessorDesc* ass = field->getSignature()->funcs; + + if (isStatic(field->access)) + JavaThread::get()->isolate->initialiseClass(field->classDef); + + switch (ass->numId) { + case SHORT_ID : + return isStatic(field->access) ? + (sint16)field->getStaticInt16Field() : + (sint16)field->getVirtualInt16Field((JavaObject*)obj); + case BYTE_ID : + return isStatic(field->access) ? + (sint16)field->getStaticInt8Field() : + (sint16)field->getVirtualInt8Field((JavaObject*)obj); + default : + JavaThread::get()->isolate->illegalArgumentException(""); + } + + return 0; +} + +JNIEXPORT jdouble JNICALL Java_java_lang_reflect_Field_getDouble( +#ifdef NATIVE_JNI +JNIEnv *env, +#endif +jobject Field, jobject obj) { + JavaField* field = (JavaField*)Classpath::fieldSlot->getVirtualInt32Field((JavaObject*)Field); + const AssessorDesc* ass = field->getSignature()->funcs; + + if (isStatic(field->access)) + JavaThread::get()->isolate->initialiseClass(field->classDef); + + switch (ass->numId) { + case BYTE_ID : + return isStatic(field->access) ? + (jdouble)(sint64)field->getStaticInt8Field() : + (jdouble)(sint64)field->getVirtualInt8Field((JavaObject*)obj); + case INT_ID : + return isStatic(field->access) ? + (jdouble)(sint64)field->getStaticInt32Field() : + (jdouble)(sint64)field->getVirtualInt32Field((JavaObject*)obj); + case SHORT_ID : + return isStatic(field->access) ? + (jdouble)(sint64)field->getStaticInt16Field() : + (jdouble)(sint64)field->getVirtualInt16Field((JavaObject*)obj); + case LONG_ID : + return isStatic(field->access) ? + (jdouble)(sint64)field->getStaticLongField() : + (jdouble)(sint64)field->getVirtualLongField((JavaObject*)obj); + case CHAR_ID : + return isStatic(field->access) ? + (jdouble)(uint64)field->getStaticInt16Field() : + (jdouble)(uint64)field->getVirtualInt16Field((JavaObject*)obj); + case FLOAT_ID : + return isStatic(field->access) ? + (jdouble)field->getStaticFloatField() : + (jdouble)field->getVirtualFloatField((JavaObject*)obj); + case DOUBLE_ID : + return isStatic(field->access) ? + (jdouble)field->getStaticDoubleField() : + (jdouble)field->getVirtualDoubleField((JavaObject*)obj); + default : + JavaThread::get()->isolate->illegalArgumentException(""); + } + return 0.0; +} + +JNIEXPORT jobject JNICALL Java_java_lang_reflect_Field_get( +#ifdef NATIVE_JNI +JNIEnv *env, +#endif +jobject Field, jobject _obj) { + JavaField* field = (JavaField*)Classpath::fieldSlot->getVirtualInt32Field((JavaObject*)Field); + Typedef* type = field->getSignature(); + const AssessorDesc* ass = type->funcs; + JavaObject* obj = (JavaObject*)_obj; + Jnjvm* vm = JavaThread::get()->isolate; + + if (isStatic(field->access)) + JavaThread::get()->isolate->initialiseClass(field->classDef); + + JavaObject* res = 0; + switch (ass->numId) { + case BOOL_ID : { + uint8 val = (isStatic(field->access) ? + field->getStaticInt8Field() : + field->getVirtualInt8Field(obj)); + res = (*Classpath::boolClass)(vm); + Classpath::boolValue->setVirtualInt8Field(res, val); + break; + } + case BYTE_ID : { + sint8 val = (isStatic(field->access) ? + field->getStaticInt8Field() : + field->getVirtualInt8Field(obj)); + res = (*Classpath::byteClass)(vm); + Classpath::byteValue->setVirtualInt8Field(res, val); + break; + } + case CHAR_ID : { + uint16 val = (isStatic(field->access) ? + field->getStaticInt16Field() : + field->getVirtualInt16Field(obj)); + res = (*Classpath::charClass)(vm); + Classpath::charValue->setVirtualInt16Field(res, val); + break; + } + case SHORT_ID : { + sint16 val = (isStatic(field->access) ? + field->getStaticInt16Field() : + field->getVirtualInt16Field(obj)); + res = (*Classpath::shortClass)(vm); + Classpath::shortValue->setVirtualInt16Field(res, val); + break; + } + case INT_ID : { + sint32 val = (isStatic(field->access) ? + field->getStaticInt32Field() : + field->getVirtualInt32Field(obj)); + res = (*Classpath::intClass)(vm); + Classpath::intValue->setVirtualInt32Field(res, val); + break; + } + case LONG_ID : { + sint64 val = (isStatic(field->access) ? + field->getStaticLongField() : + field->getVirtualLongField(obj)); + res = (*Classpath::longClass)(vm); + Classpath::longValue->setVirtualLongField(res, val); + break; + } + case FLOAT_ID : { + float val = (isStatic(field->access) ? + field->getStaticFloatField() : + field->getVirtualFloatField(obj)); + res = (*Classpath::floatClass)(vm); + Classpath::floatValue->setVirtualFloatField(res, val); + break; + } + case DOUBLE_ID : { + double val = (isStatic(field->access) ? + field->getStaticDoubleField() : + field->getVirtualDoubleField(obj)); + res = (*Classpath::doubleClass)(vm); + Classpath::doubleValue->setVirtualDoubleField(res, val); + break; + } + case OBJECT_ID : + case ARRAY_ID : + res = (isStatic(field->access) ? + field->getStaticObjectField() : + field->getVirtualObjectField(obj)); + break; + default: + JavaThread::get()->isolate->unknownError("should not be here"); + } + return (jobject)res; +} + +JNIEXPORT void JNICALL Java_java_lang_reflect_Field_set( +#ifdef NATIVE_JNI +JNIEnv *env, +#endif +jobject Field, jobject obj, jobject val) { + JavaField* field = (JavaField*)Classpath::fieldSlot->getVirtualInt32Field((JavaObject*)Field); + void** buf = (void**)alloca(sizeof(uint64)); + void* _buf = (void*)buf; + NativeUtil::decapsulePrimitive(JavaThread::get()->isolate, buf, (JavaObject*)val, field->getSignature()); + + const AssessorDesc* ass = field->getSignature()->funcs; + + if (isStatic(field->access)) + JavaThread::get()->isolate->initialiseClass(field->classDef); + + switch (ass->numId) { + case BOOL_ID : + return isStatic(field->access) ? + field->setStaticInt8Field(((uint8*)_buf)[0]) : + field->setVirtualInt8Field((JavaObject*)obj, ((uint8*)_buf)[0]); + case BYTE_ID : + return isStatic(field->access) ? + field->setStaticInt8Field(((sint8*)_buf)[0]) : + field->setVirtualInt8Field((JavaObject*)obj, ((sint8*)_buf)[0]); + case CHAR_ID : + return isStatic(field->access) ? + field->setStaticInt16Field(((uint16*)_buf)[0]) : + field->setVirtualInt16Field((JavaObject*)obj, ((uint16*)_buf)[0]); + case SHORT_ID : + return isStatic(field->access) ? + field->setStaticInt16Field(((sint16*)_buf)[0]) : + field->setVirtualInt16Field((JavaObject*)obj, ((sint16*)_buf)[0]); + case INT_ID : + return isStatic(field->access) ? + field->setStaticInt32Field(((sint32*)_buf)[0]) : + field->setVirtualInt32Field((JavaObject*)obj, ((sint32*)_buf)[0]); + case LONG_ID : + return isStatic(field->access) ? + field->setStaticLongField(((sint64*)_buf)[0]) : + field->setVirtualLongField((JavaObject*)obj, ((sint64*)_buf)[0]); + case FLOAT_ID : + return isStatic(field->access) ? + field->setStaticFloatField(((float*)_buf)[0]) : + field->setVirtualFloatField((JavaObject*)obj, ((float*)_buf)[0]); + case DOUBLE_ID : + return isStatic(field->access) ? + field->setStaticDoubleField(((double*)_buf)[0]) : + field->setVirtualDoubleField((JavaObject*)obj, ((double*)_buf)[0]); + case ARRAY_ID : + case OBJECT_ID : + return isStatic(field->access) ? + field->setStaticObjectField(((JavaObject**)_buf)[0]) : + field->setVirtualObjectField((JavaObject*)obj, ((JavaObject**)_buf)[0]); + default : + JavaThread::get()->isolate->unknownError("should not be here"); + } +} + +JNIEXPORT void JNICALL Java_java_lang_reflect_Field_setBoolean( +#ifdef NATIVE_JNI +JNIEnv *env, +#endif +jobject Field, jobject obj, jboolean val) { + JavaField* field = (JavaField*)Classpath::fieldSlot->getVirtualInt32Field((JavaObject*)Field); + const AssessorDesc* ass = field->getSignature()->funcs; + + if (isStatic(field->access)) + JavaThread::get()->isolate->initialiseClass(field->classDef); + + switch (ass->numId) { + case BOOL_ID : + return isStatic(field->access) ? + field->setStaticInt8Field((uint8)val) : + field->setVirtualInt8Field((JavaObject*)obj, (uint8)val); + default : + JavaThread::get()->isolate->illegalArgumentException(""); + } + +} + +JNIEXPORT void JNICALL Java_java_lang_reflect_Field_setByte( +#ifdef NATIVE_JNI +JNIEnv *env, +#endif +jobject Field, jobject _obj, jbyte val) { + JavaField* field = (JavaField*)Classpath::fieldSlot->getVirtualInt32Field((JavaObject*)Field); + const AssessorDesc* ass = field->getSignature()->funcs; + JavaObject* obj = (JavaObject*)_obj; + + if (isStatic(field->access)) + JavaThread::get()->isolate->initialiseClass(field->classDef); + + switch (ass->numId) { + case BYTE_ID : + return isStatic(field->access) ? + field->setStaticInt8Field((sint8)val) : + field->setVirtualInt8Field((JavaObject*)obj, (sint8)val); + case SHORT_ID : + return isStatic(field->access) ? + field->setStaticInt16Field((sint16)val) : + field->setVirtualInt16Field((JavaObject*)obj, (sint16)val); + case INT_ID : + return isStatic(field->access) ? + field->setStaticInt32Field((sint32)val) : + field->setVirtualInt32Field((JavaObject*)obj, (sint32)val); + case LONG_ID : + return isStatic(field->access) ? + field->setStaticLongField((sint64)val) : + field->setVirtualLongField((JavaObject*)obj, (sint64)val); + case FLOAT_ID : + return isStatic(field->access) ? + field->setStaticFloatField((float)val) : + field->setVirtualFloatField((JavaObject*)obj, (float)val); + case DOUBLE_ID : + return isStatic(field->access) ? + field->setStaticDoubleField((double)val) : + field->setVirtualDoubleField((JavaObject*)obj, (double)val); + default : + JavaThread::get()->isolate->illegalArgumentException(""); + } +} + +JNIEXPORT void JNICALL Java_java_lang_reflect_Field_setChar( +#ifdef NATIVE_JNI +JNIEnv *env, +#endif +jobject Field, jobject obj, jchar val) { + JavaField* field = (JavaField*)Classpath::fieldSlot->getVirtualInt32Field((JavaObject*)Field); + const AssessorDesc* ass = field->getSignature()->funcs; + + if (isStatic(field->access)) + JavaThread::get()->isolate->initialiseClass(field->classDef); + + switch (ass->numId) { + case CHAR_ID : + return isStatic(field->access) ? + field->setStaticInt16Field((uint16)val) : + field->setVirtualDoubleField((JavaObject*)obj, (uint16)val); + case INT_ID : + return isStatic(field->access) ? + field->setStaticInt32Field((uint32)val) : + field->setVirtualInt32Field((JavaObject*)obj, (uint32)val); + case LONG_ID : + return isStatic(field->access) ? + field->setStaticLongField((uint64)val) : + field->setVirtualLongField((JavaObject*)obj, (uint64)val); + case FLOAT_ID : + return isStatic(field->access) ? + field->setStaticFloatField((float)(uint32)val) : + field->setVirtualFloatField((JavaObject*)obj, (float)(uint32)val); + case DOUBLE_ID : + return isStatic(field->access) ? + field->setStaticDoubleField((double)(uint64)val) : + field->setVirtualDoubleField((JavaObject*)obj, (double)(uint64)val); + default : + JavaThread::get()->isolate->illegalArgumentException(""); + } +} + +JNIEXPORT void JNICALL Java_java_lang_reflect_Field_setShort( +#ifdef NATIVE_JNI +JNIEnv *env, +#endif +jobject Field, jobject obj, jshort val) { + JavaField* field = (JavaField*)Classpath::fieldSlot->getVirtualInt32Field((JavaObject*)Field); + const AssessorDesc* ass = field->getSignature()->funcs; + + if (isStatic(field->access)) + JavaThread::get()->isolate->initialiseClass(field->classDef); + + switch (ass->numId) { + case SHORT_ID : + return isStatic(field->access) ? + field->setStaticInt16Field((sint16)val) : + field->setVirtualInt16Field((JavaObject*)obj, (sint16)val); + case INT_ID : + return isStatic(field->access) ? + field->setStaticInt32Field((sint32)val) : + field->setVirtualInt32Field((JavaObject*)obj, (sint32)val); + case LONG_ID : + return isStatic(field->access) ? + field->setStaticLongField((sint64)val) : + field->setVirtualLongField((JavaObject*)obj, (sint64)val); + case FLOAT_ID : + return isStatic(field->access) ? + field->setStaticFloatField((float)val) : + field->setVirtualFloatField((JavaObject*)obj, (float)val); + case DOUBLE_ID : + return isStatic(field->access) ? + field->setStaticDoubleField((double)val) : + field->setVirtualDoubleField((JavaObject*)obj, (double)val); + default : + JavaThread::get()->isolate->illegalArgumentException(""); + } +} + +JNIEXPORT void JNICALL Java_java_lang_reflect_Field_setInt( +#ifdef NATIVE_JNI +JNIEnv *env, +#endif +jobject Field, jobject obj, jint val) { + JavaField* field = (JavaField*)Classpath::fieldSlot->getVirtualInt32Field((JavaObject*)Field); + const AssessorDesc* ass = field->getSignature()->funcs; + + if (isStatic(field->access)) + JavaThread::get()->isolate->initialiseClass(field->classDef); + + switch (ass->numId) { + case INT_ID : + return isStatic(field->access) ? + field->setStaticInt32Field((sint32)val) : + field->setVirtualInt32Field((JavaObject*)obj, (sint32)val); + case LONG_ID : + return isStatic(field->access) ? + field->setStaticLongField((sint64)val) : + field->setVirtualLongField((JavaObject*)obj, (sint64)val); + case FLOAT_ID : + return isStatic(field->access) ? + field->setStaticFloatField((float)val) : + field->setVirtualFloatField((JavaObject*)obj, (float)val); + case DOUBLE_ID : + return isStatic(field->access) ? + field->setStaticDoubleField((double)val) : + field->setVirtualDoubleField((JavaObject*)obj, (double)val); + default : + JavaThread::get()->isolate->illegalArgumentException(""); + } +} + +JNIEXPORT void JNICALL Java_java_lang_reflect_Field_setLong( +#ifdef NATIVE_JNI +JNIEnv *env, +#endif +jobject Field, jobject obj, jlong val) { + JavaField* field = (JavaField*)Classpath::fieldSlot->getVirtualInt32Field((JavaObject*)Field); + const AssessorDesc* ass = field->getSignature()->funcs; + + if (isStatic(field->access)) + JavaThread::get()->isolate->initialiseClass(field->classDef); + + switch (ass->numId) { + case LONG_ID : + return isStatic(field->access) ? + field->setStaticLongField((sint64)val) : + field->setVirtualLongField((JavaObject*)obj, (sint64)val); + case FLOAT_ID : + return isStatic(field->access) ? + field->setStaticFloatField((float)val) : + field->setVirtualFloatField((JavaObject*)obj, (float)val); + case DOUBLE_ID : + return isStatic(field->access) ? + field->setStaticDoubleField((double)val) : + field->setVirtualDoubleField((JavaObject*)obj, (double)val); + default : + JavaThread::get()->isolate->illegalArgumentException(""); + } +} + +JNIEXPORT void JNICALL Java_java_lang_reflect_Field_setFloat( +#ifdef NATIVE_JNI +JNIEnv *env, +#endif +jobject Field, jobject obj, jfloat val) { + JavaField* field = (JavaField*)Classpath::fieldSlot->getVirtualInt32Field((JavaObject*)Field); + const AssessorDesc* ass = field->getSignature()->funcs; + + if (isStatic(field->access)) + JavaThread::get()->isolate->initialiseClass(field->classDef); + + switch (ass->numId) { + case FLOAT_ID : + return isStatic(field->access) ? + field->setStaticFloatField((float)val) : + field->setVirtualFloatField((JavaObject*)obj, (float)val); + case DOUBLE_ID : + return isStatic(field->access) ? + field->setStaticDoubleField((double)val) : + field->setVirtualDoubleField((JavaObject*)obj, (double)val); + default : + JavaThread::get()->isolate->illegalArgumentException(""); + } +} + +JNIEXPORT void JNICALL Java_java_lang_reflect_Field_setDouble( +#ifdef NATIVE_JNI +JNIEnv *env, +#endif +jobject Field, jobject obj, jdouble val) { + JavaField* field = (JavaField*)Classpath::fieldSlot->getVirtualInt32Field((JavaObject*)Field); + const AssessorDesc* ass = field->getSignature()->funcs; + + if (isStatic(field->access)) + JavaThread::get()->isolate->initialiseClass(field->classDef); + + switch (ass->numId) { + case DOUBLE_ID : + return isStatic(field->access) ? + field->setStaticDoubleField((double)val) : + field->setVirtualDoubleField((JavaObject*)obj, (double)val); + default : + JavaThread::get()->isolate->illegalArgumentException(""); + } +} + +JNIEXPORT jlong JNICALL Java_sun_misc_Unsafe_objectFieldOffset( +#ifdef NATIVE_JNI +JNIEnv *env, +#endif +JavaObject* Unsafe, +JavaObject* Field) { + JavaField* field = (JavaField*)Classpath::fieldSlot->getVirtualInt32Field((JavaObject*)Field); + return (jlong)field->ptrOffset; +} + +} Removed: vmkit/trunk/lib/JnJVM/Classpath/ClasspathVMObject.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/Classpath/ClasspathVMObject.cpp?rev=52707&view=auto ============================================================================== --- vmkit/trunk/lib/JnJVM/Classpath/ClasspathVMObject.cpp (original) +++ vmkit/trunk/lib/JnJVM/Classpath/ClasspathVMObject.cpp (removed) @@ -1,99 +0,0 @@ -//===------ ClasspathVMObject.cpp - GNU classpath java/lang/VMObject ------===// -// -// JnJVM -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -#include - -#include "types.h" - -#include "JavaArray.h" -#include "JavaClass.h" -#include "JavaObject.h" -#include "JavaTypes.h" -#include "JavaThread.h" -#include "Jnjvm.h" -#include "NativeUtil.h" - -using namespace jnjvm; - -extern "C" { - -JNIEXPORT jobject JNICALL Java_java_lang_VMObject_clone( -#ifdef NATIVE_JNI -JNIEnv *env, -jclass clazz, -#endif - jobject _src) { - - JavaObject* src = (JavaObject*)_src; - CommonClass* cl = src->classOf; - uint64 size = 0; - if (cl->isArray) { - size = sizeof(JavaArray) + ((JavaArray*)src)->size * - ((ClassArray*)cl)->baseClass()->virtualSize; - } else { - size = cl->virtualSize; - } - JavaObject* res = (JavaObject*) - JavaThread::get()->isolate->allocateObject(size, src->getVirtualTable()); - memcpy(res, src, size); - res->lock = 0; - return (jobject)res; -} - -JNIEXPORT jobject JNICALL Java_java_lang_VMObject_getClass( -#ifdef NATIVE_JNI -JNIEnv *env, -jclass clazz, -#endif - jobject _obj) { - JavaObject* obj = (JavaObject*)_obj; - return (jobject)(obj->classOf->getClassDelegatee()); -} - -JNIEXPORT void JNICALL Java_java_lang_VMObject_notifyAll( -#ifdef NATIVE_JNI -JNIEnv *env, -jclass clazz, -#endif - - jobject _obj) { - JavaObject* obj = (JavaObject*)_obj; - obj->notifyAll(); -} - - -JNIEXPORT void JNICALL Java_java_lang_VMObject_wait( -#ifdef NATIVE_JNI -JNIEnv *env, -jclass clazz, -#endif -jobject _object, jlong ms, jint ns) { - uint32 sec = (uint32) (ms / 1000); - uint32 usec = (ns / 1000) + 1000 * (ms % 1000); - JavaObject* obj = (JavaObject*)_object; - if (sec || usec) { - struct timeval t; - t.tv_sec = sec; - t.tv_usec = usec; - obj->timedWait(t); - } else { - obj->wait(); - } -} - -JNIEXPORT void JNICALL Java_java_lang_VMObject_notify( -#ifdef NATIVE_JNI -JNIEnv *env, -jclass clazz, -#endif -jobject obj) { - ((JavaObject*)obj)->notify(); -} - -} Added: vmkit/trunk/lib/JnJVM/Classpath/ClasspathVMObject.cpp.inc URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/Classpath/ClasspathVMObject.cpp.inc?rev=52708&view=auto ============================================================================== --- vmkit/trunk/lib/JnJVM/Classpath/ClasspathVMObject.cpp.inc (added) +++ vmkit/trunk/lib/JnJVM/Classpath/ClasspathVMObject.cpp.inc Wed Jun 25 04:59:39 2008 @@ -0,0 +1,99 @@ +//===------ ClasspathVMObject.cpp - GNU classpath java/lang/VMObject ------===// +// +// JnJVM +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#include + +#include "types.h" + +#include "JavaArray.h" +#include "JavaClass.h" +#include "JavaObject.h" +#include "JavaTypes.h" +#include "JavaThread.h" +#include "Jnjvm.h" +#include "NativeUtil.h" + +using namespace jnjvm; + +extern "C" { + +JNIEXPORT jobject JNICALL Java_java_lang_VMObject_clone( +#ifdef NATIVE_JNI +JNIEnv *env, +jclass clazz, +#endif + jobject _src) { + + JavaObject* src = (JavaObject*)_src; + CommonClass* cl = src->classOf; + uint64 size = 0; + if (cl->isArray) { + size = sizeof(JavaArray) + ((JavaArray*)src)->size * + ((ClassArray*)cl)->baseClass()->virtualSize; + } else { + size = cl->virtualSize; + } + JavaObject* res = (JavaObject*) + JavaThread::get()->isolate->allocateObject(size, src->getVirtualTable()); + memcpy(res, src, size); + res->lock = 0; + return (jobject)res; +} + +JNIEXPORT jobject JNICALL Java_java_lang_VMObject_getClass( +#ifdef NATIVE_JNI +JNIEnv *env, +jclass clazz, +#endif + jobject _obj) { + JavaObject* obj = (JavaObject*)_obj; + return (jobject)(obj->classOf->getClassDelegatee()); +} + +JNIEXPORT void JNICALL Java_java_lang_VMObject_notifyAll( +#ifdef NATIVE_JNI +JNIEnv *env, +jclass clazz, +#endif + + jobject _obj) { + JavaObject* obj = (JavaObject*)_obj; + obj->notifyAll(); +} + + +JNIEXPORT void JNICALL Java_java_lang_VMObject_wait( +#ifdef NATIVE_JNI +JNIEnv *env, +jclass clazz, +#endif +jobject _object, jlong ms, jint ns) { + uint32 sec = (uint32) (ms / 1000); + uint32 usec = (ns / 1000) + 1000 * (ms % 1000); + JavaObject* obj = (JavaObject*)_object; + if (sec || usec) { + struct timeval t; + t.tv_sec = sec; + t.tv_usec = usec; + obj->timedWait(t); + } else { + obj->wait(); + } +} + +JNIEXPORT void JNICALL Java_java_lang_VMObject_notify( +#ifdef NATIVE_JNI +JNIEnv *env, +jclass clazz, +#endif +jobject obj) { + ((JavaObject*)obj)->notify(); +} + +} Removed: vmkit/trunk/lib/JnJVM/Classpath/ClasspathVMRuntime.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/Classpath/ClasspathVMRuntime.cpp?rev=52707&view=auto ============================================================================== --- vmkit/trunk/lib/JnJVM/Classpath/ClasspathVMRuntime.cpp (original) +++ vmkit/trunk/lib/JnJVM/Classpath/ClasspathVMRuntime.cpp (removed) @@ -1,174 +0,0 @@ -//===------ ClasspathVMRuntime.cpp - GNU classpath java/lang/VMRuntime ----===// -// -// JnJVM -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -#include -#include - -#include "MvmGC.h" - -#include "types.h" - -#include "JavaArray.h" -#include "JavaClass.h" -#include "JavaObject.h" -#include "JavaString.h" -#include "JavaTypes.h" -#include "JavaThread.h" -#include "Jnjvm.h" -#include "NativeUtil.h" - - -using namespace jnjvm; - -extern "C" { - - -JNIEXPORT jobject JNICALL Java_java_lang_VMRuntime_mapLibraryName( -#ifdef NATIVE_JNI -JNIEnv *env, - jclass clazz, -#endif - jobject _strLib) { - JavaString* strLib = (JavaString*)_strLib; - Jnjvm* vm = JavaThread::get()->isolate; - - const UTF8* utf8Lib = strLib->value; - uint32 stLib = strLib->offset; - sint32 lgLib = strLib->count; - sint32 lgPre = vm->prelib->size; - sint32 lgPost = vm->postlib->size; - - uint32 size = (uint32)(lgPre + lgLib + lgPost); - uint16* elements = (uint16*)alloca(size * sizeof(uint16)); - - memmove(elements, vm->prelib->elements, lgPre * sizeof(uint16)); - memmove(&(elements[lgPre]), &(utf8Lib->elements[stLib]), lgLib * sizeof(uint16)); - memmove(&(elements[lgPre + lgLib]), vm->postlib->elements, lgPost * sizeof(uint16)); - - const UTF8* res = vm->readerConstructUTF8(elements, size); - - return (jobject)(vm->UTF8ToStr(res)); - -} - -typedef int (*onLoad_t)(const void**, void*); - -JNIEXPORT jint JNICALL Java_java_lang_VMRuntime_nativeLoad( -#ifdef NATIVE_JNI -JNIEnv *env, -jclass clazz, -#endif - jobject _str, - jobject _loader) { - JavaString* str = (JavaString*)_str; -#ifndef SERVICE_VM - Jnjvm* vm = JavaThread::get()->isolate; -#else - Jnjvm* vm = Jnjvm::bootstrapVM; -#endif - - char* buf = str->strToAsciiz(); - - void* res = dlopen(buf, RTLD_LAZY | RTLD_LOCAL); - if (res != 0) { - vm->nativeLibs.push_back(res); - onLoad_t onLoad = (onLoad_t)dlsym(res, "JNI_OnLoad"); - if (onLoad) onLoad(&vm->javavmEnv, 0); - return 1; - } else { - return 0; - } -} - - -JNIEXPORT void JNICALL Java_java_lang_VMRuntime_gc( -#ifdef NATIVE_JNI -JNIEnv *env, -jclass clazz, -#endif -) { -#ifdef MULTIPLE_GC - mvm::Thread::get()->GC->collect(); -#else - Collector::collect(); -#endif -} - -JNIEXPORT void JNICALL Java_java_lang_VMRuntime_runFinalization( -#ifdef NATIVE_JNI -JNIEnv *env, -jclass clazz, -#endif -) { - return; -} - -JNIEXPORT void JNICALL Java_java_lang_VMRuntime_runFinalizationForExit( -#ifdef NATIVE_JNI -JNIEnv *env, -jclass clazz, -#endif -) { - return; -} - -JNIEXPORT void JNICALL Java_java_lang_VMRuntime_exit( -#ifdef NATIVE_JNI -JNIEnv *env, -jclass clazz, -#endif -jint par1) { -#ifndef MULTIPLE_VM - exit(par1); -#else - // TODO: do a longjmp - exit(par1); -#endif -} - -JNIEXPORT jlong Java_java_lang_VMRuntime_freeMemory( -#ifdef NATIVE_JNI -JNIEnv *env, -jclass clazz, -#endif -) { -#ifdef MULTIPLE_GC - return (jlong)mvm::Thread::get()->GC->getFreeMemory(); -#else - return (jlong)Collector::getFreeMemory(); -#endif -} - -JNIEXPORT jlong Java_java_lang_VMRuntime_totalMemory( -#ifdef NATIVE_JNI -JNIEnv *env, -jclass clazz, -#endif -) { -#ifdef MULTIPLE_GC - return (jlong)mvm::Thread::get()->GC->getTotalMemory(); -#else - return (jlong)Collector::getTotalMemory(); -#endif -} - -JNIEXPORT jlong Java_java_lang_VMRuntime_maxMemory( -#ifdef NATIVE_JNI -JNIEnv *env, -jclass clazz, -#endif -) { -#ifdef MULTIPLE_GC - return (jlong)mvm::Thread::get()->GC->getMaxMemory(); -#else - return (jlong)Collector::getMaxMemory(); -#endif -} - -} Added: vmkit/trunk/lib/JnJVM/Classpath/ClasspathVMRuntime.cpp.inc URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/Classpath/ClasspathVMRuntime.cpp.inc?rev=52708&view=auto ============================================================================== --- vmkit/trunk/lib/JnJVM/Classpath/ClasspathVMRuntime.cpp.inc (added) +++ vmkit/trunk/lib/JnJVM/Classpath/ClasspathVMRuntime.cpp.inc Wed Jun 25 04:59:39 2008 @@ -0,0 +1,174 @@ +//===------ ClasspathVMRuntime.cpp - GNU classpath java/lang/VMRuntime ----===// +// +// JnJVM +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#include +#include + +#include "MvmGC.h" + +#include "types.h" + +#include "JavaArray.h" +#include "JavaClass.h" +#include "JavaObject.h" +#include "JavaString.h" +#include "JavaTypes.h" +#include "JavaThread.h" +#include "Jnjvm.h" +#include "NativeUtil.h" + + +using namespace jnjvm; + +extern "C" { + + +JNIEXPORT jobject JNICALL Java_java_lang_VMRuntime_mapLibraryName( +#ifdef NATIVE_JNI +JNIEnv *env, + jclass clazz, +#endif + jobject _strLib) { + JavaString* strLib = (JavaString*)_strLib; + Jnjvm* vm = JavaThread::get()->isolate; + + const UTF8* utf8Lib = strLib->value; + uint32 stLib = strLib->offset; + sint32 lgLib = strLib->count; + sint32 lgPre = vm->prelib->size; + sint32 lgPost = vm->postlib->size; + + uint32 size = (uint32)(lgPre + lgLib + lgPost); + uint16* elements = (uint16*)alloca(size * sizeof(uint16)); + + memmove(elements, vm->prelib->elements, lgPre * sizeof(uint16)); + memmove(&(elements[lgPre]), &(utf8Lib->elements[stLib]), lgLib * sizeof(uint16)); + memmove(&(elements[lgPre + lgLib]), vm->postlib->elements, lgPost * sizeof(uint16)); + + const UTF8* res = vm->readerConstructUTF8(elements, size); + + return (jobject)(vm->UTF8ToStr(res)); + +} + +typedef int (*onLoad_t)(const void**, void*); + +JNIEXPORT jint JNICALL Java_java_lang_VMRuntime_nativeLoad( +#ifdef NATIVE_JNI +JNIEnv *env, +jclass clazz, +#endif + jobject _str, + jobject _loader) { + JavaString* str = (JavaString*)_str; +#ifndef SERVICE_VM + Jnjvm* vm = JavaThread::get()->isolate; +#else + Jnjvm* vm = Jnjvm::bootstrapVM; +#endif + + char* buf = str->strToAsciiz(); + + void* res = dlopen(buf, RTLD_LAZY | RTLD_LOCAL); + if (res != 0) { + vm->nativeLibs.push_back(res); + onLoad_t onLoad = (onLoad_t)dlsym(res, "JNI_OnLoad"); + if (onLoad) onLoad(&vm->javavmEnv, 0); + return 1; + } else { + return 0; + } +} + + +JNIEXPORT void JNICALL Java_java_lang_VMRuntime_gc( +#ifdef NATIVE_JNI +JNIEnv *env, +jclass clazz, +#endif +) { +#ifdef MULTIPLE_GC + mvm::Thread::get()->GC->collect(); +#else + Collector::collect(); +#endif +} + +JNIEXPORT void JNICALL Java_java_lang_VMRuntime_runFinalization( +#ifdef NATIVE_JNI +JNIEnv *env, +jclass clazz, +#endif +) { + return; +} + +JNIEXPORT void JNICALL Java_java_lang_VMRuntime_runFinalizationForExit( +#ifdef NATIVE_JNI +JNIEnv *env, +jclass clazz, +#endif +) { + return; +} + +JNIEXPORT void JNICALL Java_java_lang_VMRuntime_exit( +#ifdef NATIVE_JNI +JNIEnv *env, +jclass clazz, +#endif +jint par1) { +#ifndef MULTIPLE_VM + exit(par1); +#else + // TODO: do a longjmp + exit(par1); +#endif +} + +JNIEXPORT jlong Java_java_lang_VMRuntime_freeMemory( +#ifdef NATIVE_JNI +JNIEnv *env, +jclass clazz, +#endif +) { +#ifdef MULTIPLE_GC + return (jlong)mvm::Thread::get()->GC->getFreeMemory(); +#else + return (jlong)Collector::getFreeMemory(); +#endif +} + +JNIEXPORT jlong Java_java_lang_VMRuntime_totalMemory( +#ifdef NATIVE_JNI +JNIEnv *env, +jclass clazz, +#endif +) { +#ifdef MULTIPLE_GC + return (jlong)mvm::Thread::get()->GC->getTotalMemory(); +#else + return (jlong)Collector::getTotalMemory(); +#endif +} + +JNIEXPORT jlong Java_java_lang_VMRuntime_maxMemory( +#ifdef NATIVE_JNI +JNIEnv *env, +jclass clazz, +#endif +) { +#ifdef MULTIPLE_GC + return (jlong)mvm::Thread::get()->GC->getMaxMemory(); +#else + return (jlong)Collector::getMaxMemory(); +#endif +} + +} Removed: vmkit/trunk/lib/JnJVM/Classpath/ClasspathVMStackWalker.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/Classpath/ClasspathVMStackWalker.cpp?rev=52707&view=auto ============================================================================== --- vmkit/trunk/lib/JnJVM/Classpath/ClasspathVMStackWalker.cpp (original) +++ vmkit/trunk/lib/JnJVM/Classpath/ClasspathVMStackWalker.cpp (removed) @@ -1,91 +0,0 @@ -//===- ClasspathVMStackWalker.cpp -----------------------------------------===// -//===------------ GNU classpath gnu/classpath/VMStackWalker ---------------===// -// -// JnJVM -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -#include - -#include "types.h" - -#include "mvm/JIT.h" - -#include "JavaArray.h" -#include "JavaClass.h" -#include "JavaJIT.h" -#include "JavaObject.h" -#include "JavaTypes.h" -#include "JavaThread.h" -#include "JavaUpcalls.h" -#include "Jnjvm.h" -#include "NativeUtil.h" - -using namespace jnjvm; - -extern "C" { - -ArrayObject* recGetClassContext(int** stack, uint32 size, uint32 first, uint32 rec) { - if (size != first) { - JavaMethod* meth = JavaJIT::IPToJavaMethod(stack[first]); - if (meth) { - ArrayObject* res = recGetClassContext(stack, size, first + 1, rec + 1); - res->elements[rec] = meth->classDef->getClassDelegatee(); - return res; - } else { - return recGetClassContext(stack, size, first + 1, rec); - } - } else { - Jnjvm* vm = JavaThread::get()->isolate; - return ArrayObject::acons(rec, Classpath::classArrayClass, vm); - } -} - -JNIEXPORT jobject JNICALL Java_gnu_classpath_VMStackWalker_getClassContext( -#ifdef NATIVE_JNI -JNIEnv *env, -jclass clazz, -#endif -) { - int* ips[100]; - int real_size = mvm::jit::getBacktrace((void**)(void*)ips, 100); - int i = 0; - int first = 0; - CommonClass* cl = Classpath::vmStackWalker; - - while (i < real_size) { - JavaMethod* meth = JavaJIT::IPToJavaMethod(ips[i++]); - if (meth && meth->classDef == cl) { - first = i; - break; - } - } - - return (jobject)recGetClassContext(ips, real_size, first, 0); -} - -JNIEXPORT jobject JNICALL Java_gnu_classpath_VMStackWalker_getClassLoader( -#ifdef NATIVE_JNI -JNIEnv *env, -jclass clazz, -#endif -jclass _Cl) { - JavaObject* Cl = (JavaObject*)_Cl; - CommonClass* cl = (CommonClass*)Classpath::vmdataClass->getVirtualObjectField(Cl); - return (jobject)cl->classLoader; -} - -extern "C" JavaObject* getCallingClass() { - Class* cl = JavaJIT::getCallingClass(); - if (cl) return cl->getClassDelegatee(); - return 0; -} - -extern "C" JavaObject* getCallingClassLoader() { - return JavaJIT::getCallingClassLoader(); -} - -} Added: vmkit/trunk/lib/JnJVM/Classpath/ClasspathVMStackWalker.cpp.inc URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/Classpath/ClasspathVMStackWalker.cpp.inc?rev=52708&view=auto ============================================================================== --- vmkit/trunk/lib/JnJVM/Classpath/ClasspathVMStackWalker.cpp.inc (added) +++ vmkit/trunk/lib/JnJVM/Classpath/ClasspathVMStackWalker.cpp.inc Wed Jun 25 04:59:39 2008 @@ -0,0 +1,91 @@ +//===- ClasspathVMStackWalker.cpp -----------------------------------------===// +//===------------ GNU classpath gnu/classpath/VMStackWalker ---------------===// +// +// JnJVM +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#include + +#include "types.h" + +#include "mvm/JIT.h" + +#include "JavaArray.h" +#include "JavaClass.h" +#include "JavaJIT.h" +#include "JavaObject.h" +#include "JavaTypes.h" +#include "JavaThread.h" +#include "JavaUpcalls.h" +#include "Jnjvm.h" +#include "NativeUtil.h" + +using namespace jnjvm; + +extern "C" { + +ArrayObject* recGetClassContext(int** stack, uint32 size, uint32 first, uint32 rec) { + if (size != first) { + JavaMethod* meth = JavaJIT::IPToJavaMethod(stack[first]); + if (meth) { + ArrayObject* res = recGetClassContext(stack, size, first + 1, rec + 1); + res->elements[rec] = meth->classDef->getClassDelegatee(); + return res; + } else { + return recGetClassContext(stack, size, first + 1, rec); + } + } else { + Jnjvm* vm = JavaThread::get()->isolate; + return ArrayObject::acons(rec, Classpath::classArrayClass, vm); + } +} + +JNIEXPORT jobject JNICALL Java_gnu_classpath_VMStackWalker_getClassContext( +#ifdef NATIVE_JNI +JNIEnv *env, +jclass clazz, +#endif +) { + int* ips[100]; + int real_size = mvm::jit::getBacktrace((void**)(void*)ips, 100); + int i = 0; + int first = 0; + CommonClass* cl = Classpath::vmStackWalker; + + while (i < real_size) { + JavaMethod* meth = JavaJIT::IPToJavaMethod(ips[i++]); + if (meth && meth->classDef == cl) { + first = i; + break; + } + } + + return (jobject)recGetClassContext(ips, real_size, first, 0); +} + +JNIEXPORT jobject JNICALL Java_gnu_classpath_VMStackWalker_getClassLoader( +#ifdef NATIVE_JNI +JNIEnv *env, +jclass clazz, +#endif +jclass _Cl) { + JavaObject* Cl = (JavaObject*)_Cl; + CommonClass* cl = (CommonClass*)Classpath::vmdataClass->getVirtualObjectField(Cl); + return (jobject)cl->classLoader; +} + +extern "C" JavaObject* getCallingClass() { + Class* cl = JavaJIT::getCallingClass(); + if (cl) return cl->getClassDelegatee(); + return 0; +} + +extern "C" JavaObject* getCallingClassLoader() { + return JavaJIT::getCallingClassLoader(); +} + +} Removed: vmkit/trunk/lib/JnJVM/Classpath/ClasspathVMSystem.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/Classpath/ClasspathVMSystem.cpp?rev=52707&view=auto ============================================================================== --- vmkit/trunk/lib/JnJVM/Classpath/ClasspathVMSystem.cpp (original) +++ vmkit/trunk/lib/JnJVM/Classpath/ClasspathVMSystem.cpp (removed) @@ -1,109 +0,0 @@ -//===-- ClasspathVMSystem.cpp - GNU classpath java/lang/VMSystem ----------===// -// -// JnJVM -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -#include - -#include "types.h" - -#include "JavaArray.h" -#include "JavaClass.h" -#include "JavaObject.h" -#include "JavaTypes.h" -#include "JavaThread.h" -#include "Jnjvm.h" -#include "NativeUtil.h" - -using namespace jnjvm; - -extern "C" { - -JNIEXPORT void JNICALL Java_java_lang_VMSystem_arraycopy( -#ifdef NATIVE_JNI -JNIEnv *env, - jclass _cl, -#endif - jobject _src, - jint sstart, - jobject _dst, - jint dstart, - jint len) { - jnjvm::Jnjvm *vm = JavaThread::get()->isolate; - JavaArray* src = (JavaArray*)_src; - JavaArray* dst = (JavaArray*)_dst; - - verifyNull(src); - verifyNull(dst); - - if (!(src->classOf->isArray && dst->classOf->isArray)) { - vm->arrayStoreException(); - } - - ClassArray* ts = (ClassArray*)src->classOf; - ClassArray* td = (ClassArray*)dst->classOf; - CommonClass* dstType = td->baseClass(); - AssessorDesc* dstFuncs = td->funcs(); - AssessorDesc* srcFuncs = ts->funcs(); - CommonClass* srcPrim = srcFuncs->classType; - CommonClass* dstPrim = dstFuncs->classType; - - if (len > src->size) { - vm->indexOutOfBounds(src, len); - } else if (len > dst->size) { - vm->indexOutOfBounds(dst, len); - } else if (len + sstart > src->size) { - vm->indexOutOfBounds(src, len + sstart); - } else if (len + dstart > dst->size) { - vm->indexOutOfBounds(dst, len + dstart); - } else if (dstart < 0) { - vm->indexOutOfBounds(dst, dstart); - } else if (sstart < 0) { - vm->indexOutOfBounds(src, sstart); - } else if (len < 0) { - vm->indexOutOfBounds(src, len); - } else if (srcPrim != dstPrim) { - vm->arrayStoreException(); - } - - jint i = sstart; - bool doThrow = false; - if (srcFuncs->doTrace) { - while (i < sstart + len && !doThrow) { - JavaObject* cur = ((ArrayObject*)src)->elements[i]; - if (cur) { - if (!(cur->classOf->isAssignableFrom(dstType))) { - doThrow = true; - len = i; - } - } - ++i; - } - } - - uint32 size = srcFuncs->nbb; - if (size == 0) size = sizeof(void*); - void* ptrDst = (void*)((int64_t)(dst->elements) + size * dstart); - void* ptrSrc = (void*)((int64_t)(src->elements) + size * sstart); - memmove(ptrDst, ptrSrc, size * len); - - if (doThrow) - vm->arrayStoreException(); - - -} - -JNIEXPORT jint JNICALL Java_java_lang_VMSystem_identityHashCode( -#ifdef NATIVE_JNI -JNIEnv *env, - jclass clazz, -#endif - jobject obj) { - return (jint)(intptr_t)obj; -} - -} Added: vmkit/trunk/lib/JnJVM/Classpath/ClasspathVMSystem.cpp.inc URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/Classpath/ClasspathVMSystem.cpp.inc?rev=52708&view=auto ============================================================================== --- vmkit/trunk/lib/JnJVM/Classpath/ClasspathVMSystem.cpp.inc (added) +++ vmkit/trunk/lib/JnJVM/Classpath/ClasspathVMSystem.cpp.inc Wed Jun 25 04:59:39 2008 @@ -0,0 +1,109 @@ +//===-- ClasspathVMSystem.cpp - GNU classpath java/lang/VMSystem ----------===// +// +// JnJVM +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#include + +#include "types.h" + +#include "JavaArray.h" +#include "JavaClass.h" +#include "JavaObject.h" +#include "JavaTypes.h" +#include "JavaThread.h" +#include "Jnjvm.h" +#include "NativeUtil.h" + +using namespace jnjvm; + +extern "C" { + +JNIEXPORT void JNICALL Java_java_lang_VMSystem_arraycopy( +#ifdef NATIVE_JNI +JNIEnv *env, + jclass _cl, +#endif + jobject _src, + jint sstart, + jobject _dst, + jint dstart, + jint len) { + jnjvm::Jnjvm *vm = JavaThread::get()->isolate; + JavaArray* src = (JavaArray*)_src; + JavaArray* dst = (JavaArray*)_dst; + + verifyNull(src); + verifyNull(dst); + + if (!(src->classOf->isArray && dst->classOf->isArray)) { + vm->arrayStoreException(); + } + + ClassArray* ts = (ClassArray*)src->classOf; + ClassArray* td = (ClassArray*)dst->classOf; + CommonClass* dstType = td->baseClass(); + AssessorDesc* dstFuncs = td->funcs(); + AssessorDesc* srcFuncs = ts->funcs(); + CommonClass* srcPrim = srcFuncs->classType; + CommonClass* dstPrim = dstFuncs->classType; + + if (len > src->size) { + vm->indexOutOfBounds(src, len); + } else if (len > dst->size) { + vm->indexOutOfBounds(dst, len); + } else if (len + sstart > src->size) { + vm->indexOutOfBounds(src, len + sstart); + } else if (len + dstart > dst->size) { + vm->indexOutOfBounds(dst, len + dstart); + } else if (dstart < 0) { + vm->indexOutOfBounds(dst, dstart); + } else if (sstart < 0) { + vm->indexOutOfBounds(src, sstart); + } else if (len < 0) { + vm->indexOutOfBounds(src, len); + } else if (srcPrim != dstPrim) { + vm->arrayStoreException(); + } + + jint i = sstart; + bool doThrow = false; + if (srcFuncs->doTrace) { + while (i < sstart + len && !doThrow) { + JavaObject* cur = ((ArrayObject*)src)->elements[i]; + if (cur) { + if (!(cur->classOf->isAssignableFrom(dstType))) { + doThrow = true; + len = i; + } + } + ++i; + } + } + + uint32 size = srcFuncs->nbb; + if (size == 0) size = sizeof(void*); + void* ptrDst = (void*)((int64_t)(dst->elements) + size * dstart); + void* ptrSrc = (void*)((int64_t)(src->elements) + size * sstart); + memmove(ptrDst, ptrSrc, size * len); + + if (doThrow) + vm->arrayStoreException(); + + +} + +JNIEXPORT jint JNICALL Java_java_lang_VMSystem_identityHashCode( +#ifdef NATIVE_JNI +JNIEnv *env, + jclass clazz, +#endif + jobject obj) { + return (jint)(intptr_t)obj; +} + +} Removed: vmkit/trunk/lib/JnJVM/Classpath/ClasspathVMSystemProperties.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/Classpath/ClasspathVMSystemProperties.cpp?rev=52707&view=auto ============================================================================== --- vmkit/trunk/lib/JnJVM/Classpath/ClasspathVMSystemProperties.cpp (original) +++ vmkit/trunk/lib/JnJVM/Classpath/ClasspathVMSystemProperties.cpp (removed) @@ -1,128 +0,0 @@ -//===- ClasspathVMSystem/Properties.cpp -----------------------------------===// -//===--------------------- GNU classpath gnu/classpath/VMSystemProperties -===// -// -// JnJVM -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -#include -#include - -#include "types.h" - -#include "JavaArray.h" -#include "JavaClass.h" -#include "JavaObject.h" -#include "JavaTypes.h" -#include "JavaThread.h" -#include "JavaUpcalls.h" -#include "Jnjvm.h" -#include "NativeUtil.h" - -using namespace jnjvm; - -extern "C" { - -static void setProperty(Jnjvm* vm, JavaObject* prop, const char* key, - const char* val) { - Classpath::setProperty->invokeIntSpecial(vm, prop, vm->asciizToStr(key), - vm->asciizToStr(val)); -} - -static void setUnameProp(Jnjvm* vm, JavaObject* prop) { - struct utsname infos; - uname(&infos); - setProperty(vm, prop, "os.name", infos.sysname); - setProperty(vm, prop, "os.arch", infos.machine); - setProperty(vm, prop, "os.version", infos.release); - if (!strcmp(infos.machine, "ppc")) { - setProperty(vm, prop, "gnu.cpu.endian","big"); - } else { - setProperty(vm, prop, "gnu.cpu.endian","little"); - } -} - -JNIEXPORT void JNICALL Java_gnu_classpath_VMSystemProperties_preInit( - -#ifdef NATIVE_JNI -JNIEnv *env, -jclass clazz, -#endif -jobject _prop) { - - JavaObject* prop = (JavaObject*)_prop; - Jnjvm* vm = JavaThread::get()->isolate; - const char* tmp; - setProperty(vm, prop, "java.vm.specification.version", "1.0"); - setProperty(vm, prop, "java.vm.specification.vendor", "Sun Microsystems, Inc"); - setProperty(vm, prop, "java.vm.specification.name", "Java Virtual Machine Specification"); - setProperty(vm, prop, "java.specification.version", "1.5"); - setProperty(vm, prop, "java.specification.vendor", "Sun Microsystems, Inc"); - setProperty(vm, prop, "java.specification.name", "Java Platform API Specification"); - setProperty(vm, prop, "java.version", "1.5"); - setProperty(vm, prop, "java.runtime.version", "1.5"); - setProperty(vm, prop, "java.vendor", "VVM Project"); - setProperty(vm, prop, "java.vendor.url", "http://vvm.lip6.fr"); - - tmp = getenv("JAVA_HOME"); - if (!tmp) tmp = ""; - setProperty(vm, prop, "java.home", tmp); - - setProperty(vm, prop, "java.class.version", "49.0"); - setProperty(vm, prop, "java.class.path", vm->classpath); - setProperty(vm, prop, "java.boot.class.path", vm->bootClasspathEnv); - setProperty(vm, prop, "sun.boot.class.path", vm->bootClasspathEnv); - setProperty(vm, prop, "java.vm.version", "2.0"); - setProperty(vm, prop, "java.vm.vendor", "VVM Project"); - setProperty(vm, prop, "java.vm.name", "JnJVM"); - setProperty(vm, prop, "java.specification.version", "1.5"); - setProperty(vm, prop, "java.library.path", vm->libClasspathEnv); - setProperty(vm, prop, "java.io.tmpdir", "/tmp"); - - tmp = getenv("JAVA_COMPILER"); - if (!tmp) tmp = "gcj"; - setProperty(vm, prop, "java.compiler", tmp); - - setProperty(vm, prop, "build.compiler", "gcj"); - setProperty(vm, prop, "gcj.class.path", vm->bootClasspathEnv); - - setUnameProp(vm, prop); - - setProperty(vm, prop, "file.separator", vm->dirSeparator); - setProperty(vm, prop, "path.separator", vm->envSeparator); - setProperty(vm, prop, "line.separator", "\n"); - - tmp = getenv("USERNAME"); - if (!tmp) tmp = getenv("LOGNAME"); - else if (!tmp) tmp = getenv("NAME"); - else if (!tmp) tmp = ""; - setProperty(vm, prop, "user.name", tmp); - - tmp = getenv("HOME"); - if (!tmp) tmp = ""; - setProperty(vm, prop, "user.home", tmp); - - tmp = getenv("PWD"); - if (!tmp) tmp = ""; - setProperty(vm, prop, "user.dir", tmp); - - //setProperty(vm, prop, "gnu.classpath.nio.charset.provider.iconv", "true") - - setProperty(vm, prop, "file.encoding", "ISO8859_1"); - setProperty(vm, prop, "gnu.java.util.zoneinfo.dir", "/usr/share/zoneinfo"); - - -} - -extern "C" void propertiesPostInit(JavaObject* prop) { - Jnjvm* vm = JavaThread::get()->isolate; - for (std::vector >::iterator i = vm->postProperties.begin(), - e = vm->postProperties.end(); i!= e; i++) { - setProperty(vm, prop, i->first, i->second); - } -} - -} Added: vmkit/trunk/lib/JnJVM/Classpath/ClasspathVMSystemProperties.cpp.inc URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/Classpath/ClasspathVMSystemProperties.cpp.inc?rev=52708&view=auto ============================================================================== --- vmkit/trunk/lib/JnJVM/Classpath/ClasspathVMSystemProperties.cpp.inc (added) +++ vmkit/trunk/lib/JnJVM/Classpath/ClasspathVMSystemProperties.cpp.inc Wed Jun 25 04:59:39 2008 @@ -0,0 +1,128 @@ +//===- ClasspathVMSystem/Properties.cpp -----------------------------------===// +//===--------------------- GNU classpath gnu/classpath/VMSystemProperties -===// +// +// JnJVM +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#include +#include + +#include "types.h" + +#include "JavaArray.h" +#include "JavaClass.h" +#include "JavaObject.h" +#include "JavaTypes.h" +#include "JavaThread.h" +#include "JavaUpcalls.h" +#include "Jnjvm.h" +#include "NativeUtil.h" + +using namespace jnjvm; + +extern "C" { + +static void setProperty(Jnjvm* vm, JavaObject* prop, const char* key, + const char* val) { + Classpath::setProperty->invokeIntSpecial(vm, prop, vm->asciizToStr(key), + vm->asciizToStr(val)); +} + +static void setUnameProp(Jnjvm* vm, JavaObject* prop) { + struct utsname infos; + uname(&infos); + setProperty(vm, prop, "os.name", infos.sysname); + setProperty(vm, prop, "os.arch", infos.machine); + setProperty(vm, prop, "os.version", infos.release); + if (!strcmp(infos.machine, "ppc")) { + setProperty(vm, prop, "gnu.cpu.endian","big"); + } else { + setProperty(vm, prop, "gnu.cpu.endian","little"); + } +} + +JNIEXPORT void JNICALL Java_gnu_classpath_VMSystemProperties_preInit( + +#ifdef NATIVE_JNI +JNIEnv *env, +jclass clazz, +#endif +jobject _prop) { + + JavaObject* prop = (JavaObject*)_prop; + Jnjvm* vm = JavaThread::get()->isolate; + const char* tmp; + setProperty(vm, prop, "java.vm.specification.version", "1.0"); + setProperty(vm, prop, "java.vm.specification.vendor", "Sun Microsystems, Inc"); + setProperty(vm, prop, "java.vm.specification.name", "Java Virtual Machine Specification"); + setProperty(vm, prop, "java.specification.version", "1.5"); + setProperty(vm, prop, "java.specification.vendor", "Sun Microsystems, Inc"); + setProperty(vm, prop, "java.specification.name", "Java Platform API Specification"); + setProperty(vm, prop, "java.version", "1.5"); + setProperty(vm, prop, "java.runtime.version", "1.5"); + setProperty(vm, prop, "java.vendor", "VVM Project"); + setProperty(vm, prop, "java.vendor.url", "http://vvm.lip6.fr"); + + tmp = getenv("JAVA_HOME"); + if (!tmp) tmp = ""; + setProperty(vm, prop, "java.home", tmp); + + setProperty(vm, prop, "java.class.version", "49.0"); + setProperty(vm, prop, "java.class.path", vm->classpath); + setProperty(vm, prop, "java.boot.class.path", vm->bootClasspathEnv); + setProperty(vm, prop, "sun.boot.class.path", vm->bootClasspathEnv); + setProperty(vm, prop, "java.vm.version", "2.0"); + setProperty(vm, prop, "java.vm.vendor", "VVM Project"); + setProperty(vm, prop, "java.vm.name", "JnJVM"); + setProperty(vm, prop, "java.specification.version", "1.5"); + setProperty(vm, prop, "java.library.path", vm->libClasspathEnv); + setProperty(vm, prop, "java.io.tmpdir", "/tmp"); + + tmp = getenv("JAVA_COMPILER"); + if (!tmp) tmp = "gcj"; + setProperty(vm, prop, "java.compiler", tmp); + + setProperty(vm, prop, "build.compiler", "gcj"); + setProperty(vm, prop, "gcj.class.path", vm->bootClasspathEnv); + + setUnameProp(vm, prop); + + setProperty(vm, prop, "file.separator", vm->dirSeparator); + setProperty(vm, prop, "path.separator", vm->envSeparator); + setProperty(vm, prop, "line.separator", "\n"); + + tmp = getenv("USERNAME"); + if (!tmp) tmp = getenv("LOGNAME"); + else if (!tmp) tmp = getenv("NAME"); + else if (!tmp) tmp = ""; + setProperty(vm, prop, "user.name", tmp); + + tmp = getenv("HOME"); + if (!tmp) tmp = ""; + setProperty(vm, prop, "user.home", tmp); + + tmp = getenv("PWD"); + if (!tmp) tmp = ""; + setProperty(vm, prop, "user.dir", tmp); + + //setProperty(vm, prop, "gnu.classpath.nio.charset.provider.iconv", "true") + + setProperty(vm, prop, "file.encoding", "ISO8859_1"); + setProperty(vm, prop, "gnu.java.util.zoneinfo.dir", "/usr/share/zoneinfo"); + + +} + +extern "C" void propertiesPostInit(JavaObject* prop) { + Jnjvm* vm = JavaThread::get()->isolate; + for (std::vector >::iterator i = vm->postProperties.begin(), + e = vm->postProperties.end(); i!= e; i++) { + setProperty(vm, prop, i->first, i->second); + } +} + +} Removed: vmkit/trunk/lib/JnJVM/Classpath/ClasspathVMThread.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/Classpath/ClasspathVMThread.cpp?rev=52707&view=auto ============================================================================== --- vmkit/trunk/lib/JnJVM/Classpath/ClasspathVMThread.cpp (original) +++ vmkit/trunk/lib/JnJVM/Classpath/ClasspathVMThread.cpp (removed) @@ -1,200 +0,0 @@ -//===- ClasspathVMThread.cpp - GNU classpath java/lang/VMThread -----------===// -// -// JnJVM -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -#include - -#include "types.h" - -#include "mvm/Threads/Thread.h" - -#include "JavaArray.h" -#include "JavaClass.h" -#include "JavaIsolate.h" -#include "JavaJIT.h" -#include "JavaObject.h" -#include "JavaTypes.h" -#include "JavaThread.h" -#include "JavaUpcalls.h" -#include "Jnjvm.h" -#include "NativeUtil.h" - -#ifdef SERVICE_VM -#include "ServiceDomain.h" -#endif - -using namespace jnjvm; - -extern "C" { - -JNIEXPORT jobject JNICALL Java_java_lang_VMThread_currentThread( -#ifdef NATIVE_JNI -JNIEnv *env, -jclass clazz -#endif -) { - return (jobject)(JavaThread::currentThread()); -} - -typedef struct arg_thread_t { - JavaObject* vmThread; - JavaThread* intern; -}arg_thread_t; - -static void start(arg_thread_t* arg) { - int argc; - JavaObject* vmThread = arg->vmThread; - JavaThread* intern = arg->intern; - free(arg); - mvm::Thread::threadKey->set(intern); -#ifdef MULTIPLE_GC - intern->GC->inject_my_thread(&argc); -#else - Collector::inject_my_thread(&argc); -#endif - CommonClass* vmthClass = vmThread->classOf; - JavaObject* thread = ClasspathThread::assocThread->getVirtualObjectField(vmThread); - JavaIsolate* isolate = (JavaIsolate*)(intern->isolate); - ThreadSystem* ts = isolate->threadSystem; - bool isDaemon = ClasspathThread::daemon->getVirtualInt8Field(thread); - intern->threadID = (mvm::Thread::self() << 8) & 0x7FFFFF00; - - - if (!isDaemon) { - ts->nonDaemonLock->lock(); - ts->nonDaemonThreads++; - ts->nonDaemonLock->unlock(); - } - -#ifdef SERVICE_VM - ServiceDomain* vm = (ServiceDomain*)isolate; - vm->startExecution(); - vm->lock->lock(); - vm->numThreads++; - vm->lock->unlock(); -#endif - JavaMethod* method = vmthClass->lookupMethod(Jnjvm::runName, Jnjvm::clinitType, ACC_VIRTUAL, true); - method->invokeIntSpecial(isolate, vmThread); - - - if (!isDaemon) { - ts->nonDaemonLock->lock(); - ts->nonDaemonThreads--; - if (ts->nonDaemonThreads == 0) - ts->nonDaemonVar->signal(); - ts->nonDaemonLock->unlock(); - } - -#ifdef SERVICE_VM - vm->lock->lock(); - vm->numThreads--; - vm->lock->unlock(); -#endif - -#ifdef MULTIPLE_GC - intern->GC->remove_my_thread(); -#else - Collector::remove_my_thread(); -#endif -} - -JNIEXPORT void JNICALL Java_java_lang_VMThread_start( -#ifdef NATIVE_JNI -JNIEnv *env, -#endif -jobject _vmThread, sint64 stackSize) { - JavaObject* vmThread = (JavaObject*)_vmThread; - JavaObject* javaThread = ClasspathThread::assocThread->getVirtualObjectField(vmThread); - assert(javaThread); - Jnjvm* vm = JavaThread::get()->isolate; - - JavaThread* th = vm_new(vm, JavaThread)(); - th->initialise(javaThread, vm); - ClasspathThread::vmdata->setVirtualObjectField(vmThread, (JavaObject*)th); - int tid = 0; - arg_thread_t* arg = (arg_thread_t*)malloc(sizeof(arg_thread_t)); - arg->intern = th; - arg->vmThread = vmThread; -#ifdef MULTIPLE_GC - th->GC = mvm::Thread::get()->GC; -#endif - - mvm::Thread::start(&tid, (int (*)(void *))start, (void*)arg); -} - -JNIEXPORT void JNICALL Java_java_lang_VMThread_interrupt( -#ifdef NATIVE_JNI -JNIEnv *env, -#endif -jobject _vmthread) { - JavaObject* vmthread = (JavaObject*)_vmthread; - - while (ClasspathThread::vmdata->getVirtualObjectField(vmthread) == 0) - mvm::Thread::yield(); - - JavaThread* th = (JavaThread*)ClasspathThread::vmdata->getVirtualObjectField(vmthread); - th->lock->lock(); - th->interruptFlag = 1; - - // here we could also raise a signal for interrupting I/O - if (th->state == JavaThread::StateWaiting) { - th->state = JavaThread::StateInterrupted; - th->varcond->signal(); - } - - th->lock->unlock(); -} - -JNIEXPORT jboolean JNICALL Java_java_lang_VMThread_interrupted( -#ifdef NATIVE_JNI -JNIEnv *env, -jclass clazz, -#endif -) { - JavaThread* th = JavaThread::get(); - uint32 interrupt = th->interruptFlag; - th->interruptFlag = 0; - return (jboolean)interrupt; -} - -JNIEXPORT jboolean JNICALL Java_java_lang_VMThread_isInterrupted( -#ifdef NATIVE_JNI -JNIEnv *env, -#endif -jobject _vmthread) { - JavaObject* vmthread = (JavaObject*)_vmthread; - JavaThread* th = (JavaThread*)ClasspathThread::vmdata->getVirtualObjectField(vmthread); - return (jboolean)th->interruptFlag; -} - -JNIEXPORT void JNICALL Java_java_lang_VMThread_nativeSetPriority( -#ifdef NATIVE_JNI -JNIEnv *env, -#endif -jobject vmthread, jint prio) { - // Currently not implemented -} - -JNIEXPORT void JNICALL Java_java_lang_VMThread_nativeStop( -#ifdef NATIVE_JNI -JNIEnv *env, -#endif -jobject vmthread, jobject exc) { - // Currently not implemented -} - -JNIEXPORT void JNICALL Java_java_lang_VMThread_yield( -#ifdef NATIVE_JNI -JNIEnv *env, -jclass clazz, -#endif -) { - mvm::Thread::yield(); -} - -} Added: vmkit/trunk/lib/JnJVM/Classpath/ClasspathVMThread.cpp.inc URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/Classpath/ClasspathVMThread.cpp.inc?rev=52708&view=auto ============================================================================== --- vmkit/trunk/lib/JnJVM/Classpath/ClasspathVMThread.cpp.inc (added) +++ vmkit/trunk/lib/JnJVM/Classpath/ClasspathVMThread.cpp.inc Wed Jun 25 04:59:39 2008 @@ -0,0 +1,200 @@ +//===- ClasspathVMThread.cpp - GNU classpath java/lang/VMThread -----------===// +// +// JnJVM +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#include + +#include "types.h" + +#include "mvm/Threads/Thread.h" + +#include "JavaArray.h" +#include "JavaClass.h" +#include "JavaIsolate.h" +#include "JavaJIT.h" +#include "JavaObject.h" +#include "JavaTypes.h" +#include "JavaThread.h" +#include "JavaUpcalls.h" +#include "Jnjvm.h" +#include "NativeUtil.h" + +#ifdef SERVICE_VM +#include "ServiceDomain.h" +#endif + +using namespace jnjvm; + +extern "C" { + +JNIEXPORT jobject JNICALL Java_java_lang_VMThread_currentThread( +#ifdef NATIVE_JNI +JNIEnv *env, +jclass clazz +#endif +) { + return (jobject)(JavaThread::currentThread()); +} + +typedef struct arg_thread_t { + JavaObject* vmThread; + JavaThread* intern; +}arg_thread_t; + +static void start(arg_thread_t* arg) { + int argc; + JavaObject* vmThread = arg->vmThread; + JavaThread* intern = arg->intern; + free(arg); + mvm::Thread::threadKey->set(intern); +#ifdef MULTIPLE_GC + intern->GC->inject_my_thread(&argc); +#else + Collector::inject_my_thread(&argc); +#endif + CommonClass* vmthClass = vmThread->classOf; + JavaObject* thread = ClasspathThread::assocThread->getVirtualObjectField(vmThread); + JavaIsolate* isolate = (JavaIsolate*)(intern->isolate); + ThreadSystem* ts = isolate->threadSystem; + bool isDaemon = ClasspathThread::daemon->getVirtualInt8Field(thread); + intern->threadID = (mvm::Thread::self() << 8) & 0x7FFFFF00; + + + if (!isDaemon) { + ts->nonDaemonLock->lock(); + ts->nonDaemonThreads++; + ts->nonDaemonLock->unlock(); + } + +#ifdef SERVICE_VM + ServiceDomain* vm = (ServiceDomain*)isolate; + vm->startExecution(); + vm->lock->lock(); + vm->numThreads++; + vm->lock->unlock(); +#endif + JavaMethod* method = vmthClass->lookupMethod(Jnjvm::runName, Jnjvm::clinitType, ACC_VIRTUAL, true); + method->invokeIntSpecial(isolate, vmThread); + + + if (!isDaemon) { + ts->nonDaemonLock->lock(); + ts->nonDaemonThreads--; + if (ts->nonDaemonThreads == 0) + ts->nonDaemonVar->signal(); + ts->nonDaemonLock->unlock(); + } + +#ifdef SERVICE_VM + vm->lock->lock(); + vm->numThreads--; + vm->lock->unlock(); +#endif + +#ifdef MULTIPLE_GC + intern->GC->remove_my_thread(); +#else + Collector::remove_my_thread(); +#endif +} + +JNIEXPORT void JNICALL Java_java_lang_VMThread_start( +#ifdef NATIVE_JNI +JNIEnv *env, +#endif +jobject _vmThread, sint64 stackSize) { + JavaObject* vmThread = (JavaObject*)_vmThread; + JavaObject* javaThread = ClasspathThread::assocThread->getVirtualObjectField(vmThread); + assert(javaThread); + Jnjvm* vm = JavaThread::get()->isolate; + + JavaThread* th = vm_new(vm, JavaThread)(); + th->initialise(javaThread, vm); + ClasspathThread::vmdata->setVirtualObjectField(vmThread, (JavaObject*)th); + int tid = 0; + arg_thread_t* arg = (arg_thread_t*)malloc(sizeof(arg_thread_t)); + arg->intern = th; + arg->vmThread = vmThread; +#ifdef MULTIPLE_GC + th->GC = mvm::Thread::get()->GC; +#endif + + mvm::Thread::start(&tid, (int (*)(void *))start, (void*)arg); +} + +JNIEXPORT void JNICALL Java_java_lang_VMThread_interrupt( +#ifdef NATIVE_JNI +JNIEnv *env, +#endif +jobject _vmthread) { + JavaObject* vmthread = (JavaObject*)_vmthread; + + while (ClasspathThread::vmdata->getVirtualObjectField(vmthread) == 0) + mvm::Thread::yield(); + + JavaThread* th = (JavaThread*)ClasspathThread::vmdata->getVirtualObjectField(vmthread); + th->lock->lock(); + th->interruptFlag = 1; + + // here we could also raise a signal for interrupting I/O + if (th->state == JavaThread::StateWaiting) { + th->state = JavaThread::StateInterrupted; + th->varcond->signal(); + } + + th->lock->unlock(); +} + +JNIEXPORT jboolean JNICALL Java_java_lang_VMThread_interrupted( +#ifdef NATIVE_JNI +JNIEnv *env, +jclass clazz, +#endif +) { + JavaThread* th = JavaThread::get(); + uint32 interrupt = th->interruptFlag; + th->interruptFlag = 0; + return (jboolean)interrupt; +} + +JNIEXPORT jboolean JNICALL Java_java_lang_VMThread_isInterrupted( +#ifdef NATIVE_JNI +JNIEnv *env, +#endif +jobject _vmthread) { + JavaObject* vmthread = (JavaObject*)_vmthread; + JavaThread* th = (JavaThread*)ClasspathThread::vmdata->getVirtualObjectField(vmthread); + return (jboolean)th->interruptFlag; +} + +JNIEXPORT void JNICALL Java_java_lang_VMThread_nativeSetPriority( +#ifdef NATIVE_JNI +JNIEnv *env, +#endif +jobject vmthread, jint prio) { + // Currently not implemented +} + +JNIEXPORT void JNICALL Java_java_lang_VMThread_nativeStop( +#ifdef NATIVE_JNI +JNIEnv *env, +#endif +jobject vmthread, jobject exc) { + // Currently not implemented +} + +JNIEXPORT void JNICALL Java_java_lang_VMThread_yield( +#ifdef NATIVE_JNI +JNIEnv *env, +jclass clazz, +#endif +) { + mvm::Thread::yield(); +} + +} Removed: vmkit/trunk/lib/JnJVM/Classpath/ClasspathVMThrowable.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/Classpath/ClasspathVMThrowable.cpp?rev=52707&view=auto ============================================================================== --- vmkit/trunk/lib/JnJVM/Classpath/ClasspathVMThrowable.cpp (original) +++ vmkit/trunk/lib/JnJVM/Classpath/ClasspathVMThrowable.cpp (removed) @@ -1,111 +0,0 @@ -//===- ClasspathVMClassLoader.cpp - GNU classpath java/lang/VMClassLoader -===// -// -// JnJVM -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -#include - -#include "types.h" - -#include "mvm/JIT.h" - -#include "JavaAccess.h" -#include "JavaArray.h" -#include "JavaClass.h" -#include "JavaConstantPool.h" -#include "JavaJIT.h" -#include "JavaObject.h" -#include "JavaString.h" -#include "JavaTypes.h" -#include "JavaThread.h" -#include "JavaUpcalls.h" -#include "Jnjvm.h" -#include "NativeUtil.h" -#include "Reader.h" - -using namespace jnjvm; - -extern "C" { - -JNIEXPORT jobject JNICALL Java_java_lang_VMThrowable_fillInStackTrace( -#ifdef NATIVE_JNI -JNIEnv *env, -jclass clazz, -#endif - jobject throwable) { - //int** fp = (int**)__builtin_frame_address(0); - Jnjvm* vm = JavaThread::get()->isolate; - int** stack = (int**)malloc(sizeof(int*) * 100); - int real_size = mvm::jit::getBacktrace((void**)stack, 100); - stack[real_size] = 0; - JavaObject* vmThrowable = Classpath::newVMThrowable->doNew(vm); - ((JavaObject**)((uint64)vmThrowable + Classpath::vmDataVMThrowable->ptrOffset))[0] = (JavaObject*)stack; - return (jobject)vmThrowable; -} - -JavaObject* consStackElement(JavaMethod* meth, int* ip) { - Jnjvm* vm = JavaThread::get()->isolate; - JavaObject* methodName = vm->UTF8ToStr(meth->name); - Class* cl = meth->classDef; - JavaObject* className = vm->UTF8ToStr(cl->name->internalToJava(vm, 0, cl->name->size)); - JavaObject* sourceName = 0; - - Attribut* sourceAtt = cl->lookupAttribut(Attribut::sourceFileAttribut); - - if (sourceAtt) { - Reader reader(sourceAtt, cl->bytes); - uint16 index = reader.readU2(); - sourceName = vm->UTF8ToStr(cl->ctpInfo->UTF8At(index)); - } - - bool native = isNative(meth->access); - - JavaObject* res = (*Classpath::newStackTraceElement)(vm); - Classpath::initStackTraceElement->invokeIntSpecial(vm, res, sourceName, - (uint32)ip, className, - methodName, native); - return res; -} - -ArrayObject* recGetStackTrace(int** stack, uint32 first, uint32 rec) { - Jnjvm* vm = JavaThread::get()->isolate; - if (stack[first] != 0) { - JavaMethod* meth = JavaJIT::IPToJavaMethod(stack[first]); - if (meth) { - ArrayObject* res = recGetStackTrace(stack, first + 1, rec + 1); - res->elements[rec] = consStackElement(meth, stack[first]); - return res; - } else { - return recGetStackTrace(stack, first + 1, rec); - } - } else { - return ArrayObject::acons(rec, JavaArray::ofObject, vm); - } -} - -JNIEXPORT jobject JNICALL Java_java_lang_VMThrowable_getStackTrace( -#ifdef NATIVE_JNI -JNIEnv *env, -#endif -jobject vmthrow, jobject throwable) { - int** stack = (int**)Classpath::vmDataVMThrowable->getVirtualObjectField((JavaObject*)vmthrow); - uint32 first = 0; - sint32 i = 0; - - while (stack[i] != 0) { - JavaMethod* meth = JavaJIT::IPToJavaMethod(stack[i++]); - if (meth && !meth->classDef->subclassOf(Classpath::newThrowable)) { - first = i - 1; - break; - } - } - jobject res = (jobject)recGetStackTrace((int**)(uint32**)stack, first, 0); - free(stack); - return res; -} - -} Added: vmkit/trunk/lib/JnJVM/Classpath/ClasspathVMThrowable.cpp.inc URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/Classpath/ClasspathVMThrowable.cpp.inc?rev=52708&view=auto ============================================================================== --- vmkit/trunk/lib/JnJVM/Classpath/ClasspathVMThrowable.cpp.inc (added) +++ vmkit/trunk/lib/JnJVM/Classpath/ClasspathVMThrowable.cpp.inc Wed Jun 25 04:59:39 2008 @@ -0,0 +1,111 @@ +//===- ClasspathVMClassLoader.cpp - GNU classpath java/lang/VMClassLoader -===// +// +// JnJVM +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#include + +#include "types.h" + +#include "mvm/JIT.h" + +#include "JavaAccess.h" +#include "JavaArray.h" +#include "JavaClass.h" +#include "JavaConstantPool.h" +#include "JavaJIT.h" +#include "JavaObject.h" +#include "JavaString.h" +#include "JavaTypes.h" +#include "JavaThread.h" +#include "JavaUpcalls.h" +#include "Jnjvm.h" +#include "NativeUtil.h" +#include "Reader.h" + +using namespace jnjvm; + +extern "C" { + +JNIEXPORT jobject JNICALL Java_java_lang_VMThrowable_fillInStackTrace( +#ifdef NATIVE_JNI +JNIEnv *env, +jclass clazz, +#endif + jobject throwable) { + //int** fp = (int**)__builtin_frame_address(0); + Jnjvm* vm = JavaThread::get()->isolate; + int** stack = (int**)malloc(sizeof(int*) * 100); + int real_size = mvm::jit::getBacktrace((void**)stack, 100); + stack[real_size] = 0; + JavaObject* vmThrowable = Classpath::newVMThrowable->doNew(vm); + ((JavaObject**)((uint64)vmThrowable + Classpath::vmDataVMThrowable->ptrOffset))[0] = (JavaObject*)stack; + return (jobject)vmThrowable; +} + +JavaObject* consStackElement(JavaMethod* meth, int* ip) { + Jnjvm* vm = JavaThread::get()->isolate; + JavaObject* methodName = vm->UTF8ToStr(meth->name); + Class* cl = meth->classDef; + JavaObject* className = vm->UTF8ToStr(cl->name->internalToJava(vm, 0, cl->name->size)); + JavaObject* sourceName = 0; + + Attribut* sourceAtt = cl->lookupAttribut(Attribut::sourceFileAttribut); + + if (sourceAtt) { + Reader reader(sourceAtt, cl->bytes); + uint16 index = reader.readU2(); + sourceName = vm->UTF8ToStr(cl->ctpInfo->UTF8At(index)); + } + + bool native = isNative(meth->access); + + JavaObject* res = (*Classpath::newStackTraceElement)(vm); + Classpath::initStackTraceElement->invokeIntSpecial(vm, res, sourceName, + (uint32)ip, className, + methodName, native); + return res; +} + +ArrayObject* recGetStackTrace(int** stack, uint32 first, uint32 rec) { + Jnjvm* vm = JavaThread::get()->isolate; + if (stack[first] != 0) { + JavaMethod* meth = JavaJIT::IPToJavaMethod(stack[first]); + if (meth) { + ArrayObject* res = recGetStackTrace(stack, first + 1, rec + 1); + res->elements[rec] = consStackElement(meth, stack[first]); + return res; + } else { + return recGetStackTrace(stack, first + 1, rec); + } + } else { + return ArrayObject::acons(rec, JavaArray::ofObject, vm); + } +} + +JNIEXPORT jobject JNICALL Java_java_lang_VMThrowable_getStackTrace( +#ifdef NATIVE_JNI +JNIEnv *env, +#endif +jobject vmthrow, jobject throwable) { + int** stack = (int**)Classpath::vmDataVMThrowable->getVirtualObjectField((JavaObject*)vmthrow); + uint32 first = 0; + sint32 i = 0; + + while (stack[i] != 0) { + JavaMethod* meth = JavaJIT::IPToJavaMethod(stack[i++]); + if (meth && !meth->classDef->subclassOf(Classpath::newThrowable)) { + first = i - 1; + break; + } + } + jobject res = (jobject)recGetStackTrace((int**)(uint32**)stack, first, 0); + free(stack); + return res; +} + +} Added: vmkit/trunk/lib/JnJVM/Classpath/Makefile URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/Classpath/Makefile?rev=52708&view=auto ============================================================================== --- vmkit/trunk/lib/JnJVM/Classpath/Makefile (added) +++ vmkit/trunk/lib/JnJVM/Classpath/Makefile Wed Jun 25 04:59:39 2008 @@ -0,0 +1,14 @@ +##===- lib/JnJVM/Classpath/Makefile ------------------------*- Makefile -*-===## +# +# The vmkit project +# +# This file is distributed under the University of Illinois Open Source +# License. See LICENSE.TXT for details. +# +##===----------------------------------------------------------------------===## +LEVEL = ../../.. + +LIBRARYNAME = Classpath +include $(LEVEL)/Makefile.common + +CXX.Flags += -I../VMCore Removed: vmkit/trunk/lib/JnJVM/Classpath/Makefile.am URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/Classpath/Makefile.am?rev=52707&view=auto ============================================================================== --- vmkit/trunk/lib/JnJVM/Classpath/Makefile.am (original) +++ vmkit/trunk/lib/JnJVM/Classpath/Makefile.am (removed) @@ -1,7 +0,0 @@ -lib_LTLIBRARIES = libClasspath.la - -PREFIX=@prefix@ - -libClasspath_la_SOURCES = Classpath.cpp - -libClasspath_la_CXXFLAGS =-I../VMCore -DPREFIX=\"$(PREFIX)\" -W -Wall -ansi -Wno-unused-parameter -Wno-long-long -Wno-unused-function -fno-omit-frame-pointer -O2 -g -Werror Added: vmkit/trunk/lib/JnJVM/LLVMRuntime/Makefile URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/LLVMRuntime/Makefile?rev=52708&view=auto ============================================================================== --- vmkit/trunk/lib/JnJVM/LLVMRuntime/Makefile (added) +++ vmkit/trunk/lib/JnJVM/LLVMRuntime/Makefile Wed Jun 25 04:59:39 2008 @@ -0,0 +1,50 @@ +##===- lib/JnJVM/LLVMRuntime/Makefile ----------------------*- Makefile -*-===## +# +# The vmkit project +# +# This file is distributed under the University of Illinois Open Source +# License. See LICENSE.TXT for details. +# +##===----------------------------------------------------------------------===## +LEVEL = ../../.. + +include $(LEVEL)/Makefile.common + +all = llvmruntime.cpp + +llvmruntimebc : llvmruntimell + $(Echo) "Building LLVM runtime with llvm-as" + $(Verb) $(LLVMAS) -f LLVMRuntime.ll + +all :: llvmruntimebc + $(Echo) "Building LLVM runtime with llc" + $(Verb) $(LLC) -march=cpp -cppgen=contents -f LLVMRuntime.bc + +LL_FILES = runtime-default.ll + +ifeq ($(ISOLATE_BUILD), 1) +LL_FILES += runtime-isolate.ll +endif + +ifeq ($(SERVICE_BUILD), 1) +LL_FILES += runtime-service.ll runtime-isolate.ll runtime-multi-mmap.ll +else +ifeq ($(GC_MULTI_MMAP), 1) +LL_FILES += runtime-multi-mmap.ll +else +ifeq ($(GC_SINGLE_MMAP), 1) +LL_FILES += runtime-single-mmap.ll +else +ifeq ($(GC_BOEHM), 1) +LL_FILES += runtime-boehm.ll +endif +endif +endif +endif + +llvmruntimell: $(LL_FILES) + $(Echo) "Generating LLVM runtime" + $(Verb) cat $(LL_FILES) > LLVMRuntime.ll + +clean:: + rm -f LLVMRuntime.ll LLVMRuntime.bc LLVMRuntime.cpp Removed: vmkit/trunk/lib/JnJVM/LLVMRuntime/Makefile.am URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/LLVMRuntime/Makefile.am?rev=52707&view=auto ============================================================================== --- vmkit/trunk/lib/JnJVM/LLVMRuntime/Makefile.am (original) +++ vmkit/trunk/lib/JnJVM/LLVMRuntime/Makefile.am (removed) @@ -1,38 +0,0 @@ -all: llvmruntimecpp - -LLVMAS = @llvmprefix@/Release/bin/llvm-as -LLC = @llvmprefix@/Release/bin/llc - -llvmruntimebc : llvmruntimell - $(LLVMAS) -f LLVMRuntime.ll - -llvmruntimecpp : llvmruntimebc - $(LLC) -march=cpp -cppgen=contents -f LLVMRuntime.bc - -LL_FILES = runtime-default.ll - -if ISOLATE_BUILD -LL_FILES += runtime-isolate.ll -endif - -if SERVICE_BUILD -LL_FILES += runtime-service.ll runtime-isolate.ll runtime-multi-mmap.ll -else -if GC_MULTI_MMAP -LL_FILES += runtime-multi-mmap.ll -else -if GC_SINGLE_MMAP -LL_FILES += runtime-single-mmap.ll -else -if GC_BOEHM -LL_FILES += runtime-boehm.ll -endif -endif -endif -endif - -llvmruntimell: $(LL_FILES) - cat $(LL_FILES) > LLVMRuntime.ll - -clean: - rm -f LLVMRuntime.ll LLVMRuntime.bc LLVMRuntime.cpp Removed: vmkit/trunk/lib/JnJVM/Main.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/Main.cpp?rev=52707&view=auto ============================================================================== --- vmkit/trunk/lib/JnJVM/Main.cpp (original) +++ vmkit/trunk/lib/JnJVM/Main.cpp (removed) @@ -1,35 +0,0 @@ -//===--------- Main.cpp - Simple execution of JnJVM -----------------------===// -// -// JnJVM -// -// This file is distributed under the University of Pierre et Marie Curie -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -#include "MvmGC.h" -#include "mvm/JIT.h" -#include "mvm/Object.h" -#include "mvm/Threads/Thread.h" - -#include "llvm/Support/ManagedStatic.h" - -using namespace mvm; - - -extern "C" int boot(); -extern "C" int start_app(int, char**); - -int main(int argc, char **argv, char **envp) { - llvm::llvm_shutdown_obj X; - int base; - - jit::initialise(); - Object::initialise(); - Thread::initialise(); - Collector::initialise(0, &base); - boot(); - start_app(argc, argv); - - return 0; -} Added: vmkit/trunk/lib/JnJVM/Makefile URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/Makefile?rev=52708&view=auto ============================================================================== --- vmkit/trunk/lib/JnJVM/Makefile (added) +++ vmkit/trunk/lib/JnJVM/Makefile Wed Jun 25 04:59:39 2008 @@ -0,0 +1,14 @@ +##===- lib/JnJVM/Makefile ----------------------------------*- Makefile -*-===## +# +# The vmkit project +# +# This file is distributed under the University of Illinois Open Source +# License. See LICENSE.TXT for details. +# +##===----------------------------------------------------------------------===## +LEVEL = ../.. + +DIRS = LLVMRuntime VMCore Classpath + +include $(LEVEL)/Makefile.common + Removed: vmkit/trunk/lib/JnJVM/Makefile.am URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/Makefile.am?rev=52707&view=auto ============================================================================== --- vmkit/trunk/lib/JnJVM/Makefile.am (original) +++ vmkit/trunk/lib/JnJVM/Makefile.am (removed) @@ -1,13 +0,0 @@ -# $Id: Makefile.am,v 1.6 2008/03/21 11:12:38 varth Exp $ -SUBDIRS = LLVMRuntime VMCore Classpath -EXTRA_DIST = OpcodeNames.def -bin_PROGRAMS = main -#lib_LTLIBRARIES = libjnjvm.la - -main_SOURCES = ../Mvm/Object.cpp ../Mvm/Sigsegv.cpp Main.cpp ../Mvm/MvmMemoryManager.cpp ../Mvm/JIT.cpp ../Mvm/EscapeAnalysis.cpp -main_CXXFLAGS = -DPREFIX=\"$(PREFIX)\" -W -Wall -ansi -Wno-unused-parameter -Wno-long-long -Wno-unused-function -fno-omit-frame-pointer -g -Werror -O2 -main_LDADD = VMCore/.libs/libJnJVM.a Classpath/.libs/libClasspath.a @GC_LIBS@ @GCTHREAD_LIBS@ @LLVMDYLIB@ -main_LDFLAGS = @rdynamic@ - -#libjnjvm.la: -# gcc -shared VMCore/.libs/libJnJVM.$(DYLIB_EXTENSION) Classpath/.libs/libClasspath.$(DYLIB_EXTENSION) -o libjnjvm.$(DYLIB_EXTENSION) Removed: vmkit/trunk/lib/JnJVM/README URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/README?rev=52707&view=auto ============================================================================== --- vmkit/trunk/lib/JnJVM/README (original) +++ vmkit/trunk/lib/JnJVM/README (removed) @@ -1,33 +0,0 @@ -1 - GNU Classpath -Current version 0.97.1. Use ecj to compile Classpath. - - a - unzip classpath - tar -xzf classpath-0.97.1 - b - compile classpath - cd classpath-0.97.1 - ./configure --disable-plugin --disable-examples && make - -IMPORTANT: for local use -cd classpath-x.y/lib; -ln -s ../native/jni/gtk-peer/.libs/libgtkpeer.so; -ln -s ../native/jni/gconf-peer/.libs/libgconfpeer.so; -ln -s ../native/jni/java-io/.libs/libjavaio.so; -ln -s ../native/jni/java-lang/.libs/libjavalangreflect.so; -ln -s ../native/jni/java-lang/.libs/libjavalang.so; -ln -s ../native/jni/java-net/.libs/libjavanet.so; -ln -s ../native/jni/java-nio/.libs/libjavanio.so; -ln -s ../native/jni/java-util/.libs/libjavautil.so; - -Or for Darwin -ln -s ../native/jni/gtk-peer/.libs/libgtkpeer.dylib; -ln -s ../native/jni/gconf-peer/.libs/libgconfpeer.dylib; -ln -s ../native/jni/java-io/.libs/libjavaio.dylib; -ln -s ../native/jni/java-lang/.libs/libjavalangreflect.dylib; -ln -s ../native/jni/java-lang/.libs/libjavalang.dylib; -ln -s ../native/jni/java-net/.libs/libjavanet.dylib; -ln -s ../native/jni/java-nio/.libs/libjavanio.dylib; -ln -s ../native/jni/java-util/.libs/libjavautil.dylib; - - -2 - Run JnJVM -./main HelloWorld Added: vmkit/trunk/lib/JnJVM/README.txt URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/README.txt?rev=52708&view=auto ============================================================================== --- vmkit/trunk/lib/JnJVM/README.txt (added) +++ vmkit/trunk/lib/JnJVM/README.txt Wed Jun 25 04:59:39 2008 @@ -0,0 +1,29 @@ +GNU Classpath +Current version 0.97.2. Use ecj to compile Classpath. + + a - unzip classpath + tar -xzf classpath-0.97.2 + b - compile classpath + cd classpath-0.97.2 + ./configure --disable-plugin --disable-examples && make + +IMPORTANT: for local use +cd classpath-x.y/lib; +ln -s ../native/jni/gtk-peer/.libs/libgtkpeer.so; +ln -s ../native/jni/gconf-peer/.libs/libgconfpeer.so; +ln -s ../native/jni/java-io/.libs/libjavaio.so; +ln -s ../native/jni/java-lang/.libs/libjavalangreflect.so; +ln -s ../native/jni/java-lang/.libs/libjavalang.so; +ln -s ../native/jni/java-net/.libs/libjavanet.so; +ln -s ../native/jni/java-nio/.libs/libjavanio.so; +ln -s ../native/jni/java-util/.libs/libjavautil.so; + +Or for Darwin +ln -s ../native/jni/gtk-peer/.libs/libgtkpeer.dylib; +ln -s ../native/jni/gconf-peer/.libs/libgconfpeer.dylib; +ln -s ../native/jni/java-io/.libs/libjavaio.dylib; +ln -s ../native/jni/java-lang/.libs/libjavalangreflect.dylib; +ln -s ../native/jni/java-lang/.libs/libjavalang.dylib; +ln -s ../native/jni/java-net/.libs/libjavanet.dylib; +ln -s ../native/jni/java-nio/.libs/libjavanio.dylib; +ln -s ../native/jni/java-util/.libs/libjavautil.dylib; Removed: vmkit/trunk/lib/JnJVM/TODO URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/TODO?rev=52707&view=auto ============================================================================== --- vmkit/trunk/lib/JnJVM/TODO (original) +++ vmkit/trunk/lib/JnJVM/TODO (removed) @@ -1,4 +0,0 @@ -Patch on getVirtualField -Patch on newLookup - -Stubs are currently GC roots, make them isolate-objects Modified: vmkit/trunk/lib/JnJVM/VMCore/JavaArray.h URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/VMCore/JavaArray.h?rev=52708&r1=52707&r2=52708&view=diff ============================================================================== --- vmkit/trunk/lib/JnJVM/VMCore/JavaArray.h (original) +++ vmkit/trunk/lib/JnJVM/VMCore/JavaArray.h Wed Jun 25 04:59:39 2008 @@ -27,7 +27,7 @@ class TJavaArray : public JavaObject { public: sint32 size; - T elements[0]; + T elements[1]; }; class JavaArray : public TJavaArray { @@ -63,7 +63,7 @@ class name : public TJavaArray { \ public: \ static name* acons(sint32 n, ClassArray* cl, Jnjvm* vm); \ - }; + } ARRAYCLASS(ArrayUInt8, uint8); ARRAYCLASS(ArraySInt8, sint8); Modified: vmkit/trunk/lib/JnJVM/VMCore/JavaBacktrace.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/VMCore/JavaBacktrace.cpp?rev=52708&r1=52707&r2=52708&view=diff ============================================================================== --- vmkit/trunk/lib/JnJVM/VMCore/JavaBacktrace.cpp (original) +++ vmkit/trunk/lib/JnJVM/VMCore/JavaBacktrace.cpp Wed Jun 25 04:59:39 2008 @@ -42,17 +42,17 @@ if (code) { JavaMethod* meth = (JavaMethod*)code->getMetaInfo(); if (meth) { - printf("; %p in %s\n", ips[n - 1], meth->printString()); + printf("; %p in %s\n", (void*)ips[n - 1], meth->printString()); } else { - printf("; %p in %s\n", ips[n - 1], "unknown"); + printf("; %p in %s\n", (void*)ips[n - 1], "unknown"); } } else { Dl_info info; int res = dladdr(ips[n++], &info); if (res != 0) { - printf("; %p in %s\n", ips[n - 1], info.dli_sname); + printf("; %p in %s\n", (void*)ips[n - 1], info.dli_sname); } else { - printf("; %p in Unknown\n", ips[n - 1]); + printf("; %p in Unknown\n", (void*)ips[n - 1]); } } } Modified: vmkit/trunk/lib/JnJVM/VMCore/JavaJIT.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/VMCore/JavaJIT.cpp?rev=52708&r1=52707&r2=52708&view=diff ============================================================================== --- vmkit/trunk/lib/JnJVM/VMCore/JavaJIT.cpp (original) +++ vmkit/trunk/lib/JnJVM/VMCore/JavaJIT.cpp Wed Jun 25 04:59:39 2008 @@ -341,7 +341,7 @@ // The counter will not overflow, increment it. Value* Add = BinaryOperator::createAdd(mvm::jit::constantOne, atomic, "", currentBlock); - new StoreInst(Add, lockPtr, "", currentBlock); + new StoreInst(Add, lockPtr, false, currentBlock); BranchInst::Create(OK, currentBlock); currentBlock = OverflowCounterBB; @@ -385,7 +385,7 @@ // Locked once, set zero currentBlock = LockedOnceBB; - new StoreInst(mvm::jit::constantZero, lockPtr, currentBlock); + new StoreInst(mvm::jit::constantZero, lockPtr, false, currentBlock); BranchInst::Create(EndUnlock, currentBlock); currentBlock = NotLockedOnceBB; @@ -403,7 +403,7 @@ // Decrement the counter. Value* Sub = BinaryOperator::createSub(lock, mvm::jit::constantOne, "", currentBlock); - new StoreInst(Sub, lockPtr, currentBlock); + new StoreInst(Sub, lockPtr, false, currentBlock); BranchInst::Create(EndUnlock, currentBlock); currentBlock = FatLockBB; @@ -833,13 +833,14 @@ func->setLinkage(GlobalValue::ExternalLinkage); - /* + if (compilingMethod->name == compilingClass->isolate->asciizConstructUTF8("main")) { llvmFunction->print(llvm::cout); + printf("\n"); void* res = mvm::jit::executionEngine->getPointerToGlobal(llvmFunction); void* base = res; - while (base < (void*)((char*)res + ((mvm::Code*)res)->objectSize())) { + while (base < (void*)((char*)res + 100)) { printf("%08x\t", (unsigned)base); int n= mvm::jit::disassemble((unsigned int *)base); printf("\n"); @@ -848,7 +849,7 @@ printf("\n"); fflush(stdout); } - */ + PRINT_DEBUG(JNJVM_COMPILE, 1, COLOR_NORMAL, "--> end compiling %s\n", compilingMethod->printString()); @@ -1346,7 +1347,7 @@ nb++; #endif Args.reserve(nb + 2); - Value* args[nb]; + Value** args = (Value**)alloca(nb*sizeof(Value*)); #if defined(MULTIPLE_VM) || defined(MULTIPLE_GC) args[nb - 1] = isolateLocal; sint32 start = nb - 2; Modified: vmkit/trunk/lib/JnJVM/VMCore/JavaJITOpcodes.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/VMCore/JavaJITOpcodes.cpp?rev=52708&r1=52707&r2=52708&view=diff ============================================================================== --- vmkit/trunk/lib/JnJVM/VMCore/JavaJITOpcodes.cpp (original) +++ vmkit/trunk/lib/JnJVM/VMCore/JavaJITOpcodes.cpp Wed Jun 25 04:59:39 2008 @@ -2076,7 +2076,7 @@ LLVMCommonClassInfo* LCI = module->getClassInfo(dcl); Value* valCl = LCI->getVar(this); - Value* args[dim + 2]; + Value** args = (Value**)alloca(sizeof(Value*) * (dim + 2)); args[0] = valCl; args[1] = ConstantInt::get(Type::Int32Ty, dim); Modified: vmkit/trunk/lib/JnJVM/VMCore/JavaRuntimeJIT.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/VMCore/JavaRuntimeJIT.cpp?rev=52708&r1=52707&r2=52708&view=diff ============================================================================== --- vmkit/trunk/lib/JnJVM/VMCore/JavaRuntimeJIT.cpp (original) +++ vmkit/trunk/lib/JnJVM/VMCore/JavaRuntimeJIT.cpp Wed Jun 25 04:59:39 2008 @@ -269,7 +269,7 @@ extern "C" JavaArray* multiCallNew(ClassArray* cl, uint32 len, ...) { va_list ap; va_start(ap, len); - sint32 dims[len]; + sint32* dims = (sint32*)alloca(sizeof(sint32) * len); for (uint32 i = 0; i < len; ++i){ dims[i] = va_arg(ap, int); } Modified: vmkit/trunk/lib/JnJVM/VMCore/Jnjvm.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/VMCore/Jnjvm.cpp?rev=52708&r1=52707&r2=52708&view=diff ============================================================================== --- vmkit/trunk/lib/JnJVM/VMCore/Jnjvm.cpp (original) +++ vmkit/trunk/lib/JnJVM/VMCore/Jnjvm.cpp Wed Jun 25 04:59:39 2008 @@ -41,7 +41,7 @@ Jnjvm* Jnjvm::bootstrapVM = 0; #define DEF_UTF8(var) \ - const UTF8* Jnjvm::var = 0; + const UTF8* Jnjvm::var = 0 DEF_UTF8(initName); DEF_UTF8(clinitName); Modified: vmkit/trunk/lib/JnJVM/VMCore/JnjvmModule.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/VMCore/JnjvmModule.cpp?rev=52708&r1=52707&r2=52708&view=diff ============================================================================== --- vmkit/trunk/lib/JnJVM/VMCore/JnjvmModule.cpp (original) +++ vmkit/trunk/lib/JnJVM/VMCore/JnjvmModule.cpp Wed Jun 25 04:59:39 2008 @@ -350,7 +350,8 @@ const Type* LLVMClassInfo::getVirtualType() { if (!virtualType) { std::vector fields; - JavaField* array[classDef->virtualFields.size()]; + JavaField** array = + (JavaField**)alloca(sizeof(JavaField*) * classDef->virtualFields.size()); if (classDef->super) { LLVMClassInfo* CLI = @@ -401,7 +402,8 @@ if (!staticType) { Class* cl = (Class*)classDef; std::vector fields; - JavaField* array[classDef->staticFields.size() + 1]; + JavaField** array = (JavaField**) + alloca(sizeof(JavaField*) * (classDef->staticFields.size() + 1)); fields.push_back(JnjvmModule::JavaObjectType->getContainedType(0)); for (CommonClass::field_iterator i = classDef->staticFields.begin(), Modified: vmkit/trunk/lib/JnJVM/VMCore/JnjvmModuleProvider.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/VMCore/JnjvmModuleProvider.cpp?rev=52708&r1=52707&r2=52708&view=diff ============================================================================== --- vmkit/trunk/lib/JnJVM/VMCore/JnjvmModuleProvider.cpp (original) +++ vmkit/trunk/lib/JnJVM/VMCore/JnjvmModuleProvider.cpp Wed Jun 25 04:59:39 2008 @@ -204,6 +204,7 @@ addPass(PM, createGVNPass()); // Remove redundancies addPass(PM, createMemCpyOptPass()); // Remove memcpy / form memset addPass(PM, createSCCPPass()); // Constant prop with SCCP + addPass(PM, createCFGSimplificationPass()); // Merge & remove BBs addPass(PM, mvm::createEscapeAnalysisPass(JnjvmModule::JavaObjectAllocateFunction)); addPass(PM, mvm::createLowerConstantCallsPass()); Modified: vmkit/trunk/lib/JnJVM/VMCore/LockedMap.h URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/VMCore/LockedMap.h?rev=52708&r1=52707&r2=52708&view=diff ============================================================================== --- vmkit/trunk/lib/JnJVM/VMCore/LockedMap.h (original) +++ vmkit/trunk/lib/JnJVM/VMCore/LockedMap.h Wed Jun 25 04:59:39 2008 @@ -95,7 +95,7 @@ } - virtual void print(mvm::PrintBuffer* buf) { + virtual void print(mvm::PrintBuffer* buf) const { buf->write("Hashtable<>"); } Added: vmkit/trunk/lib/JnJVM/VMCore/Makefile URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/VMCore/Makefile?rev=52708&view=auto ============================================================================== --- vmkit/trunk/lib/JnJVM/VMCore/Makefile (added) +++ vmkit/trunk/lib/JnJVM/VMCore/Makefile Wed Jun 25 04:59:39 2008 @@ -0,0 +1,14 @@ +##===- lib/JnJVM/VMCore/Makefile ---------------------------*- Makefile -*-===## +# +# The vmkit project +# +# This file is distributed under the University of Illinois Open Source +# License. See LICENSE.TXT for details. +# +##===----------------------------------------------------------------------===## +LEVEL = ../../.. + +LIBRARYNAME = JnJVM +include $(LEVEL)/Makefile.common + +CXX.Flags += -I../LLVMRuntime $(CLASSPATH_FLAGS) Removed: vmkit/trunk/lib/JnJVM/VMCore/Makefile.am URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/VMCore/Makefile.am?rev=52707&view=auto ============================================================================== --- vmkit/trunk/lib/JnJVM/VMCore/Makefile.am (original) +++ vmkit/trunk/lib/JnJVM/VMCore/Makefile.am (removed) @@ -1,22 +0,0 @@ -EXTRA_DIST = OpcodeNames.def -lib_LTLIBRARIES = libJnJVM.la - -PREFIX=@prefix@ - -libJnJVM_la_SOURCES = \ - JavaAccess.h JavaArray.cpp JavaArray.h JavaClass.cpp JavaClass.h \ - JavaConstantPool.cpp JavaConstantPool.h JavaJIT.cpp JavaJIT.h JavaObject.cpp \ - JavaObject.h JavaThread.cpp JavaThread.h \ - JavaTypes.cpp JavaTypes.h Jnjvm.cpp Jnjvm.h Reader.cpp Reader.h \ - Zip.h Zip.cpp types.h debug.h VirtualTables.cpp LockedMap.h LockedMap.cpp \ - JavaIsolate.h JavaIsolate.cpp JavaString.h JavaString.cpp JavaInitialise.cpp JavaJITOpcodes.cpp \ - JavaBacktrace.cpp NativeUtil.h NativeUtil.cpp Jni.cpp \ - JavaCache.h JavaCache.cpp JavaUpcalls.h JavaUpcalls.cpp \ - JnjvmModuleProvider.h JnjvmModuleProvider.cpp JavaRuntimeJIT.cpp JavaMetaJIT.cpp \ - LowerConstantCalls.cpp JnjvmModule.h JnjvmModule.cpp - -if SERVICE_BUILD -libJnJVM_la_SOURCES += ServiceDomain.cpp -endif - -libJnJVM_la_CXXFLAGS =-DPREFIX=\"$(PREFIX)\" -W -Wall -ansi -Wno-unused-parameter -Wno-long-long -Wno-unused-function -fno-omit-frame-pointer -g -Werror -O2 -I../LLVMRuntime Modified: vmkit/trunk/lib/JnJVM/VMCore/ServiceDomain.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/VMCore/ServiceDomain.cpp?rev=52708&r1=52707&r2=52708&view=diff ============================================================================== --- vmkit/trunk/lib/JnJVM/VMCore/ServiceDomain.cpp (original) +++ vmkit/trunk/lib/JnJVM/VMCore/ServiceDomain.cpp Wed Jun 25 04:59:39 2008 @@ -7,6 +7,7 @@ // //===----------------------------------------------------------------------===// +#ifdef SERVICE_VM #include "mvm/JIT.h" #include "JavaJIT.h" @@ -200,3 +201,5 @@ mvm::GCThreadCollector* cur = mvm::GCCollector::threads->myloc(); cur->meta = this; } + +#endif Added: vmkit/trunk/lib/Main.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/Main.cpp?rev=52708&view=auto ============================================================================== --- vmkit/trunk/lib/Main.cpp (added) +++ vmkit/trunk/lib/Main.cpp Wed Jun 25 04:59:39 2008 @@ -0,0 +1,35 @@ +//===--------- Main.cpp - Simple execution of JnJVM -----------------------===// +// +// JnJVM +// +// This file is distributed under the University of Pierre et Marie Curie +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#include "MvmGC.h" +#include "mvm/JIT.h" +#include "mvm/Object.h" +#include "mvm/Threads/Thread.h" + +#include "llvm/Support/ManagedStatic.h" + +using namespace mvm; + + +extern "C" int boot(); +extern "C" int start_app(int, char**); + +int main(int argc, char **argv, char **envp) { + llvm::llvm_shutdown_obj X; + int base; + + jit::initialise(); + Object::initialise(); + Thread::initialise(); + Collector::initialise(0, &base); + boot(); + start_app(argc, argv); + + return 0; +} Added: vmkit/trunk/lib/Makefile URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/Makefile?rev=52708&view=auto ============================================================================== --- vmkit/trunk/lib/Makefile (added) +++ vmkit/trunk/lib/Makefile Wed Jun 25 04:59:39 2008 @@ -0,0 +1,15 @@ +##===- lib/Makefile ----------------------------------------*- Makefile -*-===## +# +# The vmkit project +# +# This file is distributed under the University of Illinois Open Source +# License. See LICENSE.TXT for details. +# +##===----------------------------------------------------------------------===## +LEVEL = .. + +PARALLEL_DIRS = Mvm JnJVM N3 +LIBRARYNAME = Main + +include $(LEVEL)/Makefile.common + Propchange: vmkit/trunk/lib/Makefile ------------------------------------------------------------------------------ svn:executable = * Removed: vmkit/trunk/lib/Mvm/Allocator/.cvsignore URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/Mvm/Allocator/.cvsignore?rev=52707&view=auto ============================================================================== --- vmkit/trunk/lib/Mvm/Allocator/.cvsignore (original) +++ vmkit/trunk/lib/Mvm/Allocator/.cvsignore (removed) @@ -1,14 +0,0 @@ -allocator -*.d -Makefile -Makefile.in -.deps -.libs -*.a -*.o -*.la -*.lo -*.class -*.stamp - -mainuvm_alloc Added: vmkit/trunk/lib/Mvm/Allocator/Makefile URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/Mvm/Allocator/Makefile?rev=52708&view=auto ============================================================================== --- vmkit/trunk/lib/Mvm/Allocator/Makefile (added) +++ vmkit/trunk/lib/Mvm/Allocator/Makefile Wed Jun 25 04:59:39 2008 @@ -0,0 +1,13 @@ +##===- lib/Mvm/Allocator/Makefile --------------------------*- Makefile -*-===## +# +# The vmkit project +# +# This file is distributed under the University of Illinois Open Source +# License. See LICENSE.TXT for details. +# +##===----------------------------------------------------------------------===## +LEVEL = ../../.. + +LIBRARYNAME = Allocator +include $(LEVEL)/Makefile.common + Removed: vmkit/trunk/lib/Mvm/Allocator/Makefile.am URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/Mvm/Allocator/Makefile.am?rev=52707&view=auto ============================================================================== --- vmkit/trunk/lib/Mvm/Allocator/Makefile.am (original) +++ vmkit/trunk/lib/Mvm/Allocator/Makefile.am (removed) @@ -1,11 +0,0 @@ -noinst_LIBRARIES = libuvm_alloc.a -noinst_PROGRAMS = mainuvm_alloc - -libuvm_alloc_a_SOURCES = gcalloc.cpp gcalloc.h gcchunk.cpp gcchunk.h gcerror.cpp gcerror.h gcmapper.cpp gcmapper.h osdep.h -libuvm_alloc_a_CXXFLAGS = -O2 -W -Wall -Werror -ansi -pedantic -Wno-variadic-macros -Wno-unused-parameter - -mainuvm_alloc_SOURCES = main.cpp -mainuvm_alloc_CXXFLAGS = -mainuvm_alloc_LDADD = libuvm_alloc.a - -CLEANFILES = *~ *.bak .*.sw? Removed: vmkit/trunk/lib/Mvm/Allocator/README URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/Mvm/Allocator/README?rev=52707&view=auto ============================================================================== --- vmkit/trunk/lib/Mvm/Allocator/README (original) +++ vmkit/trunk/lib/Mvm/Allocator/README (removed) @@ -1,130 +0,0 @@ -############################################################################## -# -# Micro-VM Allocator -# by Charles Cl?ment, corrected by Ga?l Thomas. -# -############################################################################## - - -I Memory layout - 1 Exponantial area - 2 Linear area - 3 Mmap area -II Structure - 1 Referencing memory chunks - 2 Harsh tables -III Internal memory management - -I Memory layout -#-------------- - -Based on the size of the objects to allocate, the allocator chooses between -three distincts area. -i) The exponantial area for objects less than max_exp bytes -ii) The linear area for x in max_exp < x < max_lin bytes -iii) The mmap area for LIN bytes < x - -Max_exp and max_lin are actually defined to 32 and 8192 bytes. - -I.1 Exponantial area: -Objects stored in that area are allocated 2^n bytes, the smallest power of two -in which the object can fit. - -------------------------------------- -| Size to allocate | reserved space | -------------------------------------- - 1 2 - 2 2 - 3 4 - 4 4 - {5,6,7,8} 8 - {9-16} 16 - {17-32} 32 - --> Size of allocated chunk in this area grows exponantially. -With max_exp = 32 bytes - -I.2 Linear area: -In the linear area, the size needed to be allocated is rounded to the next -max_exp multiple. This is to reduce memory loss, as otherwise, with the -previous technique allocating 260 bytes would induce to occupy a 512 bytes -area. - - ------------------------------------ - | 32 | 64 | 96 | 128 | ... - ------------------------------------ - -max_exp*1 *2 *3 *4 - --> Size of allocated chunk in this area grows linearly. - -I.3 Mmap area: -For objects larger than 2^13 (8192) bytes, a number of physical page is -associated, thus a multiplier of 4096 bytes. - - -II Descriptors -#------------- - -II.1 Hash tables: - -In order to keep track of allocated memory adresses, we need to store the -adresses that we allocated. This is a requirement for the garbage collector, as -the compatibility with the C ABI implies that a memory reference is -indistinguishable from a value. Hence, every page descriptor is inserted in a -hash table when allocated. -This has a limitation, as it is not possible to make the difference between a -value in the heap that would point to an actual allocated space in memory if -translated into a pointer. - - -II.2 Referencing memory chunks: -Here is the representation of an adress in memory : - - ---------------------------------------------------------- -Pointer: | Table Entry | Page Descriptor | Index | - ---------------------------------------------------------- - | __ | | - | | | | | - | |__| | | - | | | GCHashSet \|/ | - | |__| __ __ __ __ __ __ | - --->| |----->|__|__|__|__|__|__| | - |__| | | - | | | GCPage \|/ - |__| | __ __ __ __ __ __ - GCHash ---->|__|__|__|__|__|__| Headers - - -Memory is separated in spaces. Each space contains memory chunk of the same -size. When the allocator needs to allocate n bytes, it choose a memory space -in an exponential, linear or mmaped space and round n to the size of this -space. This technique is used to construct a performant hashtable of all -allocated memory chunks, which is used to identify pointer during a collection -(the garbage collector is only conservative). - -The first bits of a memory chunk pointer reference an entry in GCHash, and -the next bits reference an entry in GCHashSet. Each entry in GCHashSet is a -GCPage structure, which describes a set of contiguous pages (a memory space). - -The GCPage Class holds a field (GCChunkNode*)_headers containing the list to -all headers of free chunks of the space. It also holds the size of the space -in _chunk_nbb. This size is the rounded size (exp or linear) of all memory -chunks managed in this space. - -_Note_: -This is not the case for space allocated in the mmap area, whose page -descriptor holds directly the header itself. - -A header is described by the class GCChunkNode. It holds the size _nbb_mark of -memory chunks in the last 29 bits (the 3 last ones are used by the garbage -collector to set the *color* of the chunk). GCChunkNode are stored in a -circular double linked list. - - -III Internal memory management -#----------------------------- - -The allocator has to allocate its memmory structures itself. It is responsible -to allocate the memory for the micro-vm and the structures needed to manage -and access the allocated areas. Added: vmkit/trunk/lib/Mvm/Allocator/README.txt URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/Mvm/Allocator/README.txt?rev=52708&view=auto ============================================================================== --- vmkit/trunk/lib/Mvm/Allocator/README.txt (added) +++ vmkit/trunk/lib/Mvm/Allocator/README.txt Wed Jun 25 04:59:39 2008 @@ -0,0 +1,130 @@ +############################################################################## +# +# Micro-VM Allocator +# by Charles Cl?ment, corrected by Ga?l Thomas. +# +############################################################################## + + +I Memory layout + 1 Exponantial area + 2 Linear area + 3 Mmap area +II Structure + 1 Referencing memory chunks + 2 Harsh tables +III Internal memory management + +I Memory layout +#-------------- + +Based on the size of the objects to allocate, the allocator chooses between +three distincts area. +i) The exponantial area for objects less than max_exp bytes +ii) The linear area for x in max_exp < x < max_lin bytes +iii) The mmap area for LIN bytes < x + +Max_exp and max_lin are actually defined to 32 and 8192 bytes. + +I.1 Exponantial area: +Objects stored in that area are allocated 2^n bytes, the smallest power of two +in which the object can fit. + +------------------------------------- +| Size to allocate | reserved space | +------------------------------------- + 1 2 + 2 2 + 3 4 + 4 4 + {5,6,7,8} 8 + {9-16} 16 + {17-32} 32 + +-> Size of allocated chunk in this area grows exponantially. +With max_exp = 32 bytes + +I.2 Linear area: +In the linear area, the size needed to be allocated is rounded to the next +max_exp multiple. This is to reduce memory loss, as otherwise, with the +previous technique allocating 260 bytes would induce to occupy a 512 bytes +area. + + ------------------------------------ + | 32 | 64 | 96 | 128 | ... + ------------------------------------ + +max_exp*1 *2 *3 *4 + +-> Size of allocated chunk in this area grows linearly. + +I.3 Mmap area: +For objects larger than 2^13 (8192) bytes, a number of physical page is +associated, thus a multiplier of 4096 bytes. + + +II Descriptors +#------------- + +II.1 Hash tables: + +In order to keep track of allocated memory adresses, we need to store the +adresses that we allocated. This is a requirement for the garbage collector, as +the compatibility with the C ABI implies that a memory reference is +indistinguishable from a value. Hence, every page descriptor is inserted in a +hash table when allocated. +This has a limitation, as it is not possible to make the difference between a +value in the heap that would point to an actual allocated space in memory if +translated into a pointer. + + +II.2 Referencing memory chunks: +Here is the representation of an adress in memory : + + ---------------------------------------------------------- +Pointer: | Table Entry | Page Descriptor | Index | + ---------------------------------------------------------- + | __ | | + | | | | | + | |__| | | + | | | GCHashSet \|/ | + | |__| __ __ __ __ __ __ | + --->| |----->|__|__|__|__|__|__| | + |__| | | + | | | GCPage \|/ + |__| | __ __ __ __ __ __ + GCHash ---->|__|__|__|__|__|__| Headers + + +Memory is separated in spaces. Each space contains memory chunk of the same +size. When the allocator needs to allocate n bytes, it choose a memory space +in an exponential, linear or mmaped space and round n to the size of this +space. This technique is used to construct a performant hashtable of all +allocated memory chunks, which is used to identify pointer during a collection +(the garbage collector is only conservative). + +The first bits of a memory chunk pointer reference an entry in GCHash, and +the next bits reference an entry in GCHashSet. Each entry in GCHashSet is a +GCPage structure, which describes a set of contiguous pages (a memory space). + +The GCPage Class holds a field (GCChunkNode*)_headers containing the list to +all headers of free chunks of the space. It also holds the size of the space +in _chunk_nbb. This size is the rounded size (exp or linear) of all memory +chunks managed in this space. + +_Note_: +This is not the case for space allocated in the mmap area, whose page +descriptor holds directly the header itself. + +A header is described by the class GCChunkNode. It holds the size _nbb_mark of +memory chunks in the last 29 bits (the 3 last ones are used by the garbage +collector to set the *color* of the chunk). GCChunkNode are stored in a +circular double linked list. + + +III Internal memory management +#----------------------------- + +The allocator has to allocate its memmory structures itself. It is responsible +to allocate the memory for the micro-vm and the structures needed to manage +and access the allocated areas. Removed: vmkit/trunk/lib/Mvm/Allocator/main.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/Mvm/Allocator/main.cpp?rev=52707&view=auto ============================================================================== --- vmkit/trunk/lib/Mvm/Allocator/main.cpp (original) +++ vmkit/trunk/lib/Mvm/Allocator/main.cpp (removed) @@ -1,123 +0,0 @@ -//===------------------ main.cc - Mvm allocator ---------------------------===// -// -// Mvm -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -#include "gcalloc.h" -#include -#include -#include -#include -#include - -unsigned int rand(unsigned int min, unsigned int max) { - return (unsigned int)nearbyint((((double)(max - min))*::rand())/(RAND_MAX + 1.0)) + min; -} - -void tire(size_t n, size_t *vals, size_t *reallocs, size_t *frees) { - for(size_t i=0; ialloc(vals[i]); - if(reallocs[i]) - p = a->realloc(p, reallocs[i]); - if(frees[i]) - a->free(p); - } - gettimeofday(&end, 0); - delete a; - - printMesure(n, vals, reallocs, frees, &start, &end); - printf("Press a key...\n"); - getchar(); - - gettimeofday(&start, 0); - for(size_t i=0; i -#include - -LockReccursive * l; -Cond * c; -int go=0; - -extern "C" int getchar(void); - -int f(void *arg) { - struct timeval tv; - tv.tv_sec = 2; - tv.tv_usec = 0; - l->lock(); - while(!go) { - printf("Wait %d\n", Thread::self()); - c->timed_wait(l, &tv); - } - l->unlock(); - printf("Salut\n"); - return 0; -} - -void pre(void *a) { - printf("Pr? %p\n", a); -} - -void post(void *a) { - printf("Post %p\n", a); -} - -class Zop { -public: - static Key * k; - static void initialise_Key(void *pk) { - printf("Init %p %p\n", pk, &k); - ((Key*)pk)->set(new Zop()); - printf("GOOD\n"); - } - - static void duplicate_for_thread(void *, void *z) { - printf("Dup %p\n", z); - k->set(new Zop()); - } - - static void destroy_Key(void *z) { - printf("************ Del %p\n", z); - delete (Zop *)z; - } -}; - -Key* Zop::k; - -int main(int argc, char **argv) { - printf("START\n"); - ctthread_t tid; - - printf("Initialise thread...\n"); - Thread::initialise(); - printf("Create Key...\n"); - - Zop::k = new Key(); - l = new LockReccursive(); - c = new Cond(); - printf("OK\n"); - - Thread::register_handler(pre, post, (void *)0x1000); - Thread::remove_handler(Thread::register_handler(pre, post, (void *)0x1000)); - - Thread::start(&tid, f, (void *)22); - Thread::start(&tid, f, (void *)33); - - getchar(); - l->lock(); - go = 1; - c->broadcast(); - l->unlock(); - - printf("On est pass?\n"); - - getchar(); - Thread::exit(22); -} - Added: vmkit/trunk/lib/Mvm/GCMmap2/Makefile URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/Mvm/GCMmap2/Makefile?rev=52708&view=auto ============================================================================== --- vmkit/trunk/lib/Mvm/GCMmap2/Makefile (added) +++ vmkit/trunk/lib/Mvm/GCMmap2/Makefile Wed Jun 25 04:59:39 2008 @@ -0,0 +1,14 @@ +##===- lib/Mvm/GCMmap2/Makefile ----------------------------*- Makefile -*-===## +# +# The vmkit project +# +# This file is distributed under the University of Illinois Open Source +# License. See LICENSE.TXT for details. +# +##===----------------------------------------------------------------------===## +LEVEL = ../../.. + +LIBRARYNAME = GCMmap2 +include $(LEVEL)/Makefile.common + +CXX.Flags += -I../CommonThread -I../Allocator Removed: vmkit/trunk/lib/Mvm/GCMmap2/Makefile.am URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/Mvm/GCMmap2/Makefile.am?rev=52707&view=auto ============================================================================== --- vmkit/trunk/lib/Mvm/GCMmap2/Makefile.am (original) +++ vmkit/trunk/lib/Mvm/GCMmap2/Makefile.am (removed) @@ -1,22 +0,0 @@ -noinst_LIBRARIES = libuvm_gc_mmap2.a -noinst_PROGRAMS = mainuvm_gc_mmap2 - -THREADDIR=../CommonThread -ALLOCDIR=../Allocator -INCLUDEDIRS=-I at srcdir@/$(THREADDIR) -I at srcdir@/$(ALLOCDIR) - -LIBTHREAD=$(THREADDIR)/libuvm_common_thread.a -LIBALLOC=$(ALLOCDIR)/libuvm_alloc.a - -libuvm_gc_mmap2_a_SOURCES = gc.cpp gccollector.cpp gcinit.cpp gccollector.h -if HAVE_PTHREAD -libuvm_gc_mmap2_a_SOURCES += gcthread.cpp -endif -libuvm_gc_mmap2_a_CXXFLAGS =$(INCLUDEDIRS) -O2 -W -Wall -ansi -pedantic -Wno-unused-parameter -Wno-variadic-macros - -mainuvm_gc_mmap2_SOURCES = main.cpp -mainuvm_gc_mmap2_CXXFLAGS = -O2 -mainuvm_gc_mmap2_LDADD = libuvm_gc_mmap2.a $(LIBTHREAD) $(LIBALLOC) -mainuvm_gc_mmap2_LDFLAGS = - -CLEANFILES = *~ *.bak .*.sw? Modified: vmkit/trunk/lib/Mvm/GCMmap2/gccollector.h URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/Mvm/GCMmap2/gccollector.h?rev=52708&r1=52707&r2=52708&view=diff ============================================================================== --- vmkit/trunk/lib/Mvm/GCMmap2/gccollector.h (original) +++ vmkit/trunk/lib/Mvm/GCMmap2/gccollector.h Wed Jun 25 04:59:39 2008 @@ -10,7 +10,7 @@ #ifndef _GC_COLLECTOR_H_ #define _GC_COLLECTOR_H_ -#include "config.h" +#include "mvm/Config/config.h" #include "gcalloc.h" #ifdef HAVE_PTHREAD #include "gcthread.h" Removed: vmkit/trunk/lib/Mvm/GCMmap2/main.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/Mvm/GCMmap2/main.cpp?rev=52707&view=auto ============================================================================== --- vmkit/trunk/lib/Mvm/GCMmap2/main.cpp (original) +++ vmkit/trunk/lib/Mvm/GCMmap2/main.cpp (removed) @@ -1,43 +0,0 @@ -//===---------------- main.cc - Mvm Garbage Collector ---------------------===// -// -// Mvm -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -#include "mvm/GC/GC.h" -#include "mvm/Threads/Thread.h" -#include - -mvm::Key* mvm::Thread::threadKey = 0; - -void destr(gc *me, size_t sz) { - printf("Destroy %p\n", me); -} - -void trace(gc *me, size_t sz) { - // printf("Trace %p\n", me); -} - -void marker(void*) { - // printf("Marker...\n"); -} - -int main(int argc, char **argv) { - mvm::Thread::initialise(); - Collector::initialise(marker, 0); -#ifdef MULTIPLE_GC - mvm::Thread::get()->GC->destroy(); -#else - Collector::destroy(); -#endif - return 0; -} - - - - - - Removed: vmkit/trunk/lib/Mvm/Main.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/Mvm/Main.cpp?rev=52707&view=auto ============================================================================== --- vmkit/trunk/lib/Mvm/Main.cpp (original) +++ vmkit/trunk/lib/Mvm/Main.cpp (removed) @@ -1,58 +0,0 @@ -//===--------------- Main.cc - Execution of the mvm -----------------------===// -// -// The Micro Virtual Machine -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -#include "MvmGC.h" -#include "mvm/JIT.h" -#include "mvm/PrintBuffer.h" -#include "mvm/Threads/Thread.h" - - -#include -#include -#include -#include - -#include "llvm/Support/CommandLine.h" -#include "llvm/Support/ManagedStatic.h" - -#include "CommandLine.h" - -using namespace mvm; - - -typedef int (*boot)(int, char**, char**); - -static void clearSignals(void) { - signal(SIGINT, SIG_DFL); - signal(SIGILL, SIG_DFL); -#if !defined(WIN32) - signal(SIGIOT, SIG_DFL); - signal(SIGBUS, SIG_DFL); -#endif - signal(SIGSEGV, SIG_DFL); -} - -int main(int argc, char **argv, char **envp) { - llvm::llvm_shutdown_obj X; - int base; - llvm::cl::ParseCommandLineOptions(argc, argv, - " VMKit: a virtual machine launcher\n"); - jit::initialise(); - Object::initialise(); - Thread::initialise(); - Collector::initialise(0, &base); - - CommandLine cl; - cl.start(); - - clearSignals(); - Thread::exit(0); - - return 0; -} Added: vmkit/trunk/lib/Mvm/Makefile URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/Mvm/Makefile?rev=52708&view=auto ============================================================================== --- vmkit/trunk/lib/Mvm/Makefile (added) +++ vmkit/trunk/lib/Mvm/Makefile Wed Jun 25 04:59:39 2008 @@ -0,0 +1,15 @@ +##===- lib/Mvm/Makefile ------------------------------------*- Makefile -*-===## +# +# The vmkit project +# +# This file is distributed under the University of Illinois Open Source +# License. See LICENSE.TXT for details. +# +##===----------------------------------------------------------------------===## +LEVEL = ../.. + +PARALLEL_DIRS = Allocator BoehmGC CommonThread GCMmap2 + +LIBRARYNAME = Mvm +include $(LEVEL)/Makefile.common + Removed: vmkit/trunk/lib/Mvm/Makefile.am URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/Mvm/Makefile.am?rev=52707&view=auto ============================================================================== --- vmkit/trunk/lib/Mvm/Makefile.am (original) +++ vmkit/trunk/lib/Mvm/Makefile.am (removed) @@ -1,11 +0,0 @@ -SUBDIRS = CommonThread Allocator GCMmap2 BoehmGC -DIST_SUBDIRS = CommonThread Allocator GCMmap2 BoehmGC - -bin_PROGRAMS = main - -PREFIX=@prefix@ - -main_SOURCES = Main.cpp Object.cpp Sigsegv.cpp JIT.cpp CommandLine.cpp CommandLine.h MvmMemoryManager.h MvmMemoryManager.cpp EscapeAnalysis.cpp Disassembler.cpp -main_CXXFLAGS = -DPREFIX=\"$(PREFIX)\" -W -Wall -ansi -Wno-unused-parameter -pedantic -Wno-long-long -fno-omit-frame-pointer -O2 -g -main_LDFLAGS=@rdynamic@ -main_LDADD = @LLVMDYLIB@ @GC_LIBS@ @GCTHREAD_LIBS@ Removed: vmkit/trunk/lib/Mvm/VTOffset.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/Mvm/VTOffset.cpp?rev=52707&view=auto ============================================================================== --- vmkit/trunk/lib/Mvm/VTOffset.cpp (original) +++ vmkit/trunk/lib/Mvm/VTOffset.cpp (removed) @@ -1,97 +0,0 @@ -//===-- VTOffset.cpp - Calculates compiler dependant VT offsets -----------===// -// -// The Micro Virtual Machine -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -#include -#include -#include -#include - -#include "MvmGC.h" -#include "mvm/PrintBuffer.h" -#include "mvm/Threads/Thread.h" -#include "mvm/Sigsegv.h" - -class Toto : public mvm::Object { -public: - - static VirtualTable* VT; - virtual void print(mvm::PrintBuffer* buf) const { - printf("in print!\n"); - } - virtual int hashCode() { - printf("in hashcode!\n"); - return 1; - } - - virtual void tracer(size_t sz) { - printf("in tracer\n"); - } - - virtual void destroyer(size_t sz) { - printf("in destroy!\n"); - } - - ~Toto() { - printf("in delete Toto!\n"); - } -}; - -class Tata : public Toto { - public: - static VirtualTable* VT; - ~Tata() { - printf("in delete Tata!\n"); - } -}; - -VirtualTable* Toto::VT = 0; -typedef void (*toto_t)(Toto* t); - -VirtualTable* Tata::VT = 0; -typedef void (*tata_t)(Tata* t); - -int main(int argc, char **argv, char **envp) { - int base; - - mvm::Object::initialise(); - - /*void* handle = sys_dlopen("libLisp.so", RTLD_LAZY | RTLD_GLOBAL); - boot func = (boot)sys_dlsym(handle, "boot"); - func(argc, argv, envp);*/ - { - Toto t; - Toto::VT =((void**)(void*)&t)[0]; - toto_t* ptr = (toto_t*)Toto::VT; - printf("ptr[0] = %d, ptr[1]= %d, ptr[2] = %d ptr[3] = %d ptr[4] = %d ptr[5] = %d\n", ptr[0], ptr[1], ptr[2], ptr[3], ptr[4], ptr[5]); - ptr[0](&t); - //ptr[1](&t); // This should be ~gc - ptr[2](&t); - ptr[3](&t); - ptr[4](&t); - ptr[5](&t); -} -{ - Tata t; - Tata::VT =((void**)(void*)&t)[0]; - tata_t* ptr = (tata_t*)Tata::VT; - printf("ptr[0] = %d, ptr[1]= %d, ptr[2] = %d ptr[3] = %d ptr[4] = %d ptr[5] = %d\n", ptr[0], ptr[1], ptr[2], ptr[3], ptr[4], ptr[5]); - printf("Call des\n"); - ptr[0](&t); - printf("End\n"); - //ptr[1](&t); // This should be ~gc - ptr[2](&t); - ptr[3](&t); - ptr[4](&t); - ptr[5](&t); -} -Tata* t = gc_new(Tata)(); - mvm::Thread::exit(0); - - return 0; -} Removed: vmkit/trunk/lib/N3/Main.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/N3/Main.cpp?rev=52707&view=auto ============================================================================== --- vmkit/trunk/lib/N3/Main.cpp (original) +++ vmkit/trunk/lib/N3/Main.cpp (removed) @@ -1,36 +0,0 @@ -//===------------ Main.cpp - Simple execution of N3 -----------------------===// -// -// N3 -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -#include "MvmGC.h" -#include "mvm/JIT.h" -#include "mvm/PrintBuffer.h" -#include "mvm/Threads/Thread.h" - -#include "llvm/Support/ManagedStatic.h" - -using namespace mvm; - - -extern "C" int boot(); -extern "C" int start_app(int, char**); - - -int main(int argc, char **argv, char **envp) { - llvm::llvm_shutdown_obj X; - int base; - - Thread::initialise(); - jit::initialise(); - Object::initialise(); - Collector::initialise(0, &base); - boot(); - start_app(argc, argv); - - return 0; -} Added: vmkit/trunk/lib/N3/Makefile URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/N3/Makefile?rev=52708&view=auto ============================================================================== --- vmkit/trunk/lib/N3/Makefile (added) +++ vmkit/trunk/lib/N3/Makefile Wed Jun 25 04:59:39 2008 @@ -0,0 +1,13 @@ +##===- lib/Makefile ----------------------------------------*- Makefile -*-===## +# +# The vmkit project +# +# This file is distributed under the University of Illinois Open Source +# License. See LICENSE.TXT for details. +# +##===----------------------------------------------------------------------===## +LEVEL = ../.. + +DIRS = VMCore + +include $(LEVEL)/Makefile.common Removed: vmkit/trunk/lib/N3/Makefile.am URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/N3/Makefile.am?rev=52707&view=auto ============================================================================== --- vmkit/trunk/lib/N3/Makefile.am (original) +++ vmkit/trunk/lib/N3/Makefile.am (removed) @@ -1,11 +0,0 @@ -SUBDIRS = VMCore -bin_PROGRAMS = main - -PREFIX=@prefix@ - -main_SOURCES = ../Mvm/Object.cpp ../Mvm/Sigsegv.cpp Main.cpp ../Mvm/MvmMemoryManager.cpp ../Mvm/JIT.cpp ../Mvm/EscapeAnalysis.cpp - -main_CXXFLAGS = -DPREFIX=\"$(PREFIX)\" -W -Wall -ansi -Wno-unused-parameter -Wno-long-long -Wno-unused-function -fno-omit-frame-pointer -g -Werror -O2 -main_LDADD = VMCore/.libs/libN3.a @GC_LIBS@ @GCTHREAD_LIBS@ @LLVMDYLIB@ @pnetlocalprefix@/engine/libILEngine.a @pnetlocalprefix@/image/libILImage.a @pnetlocalprefix@/support/libILSupport.a \ - @pnetlocalprefix@/libffi/.libs/libffi.a @pnetlocalprefix@/dumpasm/libILDumpAsm.a -main_LDFLAGS = @rdynamic@ Removed: vmkit/trunk/lib/N3/README URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/N3/README?rev=52707&view=auto ============================================================================== --- vmkit/trunk/lib/N3/README (original) +++ vmkit/trunk/lib/N3/README (removed) @@ -1,12 +0,0 @@ -1 - Install pnetlib-0.8.0 - -2 - Download pnet 0.8.0 - tar zxvf pnet-0.8.0.tar.gz - ./configure - make - -3 - Compile n3 - -4 - Run - export MSCORLIB={directory of pnetlib's mscorlib.dll} - ./run-n3 HelloWorld.exe Added: vmkit/trunk/lib/N3/README.txt URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/N3/README.txt?rev=52708&view=auto ============================================================================== --- vmkit/trunk/lib/N3/README.txt (added) +++ vmkit/trunk/lib/N3/README.txt Wed Jun 25 04:59:39 2008 @@ -0,0 +1,12 @@ +1 - Install pnetlib-0.8.0 + +2 - Download pnet 0.8.0 + tar zxvf pnet-0.8.0.tar.gz + ./configure + make + +3 - Compile n3 + +4 - Run + export MSCORLIB={directory of pnetlib's mscorlib.dll} + n3 HelloWorld.exe Modified: vmkit/trunk/lib/N3/VMCore/Assembly.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/N3/VMCore/Assembly.cpp?rev=52708&r1=52707&r2=52708&view=diff ============================================================================== --- vmkit/trunk/lib/N3/VMCore/Assembly.cpp (original) +++ vmkit/trunk/lib/N3/VMCore/Assembly.cpp Wed Jun 25 04:59:39 2008 @@ -25,6 +25,197 @@ using namespace n3; + +#define DEF_TABLE_MASK(name, nb, ...) \ + static void name(uint32 index, \ + std::vector >& tables, \ + uint32 heapSizes) { \ + Table* table = tables[index]; \ + uint32 rowSize = 0; \ + uint32 bitmask = 0; \ + __VA_ARGS__; \ + table->count = nb; \ + table->sizeMask = bitmask; \ + table->rowSize = rowSize; \ + } + + +DEF_TABLE_MASK(METHOD_Module, 5, + INT16(CONSTANT_MODULE_GENERATION) + STRING(CONSTANT_MODULE_NAME) + GUID(CONSTANT_MODULE_MVID) + GUID(CONSTANT_MODULE_ENCID) + GUID(CONSTANT_MODULE_ENCBASEID)) + +DEF_TABLE_MASK(METHOD_TypeRef, 3, + RESOLUTION_SCOPE(CONSTANT_TYPEREF_RESOLUTION_SCOPE) + STRING(CONSTANT_TYPEREF_NAME) + STRING(CONSTANT_TYPEREF_NAMESPACE)) + +DEF_TABLE_MASK(METHOD_TypeDef, 6, + INT32(CONSTANT_TYPEDEF_FLAGS) + STRING(CONSTANT_TYPEDEF_NAME) + STRING(CONSTANT_TYPEDEF_NAMESPACE) + TYPEDEF_OR_REF(CONSTANT_TYPEDEF_EXTENDS) + TABLE(CONSTANT_Field, CONSTANT_TYPEDEF_FIELDLIST) + TABLE(CONSTANT_MethodDef, CONSTANT_TYPEDEF_METHODLIST)) + +DEF_TABLE_MASK(METHOD_MethodDef, 6, + INT32(CONSTANT_METHODDEF_RVA) + INT16(CONSTANT_METHODDEF_IMPLFLAGS) + INT16(CONSTANT_METHODDEF_FLAGS) + STRING(CONSTANT_METHODDEF_NAME) + BLOB(CONSTANT_METHODDEF_SIGNATURE) + TABLE(CONSTANT_Param, CONSTANT_METHODDEF_PARAMLIST)) + +DEF_TABLE_MASK(METHOD_Param, 3, + INT16(CONSTANT_PARAM_FLAGS) + INT16(CONSTANT_PARAM_SEQUENCE) + STRING(CONSTANT_PARAM_NAME)) + +DEF_TABLE_MASK(METHOD_MemberRef, 3, + MEMBER_REF_PARENT(CONSTANT_MEMBERREF_CLASS) + STRING(CONSTANT_MEMBERREF_NAME) + BLOB(CONSTANT_MEMBERREF_SIGNATURE)) + +DEF_TABLE_MASK(METHOD_CustomAttribute, 3, + HAS_CUSTOM_ATTRIBUTE(CONSTANT_CUSTOM_ATTRIBUTE_PARENT) + CUSTOM_ATTRIBUTE_TYPE(CONSTANT_CUSTOM_ATTRIBUTE_TYPE) + BLOB(CONSTANT_CUSTOM_ATTRIBUTE_VALUE)) + +DEF_TABLE_MASK(METHOD_StandaloneSig, 1, + BLOB(CONSTANT_STANDALONE_SIG_SIGNATURE)) + +DEF_TABLE_MASK(METHOD_TypeSpec, 1, + BLOB(CONSTANT_TYPESPEC_SIGNATURE)) + +DEF_TABLE_MASK(METHOD_Assembly, 9, + INT32(CONSTANT_ASSEMBLY_HASH_ALG_ID) + INT16(CONSTANT_ASSEMBLY_MAJOR) + INT16(CONSTANT_ASSEMBLY_MINOR) + INT16(CONSTANT_ASSEMBLY_BUILD) + INT16(CONSTANT_ASSEMBLY_REVISION) + INT32(CONSTANT_ASSEMBLY_FLAGS) + BLOB(CONSTANT_ASSEMBLY_PUBLIC_KEY) + STRING(CONSTANT_ASSEMBLY_NAME) + STRING(CONSTANT_ASSEMBLY_CULTURE)) + +DEF_TABLE_MASK(METHOD_AssemblyRef, 9, + INT16(CONSTANT_ASSEMBLY_REF_MAJOR) + INT16(CONSTANT_ASSEMBLY_REF_MINOR) + INT16(CONSTANT_ASSEMBLY_REF_BUILD) + INT16(CONSTANT_ASSEMBLY_REF_REVISION) + INT32(CONSTANT_ASSEMBLY_REF_FLAGS) + BLOB(CONSTANT_ASSEMBLY_REF_PUBLIC_KEY) + STRING(CONSTANT_ASSEMBLY_REF_NAME) + STRING(CONSTANT_ASSEMBLY_REF_CULTURE) + BLOB(CONSTANT_ASSEMBLY_REF_HASH_VALUE)) + +DEF_TABLE_MASK(METHOD_Field, 3, + INT16(CONSTANT_FIELD_FLAGS) + STRING(CONSTANT_FIELD_NAME) + BLOB(CONSTANT_FIELD_SIGNATURE)) + +DEF_TABLE_MASK(METHOD_InterfaceImpl, 2, + TABLE(CONSTANT_TypeDef, CONSTANT_INTERFACE_IMPL_CLASS) + TYPEDEF_OR_REF(CONSTANT_INTERFACE_IMPL_INTERFACE)) + +DEF_TABLE_MASK(METHOD_NestedClass, 2, + TABLE(CONSTANT_TypeDef, CONSTANT_NESTED_CLASS_NESTED_CLASS) + TABLE(CONSTANT_TypeDef, CONSTANT_NESTED_CLASS_ENCLOSING_CLASS)) + +DEF_TABLE_MASK(METHOD_MethodSpec, 2, + METHODDEF_OR_REF(CONSTANT_METHOD_SPEC_METHOD) + BLOB(CONSTANT_METHOD_SPEC_INSTANTIATION)) + +DEF_TABLE_MASK(METHOD_GenericParamConstraint, 2, + TABLE(CONSTANT_GenericParam, CONSTANT_GENERIC_PARAM_CONSTRAINT_OWNER) + TYPEDEF_OR_REF(CONSTANT_GENERIC_PARAM_CONSTRAINT_CONSTRAINT)) + +DEF_TABLE_MASK(METHOD_Constant, 3, + INT16(CONSTANT_CONSTANT_TYPE) + HAS_CONSTANT(CONSTANT_CONSTANT_PARENT) + BLOB(CONSTANT_CONSTANT_VALUE)) + +DEF_TABLE_MASK(METHOD_FieldMarshal, 2, + HAS_FIELD_MARSHAL(CONSTANT_FIELD_MARSHAL_PARENT) + BLOB(CONSTANT_FIELD_MARSHAL_NATIVE_TYPE)) + +DEF_TABLE_MASK(METHOD_DeclSecurity, 3, + INT16(CONSTANT_DECL_SECURITY_ACTION) + HAS_DECL_SECURITY(CONSTANT_DECL_SECURITY_PARENT) + BLOB(CONSTANT_DECL_SECURITY_PERMISSION_SET)) + +DEF_TABLE_MASK(METHOD_ClassLayout, 3, + INT16(CONSTANT_CLASS_LAYOUT_PACKING_SIZE) + INT32(CONSTANT_CLASS_LAYOUT_CLASS_SIZE) + TABLE(CONSTANT_TypeDef, CONSTANT_CLASS_LAYOUT_PARENT)) + +DEF_TABLE_MASK(METHOD_FieldLayout, 2, + INT32(CONSTANT_FIELD_LAYOUT_OFFSET) + TABLE(CONSTANT_Field, CONSTANT_FIELD_LAYOUT_FIELD)) + +DEF_TABLE_MASK(METHOD_EventMap, 2, + TABLE(CONSTANT_TypeDef, CONSTANT_EVENT_MAP_PARENT) + TABLE(CONSTANT_Event, CONSTANT_EVEN_MAP_EVENT_LIST)) + +DEF_TABLE_MASK(METHOD_Event, 3, + INT16(CONSTANT_EVENT_EVENT_FLAGS) + STRING(CONSTANT_EVENT_NAME) + TYPEDEF_OR_REF(CONSTANT_EVENT_TYPE)) + +DEF_TABLE_MASK(METHOD_PropertyMap, 2, + TABLE(CONSTANT_TypeDef, CONSTANT_PROPERTY_MAP_PARENT) + TABLE(CONSTANT_Property, CONSTANT_PROPERTY_MAP_PROPERTY_LIST)) + +DEF_TABLE_MASK(METHOD_Property, 3, + INT16(CONSTANT_PROPERTY_FLAGS) + STRING(CONSTANT_PROPERTY_NAME) + BLOB(CONSTANT_PROPERTY_TYPE)) + +DEF_TABLE_MASK(METHOD_MethodSemantics, 3, + INT16(CONSTANT_METHOD_SEMANTICS_SEMANTICS) + TABLE(CONSTANT_MethodDef, CONSTANT_METHOD_SEMANTICS_METHOD) + HAS_SEMANTICS(CONSTANT_METHOD_SEMANTICS_ASSOCIATION)) + +DEF_TABLE_MASK(METHOD_MethodImpl, 3, + TABLE(CONSTANT_TypeDef, CONSTANT_METHOD_IMPL_CLASS) + METHODDEF_OR_REF(CONSTANT_METHOD_IMPL_METHOD_BODY) + METHODDEF_OR_REF(CONSTANT_METHOD_IMPL_METHOD_DECLARATION)) + +DEF_TABLE_MASK(METHOD_ModuleRef, 1, + STRING(CONSTANT_MODULE_REF_NAME)) + +DEF_TABLE_MASK(METHOD_ImplMap, 4, + INT16(CONSTANT_IMPL_MAP_MAPPING_FLAGS) + MEMBER_FORWARDED(CONSTANT_IMPL_MAP_MEMBER_FORWARDED) + STRING(CONSTANT_IMPL_MAP_IMPORT_NAME) + TABLE(CONSTANT_ModuleRef, CONSTANT_IMPL_MAP_IMPORT_SCOPE)) + +DEF_TABLE_MASK(METHOD_FieldRva, 2, + INT32(CONSTANT_FIELD_RVA_RVA) + TABLE(CONSTANT_Field, CONSTANT_FIELD_RVA_FIELD)) + +DEF_TABLE_MASK(METHOD_ManifestResource, 4, + INT32(CONSTANT_MANIFEST_RESOURCE_OFFSET) + INT32(CONSTANT_MANIFEST_RESOURCE_FLAGS) + STRING(CONSTANT_MANIFEST_RESOURCE_NAME) + IMPLEMENTATION(CONSTANT_MANIFEST_RESOURCE_IMPLEMENTATION)) + +DEF_TABLE_MASK(METHOD_AssemblyProcessor, 1, + INT32(CONSTANT_ASSEMBLY_PROCESSOR_PROCESSOR)) + +DEF_TABLE_MASK(METHOD_AssemblyOS, 3, + INT32(CONSTANT_ASSEMBLY_OS_PLATFORM_ID) + INT32(CONSTANT_ASSEMBLY_OS_MAJOR_VERSION) + INT32(CONSTANT_ASSEMBLY_OS_MINOR_VERSION)) + +DEF_TABLE_MASK(METHOD_File, 3, + INT32(CONSTANT_FILE_FLAGS) + STRING(CONSTANT_FILE_NAME) + BLOB(CONSTANT_FILE_HASH_VALUE)) + + void Header::print(mvm::PrintBuffer* buf) const { buf->write("Header<>"); } Modified: vmkit/trunk/lib/N3/VMCore/Assembly.h URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/N3/VMCore/Assembly.h?rev=52708&r1=52707&r2=52708&view=diff ============================================================================== --- vmkit/trunk/lib/N3/VMCore/Assembly.h (original) +++ vmkit/trunk/lib/N3/VMCore/Assembly.h Wed Jun 25 04:59:39 2008 @@ -562,19 +562,6 @@ } -#define DEF_TABLE_MASK(name, nb, ...) \ - static void name(uint32 index, \ - std::vector >& tables, \ - uint32 heapSizes) { \ - Table* table = tables[index]; \ - uint32 rowSize = 0; \ - uint32 bitmask = 0; \ - __VA_ARGS__; \ - table->count = nb; \ - table->sizeMask = bitmask; \ - table->rowSize = rowSize; \ - } - #define CONSTANT_MODULE_GENERATION 0 #define CONSTANT_MODULE_NAME 1 #define CONSTANT_MODULE_MVID 2 @@ -582,22 +569,10 @@ #define CONSTANT_MODULE_ENCBASEID 4 -DEF_TABLE_MASK(METHOD_Module, 5, - INT16(CONSTANT_MODULE_GENERATION) - STRING(CONSTANT_MODULE_NAME) - GUID(CONSTANT_MODULE_MVID) - GUID(CONSTANT_MODULE_ENCID) - GUID(CONSTANT_MODULE_ENCBASEID)) - #define CONSTANT_TYPEREF_RESOLUTION_SCOPE 0 #define CONSTANT_TYPEREF_NAME 1 #define CONSTANT_TYPEREF_NAMESPACE 2 -DEF_TABLE_MASK(METHOD_TypeRef, 3, - RESOLUTION_SCOPE(CONSTANT_TYPEREF_RESOLUTION_SCOPE) - STRING(CONSTANT_TYPEREF_NAME) - STRING(CONSTANT_TYPEREF_NAMESPACE)) - #define CONSTANT_TYPEDEF_FLAGS 0 #define CONSTANT_TYPEDEF_NAME 1 #define CONSTANT_TYPEDEF_NAMESPACE 2 @@ -605,14 +580,6 @@ #define CONSTANT_TYPEDEF_FIELDLIST 4 #define CONSTANT_TYPEDEF_METHODLIST 5 -DEF_TABLE_MASK(METHOD_TypeDef, 6, - INT32(CONSTANT_TYPEDEF_FLAGS) - STRING(CONSTANT_TYPEDEF_NAME) - STRING(CONSTANT_TYPEDEF_NAMESPACE) - TYPEDEF_OR_REF(CONSTANT_TYPEDEF_EXTENDS) - TABLE(CONSTANT_Field, CONSTANT_TYPEDEF_FIELDLIST) - TABLE(CONSTANT_MethodDef, CONSTANT_TYPEDEF_METHODLIST)) - #define CONSTANT_METHODDEF_RVA 0 #define CONSTANT_METHODDEF_IMPLFLAGS 1 #define CONSTANT_METHODDEF_FLAGS 2 @@ -620,51 +587,22 @@ #define CONSTANT_METHODDEF_SIGNATURE 4 #define CONSTANT_METHODDEF_PARAMLIST 5 -DEF_TABLE_MASK(METHOD_MethodDef, 6, - INT32(CONSTANT_METHODDEF_RVA) - INT16(CONSTANT_METHODDEF_IMPLFLAGS) - INT16(CONSTANT_METHODDEF_FLAGS) - STRING(CONSTANT_METHODDEF_NAME) - BLOB(CONSTANT_METHODDEF_SIGNATURE) - TABLE(CONSTANT_Param, CONSTANT_METHODDEF_PARAMLIST)) - #define CONSTANT_PARAM_FLAGS 0 #define CONSTANT_PARAM_SEQUENCE 1 #define CONSTANT_PARAM_NAME 2 -DEF_TABLE_MASK(METHOD_Param, 3, - INT16(CONSTANT_PARAM_FLAGS) - INT16(CONSTANT_PARAM_SEQUENCE) - STRING(CONSTANT_PARAM_NAME)) - #define CONSTANT_MEMBERREF_CLASS 0 #define CONSTANT_MEMBERREF_NAME 1 #define CONSTANT_MEMBERREF_SIGNATURE 2 -DEF_TABLE_MASK(METHOD_MemberRef, 3, - MEMBER_REF_PARENT(CONSTANT_MEMBERREF_CLASS) - STRING(CONSTANT_MEMBERREF_NAME) - BLOB(CONSTANT_MEMBERREF_SIGNATURE)) - #define CONSTANT_CUSTOM_ATTRIBUTE_PARENT 0 #define CONSTANT_CUSTOM_ATTRIBUTE_TYPE 1 #define CONSTANT_CUSTOM_ATTRIBUTE_VALUE 2 -DEF_TABLE_MASK(METHOD_CustomAttribute, 3, - HAS_CUSTOM_ATTRIBUTE(CONSTANT_CUSTOM_ATTRIBUTE_PARENT) - CUSTOM_ATTRIBUTE_TYPE(CONSTANT_CUSTOM_ATTRIBUTE_TYPE) - BLOB(CONSTANT_CUSTOM_ATTRIBUTE_VALUE)) - #define CONSTANT_STANDALONE_SIG_SIGNATURE 0 -DEF_TABLE_MASK(METHOD_StandaloneSig, 1, - BLOB(CONSTANT_STANDALONE_SIG_SIGNATURE)) - #define CONSTANT_TYPESPEC_SIGNATURE 0 -DEF_TABLE_MASK(METHOD_TypeSpec, 1, - BLOB(CONSTANT_TYPESPEC_SIGNATURE)) - #define CONSTANT_ASSEMBLY_HASH_ALG_ID 0 #define CONSTANT_ASSEMBLY_MAJOR 1 #define CONSTANT_ASSEMBLY_MINOR 2 @@ -675,17 +613,6 @@ #define CONSTANT_ASSEMBLY_NAME 7 #define CONSTANT_ASSEMBLY_CULTURE 8 -DEF_TABLE_MASK(METHOD_Assembly, 9, - INT32(CONSTANT_ASSEMBLY_HASH_ALG_ID) - INT16(CONSTANT_ASSEMBLY_MAJOR) - INT16(CONSTANT_ASSEMBLY_MINOR) - INT16(CONSTANT_ASSEMBLY_BUILD) - INT16(CONSTANT_ASSEMBLY_REVISION) - INT32(CONSTANT_ASSEMBLY_FLAGS) - BLOB(CONSTANT_ASSEMBLY_PUBLIC_KEY) - STRING(CONSTANT_ASSEMBLY_NAME) - STRING(CONSTANT_ASSEMBLY_CULTURE)) - #define CONSTANT_ASSEMBLY_REF_MAJOR 0 #define CONSTANT_ASSEMBLY_REF_MINOR 1 #define CONSTANT_ASSEMBLY_REF_BUILD 2 @@ -696,203 +623,87 @@ #define CONSTANT_ASSEMBLY_REF_CULTURE 7 #define CONSTANT_ASSEMBLY_REF_HASH_VALUE 8 -DEF_TABLE_MASK(METHOD_AssemblyRef, 9, - INT16(CONSTANT_ASSEMBLY_REF_MAJOR) - INT16(CONSTANT_ASSEMBLY_REF_MINOR) - INT16(CONSTANT_ASSEMBLY_REF_BUILD) - INT16(CONSTANT_ASSEMBLY_REF_REVISION) - INT32(CONSTANT_ASSEMBLY_REF_FLAGS) - BLOB(CONSTANT_ASSEMBLY_REF_PUBLIC_KEY) - STRING(CONSTANT_ASSEMBLY_REF_NAME) - STRING(CONSTANT_ASSEMBLY_REF_CULTURE) - BLOB(CONSTANT_ASSEMBLY_REF_HASH_VALUE)) - #define CONSTANT_FIELD_FLAGS 0 #define CONSTANT_FIELD_NAME 1 #define CONSTANT_FIELD_SIGNATURE 2 -DEF_TABLE_MASK(METHOD_Field, 3, - INT16(CONSTANT_FIELD_FLAGS) - STRING(CONSTANT_FIELD_NAME) - BLOB(CONSTANT_FIELD_SIGNATURE)) - #define CONSTANT_INTERFACE_IMPL_CLASS 0 #define CONSTANT_INTERFACE_IMPL_INTERFACE 1 -DEF_TABLE_MASK(METHOD_InterfaceImpl, 2, - TABLE(CONSTANT_TypeDef, CONSTANT_INTERFACE_IMPL_CLASS) - TYPEDEF_OR_REF(CONSTANT_INTERFACE_IMPL_INTERFACE)) - #define CONSTANT_NESTED_CLASS_NESTED_CLASS 0 #define CONSTANT_NESTED_CLASS_ENCLOSING_CLASS 1 -DEF_TABLE_MASK(METHOD_NestedClass, 2, - TABLE(CONSTANT_TypeDef, CONSTANT_NESTED_CLASS_NESTED_CLASS) - TABLE(CONSTANT_TypeDef, CONSTANT_NESTED_CLASS_ENCLOSING_CLASS)) - #define CONSTANT_METHOD_SPEC_METHOD 0 #define CONSTANT_METHOD_SPEC_INSTANTIATION 1 -DEF_TABLE_MASK(METHOD_MethodSpec, 2, - METHODDEF_OR_REF(CONSTANT_METHOD_SPEC_METHOD) - BLOB(CONSTANT_METHOD_SPEC_INSTANTIATION)) - #define CONSTANT_GENERIC_PARAM_CONSTRAINT_OWNER 0 #define CONSTANT_GENERIC_PARAM_CONSTRAINT_CONSTRAINT 1 -DEF_TABLE_MASK(METHOD_GenericParamConstraint, 2, - TABLE(CONSTANT_GenericParam, CONSTANT_GENERIC_PARAM_CONSTRAINT_OWNER) - TYPEDEF_OR_REF(CONSTANT_GENERIC_PARAM_CONSTRAINT_CONSTRAINT)) - #define CONSTANT_CONSTANT_TYPE 0 #define CONSTANT_CONSTANT_PARENT 1 #define CONSTANT_CONSTANT_VALUE 2 -DEF_TABLE_MASK(METHOD_Constant, 3, - INT16(CONSTANT_CONSTANT_TYPE) - HAS_CONSTANT(CONSTANT_CONSTANT_PARENT) - BLOB(CONSTANT_CONSTANT_VALUE)) - #define CONSTANT_FIELD_MARSHAL_PARENT 0 #define CONSTANT_FIELD_MARSHAL_NATIVE_TYPE 1 -DEF_TABLE_MASK(METHOD_FieldMarshal, 2, - HAS_FIELD_MARSHAL(CONSTANT_FIELD_MARSHAL_PARENT) - BLOB(CONSTANT_FIELD_MARSHAL_NATIVE_TYPE)) - #define CONSTANT_DECL_SECURITY_ACTION 0 #define CONSTANT_DECL_SECURITY_PARENT 1 #define CONSTANT_DECL_SECURITY_PERMISSION_SET 2 -DEF_TABLE_MASK(METHOD_DeclSecurity, 3, - INT16(CONSTANT_DECL_SECURITY_ACTION) - HAS_DECL_SECURITY(CONSTANT_DECL_SECURITY_PARENT) - BLOB(CONSTANT_DECL_SECURITY_PERMISSION_SET)) - #define CONSTANT_CLASS_LAYOUT_PACKING_SIZE 0 #define CONSTANT_CLASS_LAYOUT_CLASS_SIZE 1 #define CONSTANT_CLASS_LAYOUT_PARENT 2 -DEF_TABLE_MASK(METHOD_ClassLayout, 3, - INT16(CONSTANT_CLASS_LAYOUT_PACKING_SIZE) - INT32(CONSTANT_CLASS_LAYOUT_CLASS_SIZE) - TABLE(CONSTANT_TypeDef, CONSTANT_CLASS_LAYOUT_PARENT)) - #define CONSTANT_FIELD_LAYOUT_OFFSET 0 #define CONSTANT_FIELD_LAYOUT_FIELD 1 -DEF_TABLE_MASK(METHOD_FieldLayout, 2, - INT32(CONSTANT_FIELD_LAYOUT_OFFSET) - TABLE(CONSTANT_Field, CONSTANT_FIELD_LAYOUT_FIELD)) - #define CONSTANT_EVENT_MAP_PARENT 0 #define CONSTANT_EVEN_MAP_EVENT_LIST 1 -DEF_TABLE_MASK(METHOD_EventMap, 2, - TABLE(CONSTANT_TypeDef, CONSTANT_EVENT_MAP_PARENT) - TABLE(CONSTANT_Event, CONSTANT_EVEN_MAP_EVENT_LIST)) - #define CONSTANT_EVENT_EVENT_FLAGS 0 #define CONSTANT_EVENT_NAME 1 #define CONSTANT_EVENT_TYPE 2 -DEF_TABLE_MASK(METHOD_Event, 3, - INT16(CONSTANT_EVENT_EVENT_FLAGS) - STRING(CONSTANT_EVENT_NAME) - TYPEDEF_OR_REF(CONSTANT_EVENT_TYPE)) - #define CONSTANT_PROPERTY_MAP_PARENT 0 #define CONSTANT_PROPERTY_MAP_PROPERTY_LIST 1 -DEF_TABLE_MASK(METHOD_PropertyMap, 2, - TABLE(CONSTANT_TypeDef, CONSTANT_PROPERTY_MAP_PARENT) - TABLE(CONSTANT_Property, CONSTANT_PROPERTY_MAP_PROPERTY_LIST)) - #define CONSTANT_PROPERTY_FLAGS 0 #define CONSTANT_PROPERTY_NAME 1 #define CONSTANT_PROPERTY_TYPE 2 -DEF_TABLE_MASK(METHOD_Property, 3, - INT16(CONSTANT_PROPERTY_FLAGS) - STRING(CONSTANT_PROPERTY_NAME) - BLOB(CONSTANT_PROPERTY_TYPE)) - #define CONSTANT_METHOD_SEMANTICS_SEMANTICS 0 #define CONSTANT_METHOD_SEMANTICS_METHOD 1 #define CONSTANT_METHOD_SEMANTICS_ASSOCIATION 2 -DEF_TABLE_MASK(METHOD_MethodSemantics, 3, - INT16(CONSTANT_METHOD_SEMANTICS_SEMANTICS) - TABLE(CONSTANT_MethodDef, CONSTANT_METHOD_SEMANTICS_METHOD) - HAS_SEMANTICS(CONSTANT_METHOD_SEMANTICS_ASSOCIATION)) - #define CONSTANT_METHOD_IMPL_CLASS 0 #define CONSTANT_METHOD_IMPL_METHOD_BODY 1 #define CONSTANT_METHOD_IMPL_METHOD_DECLARATION 2 -DEF_TABLE_MASK(METHOD_MethodImpl, 3, - TABLE(CONSTANT_TypeDef, CONSTANT_METHOD_IMPL_CLASS) - METHODDEF_OR_REF(CONSTANT_METHOD_IMPL_METHOD_BODY) - METHODDEF_OR_REF(CONSTANT_METHOD_IMPL_METHOD_DECLARATION)) - #define CONSTANT_MODULE_REF_NAME 0 -DEF_TABLE_MASK(METHOD_ModuleRef, 1, - STRING(CONSTANT_MODULE_REF_NAME)) - #define CONSTANT_IMPL_MAP_MAPPING_FLAGS 0 #define CONSTANT_IMPL_MAP_MEMBER_FORWARDED 1 #define CONSTANT_IMPL_MAP_IMPORT_NAME 2 #define CONSTANT_IMPL_MAP_IMPORT_SCOPE 3 -DEF_TABLE_MASK(METHOD_ImplMap, 4, - INT16(CONSTANT_IMPL_MAP_MAPPING_FLAGS) - MEMBER_FORWARDED(CONSTANT_IMPL_MAP_MEMBER_FORWARDED) - STRING(CONSTANT_IMPL_MAP_IMPORT_NAME) - TABLE(CONSTANT_ModuleRef, CONSTANT_IMPL_MAP_IMPORT_SCOPE)) - #define CONSTANT_FIELD_RVA_RVA 0 #define CONSTANT_FIELD_RVA_FIELD 1 -DEF_TABLE_MASK(METHOD_FieldRva, 2, - INT32(CONSTANT_FIELD_RVA_RVA) - TABLE(CONSTANT_Field, CONSTANT_FIELD_RVA_FIELD)) - #define CONSTANT_MANIFEST_RESOURCE_OFFSET 0 #define CONSTANT_MANIFEST_RESOURCE_FLAGS 1 #define CONSTANT_MANIFEST_RESOURCE_NAME 2 #define CONSTANT_MANIFEST_RESOURCE_IMPLEMENTATION 3 -DEF_TABLE_MASK(METHOD_ManifestResource, 4, - INT32(CONSTANT_MANIFEST_RESOURCE_OFFSET) - INT32(CONSTANT_MANIFEST_RESOURCE_FLAGS) - STRING(CONSTANT_MANIFEST_RESOURCE_NAME) - IMPLEMENTATION(CONSTANT_MANIFEST_RESOURCE_IMPLEMENTATION)) - #define CONSTANT_ASSEMBLY_PROCESSOR_PROCESSOR 0 -DEF_TABLE_MASK(METHOD_AssemblyProcessor, 1, - INT32(CONSTANT_ASSEMBLY_PROCESSOR_PROCESSOR)) - #define CONSTANT_ASSEMBLY_OS_PLATFORM_ID 0 #define CONSTANT_ASSEMBLY_OS_MAJOR_VERSION 1 #define CONSTANT_ASSEMBLY_OS_MINOR_VERSION 2 -DEF_TABLE_MASK(METHOD_AssemblyOS, 3, - INT32(CONSTANT_ASSEMBLY_OS_PLATFORM_ID) - INT32(CONSTANT_ASSEMBLY_OS_MAJOR_VERSION) - INT32(CONSTANT_ASSEMBLY_OS_MINOR_VERSION)) - #define CONSTANT_FILE_FLAGS 0 #define CONSTANT_FILE_NAME 1 #define CONSTANT_FILE_HASH_VALUE 2 -DEF_TABLE_MASK(METHOD_File, 3, - INT32(CONSTANT_FILE_FLAGS) - STRING(CONSTANT_FILE_NAME) - BLOB(CONSTANT_FILE_HASH_VALUE)) - - } // end namespace n3 #endif Modified: vmkit/trunk/lib/N3/VMCore/BackTrace.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/N3/VMCore/BackTrace.cpp?rev=52708&r1=52707&r2=52708&view=diff ============================================================================== --- vmkit/trunk/lib/N3/VMCore/BackTrace.cpp (original) +++ vmkit/trunk/lib/N3/VMCore/BackTrace.cpp Wed Jun 25 04:59:39 2008 @@ -34,17 +34,17 @@ if (code) { VMMethod* meth = (VMMethod*)code->getMetaInfo(); if (meth) { - printf("; %p in %s\n", ips[n - 1], meth->printString()); + printf("; %p in %s\n", (void*)ips[n - 1], meth->printString()); } else { - printf("; %p in %s\n", ips[n - 1], "unknown"); + printf("; %p in %s\n", (void*)ips[n - 1], "unknown"); } } else { Dl_info info; int res = dladdr(ips[n++], &info); if (res != 0) { - printf("; %p in %s\n", ips[n - 1], info.dli_sname); + printf("; %p in %s\n", (void*)ips[n - 1], info.dli_sname); } else { - printf("; %p in Unknown\n", ips[n - 1]); + printf("; %p in Unknown\n", (void*)ips[n - 1]); } } } Modified: vmkit/trunk/lib/N3/VMCore/CLIJit.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/N3/VMCore/CLIJit.cpp?rev=52708&r1=52707&r2=52708&view=diff ============================================================================== --- vmkit/trunk/lib/N3/VMCore/CLIJit.cpp (original) +++ vmkit/trunk/lib/N3/VMCore/CLIJit.cpp Wed Jun 25 04:59:39 2008 @@ -399,7 +399,7 @@ void CLIJit::makeArgs(const FunctionType* type, std::vector& Args, bool structReturn) { uint32 size = type->getNumParams(); - Value* args[size]; + Value** args = (Value**)alloca(sizeof(Value*) * size); sint32 index = size - 1; FunctionType::param_iterator e = type->param_end(); e--; @@ -486,7 +486,7 @@ VMClassArray* type = (VMClassArray*)meth->classDef; uint32 dims = type->dims; - Value* args[dims]; + Value** args = (Value**)alloca(sizeof(Value*) * dims); Value* val = 0; if (func == 0) { val = pop(); @@ -611,7 +611,7 @@ } else if (type->isArray) { VMClassArray* arrayType = (VMClassArray*)type; Value* valCl = new LoadInst(arrayType->llvmVar(), "", currentBlock); - Value* args[arrayType->dims + 1]; + Value** args = (Value**)alloca(sizeof(Value*) * (arrayType->dims + 1)); args[0] = valCl; for (int cur = arrayType->dims; cur > 0; --cur) @@ -2159,7 +2159,6 @@ // LLVM does not allow calling functions from other modules in verifier //PM->add(llvm::createVerifierPass()); // Verify that input is correct - addPass(PM, mvm::createEscapeAnalysisPass(CLIJit::objConsLLVM, CLIJit::objInitLLVM)); addPass(PM, llvm::createCFGSimplificationPass()); // Clean up disgusting code addPass(PM, llvm::createScalarReplAggregatesPass());// Kill useless allocas addPass(PM, llvm::createInstructionCombiningPass()); // Clean up after IPCP & DAE Modified: vmkit/trunk/lib/N3/VMCore/LockedMap.h URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/N3/VMCore/LockedMap.h?rev=52708&r1=52707&r2=52708&view=diff ============================================================================== --- vmkit/trunk/lib/N3/VMCore/LockedMap.h (original) +++ vmkit/trunk/lib/N3/VMCore/LockedMap.h Wed Jun 25 04:59:39 2008 @@ -97,7 +97,7 @@ } } - virtual void print(mvm::PrintBuffer* buf) { + virtual void print(mvm::PrintBuffer* buf) const { buf->write("Hashtable<>"); } @@ -217,7 +217,7 @@ } } - virtual void print(mvm::PrintBuffer* buf) { + virtual void print(mvm::PrintBuffer* buf) const { buf->write("UTF8 Hashtable<>"); } Added: vmkit/trunk/lib/N3/VMCore/Makefile URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/N3/VMCore/Makefile?rev=52708&view=auto ============================================================================== --- vmkit/trunk/lib/N3/VMCore/Makefile (added) +++ vmkit/trunk/lib/N3/VMCore/Makefile Wed Jun 25 04:59:39 2008 @@ -0,0 +1,15 @@ +##===- lib/JnJVM/VMCore/Makefile ---------------------------*- Makefile -*-===## +# +# The vmkit project +# +# This file is distributed under the University of Illinois Open Source +# License. See LICENSE.TXT for details. +# +##===----------------------------------------------------------------------===## +LEVEL = ../../.. + +CXX.Flags += -Wno-unused +LIBRARYNAME = N3 +include $(LEVEL)/Makefile.common + +CXX.Flags += -Wno-unused Removed: vmkit/trunk/lib/N3/VMCore/Makefile.am URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/N3/VMCore/Makefile.am?rev=52707&view=auto ============================================================================== --- vmkit/trunk/lib/N3/VMCore/Makefile.am (original) +++ vmkit/trunk/lib/N3/VMCore/Makefile.am (removed) @@ -1,15 +0,0 @@ -EXTRA_DIST = SignatureNames.def OpcodeNames.def -lib_LTLIBRARIES = libN3.la - -PREFIX=@prefix@ - -libN3_la_SOURCES = \ - Assembly.cpp Assembly.h CLIAccess.h CLISignature.cpp LockedMap.cpp LockedMap.h N3.cpp N3.h \ - Reader.cpp Reader.h VMArray.cpp VMArray.h VMCache.cpp VMCache.h VMClass.cpp VMClass.h \ - VMObject.cpp VMObject.h VMThread.cpp VMThread.h VirtualMachine.cpp VirtualMachine.h \ - VirtualTables.cpp CLIString.cpp CLIString.h N3Initialise.cpp CLIJitMeta.cpp CLIJit.h CLIJit.cpp \ - Opcodes.cpp NativeUtil.h NativeUtil.cpp PNetLib.cpp N3ModuleProvider.cpp N3ModuleProvider.h \ - PNetLib.h BackTrace.cpp LowerArrayLength.cpp - -libN3_la_CXXFLAGS =-DPREFIX=\"$(PREFIX)\" -W -Wall -ansi -Wno-unused-parameter -Wno-long-long -Wno-unused-function -fno-omit-frame-pointer -g -O2 -I at pnetlocalprefix@/include \ - -I at pnetlocalprefix@/engine Modified: vmkit/trunk/lib/N3/VMCore/PNetLib.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/N3/VMCore/PNetLib.cpp?rev=52708&r1=52707&r2=52708&view=diff ============================================================================== --- vmkit/trunk/lib/N3/VMCore/PNetLib.cpp (original) +++ vmkit/trunk/lib/N3/VMCore/PNetLib.cpp Wed Jun 25 04:59:39 2008 @@ -70,26 +70,26 @@ #ifndef USE_GC_BOEHM int GC_invoke_finalizers (void) { return 0; } int GC_should_invoke_finalizers (void) { return 0; } -void GC_register_finalizer_no_order(void) { return; } +void GC_register_finalizer_no_order(void*, void (*)(void*, void*), void*, void (**)(void*, void*), void**) { return; } void GC_gcollect(void) {} -void GC_malloc_uncollectable(void) {} -void GC_exclude_static_roots(void) {} -void GC_free(void) {} +void* GC_malloc_uncollectable(size_t) { return 0; } +void GC_exclude_static_roots(void*, void*) {} +void GC_free(void*) {} void GC_malloc_explicitly_typed(void) {} -void GC_get_heap_size(void) {} -void GC_register_disappearing_link(void) {} -void GC_general_register_disappearing_link(void) {} -void GC_pthread_sigmask(void) {} -void GC_pthread_detach(void) {} -void GC_pthread_create(void) {} -void GC_malloc(void) {} +size_t GC_get_heap_size(void) {return 0;} +int GC_register_disappearing_link(void**) { return 0; } +int GC_general_register_disappearing_link(void**, void*) { return 0; } +int GC_pthread_sigmask(int, const sigset_t*, sigset_t*) { return 0; } +int GC_pthread_detach(pthread_t) { return 0; } +int GC_pthread_create(pthread_t*, const pthread_attr_t*, void* (*)(void*), void*) { return 0; } +void* GC_malloc(size_t) { return 0; } void GC_make_descriptor(void) {} -void GC_unregister_disappearing_link(void) {} -void GC_finalizer_notifier(void) {} -void GC_java_finalization(void) {} -void GC_finalize_on_demand(void) {} -void GC_set_max_heap_size(void) {} -void GC_malloc_atomic(void) {} +int GC_unregister_disappearing_link(void**) { return 0; } +void (*GC_finalizer_notifier)(void); +int GC_java_finalization; +int GC_finalize_on_demand; +void GC_set_max_heap_size(GC_word) {} +void* GC_malloc_atomic(size_t) { return 0; } #endif // Fake termcap symbols Modified: vmkit/trunk/lib/N3/VMCore/VMArray.h URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/N3/VMCore/VMArray.h?rev=52708&r1=52707&r2=52708&view=diff ============================================================================== --- vmkit/trunk/lib/N3/VMCore/VMArray.h (original) +++ vmkit/trunk/lib/N3/VMCore/VMArray.h Wed Jun 25 04:59:39 2008 @@ -30,7 +30,7 @@ public: static VirtualTable* VT; sint32 size; - void* elements[0]; + void* elements[1]; static const sint32 MaxArraySize; static const llvm::Type* llvmType; @@ -48,7 +48,7 @@ public: \ static VirtualTable* VT; \ static const llvm::Type* llvmType; \ - elmt elements[0]; \ + elmt elements[1]; \ static name *acons(sint32 n, VMClassArray* cl); \ void initialise(VMCommonClass* atype, sint32 n); \ elmt at(sint32) const; \ @@ -73,7 +73,7 @@ public: static VirtualTable* VT; static const llvm::Type* llvmType; - VMObject* elements[0]; + VMObject* elements[1]; static ArrayObject *acons(sint32 n, VMClassArray* cl); void initialise(VMCommonClass* atype, sint32 n); VMObject* at(sint32) const; @@ -85,7 +85,7 @@ class UTF8 : public VMArray { public: static VirtualTable* VT; - uint16 elements[0]; + uint16 elements[1]; static const llvm::Type* llvmType; static UTF8* acons(sint32 n, VMClassArray* cl); Modified: vmkit/trunk/lib/N3/VMCore/VirtualTables.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/N3/VMCore/VirtualTables.cpp?rev=52708&r1=52707&r2=52708&view=diff ============================================================================== --- vmkit/trunk/lib/N3/VMCore/VirtualTables.cpp (original) +++ vmkit/trunk/lib/N3/VMCore/VirtualTables.cpp Wed Jun 25 04:59:39 2008 @@ -123,15 +123,15 @@ } -ARRAYTRACER(ArrayUInt8); -ARRAYTRACER(ArraySInt8); -ARRAYTRACER(ArrayUInt16); -ARRAYTRACER(ArraySInt16); -ARRAYTRACER(ArrayUInt32); -ARRAYTRACER(ArraySInt32); -ARRAYTRACER(ArrayLong); -ARRAYTRACER(ArrayFloat); -ARRAYTRACER(ArrayDouble); +ARRAYTRACER(ArrayUInt8) +ARRAYTRACER(ArraySInt8) +ARRAYTRACER(ArrayUInt16) +ARRAYTRACER(ArraySInt16) +ARRAYTRACER(ArrayUInt32) +ARRAYTRACER(ArraySInt32) +ARRAYTRACER(ArrayLong) +ARRAYTRACER(ArrayFloat) +ARRAYTRACER(ArrayDouble) #undef ARRAYTRACER Removed: vmkit/trunk/lib/N3/pnet-0.7.4.patch URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/N3/pnet-0.7.4.patch?rev=52707&view=auto ============================================================================== --- vmkit/trunk/lib/N3/pnet-0.7.4.patch (original) +++ vmkit/trunk/lib/N3/pnet-0.7.4.patch (removed) @@ -1,72 +0,0 @@ ---- pnet-0.7.4/configure.in 2006-01-15 06:17:01.000000000 +0100 -+++ pnet-0.7.4/configure.in 2006-12-19 11:03:05.000000000 +0100 -@@ -19,6 +19,7 @@ - AC_PROG_RANLIB - AC_PROG_YACC - AM_PROG_LEX -+AM_PROG_LIBTOOL - - AC_PATH_PROG(TREECC, treecc,, ${prefix}/bin:$PATH) - if test -z "$TREECC" ; then - ---- pnet-0.7.4/engine/Makefile.am 2005-12-19 19:00:35.000000000 +0100 -+++ /home/varth/project/pnet-0.7.4/engine/Makefile.am 2006-12-19 11:17:07.000000000 +0100 -@@ -1,4 +1,5 @@ - bin_PROGRAMS = ilrun ilverify -+lib_LTLIBRARIES = libStdio.la libTime.la - lib_LIBRARIES = libILEngine.a - man_MANS = ilrun.1 ilverify.1 - -@@ -76,6 +77,11 @@ - $(UNROLL_INCLUDES) \ - $(VERIFY_INCLUDES) - -+ -+libStdio_la_SOURCES = lib_stdio.c -+libTime_la_SOURCES = lib_time.c -+ -+ - BUILT_SOURCES = gen_marshal.c \ - gen_marshal.h - ---- pnet-0.7.4/support/Makefile.am 2005-08-22 14:39:20.000000000 +0200 -+++ pnet-0.7.4/support/Makefile.am 2006-12-19 19:18:10.000000000 +0100 -@@ -1,3 +1,4 @@ -+lib_LTLIBRARIES = libILSupport.la - lib_LIBRARIES = libILSupport.a - noinst_PROGRAMS = mkcategory mknumber mkcase - EXTRA_DIST = gen_errno.sh -@@ -8,7 +9,7 @@ - - BUILT_SOURCES = errno_map.c - --libILSupport_a_SOURCES = aes.c \ -+libILSupport_la_SOURCES = aes.c \ - allocate.c \ - ansi.c \ - bignum.c \ -@@ -30,7 +31,6 @@ - guid.c \ - hash.c \ - hashtab.c \ -- hb_gc.c \ - interlocked.h \ - interlocked_any.h \ - interlocked_x86.h \ -@@ -85,6 +85,8 @@ - write_float.c \ - xml.c - -+libILSupport_a_SOURCES = $(libILSupport_la_SOURCES) hb_gc.c -+ - mkcategory_SOURCES = mkcategory.c - - mknumber_SOURCES = mknumber.c ---- pnet-0.7.4/auto_gen.sh 2002-12-01 23:58:37.000000000 +0100 -+++ pnet-0.7.4/auto_gen.sh 2006-12-19 11:05:39.000000000 +0100 -@@ -34,4 +34,5 @@ - # Run automake and autoconf. - automake --add-missing --copy $AM_FLAGS - autoconf -+libtoolize --copy --force - exit 0 Added: vmkit/trunk/patches/vmkit-llvm-ppc.patch URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/patches/vmkit-llvm-ppc.patch?rev=52708&view=auto ============================================================================== --- vmkit/trunk/patches/vmkit-llvm-ppc.patch (added) +++ vmkit/trunk/patches/vmkit-llvm-ppc.patch Wed Jun 25 04:59:39 2008 @@ -0,0 +1,339 @@ +Index: PPCInstrInfo.td +=================================================================== +--- PPCInstrInfo.td (revision 50006) ++++ PPCInstrInfo.td (working copy) +@@ -1212,6 +1212,8 @@ + (BL_ELF texternalsym:$dst)>; + + // Hi and Lo for Darwin Global Addresses. ++def : Pat<(PPChi texternalsym:$in, 0), (LIS texternalsym:$in)>; ++def : Pat<(PPClo texternalsym:$in, 0), (LI texternalsym:$in)>; + def : Pat<(PPChi tglobaladdr:$in, 0), (LIS tglobaladdr:$in)>; + def : Pat<(PPClo tglobaladdr:$in, 0), (LI tglobaladdr:$in)>; + def : Pat<(PPChi tconstpool:$in, 0), (LIS tconstpool:$in)>; +Index: PPCJITInfo.cpp +=================================================================== +--- PPCJITInfo.cpp (revision 50006) ++++ PPCJITInfo.cpp (working copy) +@@ -13,12 +13,16 @@ + + #define DEBUG_TYPE "jit" + #include "PPCJITInfo.h" ++#include "PPCRegisterInfo.h" + #include "PPCRelocations.h" + #include "PPCTargetMachine.h" + #include "llvm/Function.h" + #include "llvm/CodeGen/MachineCodeEmitter.h" + #include "llvm/Config/alloca.h" ++#include "llvm/ExecutionEngine/ExecutionEngine.h" + #include "llvm/Support/Debug.h" ++#include "llvm/Support/Dwarf.h" ++#include "llvm/Target/TargetOptions.h" + #include + using namespace llvm; + +@@ -53,24 +57,27 @@ + if (Offset >= -(1 << 23) && Offset < (1 << 23)) { // In range? + AtI[0] = BUILD_B(Offset, isCall); // b/bl target + } else if (!is64Bit) { +- AtI[0] = BUILD_LIS(12, To >> 16); // lis r12, hi16(address) ++ AtI[0] = BUILD_B(0, false); // thread safety + AtI[1] = BUILD_ORI(12, 12, To); // ori r12, r12, lo16(address) + AtI[2] = BUILD_MTCTR(12); // mtctr r12 + AtI[3] = BUILD_BCTR(isCall); // bctr/bctrl ++ AtI[0] = BUILD_LIS(12, To >> 16); // lis r12, hi16(address) + } else { +- AtI[0] = BUILD_LIS(12, To >> 48); // lis r12, hi16(address) ++ AtI[0] = BUILD_B(0, false); // thread safety + AtI[1] = BUILD_ORI(12, 12, To >> 32); // ori r12, r12, lo16(address) + AtI[2] = BUILD_SLDI(12, 12, 32); // sldi r12, r12, 32 + AtI[3] = BUILD_ORIS(12, 12, To >> 16); // oris r12, r12, hi16(address) + AtI[4] = BUILD_ORI(12, 12, To); // ori r12, r12, lo16(address) + AtI[5] = BUILD_MTCTR(12); // mtctr r12 + AtI[6] = BUILD_BCTR(isCall); // bctr/bctrl ++ AtI[0] = BUILD_LIS(12, To >> 48); // lis r12, hi16(address) + } + } + + extern "C" void PPC32CompilationCallback(); + extern "C" void PPC64CompilationCallback(); + ++ + #if (defined(__POWERPC__) || defined (__ppc__) || defined(_POWER)) && \ + !defined(__ppc64__) + // CompilationCallback stub - We can't use a C function with inline assembly in +@@ -144,6 +151,9 @@ + // it, because we the prolog/epilog inserted by GCC won't work for us. Instead, + // write our own wrapper, which does things our way, so we have complete control + // over register saving and restoring. ++ ++# define CFI(x) x ++ + asm( + ".text\n" + ".align 2\n" +@@ -156,19 +166,29 @@ + // FIXME Layout + // 8 double registers - 64 bytes + // 8 int registers - 32 bytes ++ CFI(".cfi_startproc\n") ++ "stwu 1, -104(1)\n" ++ CFI(".cfi_adjust_cfa_offset 104\n") + "mflr 0\n" +- "stw 0, 4(1)\n" +- "stwu 1, -104(1)\n" ++ "stw 0, 108(1)\n" ++ CFI(".cfi_offset lr, 4\n") + // Save all int arg registers +- "stw 10, 100(1)\n" "stw 9, 96(1)\n" +- "stw 8, 92(1)\n" "stw 7, 88(1)\n" +- "stw 6, 84(1)\n" "stw 5, 80(1)\n" +- "stw 4, 76(1)\n" "stw 3, 72(1)\n" ++ "stw 10, 100(1)\n" ++ "stw 9, 96(1)\n" ++ "stw 8, 92(1)\n" ++ "stw 7, 88(1)\n" ++ "stw 6, 84(1)\n" ++ "stw 5, 80(1)\n" ++ "stw 4, 76(1)\n" ++ "stw 3, 72(1)\n" + // Save all call-clobbered FP regs. + "stfd 8, 64(1)\n" +- "stfd 7, 56(1)\n" "stfd 6, 48(1)\n" +- "stfd 5, 40(1)\n" "stfd 4, 32(1)\n" +- "stfd 3, 24(1)\n" "stfd 2, 16(1)\n" ++ "stfd 7, 56(1)\n" ++ "stfd 6, 48(1)\n" ++ "stfd 5, 40(1)\n" ++ "stfd 4, 32(1)\n" ++ "stfd 3, 24(1)\n" ++ "stfd 2, 16(1)\n" + "stfd 1, 8(1)\n" + // Arguments to Compilation Callback: + // r3 - our lr (address of the call instruction in stub plus 4) +@@ -181,21 +201,29 @@ + "bl PPCCompilationCallbackC\n" + "mtctr 3\n" + // Restore all int arg registers +- "lwz 10, 100(1)\n" "lwz 9, 96(1)\n" +- "lwz 8, 92(1)\n" "lwz 7, 88(1)\n" +- "lwz 6, 84(1)\n" "lwz 5, 80(1)\n" +- "lwz 4, 76(1)\n" "lwz 3, 72(1)\n" ++ "lwz 10, 100(1)\n" ++ "lwz 9, 96(1)\n" ++ "lwz 8, 92(1)\n" ++ "lwz 7, 88(1)\n" ++ "lwz 6, 84(1)\n" ++ "lwz 5, 80(1)\n" ++ "lwz 4, 76(1)\n" ++ "lwz 3, 72(1)\n" + // Restore all FP arg registers + "lfd 8, 64(1)\n" +- "lfd 7, 56(1)\n" "lfd 6, 48(1)\n" +- "lfd 5, 40(1)\n" "lfd 4, 32(1)\n" +- "lfd 3, 24(1)\n" "lfd 2, 16(1)\n" ++ "lfd 7, 56(1)\n" ++ "lfd 6, 48(1)\n" ++ "lfd 5, 40(1)\n" ++ "lfd 4, 32(1)\n" ++ "lfd 3, 24(1)\n" ++ "lfd 2, 16(1)\n" + "lfd 1, 8(1)\n" + // Pop 3 frames off the stack and branch to target + "lwz 1, 104(1)\n" + "lwz 0, 4(1)\n" + "mtlr 0\n" + "bctr\n" ++ CFI(".cfi_endproc\n") + ); + #else + void PPC32CompilationCallback() { +@@ -325,6 +353,31 @@ + return is64Bit ? PPC64CompilationCallback : PPC32CompilationCallback; + } + ++static const char* GetCommonFrame32() { ++ /* ++ // Size of common frame ++ MCE.emitWordBE(16); ++ // Common frame ++ MCE.emitWordBE(0); ++ MCE.emitByte(1); ++ MCE.emitByte('z'); ++ MCE.emitByte('R'); ++ MCE.emitByte(0); ++ MCE.emitByte(1); ++ MCE.emitByte(-4 & 0x7f); ++ MCE.emitByte(0x41); ++ MCE.emitByte(1); ++ MCE.emitByte(16); ++ MCE.emitByte(0xc); ++ MCE.emitByte(1); ++ MCE.emitByte(0);*/ ++ static const char CF[] = { ++ 0, 0, 0, 16, 0, 0, 0, 0, 1, 'z', 'R', 0, 1, -4 & 0x7f, ++ 0x41, 1, 16, 0xc, 1, 0 ++ }; ++ return CF; ++} ++ + #if (defined(__POWERPC__) || defined (__ppc__) || defined(_POWER)) && \ + defined(__APPLE__) + extern "C" void sys_icache_invalidate(const void *Addr, size_t len); +@@ -358,21 +411,26 @@ + SyncICache((void*)Addr, 7*4); + return MCE.finishFunctionStub(F); + } +- +- MCE.startFunctionStub(F, 10*4); ++ ++ if (ExceptionHandling && !is64Bit) { ++ MCE.startFunctionStub(F, 10*4 + 44); ++ } else { ++ MCE.startFunctionStub(F, 10*4); ++ } ++ + intptr_t Addr = (intptr_t)MCE.getCurrentPCValue(); + if (is64Bit) { ++ MCE.emitWordBE(0x7d6802a6); // mflr r11 ++ MCE.emitWordBE(0xf9610010); // std r11, 16(r1) + MCE.emitWordBE(0xf821ffb1); // stdu r1,-80(r1) ++ } else if (TM.getSubtargetImpl()->isMachoABI()){ + MCE.emitWordBE(0x7d6802a6); // mflr r11 +- MCE.emitWordBE(0xf9610060); // std r11, 96(r1) +- } else if (TM.getSubtargetImpl()->isMachoABI()){ ++ MCE.emitWordBE(0x91610008); // stw r11, 8(r1) + MCE.emitWordBE(0x9421ffe0); // stwu r1,-32(r1) ++ } else { + MCE.emitWordBE(0x7d6802a6); // mflr r11 +- MCE.emitWordBE(0x91610028); // stw r11, 40(r1) +- } else { ++ MCE.emitWordBE(0x91610004); // stw r11, 4(r1) + MCE.emitWordBE(0x9421ffe0); // stwu r1,-32(r1) +- MCE.emitWordBE(0x7d6802a6); // mflr r11 +- MCE.emitWordBE(0x91610024); // stw r11, 36(r1) + } + intptr_t BranchAddr = (intptr_t)MCE.getCurrentPCValue(); + MCE.emitWordBE(0); +@@ -384,6 +442,42 @@ + MCE.emitWordBE(0); + EmitBranchToAt(BranchAddr, (intptr_t)Fn, true, is64Bit); + SyncICache((void*)Addr, 10*4); ++ intptr_t EndAddr = (intptr_t)MCE.getCurrentPCValue(); ++ ++ if (ExceptionHandling && !is64Bit) { ++ // Size of Eh section ++ MCE.emitWordBE(32); ++ // Eh section ++ MCE.emitWordBE(MCE.getCurrentPCValue() - (intptr_t)GetCommonFrame32()); ++ MCE.emitWordBE(Addr - MCE.getCurrentPCValue()); ++ MCE.emitWordBE(EndAddr - Addr); ++ MCE.emitByte(0); ++ MCE.emitByte(dwarf::DW_CFA_advance_loc4); ++ MCE.emitWordBE(8); ++ MCE.emitByte(dwarf::DW_CFA_def_cfa_offset); ++ MCE.emitByte(32); ++ MCE.emitByte(dwarf::DW_CFA_offset_extended_sf); ++ MCE.emitByte(TM.getRegisterInfo()->getDwarfRegNum(PPC::LR, true)); ++ if (TM.getSubtargetImpl()->isMachoABI()){ ++ MCE.emitByte(-2 & 0x7f); ++ } else { ++ MCE.emitByte(-1 & 0x7f); ++ } ++ MCE.emitByte(dwarf::DW_CFA_advance_loc4); ++ MCE.emitWordBE(4); ++ MCE.emitByte(dwarf::DW_CFA_def_cfa_register); ++ MCE.emitByte(1); ++ // Alignment ++ MCE.emitByte(0); ++ MCE.emitByte(0); ++ ++ // Two zero for the unwind runtime ++ MCE.emitWordBE(0); ++ MCE.emitWordBE(0); ++ ++ SyncICache((void*)EndAddr, 44); ++ ExecutionEngine::RegisterTable((void*)EndAddr); ++ } + return MCE.finishFunctionStub(F); + } + +Index: PPCISelLowering.cpp +=================================================================== +--- PPCISelLowering.cpp (revision 50006) ++++ PPCISelLowering.cpp (working copy) +@@ -175,10 +175,12 @@ + // We want to legalize GlobalAddress and ConstantPool nodes into the + // appropriate instructions to materialize the address. + setOperationAction(ISD::GlobalAddress, MVT::i32, Custom); ++ setOperationAction(ISD::ExternalSymbol , MVT::i32 , Custom); + setOperationAction(ISD::GlobalTLSAddress, MVT::i32, Custom); + setOperationAction(ISD::ConstantPool, MVT::i32, Custom); + setOperationAction(ISD::JumpTable, MVT::i32, Custom); + setOperationAction(ISD::GlobalAddress, MVT::i64, Custom); ++ setOperationAction(ISD::ExternalSymbol , MVT::i64 , Custom); + setOperationAction(ISD::GlobalTLSAddress, MVT::i64, Custom); + setOperationAction(ISD::ConstantPool, MVT::i64, Custom); + setOperationAction(ISD::JumpTable, MVT::i64, Custom); +@@ -745,6 +747,36 @@ + return isIntS16Immediate(Op.Val, Imm); + } + ++ static SDOperand LowerExternalSymbol(SDOperand Op, SelectionDAG &DAG) { ++ MVT::ValueType PtrVT = Op.getValueType(); ++ ExternalSymbolSDNode *GSDB = dyn_cast(Op); ++ SDOperand GA = DAG.getTargetExternalSymbol(GSDB->getSymbol(), PtrVT); ++ SDOperand Zero = DAG.getConstant(0, PtrVT); ++ ++ const TargetMachine &TM = DAG.getTarget(); ++ ++ SDOperand Hi = DAG.getNode(PPCISD::Hi, PtrVT, GA, Zero); ++ SDOperand Lo = DAG.getNode(PPCISD::Lo, PtrVT, GA, Zero); ++ ++ // If this is a non-darwin platform, we don't support non-static relo models ++ // yet. ++ if (TM.getRelocationModel() == Reloc::Static || ++ !TM.getSubtarget().isDarwin()) { ++ // Generate non-pic code that has direct accesses to globals. ++ // The address of the global is just (hi(&g)+lo(&g)). ++ return DAG.getNode(ISD::ADD, PtrVT, Hi, Lo); ++ } ++ ++ if (TM.getRelocationModel() == Reloc::PIC_) { ++ // With PIC, the first instruction is actually "GR+hi(&G)". ++ Hi = DAG.getNode(ISD::ADD, PtrVT, ++ DAG.getNode(PPCISD::GlobalBaseReg, PtrVT), Hi); ++ } ++ ++ Lo = DAG.getNode(ISD::ADD, PtrVT, Hi, Lo); ++ ++ return Lo; ++ } + + /// SelectAddressRegReg - Given the specified addressed, check to see if it + /// can be represented as an indexed [r+r] operation. Returns false if it +@@ -2130,11 +2162,11 @@ + // 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. +- if (GlobalAddressSDNode *G = dyn_cast(Callee)) +- Callee = DAG.getTargetGlobalAddress(G->getGlobal(), Callee.getValueType()); +- else if (ExternalSymbolSDNode *S = dyn_cast(Callee)) +- Callee = DAG.getTargetExternalSymbol(S->getSymbol(), Callee.getValueType()); +- else if (SDNode *Dest = isBLACompatibleAddress(Callee, DAG)) ++ //if (GlobalAddressSDNode *G = dyn_cast(Callee)) ++ // Callee = DAG.getTargetGlobalAddress(G->getGlobal(), Callee.getValueType()); ++ //if (ExternalSymbolSDNode *S = dyn_cast(Callee)) ++ // Callee = DAG.getTargetExternalSymbol(S->getSymbol(), Callee.getValueType()); ++ if (SDNode *Dest = isBLACompatibleAddress(Callee, DAG)) + // If this is an absolute destination address, use the munged value. + Callee = SDOperand(Dest, 0); + else { +@@ -3506,6 +3538,7 @@ + default: assert(0 && "Wasn't expecting to be able to lower this!"); + case ISD::ConstantPool: return LowerConstantPool(Op, DAG); + case ISD::GlobalAddress: return LowerGlobalAddress(Op, DAG); ++ case ISD::ExternalSymbol: return LowerExternalSymbol(Op, DAG); + case ISD::GlobalTLSAddress: return LowerGlobalTLSAddress(Op, DAG); + case ISD::JumpTable: return LowerJumpTable(Op, DAG); + case ISD::SETCC: return LowerSETCC(Op, DAG); Added: vmkit/trunk/patches/vmkit-llvm-x86.patch URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/patches/vmkit-llvm-x86.patch?rev=52708&view=auto ============================================================================== --- vmkit/trunk/patches/vmkit-llvm-x86.patch (added) +++ vmkit/trunk/patches/vmkit-llvm-x86.patch Wed Jun 25 04:59:39 2008 @@ -0,0 +1,37 @@ +Index: X86Subtarget.cpp +=================================================================== +--- X86Subtarget.cpp (revision 50008) ++++ X86Subtarget.cpp (working copy) +@@ -127,7 +127,7 @@ + return; + + X86::GetCpuIDAndInfo(0x1, &EAX, &EBX, &ECX, &EDX); +- ++#if 0 + if ((EDX >> 23) & 0x1) X86SSELevel = MMX; + if ((EDX >> 25) & 0x1) X86SSELevel = SSE1; + if ((EDX >> 26) & 0x1) X86SSELevel = SSE2; +@@ -135,7 +135,9 @@ + if ((ECX >> 9) & 0x1) X86SSELevel = SSSE3; + if ((ECX >> 19) & 0x1) X86SSELevel = SSE41; + if ((ECX >> 20) & 0x1) X86SSELevel = SSE42; +- ++#else ++ X86SSELevel = MMX; ++#endif + if (memcmp(text.c, "GenuineIntel", 12) == 0 || + memcmp(text.c, "AuthenticAMD", 12) == 0) { + X86::GetCpuIDAndInfo(0x80000001, &EAX, &EBX, &ECX, &EDX); +Index: X86JITInfo.cpp +=================================================================== +--- X86JITInfo.cpp (revision 50008) ++++ X86JITInfo.cpp (working copy) +@@ -60,7 +60,7 @@ + // FIXME: Disable this until we really want to use it. Also, we will + // need to add some workarounds for compilers, which support + // only subset of these directives. +-# define CFI(x) ++# define CFI(x) x + #endif + + // Provide a wrapper for X86CompilationCallback2 that saves non-traditional Added: vmkit/trunk/tools/Makefile URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/tools/Makefile?rev=52708&view=auto ============================================================================== --- vmkit/trunk/tools/Makefile (added) +++ vmkit/trunk/tools/Makefile Wed Jun 25 04:59:39 2008 @@ -0,0 +1,14 @@ +##===- tools/Makefile --------------------------------------*- Makefile -*-===## +# +# The vmkit project +# +# This file is distributed under the University of Illinois Open Source +# License. See LICENSE.TXT for details. +# +##===----------------------------------------------------------------------===## +LEVEL = .. + +PARALLEL_DIRS = jnjvm n3 + +include $(LEVEL)/Makefile.common + Propchange: vmkit/trunk/tools/Makefile ------------------------------------------------------------------------------ svn:executable = * Added: vmkit/trunk/tools/jnjvm/Makefile URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/tools/jnjvm/Makefile?rev=52708&view=auto ============================================================================== --- vmkit/trunk/tools/jnjvm/Makefile (added) +++ vmkit/trunk/tools/jnjvm/Makefile Wed Jun 25 04:59:39 2008 @@ -0,0 +1,17 @@ +##===- tools/jnjvm/Makefile --------------------------------*- Makefile -*-===## +# +# The vmkit project +# +# This file is distributed under the University of Illinois Open Source +# License. See LICENSE.TXT for details. +# +##===----------------------------------------------------------------------===## +LEVEL = ../.. + +include $(LEVEL)/Makefile.config + +TOOLNAME = jnjvm +USEDLIBS = Allocator CommonThread Mvm JnJVM Classpath Main $(GCLIB) +LINK_COMPONENTS = engine scalaropts instrumentation ipa ipo + +include $(LEVEL)/Makefile.common Propchange: vmkit/trunk/tools/jnjvm/Makefile ------------------------------------------------------------------------------ svn:executable = * Added: vmkit/trunk/tools/n3/Makefile URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/tools/n3/Makefile?rev=52708&view=auto ============================================================================== --- vmkit/trunk/tools/n3/Makefile (added) +++ vmkit/trunk/tools/n3/Makefile Wed Jun 25 04:59:39 2008 @@ -0,0 +1,21 @@ +##===- tools/n3/Makefile -----------------------------------*- Makefile -*-===## +# +# The vmkit project +# +# This file is distributed under the University of Illinois Open Source +# License. See LICENSE.TXT for details. +# +##===----------------------------------------------------------------------===## +LEVEL = ../.. + +include $(LEVEL)/Makefile.config + +TOOLNAME = n3 +LINK_COMPONENTS = engine scalaropts instrumentation ipa ipo +USEDLIBS = Allocator CommonThread Mvm N3 Main $(GCLIB) + +include $(LEVEL)/Makefile.common + +LIBS += $(PNETLIB)/engine/libILEngine.a $(PNETLIB)/image/libILImage.a $(PNETLIB)/support/libILSupport.a \ + $(PNETLIB)/libffi/.libs/libffi.a $(PNETLIB)//dumpasm/libILDumpAsm.a + Propchange: vmkit/trunk/tools/n3/Makefile ------------------------------------------------------------------------------ svn:executable = * Added: vmkit/trunk/tools/testAllocator/Main.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/tools/testAllocator/Main.cpp?rev=52708&view=auto ============================================================================== --- vmkit/trunk/tools/testAllocator/Main.cpp (added) +++ vmkit/trunk/tools/testAllocator/Main.cpp Wed Jun 25 04:59:39 2008 @@ -0,0 +1,123 @@ +//===------------------ main.cc - Mvm allocator ---------------------------===// +// +// Mvm +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#include "gcalloc.h" +#include +#include +#include +#include +#include + +unsigned int rand(unsigned int min, unsigned int max) { + return (unsigned int)nearbyint((((double)(max - min))*::rand())/(RAND_MAX + 1.0)) + min; +} + +void tire(size_t n, size_t *vals, size_t *reallocs, size_t *frees) { + for(size_t i=0; ialloc(vals[i]); + if(reallocs[i]) + p = a->realloc(p, reallocs[i]); + if(frees[i]) + a->free(p); + } + gettimeofday(&end, 0); + delete a; + + printMesure(n, vals, reallocs, frees, &start, &end); + printf("Press a key...\n"); + getchar(); + + gettimeofday(&start, 0); + for(size_t i=0; i + +mvm::Key* mvm::Thread::threadKey = 0; + +void destr(gc *me, size_t sz) { + printf("Destroy %p\n", me); +} + +void trace(gc *me, size_t sz) { + // printf("Trace %p\n", me); +} + +void marker(void*) { + // printf("Marker...\n"); +} + +int main(int argc, char **argv) { + mvm::Thread::initialise(); + Collector::initialise(marker, 0); +#ifdef MULTIPLE_GC + mvm::Thread::get()->GC->destroy(); +#else + Collector::destroy(); +#endif + return 0; +} + + + + + + Added: vmkit/trunk/tools/testCollector/Makefile URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/tools/testCollector/Makefile?rev=52708&view=auto ============================================================================== --- vmkit/trunk/tools/testCollector/Makefile (added) +++ vmkit/trunk/tools/testCollector/Makefile Wed Jun 25 04:59:39 2008 @@ -0,0 +1,16 @@ +##===- tools/testCollector/Makefile ------------------------*- Makefile -*-===## +# +# The vmkit project +# +# This file is distributed under the University of Illinois Open Source +# License. See LICENSE.TXT for details. +# +##===----------------------------------------------------------------------===## +LEVEL = ../.. + +TOOLNAME = CollectorTest +USEDLIBS = Allocator GCMmap2 CommonThread + +include $(LEVEL)/Makefile.common + +CXX.Flags += -I$(LEVEL)/lib/Mvm/Allocator -I$(LEVEL)/lib/Mvm/GCMmap2 Propchange: vmkit/trunk/tools/testCollector/Makefile ------------------------------------------------------------------------------ svn:executable = * Added: vmkit/trunk/tools/vtoffset/Makefile URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/tools/vtoffset/Makefile?rev=52708&view=auto ============================================================================== --- vmkit/trunk/tools/vtoffset/Makefile (added) +++ vmkit/trunk/tools/vtoffset/Makefile Wed Jun 25 04:59:39 2008 @@ -0,0 +1,17 @@ +##===- tools/vtoffset/Makefile -------)---------------------*- Makefile -*-===## +# +# The vmkit project +# +# This file is distributed under the University of Illinois Open Source +# License. See LICENSE.TXT for details. +# +##===----------------------------------------------------------------------===## +LEVEL = ../.. + +include $(LEVEL)/Makefile.config + +TOOLNAME = vtoffset +USEDLIBS = Mvm CommonThread Allocator $(GCLIB) +LINK_COMPONENTS = engine + +include $(LEVEL)/Makefile.common Added: vmkit/trunk/tools/vtoffset/VTOffset.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/tools/vtoffset/VTOffset.cpp?rev=52708&view=auto ============================================================================== --- vmkit/trunk/tools/vtoffset/VTOffset.cpp (added) +++ vmkit/trunk/tools/vtoffset/VTOffset.cpp Wed Jun 25 04:59:39 2008 @@ -0,0 +1,97 @@ +//===-- VTOffset.cpp - Calculates compiler dependant VT offsets -----------===// +// +// The Micro Virtual Machine +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#include +#include +#include +#include + +#include "MvmGC.h" +#include "mvm/PrintBuffer.h" +#include "mvm/Threads/Thread.h" +#include "mvm/Sigsegv.h" + +class Toto : public mvm::Object { +public: + + static VirtualTable* VT; + virtual void print(mvm::PrintBuffer* buf) const { + printf("in print!\n"); + } + virtual int hashCode() { + printf("in hashcode!\n"); + return 1; + } + + virtual void tracer(size_t sz) { + printf("in tracer\n"); + } + + virtual void destroyer(size_t sz) { + printf("in destroy!\n"); + } + + ~Toto() { + printf("in delete Toto!\n"); + } +}; + +class Tata : public Toto { + public: + static VirtualTable* VT; + ~Tata() { + printf("in delete Tata!\n"); + } +}; + +VirtualTable* Toto::VT = 0; +typedef void (*toto_t)(Toto* t); + +VirtualTable* Tata::VT = 0; +typedef void (*tata_t)(Tata* t); + +int main(int argc, char **argv, char **envp) { + int base; + + mvm::Object::initialise(); + + /*void* handle = sys_dlopen("libLisp.so", RTLD_LAZY | RTLD_GLOBAL); + boot func = (boot)sys_dlsym(handle, "boot"); + func(argc, argv, envp);*/ + { + Toto t; + Toto::VT =((void**)(void*)&t)[0]; + toto_t* ptr = (toto_t*)Toto::VT; + printf("ptr[0] = %d, ptr[1]= %d, ptr[2] = %d ptr[3] = %d ptr[4] = %d ptr[5] = %d\n", ptr[0], ptr[1], ptr[2], ptr[3], ptr[4], ptr[5]); + ptr[0](&t); + //ptr[1](&t); // This should be ~gc + ptr[2](&t); + ptr[3](&t); + ptr[4](&t); + ptr[5](&t); +} +{ + Tata t; + Tata::VT =((void**)(void*)&t)[0]; + tata_t* ptr = (tata_t*)Tata::VT; + printf("ptr[0] = %d, ptr[1]= %d, ptr[2] = %d ptr[3] = %d ptr[4] = %d ptr[5] = %d\n", ptr[0], ptr[1], ptr[2], ptr[3], ptr[4], ptr[5]); + printf("Call des\n"); + ptr[0](&t); + printf("End\n"); + //ptr[1](&t); // This should be ~gc + ptr[2](&t); + ptr[3](&t); + ptr[4](&t); + ptr[5](&t); +} +Tata* t = gc_new(Tata)(); + mvm::Thread::exit(0); + + return 0; +} Removed: vmkit/trunk/vmkit-llvm-ppc.patch URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/vmkit-llvm-ppc.patch?rev=52707&view=auto ============================================================================== --- vmkit/trunk/vmkit-llvm-ppc.patch (original) +++ vmkit/trunk/vmkit-llvm-ppc.patch (removed) @@ -1,339 +0,0 @@ -Index: PPCInstrInfo.td -=================================================================== ---- PPCInstrInfo.td (revision 50006) -+++ PPCInstrInfo.td (working copy) -@@ -1212,6 +1212,8 @@ - (BL_ELF texternalsym:$dst)>; - - // Hi and Lo for Darwin Global Addresses. -+def : Pat<(PPChi texternalsym:$in, 0), (LIS texternalsym:$in)>; -+def : Pat<(PPClo texternalsym:$in, 0), (LI texternalsym:$in)>; - def : Pat<(PPChi tglobaladdr:$in, 0), (LIS tglobaladdr:$in)>; - def : Pat<(PPClo tglobaladdr:$in, 0), (LI tglobaladdr:$in)>; - def : Pat<(PPChi tconstpool:$in, 0), (LIS tconstpool:$in)>; -Index: PPCJITInfo.cpp -=================================================================== ---- PPCJITInfo.cpp (revision 50006) -+++ PPCJITInfo.cpp (working copy) -@@ -13,12 +13,16 @@ - - #define DEBUG_TYPE "jit" - #include "PPCJITInfo.h" -+#include "PPCRegisterInfo.h" - #include "PPCRelocations.h" - #include "PPCTargetMachine.h" - #include "llvm/Function.h" - #include "llvm/CodeGen/MachineCodeEmitter.h" - #include "llvm/Config/alloca.h" -+#include "llvm/ExecutionEngine/ExecutionEngine.h" - #include "llvm/Support/Debug.h" -+#include "llvm/Support/Dwarf.h" -+#include "llvm/Target/TargetOptions.h" - #include - using namespace llvm; - -@@ -53,24 +57,27 @@ - if (Offset >= -(1 << 23) && Offset < (1 << 23)) { // In range? - AtI[0] = BUILD_B(Offset, isCall); // b/bl target - } else if (!is64Bit) { -- AtI[0] = BUILD_LIS(12, To >> 16); // lis r12, hi16(address) -+ AtI[0] = BUILD_B(0, false); // thread safety - AtI[1] = BUILD_ORI(12, 12, To); // ori r12, r12, lo16(address) - AtI[2] = BUILD_MTCTR(12); // mtctr r12 - AtI[3] = BUILD_BCTR(isCall); // bctr/bctrl -+ AtI[0] = BUILD_LIS(12, To >> 16); // lis r12, hi16(address) - } else { -- AtI[0] = BUILD_LIS(12, To >> 48); // lis r12, hi16(address) -+ AtI[0] = BUILD_B(0, false); // thread safety - AtI[1] = BUILD_ORI(12, 12, To >> 32); // ori r12, r12, lo16(address) - AtI[2] = BUILD_SLDI(12, 12, 32); // sldi r12, r12, 32 - AtI[3] = BUILD_ORIS(12, 12, To >> 16); // oris r12, r12, hi16(address) - AtI[4] = BUILD_ORI(12, 12, To); // ori r12, r12, lo16(address) - AtI[5] = BUILD_MTCTR(12); // mtctr r12 - AtI[6] = BUILD_BCTR(isCall); // bctr/bctrl -+ AtI[0] = BUILD_LIS(12, To >> 48); // lis r12, hi16(address) - } - } - - extern "C" void PPC32CompilationCallback(); - extern "C" void PPC64CompilationCallback(); - -+ - #if (defined(__POWERPC__) || defined (__ppc__) || defined(_POWER)) && \ - !defined(__ppc64__) - // CompilationCallback stub - We can't use a C function with inline assembly in -@@ -144,6 +151,9 @@ - // it, because we the prolog/epilog inserted by GCC won't work for us. Instead, - // write our own wrapper, which does things our way, so we have complete control - // over register saving and restoring. -+ -+# define CFI(x) x -+ - asm( - ".text\n" - ".align 2\n" -@@ -156,19 +166,29 @@ - // FIXME Layout - // 8 double registers - 64 bytes - // 8 int registers - 32 bytes -+ CFI(".cfi_startproc\n") -+ "stwu 1, -104(1)\n" -+ CFI(".cfi_adjust_cfa_offset 104\n") - "mflr 0\n" -- "stw 0, 4(1)\n" -- "stwu 1, -104(1)\n" -+ "stw 0, 108(1)\n" -+ CFI(".cfi_offset lr, 4\n") - // Save all int arg registers -- "stw 10, 100(1)\n" "stw 9, 96(1)\n" -- "stw 8, 92(1)\n" "stw 7, 88(1)\n" -- "stw 6, 84(1)\n" "stw 5, 80(1)\n" -- "stw 4, 76(1)\n" "stw 3, 72(1)\n" -+ "stw 10, 100(1)\n" -+ "stw 9, 96(1)\n" -+ "stw 8, 92(1)\n" -+ "stw 7, 88(1)\n" -+ "stw 6, 84(1)\n" -+ "stw 5, 80(1)\n" -+ "stw 4, 76(1)\n" -+ "stw 3, 72(1)\n" - // Save all call-clobbered FP regs. - "stfd 8, 64(1)\n" -- "stfd 7, 56(1)\n" "stfd 6, 48(1)\n" -- "stfd 5, 40(1)\n" "stfd 4, 32(1)\n" -- "stfd 3, 24(1)\n" "stfd 2, 16(1)\n" -+ "stfd 7, 56(1)\n" -+ "stfd 6, 48(1)\n" -+ "stfd 5, 40(1)\n" -+ "stfd 4, 32(1)\n" -+ "stfd 3, 24(1)\n" -+ "stfd 2, 16(1)\n" - "stfd 1, 8(1)\n" - // Arguments to Compilation Callback: - // r3 - our lr (address of the call instruction in stub plus 4) -@@ -181,21 +201,29 @@ - "bl PPCCompilationCallbackC\n" - "mtctr 3\n" - // Restore all int arg registers -- "lwz 10, 100(1)\n" "lwz 9, 96(1)\n" -- "lwz 8, 92(1)\n" "lwz 7, 88(1)\n" -- "lwz 6, 84(1)\n" "lwz 5, 80(1)\n" -- "lwz 4, 76(1)\n" "lwz 3, 72(1)\n" -+ "lwz 10, 100(1)\n" -+ "lwz 9, 96(1)\n" -+ "lwz 8, 92(1)\n" -+ "lwz 7, 88(1)\n" -+ "lwz 6, 84(1)\n" -+ "lwz 5, 80(1)\n" -+ "lwz 4, 76(1)\n" -+ "lwz 3, 72(1)\n" - // Restore all FP arg registers - "lfd 8, 64(1)\n" -- "lfd 7, 56(1)\n" "lfd 6, 48(1)\n" -- "lfd 5, 40(1)\n" "lfd 4, 32(1)\n" -- "lfd 3, 24(1)\n" "lfd 2, 16(1)\n" -+ "lfd 7, 56(1)\n" -+ "lfd 6, 48(1)\n" -+ "lfd 5, 40(1)\n" -+ "lfd 4, 32(1)\n" -+ "lfd 3, 24(1)\n" -+ "lfd 2, 16(1)\n" - "lfd 1, 8(1)\n" - // Pop 3 frames off the stack and branch to target - "lwz 1, 104(1)\n" - "lwz 0, 4(1)\n" - "mtlr 0\n" - "bctr\n" -+ CFI(".cfi_endproc\n") - ); - #else - void PPC32CompilationCallback() { -@@ -325,6 +353,31 @@ - return is64Bit ? PPC64CompilationCallback : PPC32CompilationCallback; - } - -+static const char* GetCommonFrame32() { -+ /* -+ // Size of common frame -+ MCE.emitWordBE(16); -+ // Common frame -+ MCE.emitWordBE(0); -+ MCE.emitByte(1); -+ MCE.emitByte('z'); -+ MCE.emitByte('R'); -+ MCE.emitByte(0); -+ MCE.emitByte(1); -+ MCE.emitByte(-4 & 0x7f); -+ MCE.emitByte(0x41); -+ MCE.emitByte(1); -+ MCE.emitByte(16); -+ MCE.emitByte(0xc); -+ MCE.emitByte(1); -+ MCE.emitByte(0);*/ -+ static const char CF[] = { -+ 0, 0, 0, 16, 0, 0, 0, 0, 1, 'z', 'R', 0, 1, -4 & 0x7f, -+ 0x41, 1, 16, 0xc, 1, 0 -+ }; -+ return CF; -+} -+ - #if (defined(__POWERPC__) || defined (__ppc__) || defined(_POWER)) && \ - defined(__APPLE__) - extern "C" void sys_icache_invalidate(const void *Addr, size_t len); -@@ -358,21 +411,26 @@ - SyncICache((void*)Addr, 7*4); - return MCE.finishFunctionStub(F); - } -- -- MCE.startFunctionStub(F, 10*4); -+ -+ if (ExceptionHandling && !is64Bit) { -+ MCE.startFunctionStub(F, 10*4 + 44); -+ } else { -+ MCE.startFunctionStub(F, 10*4); -+ } -+ - intptr_t Addr = (intptr_t)MCE.getCurrentPCValue(); - if (is64Bit) { -+ MCE.emitWordBE(0x7d6802a6); // mflr r11 -+ MCE.emitWordBE(0xf9610010); // std r11, 16(r1) - MCE.emitWordBE(0xf821ffb1); // stdu r1,-80(r1) -+ } else if (TM.getSubtargetImpl()->isMachoABI()){ - MCE.emitWordBE(0x7d6802a6); // mflr r11 -- MCE.emitWordBE(0xf9610060); // std r11, 96(r1) -- } else if (TM.getSubtargetImpl()->isMachoABI()){ -+ MCE.emitWordBE(0x91610008); // stw r11, 8(r1) - MCE.emitWordBE(0x9421ffe0); // stwu r1,-32(r1) -+ } else { - MCE.emitWordBE(0x7d6802a6); // mflr r11 -- MCE.emitWordBE(0x91610028); // stw r11, 40(r1) -- } else { -+ MCE.emitWordBE(0x91610004); // stw r11, 4(r1) - MCE.emitWordBE(0x9421ffe0); // stwu r1,-32(r1) -- MCE.emitWordBE(0x7d6802a6); // mflr r11 -- MCE.emitWordBE(0x91610024); // stw r11, 36(r1) - } - intptr_t BranchAddr = (intptr_t)MCE.getCurrentPCValue(); - MCE.emitWordBE(0); -@@ -384,6 +442,42 @@ - MCE.emitWordBE(0); - EmitBranchToAt(BranchAddr, (intptr_t)Fn, true, is64Bit); - SyncICache((void*)Addr, 10*4); -+ intptr_t EndAddr = (intptr_t)MCE.getCurrentPCValue(); -+ -+ if (ExceptionHandling && !is64Bit) { -+ // Size of Eh section -+ MCE.emitWordBE(32); -+ // Eh section -+ MCE.emitWordBE(MCE.getCurrentPCValue() - (intptr_t)GetCommonFrame32()); -+ MCE.emitWordBE(Addr - MCE.getCurrentPCValue()); -+ MCE.emitWordBE(EndAddr - Addr); -+ MCE.emitByte(0); -+ MCE.emitByte(dwarf::DW_CFA_advance_loc4); -+ MCE.emitWordBE(8); -+ MCE.emitByte(dwarf::DW_CFA_def_cfa_offset); -+ MCE.emitByte(32); -+ MCE.emitByte(dwarf::DW_CFA_offset_extended_sf); -+ MCE.emitByte(TM.getRegisterInfo()->getDwarfRegNum(PPC::LR, true)); -+ if (TM.getSubtargetImpl()->isMachoABI()){ -+ MCE.emitByte(-2 & 0x7f); -+ } else { -+ MCE.emitByte(-1 & 0x7f); -+ } -+ MCE.emitByte(dwarf::DW_CFA_advance_loc4); -+ MCE.emitWordBE(4); -+ MCE.emitByte(dwarf::DW_CFA_def_cfa_register); -+ MCE.emitByte(1); -+ // Alignment -+ MCE.emitByte(0); -+ MCE.emitByte(0); -+ -+ // Two zero for the unwind runtime -+ MCE.emitWordBE(0); -+ MCE.emitWordBE(0); -+ -+ SyncICache((void*)EndAddr, 44); -+ ExecutionEngine::RegisterTable((void*)EndAddr); -+ } - return MCE.finishFunctionStub(F); - } - -Index: PPCISelLowering.cpp -=================================================================== ---- PPCISelLowering.cpp (revision 50006) -+++ PPCISelLowering.cpp (working copy) -@@ -175,10 +175,12 @@ - // We want to legalize GlobalAddress and ConstantPool nodes into the - // appropriate instructions to materialize the address. - setOperationAction(ISD::GlobalAddress, MVT::i32, Custom); -+ setOperationAction(ISD::ExternalSymbol , MVT::i32 , Custom); - setOperationAction(ISD::GlobalTLSAddress, MVT::i32, Custom); - setOperationAction(ISD::ConstantPool, MVT::i32, Custom); - setOperationAction(ISD::JumpTable, MVT::i32, Custom); - setOperationAction(ISD::GlobalAddress, MVT::i64, Custom); -+ setOperationAction(ISD::ExternalSymbol , MVT::i64 , Custom); - setOperationAction(ISD::GlobalTLSAddress, MVT::i64, Custom); - setOperationAction(ISD::ConstantPool, MVT::i64, Custom); - setOperationAction(ISD::JumpTable, MVT::i64, Custom); -@@ -745,6 +747,36 @@ - return isIntS16Immediate(Op.Val, Imm); - } - -+ static SDOperand LowerExternalSymbol(SDOperand Op, SelectionDAG &DAG) { -+ MVT::ValueType PtrVT = Op.getValueType(); -+ ExternalSymbolSDNode *GSDB = dyn_cast(Op); -+ SDOperand GA = DAG.getTargetExternalSymbol(GSDB->getSymbol(), PtrVT); -+ SDOperand Zero = DAG.getConstant(0, PtrVT); -+ -+ const TargetMachine &TM = DAG.getTarget(); -+ -+ SDOperand Hi = DAG.getNode(PPCISD::Hi, PtrVT, GA, Zero); -+ SDOperand Lo = DAG.getNode(PPCISD::Lo, PtrVT, GA, Zero); -+ -+ // If this is a non-darwin platform, we don't support non-static relo models -+ // yet. -+ if (TM.getRelocationModel() == Reloc::Static || -+ !TM.getSubtarget().isDarwin()) { -+ // Generate non-pic code that has direct accesses to globals. -+ // The address of the global is just (hi(&g)+lo(&g)). -+ return DAG.getNode(ISD::ADD, PtrVT, Hi, Lo); -+ } -+ -+ if (TM.getRelocationModel() == Reloc::PIC_) { -+ // With PIC, the first instruction is actually "GR+hi(&G)". -+ Hi = DAG.getNode(ISD::ADD, PtrVT, -+ DAG.getNode(PPCISD::GlobalBaseReg, PtrVT), Hi); -+ } -+ -+ Lo = DAG.getNode(ISD::ADD, PtrVT, Hi, Lo); -+ -+ return Lo; -+ } - - /// SelectAddressRegReg - Given the specified addressed, check to see if it - /// can be represented as an indexed [r+r] operation. Returns false if it -@@ -2130,11 +2162,11 @@ - // 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. -- if (GlobalAddressSDNode *G = dyn_cast(Callee)) -- Callee = DAG.getTargetGlobalAddress(G->getGlobal(), Callee.getValueType()); -- else if (ExternalSymbolSDNode *S = dyn_cast(Callee)) -- Callee = DAG.getTargetExternalSymbol(S->getSymbol(), Callee.getValueType()); -- else if (SDNode *Dest = isBLACompatibleAddress(Callee, DAG)) -+ //if (GlobalAddressSDNode *G = dyn_cast(Callee)) -+ // Callee = DAG.getTargetGlobalAddress(G->getGlobal(), Callee.getValueType()); -+ //if (ExternalSymbolSDNode *S = dyn_cast(Callee)) -+ // Callee = DAG.getTargetExternalSymbol(S->getSymbol(), Callee.getValueType()); -+ if (SDNode *Dest = isBLACompatibleAddress(Callee, DAG)) - // If this is an absolute destination address, use the munged value. - Callee = SDOperand(Dest, 0); - else { -@@ -3506,6 +3538,7 @@ - default: assert(0 && "Wasn't expecting to be able to lower this!"); - case ISD::ConstantPool: return LowerConstantPool(Op, DAG); - case ISD::GlobalAddress: return LowerGlobalAddress(Op, DAG); -+ case ISD::ExternalSymbol: return LowerExternalSymbol(Op, DAG); - case ISD::GlobalTLSAddress: return LowerGlobalTLSAddress(Op, DAG); - case ISD::JumpTable: return LowerJumpTable(Op, DAG); - case ISD::SETCC: return LowerSETCC(Op, DAG); Removed: vmkit/trunk/vmkit-llvm-x86.patch URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/vmkit-llvm-x86.patch?rev=52707&view=auto ============================================================================== --- vmkit/trunk/vmkit-llvm-x86.patch (original) +++ vmkit/trunk/vmkit-llvm-x86.patch (removed) @@ -1,37 +0,0 @@ -Index: X86Subtarget.cpp -=================================================================== ---- X86Subtarget.cpp (revision 50008) -+++ X86Subtarget.cpp (working copy) -@@ -127,7 +127,7 @@ - return; - - X86::GetCpuIDAndInfo(0x1, &EAX, &EBX, &ECX, &EDX); -- -+#if 0 - if ((EDX >> 23) & 0x1) X86SSELevel = MMX; - if ((EDX >> 25) & 0x1) X86SSELevel = SSE1; - if ((EDX >> 26) & 0x1) X86SSELevel = SSE2; -@@ -135,7 +135,9 @@ - if ((ECX >> 9) & 0x1) X86SSELevel = SSSE3; - if ((ECX >> 19) & 0x1) X86SSELevel = SSE41; - if ((ECX >> 20) & 0x1) X86SSELevel = SSE42; -- -+#else -+ X86SSELevel = MMX; -+#endif - if (memcmp(text.c, "GenuineIntel", 12) == 0 || - memcmp(text.c, "AuthenticAMD", 12) == 0) { - X86::GetCpuIDAndInfo(0x80000001, &EAX, &EBX, &ECX, &EDX); -Index: X86JITInfo.cpp -=================================================================== ---- X86JITInfo.cpp (revision 50008) -+++ X86JITInfo.cpp (working copy) -@@ -60,7 +60,7 @@ - // FIXME: Disable this until we really want to use it. Also, we will - // need to add some workarounds for compilers, which support - // only subset of these directives. --# define CFI(x) -+# define CFI(x) x - #endif - - // Provide a wrapper for X86CompilationCallback2 that saves non-traditional From nicolas.geoffray at lip6.fr Wed Jun 25 05:16:23 2008 From: nicolas.geoffray at lip6.fr (Nicolas Geoffray) Date: Wed, 25 Jun 2008 10:16:23 -0000 Subject: [llvm-commits] [vmkit] r52709 - /vmkit/trunk/lib/N3/VMCore/PNetLib.cpp Message-ID: <200806251016.m5PAGSVH004856@zion.cs.uiuc.edu> Author: geoffray Date: Wed Jun 25 05:16:04 2008 New Revision: 52709 URL: http://llvm.org/viewvc/llvm-project?rev=52709&view=rev Log: Don't declare external boehm symbols when using the gc boehm. Modified: vmkit/trunk/lib/N3/VMCore/PNetLib.cpp Modified: vmkit/trunk/lib/N3/VMCore/PNetLib.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/N3/VMCore/PNetLib.cpp?rev=52709&r1=52708&r2=52709&view=diff ============================================================================== --- vmkit/trunk/lib/N3/VMCore/PNetLib.cpp (original) +++ vmkit/trunk/lib/N3/VMCore/PNetLib.cpp Wed Jun 25 05:16:04 2008 @@ -65,9 +65,10 @@ extern sint32 ILUnicodeStringCompareIgnoreCase(void*, void*, sint32); extern sint32 ILUnicodeStringCompareNoIgnoreCase(void*, void*, sint32); +#include "mvm/Config/config.h" // PNET wants this void *GC_run_thread(void *(*thread_func)(void *), void *arg){ return 0; } -#ifndef USE_GC_BOEHM +#if not(USE_GC_BOEHM) int GC_invoke_finalizers (void) { return 0; } int GC_should_invoke_finalizers (void) { return 0; } void GC_register_finalizer_no_order(void*, void (*)(void*, void*), void*, void (**)(void*, void*), void**) { return; } @@ -88,7 +89,7 @@ void (*GC_finalizer_notifier)(void); int GC_java_finalization; int GC_finalize_on_demand; -void GC_set_max_heap_size(GC_word) {} +void GC_set_max_heap_size(size_t) {} void* GC_malloc_atomic(size_t) { return 0; } #endif From nicolas.geoffray at lip6.fr Wed Jun 25 05:28:22 2008 From: nicolas.geoffray at lip6.fr (Nicolas Geoffray) Date: Wed, 25 Jun 2008 10:28:22 -0000 Subject: [llvm-commits] [vmkit] r52710 - /vmkit/trunk/lib/Mvm/Makefile Message-ID: <200806251028.m5PASNSu005237@zion.cs.uiuc.edu> Author: geoffray Date: Wed Jun 25 05:28:15 2008 New Revision: 52710 URL: http://llvm.org/viewvc/llvm-project?rev=52710&view=rev Log: Only compile the desired GC. Modified: vmkit/trunk/lib/Mvm/Makefile Modified: vmkit/trunk/lib/Mvm/Makefile URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/Mvm/Makefile?rev=52710&r1=52709&r2=52710&view=diff ============================================================================== --- vmkit/trunk/lib/Mvm/Makefile (original) +++ vmkit/trunk/lib/Mvm/Makefile Wed Jun 25 05:28:15 2008 @@ -8,7 +8,9 @@ ##===----------------------------------------------------------------------===## LEVEL = ../.. -PARALLEL_DIRS = Allocator BoehmGC CommonThread GCMmap2 +include $(LEVEL)/Makefile.config + +PARALLEL_DIRS = Allocator CommonThread $(GCLIB) LIBRARYNAME = Mvm include $(LEVEL)/Makefile.common From isanbard at gmail.com Wed Jun 25 05:41:33 2008 From: isanbard at gmail.com (Bill Wendling) Date: Wed, 25 Jun 2008 10:41:33 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r52711 - /llvm-gcc-4.2/trunk/gcc/llvm-debug.cpp Message-ID: <200806251041.m5PAfZan005619@zion.cs.uiuc.edu> Author: void Date: Wed Jun 25 05:41:27 2008 New Revision: 52711 URL: http://llvm.org/viewvc/llvm-project?rev=52711&view=rev Log: Convert: >> ATOMIC_LCS => ATOMIC_CMP_SWAP >> ATOMIC_LAS => ATOMIC_LOAD_ADD >> ATOMIC_LSS => ATOMIC_LOAD_SUB 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=52711&r1=52710&r2=52711&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/llvm-debug.cpp (original) +++ llvm-gcc-4.2/trunk/gcc/llvm-debug.cpp Wed Jun 25 05:41:27 2008 @@ -39,8 +39,6 @@ #include "llvm/ADT/SmallVector.h" #include "llvm/CodeGen/MachineModuleInfo.h" -#include - extern "C" { #include "langhooks.h" #include "toplev.h" From nicolas.geoffray at lip6.fr Wed Jun 25 06:02:01 2008 From: nicolas.geoffray at lip6.fr (Nicolas Geoffray) Date: Wed, 25 Jun 2008 11:02:01 -0000 Subject: [llvm-commits] [vmkit] r52712 - in /vmkit/trunk/lib/JnJVM/VMCore: JavaConstantPool.cpp Jnjvm.cpp Message-ID: <200806251102.m5PB23OT006245@zion.cs.uiuc.edu> Author: geoffray Date: Wed Jun 25 06:01:56 2008 New Revision: 52712 URL: http://llvm.org/viewvc/llvm-project?rev=52712&view=rev Log: Define JNJVM_LOAD debug macro. Modified: vmkit/trunk/lib/JnJVM/VMCore/JavaConstantPool.cpp vmkit/trunk/lib/JnJVM/VMCore/Jnjvm.cpp Modified: vmkit/trunk/lib/JnJVM/VMCore/JavaConstantPool.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/VMCore/JavaConstantPool.cpp?rev=52712&r1=52711&r2=52712&view=diff ============================================================================== --- vmkit/trunk/lib/JnJVM/VMCore/JavaConstantPool.cpp (original) +++ vmkit/trunk/lib/JnJVM/VMCore/JavaConstantPool.cpp Wed Jun 25 06:01:56 2008 @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +#define JNJVM_LOAD 0 + #include #include Modified: vmkit/trunk/lib/JnJVM/VMCore/Jnjvm.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/VMCore/Jnjvm.cpp?rev=52712&r1=52711&r2=52712&view=diff ============================================================================== --- vmkit/trunk/lib/JnJVM/VMCore/Jnjvm.cpp (original) +++ vmkit/trunk/lib/JnJVM/VMCore/Jnjvm.cpp Wed Jun 25 06:01:56 2008 @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +#define JNJVM_LOAD 0 + #include #include #include From nicolas.geoffray at lip6.fr Wed Jun 25 06:06:51 2008 From: nicolas.geoffray at lip6.fr (Nicolas Geoffray) Date: Wed, 25 Jun 2008 11:06:51 -0000 Subject: [llvm-commits] [vmkit] r52713 - /vmkit/trunk/README.txt Message-ID: <200806251106.m5PB6qDI006469@zion.cs.uiuc.edu> Author: geoffray Date: Wed Jun 25 06:06:49 2008 New Revision: 52713 URL: http://llvm.org/viewvc/llvm-project?rev=52713&view=rev Log: Complete note. Modified: vmkit/trunk/README.txt Modified: vmkit/trunk/README.txt URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/README.txt?rev=52713&r1=52712&r2=52713&view=diff ============================================================================== --- vmkit/trunk/README.txt (original) +++ vmkit/trunk/README.txt Wed Jun 25 06:06:49 2008 @@ -14,10 +14,13 @@ JnJVM and N3 use GCC's unwinding library (libgcc_s.so). -There are mainly two options in the ./configure script +These are the options you should pass to the ./configure script +--with-llvmsrc: the source directory of LLVM +--with-llvmobj: the object directory of LLVM --with-gnu-classpath-local-prefix: the local build of GNU classpath --with-pnet-local-prefix: the local build of PNET ---with-llvmsrc: the local build of LLVM + +There's also: --with-gc: user either boehm or single-mmap Running make on the root tree will produce two "tools": From nicolas.geoffray at lip6.fr Wed Jun 25 06:12:38 2008 From: nicolas.geoffray at lip6.fr (Nicolas Geoffray) Date: Wed, 25 Jun 2008 11:12:38 -0000 Subject: [llvm-commits] [vmkit] r52714 - /vmkit/trunk/lib/JnJVM/VMCore/JavaConstantPool.cpp Message-ID: <200806251112.m5PBCdkO006722@zion.cs.uiuc.edu> Author: geoffray Date: Wed Jun 25 06:12:33 2008 New Revision: 52714 URL: http://llvm.org/viewvc/llvm-project?rev=52714&view=rev Log: Remove some warnings. Modified: vmkit/trunk/lib/JnJVM/VMCore/JavaConstantPool.cpp Modified: vmkit/trunk/lib/JnJVM/VMCore/JavaConstantPool.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/VMCore/JavaConstantPool.cpp?rev=52714&r1=52713&r2=52714&view=diff ============================================================================== --- vmkit/trunk/lib/JnJVM/VMCore/JavaConstantPool.cpp (original) +++ vmkit/trunk/lib/JnJVM/VMCore/JavaConstantPool.cpp Wed Jun 25 06:12:33 2008 @@ -76,7 +76,7 @@ void** ctpRes, uint8* ctpType) { uint32 val = reader.readU4(); ctpDef[e] = val; - PRINT_DEBUG(JNJVM_LOAD, 3, COLOR_NORMAL, "; [%5d] \tfloat: %p\n", e, + PRINT_DEBUG(JNJVM_LOAD, 3, COLOR_NORMAL, "; [%5d] \tfloat: %d\n", e, val); return 1; } @@ -181,7 +181,7 @@ ctpDef[e + 1] = reader.readU4(); ctpDef[e] = reader.readU4(); ctpType[e] = ConstantLong; - PRINT_DEBUG(JNJVM_LOAD, 3, COLOR_NORMAL, "; [%5d] \%d %d\n", e, + PRINT_DEBUG(JNJVM_LOAD, 3, COLOR_NORMAL, "; [%5d] %d %d\n", e, ctpDef[e], ctpDef[e + 1]); return 2; } @@ -192,7 +192,7 @@ ctpDef[e + 1] = reader.readU4(); ctpDef[e] = reader.readU4(); ctpType[e] = ConstantDouble; - PRINT_DEBUG(JNJVM_LOAD, 3, COLOR_NORMAL, "; [%5d] \%d %d\n", e, + PRINT_DEBUG(JNJVM_LOAD, 3, COLOR_NORMAL, "; [%5d] %d %d\n", e, ctpDef[e], ctpDef[e + 1]); return 2; } From nicolas.geoffray at lip6.fr Wed Jun 25 07:06:16 2008 From: nicolas.geoffray at lip6.fr (Nicolas Geoffray) Date: Wed, 25 Jun 2008 12:06:16 -0000 Subject: [llvm-commits] [vmkit] r52715 - in /vmkit/trunk: ./ autoconf/ include/ lib/ lib/JnJVM/Classpath/ lib/JnJVM/VMCore/ lib/Mvm/ lib/N3/VMCore/ tools/ Message-ID: <200806251206.m5PC6HSO008382@zion.cs.uiuc.edu> Author: geoffray Date: Wed Jun 25 07:06:15 2008 New Revision: 52715 URL: http://llvm.org/viewvc/llvm-project?rev=52715&view=rev Log: Remove warnings on macro and pointer-to-function casts. Modified: vmkit/trunk/Makefile.config.in vmkit/trunk/autoconf/configure.ac vmkit/trunk/configure vmkit/trunk/include/debug.h vmkit/trunk/lib/JnJVM/Classpath/ClasspathVMRuntime.cpp.inc vmkit/trunk/lib/JnJVM/VMCore/JavaJIT.cpp vmkit/trunk/lib/JnJVM/VMCore/JavaJITOpcodes.cpp vmkit/trunk/lib/JnJVM/VMCore/JavaTypes.cpp vmkit/trunk/lib/JnJVM/VMCore/JavaTypes.h vmkit/trunk/lib/JnJVM/VMCore/Jnjvm.cpp vmkit/trunk/lib/JnJVM/VMCore/JnjvmModule.cpp vmkit/trunk/lib/JnJVM/VMCore/JnjvmModuleProvider.cpp vmkit/trunk/lib/Makefile vmkit/trunk/lib/Mvm/CommandLine.cpp vmkit/trunk/lib/N3/VMCore/CLIJit.cpp vmkit/trunk/lib/N3/VMCore/Opcodes.cpp vmkit/trunk/lib/N3/VMCore/PNetLib.cpp vmkit/trunk/lib/N3/VMCore/VMClass.cpp vmkit/trunk/tools/Makefile Modified: vmkit/trunk/Makefile.config.in URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/Makefile.config.in?rev=52715&r1=52714&r2=52715&view=diff ============================================================================== --- vmkit/trunk/Makefile.config.in (original) +++ vmkit/trunk/Makefile.config.in Wed Jun 25 07:06:15 2008 @@ -1 +1,3 @@ GCLIB = @GC_LIBS@ +WITH_N3 = @WITH_N3@ +WITH_JNJVM = @WITH_JNJVM@ Modified: vmkit/trunk/autoconf/configure.ac URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/autoconf/configure.ac?rev=52715&r1=52714&r2=52715&view=diff ============================================================================== --- vmkit/trunk/autoconf/configure.ac (original) +++ vmkit/trunk/autoconf/configure.ac Wed Jun 25 07:06:15 2008 @@ -256,16 +256,22 @@ [[gnuclasspathinstallationprefix=/usr/local/classpath]] ) -if test "x${gnuclasspathlocalprefix}" = x; then +WITH_JNJVM=0; + +if test "x${gnuclasspathinstallationprefix}" != x; then echo Using ${gnuclasspathinstallationprefix} as GNU CLASSPATH installation prefix; classpathglibj=${gnuclasspathinstallationprefix}/share/classpath/glibj.zip; classpathlibs=${gnuclasspathinstallationprefix}/lib/classpath/; classpathinclude=${gnuclasspathlocalprefix}/include; -else + WITH_JNJVM=1; +fi + +if test "x${gnuclasspathlocalprefix}" != x; then echo Using ${gnuclasspathlocalprefix} as GNU CLASSPATH local prefix; classpathglibj=${gnuclasspathlocalprefix}/lib/; classpathlibs=${gnuclasspathlocalprefix}/lib/; classpathinclude=${gnuclasspathlocalprefix}/include; + WITH_JNJVM=1; fi @@ -273,6 +279,7 @@ AC_SUBST([classpathlibs]) AC_SUBST([classpathinclude]) AC_SUBST([gnuclasspathversion]) +AC_SUBST([WITH_JNJVM]) dnl ************************************************************************** dnl Local PNet directory @@ -286,13 +293,15 @@ ]] ) -AM_CONDITIONAL([WITH_N3], [test "x$pnetlocalprefix" != "x"]) if test "x$pnetlocalprefix" != x; then echo Using ${pnetlocalprefix} as PNET local prefix; - AC_DEFINE([WITH_N3], [1], [Compiling N3]) + WITH_N3=1; +else + WITH_N3=0; fi AC_SUBST([pnetlocalprefix]) +AC_SUBST([WITH_N3]) dnl===-----------------------------------------------------------------------=== dnl=== Modified: vmkit/trunk/configure URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/configure?rev=52715&r1=52714&r2=52715&view=diff ============================================================================== --- vmkit/trunk/configure (original) +++ vmkit/trunk/configure Wed Jun 25 07:06:15 2008 @@ -695,9 +695,9 @@ classpathlibs classpathinclude gnuclasspathversion -WITH_N3_TRUE -WITH_N3_FALSE +WITH_JNJVM pnetlocalprefix +WITH_N3 CXX CXXFLAGS ac_ct_CXX @@ -3988,16 +3988,22 @@ fi -if test "x${gnuclasspathlocalprefix}" = x; then +WITH_JNJVM=0; + +if test "x${gnuclasspathinstallationprefix}" != x; then echo Using ${gnuclasspathinstallationprefix} as GNU CLASSPATH installation prefix; classpathglibj=${gnuclasspathinstallationprefix}/share/classpath/glibj.zip; classpathlibs=${gnuclasspathinstallationprefix}/lib/classpath/; classpathinclude=${gnuclasspathlocalprefix}/include; -else + WITH_JNJVM=1; +fi + +if test "x${gnuclasspathlocalprefix}" != x; then echo Using ${gnuclasspathlocalprefix} as GNU CLASSPATH local prefix; classpathglibj=${gnuclasspathlocalprefix}/lib/; classpathlibs=${gnuclasspathlocalprefix}/lib/; classpathinclude=${gnuclasspathlocalprefix}/include; + WITH_JNJVM=1; fi @@ -4007,6 +4013,7 @@ + # Check whether --with-pnet-local-prefix was given. if test "${with_pnet_local_prefix+set}" = set; then withval=$with_pnet_local_prefix; pnetlocalprefix=$withval @@ -4018,28 +4025,17 @@ fi - - -if test "x$pnetlocalprefix" != "x"; then - WITH_N3_TRUE= - WITH_N3_FALSE='#' -else - WITH_N3_TRUE='#' - WITH_N3_FALSE= -fi - if test "x$pnetlocalprefix" != x; then echo Using ${pnetlocalprefix} as PNET local prefix; - -cat >>confdefs.h <<\_ACEOF -#define WITH_N3 1 -_ACEOF - + WITH_N3=1; +else + WITH_N3=0; fi + ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' @@ -7220,13 +7216,6 @@ Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi -if test -z "${WITH_N3_TRUE}" && test -z "${WITH_N3_FALSE}"; then - { { echo "$as_me:$LINENO: error: conditional \"WITH_N3\" was never defined. -Usually this means the macro was only invoked conditionally." >&5 -echo "$as_me: error: conditional \"WITH_N3\" was never defined. -Usually this means the macro was only invoked conditionally." >&2;} - { (exit 1); exit 1; }; } -fi : ${CONFIG_STATUS=./config.status} ac_clean_files_save=$ac_clean_files @@ -7839,9 +7828,9 @@ classpathlibs!$classpathlibs$ac_delim classpathinclude!$classpathinclude$ac_delim gnuclasspathversion!$gnuclasspathversion$ac_delim -WITH_N3_TRUE!$WITH_N3_TRUE$ac_delim -WITH_N3_FALSE!$WITH_N3_FALSE$ac_delim +WITH_JNJVM!$WITH_JNJVM$ac_delim pnetlocalprefix!$pnetlocalprefix$ac_delim +WITH_N3!$WITH_N3$ac_delim CXX!$CXX$ac_delim CXXFLAGS!$CXXFLAGS$ac_delim ac_ct_CXX!$ac_ct_CXX$ac_delim Modified: vmkit/trunk/include/debug.h URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/include/debug.h?rev=52715&r1=52714&r2=52715&view=diff ============================================================================== --- vmkit/trunk/include/debug.h (original) +++ vmkit/trunk/include/debug.h Wed Jun 25 07:06:15 2008 @@ -63,7 +63,7 @@ #endif #else -#define PRINT_DEBUG(symb, level, color, fmt, args...) +#define PRINT_DEBUG(symb, level, color, fmt, args...) do {} while(0); #endif Modified: vmkit/trunk/lib/JnJVM/Classpath/ClasspathVMRuntime.cpp.inc URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/Classpath/ClasspathVMRuntime.cpp.inc?rev=52715&r1=52714&r2=52715&view=diff ============================================================================== --- vmkit/trunk/lib/JnJVM/Classpath/ClasspathVMRuntime.cpp.inc (original) +++ vmkit/trunk/lib/JnJVM/Classpath/ClasspathVMRuntime.cpp.inc Wed Jun 25 07:06:15 2008 @@ -78,7 +78,7 @@ void* res = dlopen(buf, RTLD_LAZY | RTLD_LOCAL); if (res != 0) { vm->nativeLibs.push_back(res); - onLoad_t onLoad = (onLoad_t)dlsym(res, "JNI_OnLoad"); + onLoad_t onLoad = (onLoad_t)(intptr_t)dlsym(res, "JNI_OnLoad"); if (onLoad) onLoad(&vm->javavmEnv, 0); return 1; } else { Modified: vmkit/trunk/lib/JnJVM/VMCore/JavaJIT.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/VMCore/JavaJIT.cpp?rev=52715&r1=52714&r2=52715&view=diff ============================================================================== --- vmkit/trunk/lib/JnJVM/VMCore/JavaJIT.cpp (original) +++ vmkit/trunk/lib/JnJVM/VMCore/JavaJIT.cpp Wed Jun 25 07:06:15 2008 @@ -833,24 +833,6 @@ func->setLinkage(GlobalValue::ExternalLinkage); - - if (compilingMethod->name == - compilingClass->isolate->asciizConstructUTF8("main")) { - llvmFunction->print(llvm::cout); - printf("\n"); - void* res = mvm::jit::executionEngine->getPointerToGlobal(llvmFunction); - void* base = res; - while (base < (void*)((char*)res + 100)) { - printf("%08x\t", (unsigned)base); - int n= mvm::jit::disassemble((unsigned int *)base); - printf("\n"); - base= ((void *)((char *)base + n)); - } - printf("\n"); - fflush(stdout); - } - - PRINT_DEBUG(JNJVM_COMPILE, 1, COLOR_NORMAL, "--> end compiling %s\n", compilingMethod->printString()); Modified: vmkit/trunk/lib/JnJVM/VMCore/JavaJITOpcodes.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/VMCore/JavaJITOpcodes.cpp?rev=52715&r1=52714&r2=52715&view=diff ============================================================================== --- vmkit/trunk/lib/JnJVM/VMCore/JavaJITOpcodes.cpp (original) +++ vmkit/trunk/lib/JnJVM/VMCore/JavaJITOpcodes.cpp Wed Jun 25 07:06:15 2008 @@ -106,9 +106,9 @@ PRINT_DEBUG(JNJVM_COMPILE, 1, COLOR_NORMAL, "\t[at %5d] %-5d ", i, bytecodes[i]); - PRINT_DEBUG(JNJVM_COMPILE, 1, LIGHT_BLUE, "compiling "); - PRINT_DEBUG(JNJVM_COMPILE, 1, LIGHT_CYAN, OpcodeNames[bytecodes[i]]); - PRINT_DEBUG(JNJVM_COMPILE, 1, LIGHT_BLUE, "\n"); + PRINT_DEBUG(JNJVM_COMPILE, 1, LIGHT_BLUE, "compiling ", 0); + PRINT_DEBUG(JNJVM_COMPILE, 1, LIGHT_CYAN, OpcodeNames[bytecodes[i]], 0); + PRINT_DEBUG(JNJVM_COMPILE, 1, LIGHT_BLUE, "\n", 0); Opinfo* opinfo = &(opcodeInfos[i]); if (opinfo->newBlock) { @@ -2142,9 +2142,9 @@ PRINT_DEBUG(JNJVM_COMPILE, 1, COLOR_NORMAL, "\t[at %5d] %-5d ", i, bytecodes[i]); - PRINT_DEBUG(JNJVM_COMPILE, 1, LIGHT_BLUE, "exploring "); - PRINT_DEBUG(JNJVM_COMPILE, 1, LIGHT_CYAN, OpcodeNames[bytecodes[i]]); - PRINT_DEBUG(JNJVM_COMPILE, 1, LIGHT_BLUE, "\n"); + PRINT_DEBUG(JNJVM_COMPILE, 1, LIGHT_BLUE, "exploring ",0); + PRINT_DEBUG(JNJVM_COMPILE, 1, LIGHT_CYAN, OpcodeNames[bytecodes[i]], 0); + PRINT_DEBUG(JNJVM_COMPILE, 1, LIGHT_BLUE, "\n", 0); switch (bytecodes[i]) { Modified: vmkit/trunk/lib/JnJVM/VMCore/JavaTypes.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/VMCore/JavaTypes.cpp?rev=52715&r1=52714&r2=52715&view=diff ============================================================================== --- vmkit/trunk/lib/JnJVM/VMCore/JavaTypes.cpp (original) +++ vmkit/trunk/lib/JnJVM/VMCore/JavaTypes.cpp Wed Jun 25 07:06:15 2008 @@ -512,7 +512,7 @@ } -void* Signdef::staticCallBuf() { +intptr_t Signdef::staticCallBuf() { if (!_staticCallBuf) { LLVMSignatureInfo* LSI = isolate->TheModule->getSignatureInfo(this); LSI->getStaticBuf(); @@ -520,7 +520,7 @@ return _staticCallBuf; } -void* Signdef::virtualCallBuf() { +intptr_t Signdef::virtualCallBuf() { if (!_virtualCallBuf) { LLVMSignatureInfo* LSI = isolate->TheModule->getSignatureInfo(this); LSI->getVirtualBuf(); @@ -528,7 +528,7 @@ return _virtualCallBuf; } -void* Signdef::staticCallAP() { +intptr_t Signdef::staticCallAP() { if (!_staticCallAP) { LLVMSignatureInfo* LSI = isolate->TheModule->getSignatureInfo(this); LSI->getStaticAP(); @@ -536,7 +536,7 @@ return _staticCallAP; } -void* Signdef::virtualCallAP() { +intptr_t Signdef::virtualCallAP() { if (!_virtualCallAP) { LLVMSignatureInfo* LSI = isolate->TheModule->getSignatureInfo(this); LSI->getVirtualAP(); Modified: vmkit/trunk/lib/JnJVM/VMCore/JavaTypes.h URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/VMCore/JavaTypes.h?rev=52715&r1=52714&r2=52715&view=diff ============================================================================== --- vmkit/trunk/lib/JnJVM/VMCore/JavaTypes.h (original) +++ vmkit/trunk/lib/JnJVM/VMCore/JavaTypes.h Wed Jun 25 07:06:15 2008 @@ -141,15 +141,15 @@ class Signdef : public Typedef { private: - mvm::Code* _staticCallBuf; - mvm::Code* _virtualCallBuf; - mvm::Code* _staticCallAP; - mvm::Code* _virtualCallAP; - - void* staticCallBuf(); - void* virtualCallBuf(); - void* staticCallAP(); - void* virtualCallAP(); + intptr_t _staticCallBuf; + intptr_t _virtualCallBuf; + intptr_t _staticCallAP; + intptr_t _virtualCallAP; + + intptr_t staticCallBuf(); + intptr_t virtualCallBuf(); + intptr_t staticCallAP(); + intptr_t virtualCallAP(); public: std::vector args; @@ -161,39 +161,39 @@ static Signdef* signDup(const UTF8* name, Jnjvm* vm); - void* getStaticCallBuf() { + intptr_t getStaticCallBuf() { if(!_staticCallBuf) return staticCallBuf(); return _staticCallBuf; } - void* getVirtualCallBuf() { + intptr_t getVirtualCallBuf() { if(!_virtualCallBuf) return virtualCallBuf(); return _virtualCallBuf; } - void* getStaticCallAP() { + intptr_t getStaticCallAP() { if (!_staticCallAP) return staticCallAP(); return _staticCallAP; } - void* getVirtualCallAP() { + intptr_t getVirtualCallAP() { if (!_virtualCallAP) return virtualCallAP(); return _virtualCallAP; } - void setStaticCallBuf(mvm::Code* code) { + void setStaticCallBuf(intptr_t code) { _staticCallBuf = code; } - void setVirtualCallBuf(mvm::Code* code) { + void setVirtualCallBuf(intptr_t code) { _virtualCallBuf = code; } - void setStaticCallAP(mvm::Code* code) { + void setStaticCallAP(intptr_t code) { _staticCallAP = code; } - void setVirtualCallAP(mvm::Code* code) { + void setVirtualCallAP(intptr_t code) { _virtualCallAP = code; } Modified: vmkit/trunk/lib/JnJVM/VMCore/Jnjvm.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/VMCore/Jnjvm.cpp?rev=52715&r1=52714&r2=52715&view=diff ============================================================================== --- vmkit/trunk/lib/JnJVM/VMCore/Jnjvm.cpp (original) +++ vmkit/trunk/lib/JnJVM/VMCore/Jnjvm.cpp Wed Jun 25 07:06:15 2008 @@ -245,8 +245,8 @@ void Jnjvm::readClass(Class* cl) { - PRINT_DEBUG(JNJVM_LOAD, 0, COLOR_NORMAL, "; "); - PRINT_DEBUG(JNJVM_LOAD, 0, LIGHT_GREEN, "reading "); + PRINT_DEBUG(JNJVM_LOAD, 0, COLOR_NORMAL, "; ", 0); + PRINT_DEBUG(JNJVM_LOAD, 0, LIGHT_GREEN, "reading ", 0); PRINT_DEBUG(JNJVM_LOAD, 0, COLOR_NORMAL, "%s::%s\n", printString(), cl->printString()); @@ -326,8 +326,8 @@ JavaMethod* meth = cl->lookupMethodDontThrow(clinitName, clinitType, true, false); - PRINT_DEBUG(JNJVM_LOAD, 0, COLOR_NORMAL, "; "); - PRINT_DEBUG(JNJVM_LOAD, 0, LIGHT_GREEN, "clinit "); + PRINT_DEBUG(JNJVM_LOAD, 0, COLOR_NORMAL, "; ", 0); + PRINT_DEBUG(JNJVM_LOAD, 0, LIGHT_GREEN, "clinit ", 0); PRINT_DEBUG(JNJVM_LOAD, 0, COLOR_NORMAL, "%s::%s\n", printString(), cl->printString()); @@ -336,7 +336,7 @@ if (meth) { JavaObject* exc = 0; try{ - clinit_t pred = (clinit_t)meth->compiledPtr(); + clinit_t pred = (clinit_t)(intptr_t)meth->compiledPtr(); pred(JavaThread::get()->isolate); } catch(...) { exc = JavaThread::getJavaException(); Modified: vmkit/trunk/lib/JnJVM/VMCore/JnjvmModule.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/VMCore/JnjvmModule.cpp?rev=52715&r1=52714&r2=52715&view=diff ============================================================================== --- vmkit/trunk/lib/JnJVM/VMCore/JnjvmModule.cpp (original) +++ vmkit/trunk/lib/JnJVM/VMCore/JnjvmModule.cpp Wed Jun 25 07:06:15 2008 @@ -803,7 +803,7 @@ // Lock here because we are called by arbitrary code llvm::MutexGuard locked(mvm::jit::executionEngine->lock); virtualBufFunction = createFunctionCallBuf(true); - signature->setVirtualCallBuf((mvm::Code*) + signature->setVirtualCallBuf((intptr_t) mvm::jit::executionEngine->getPointerToGlobal(virtualBufFunction)); } return virtualBufFunction; @@ -814,7 +814,7 @@ // Lock here because we are called by arbitrary code llvm::MutexGuard locked(mvm::jit::executionEngine->lock); virtualAPFunction = createFunctionCallAP(true); - signature->setVirtualCallAP((mvm::Code*) + signature->setVirtualCallAP((intptr_t) mvm::jit::executionEngine->getPointerToGlobal(virtualAPFunction)); } return virtualAPFunction; @@ -825,7 +825,7 @@ // Lock here because we are called by arbitrary code llvm::MutexGuard locked(mvm::jit::executionEngine->lock); staticBufFunction = createFunctionCallBuf(false); - signature->setStaticCallBuf((mvm::Code*) + signature->setStaticCallBuf((intptr_t) mvm::jit::executionEngine->getPointerToGlobal(staticBufFunction)); } return staticBufFunction; @@ -836,7 +836,7 @@ // Lock here because we are called by arbitrary code llvm::MutexGuard locked(mvm::jit::executionEngine->lock); staticAPFunction = createFunctionCallAP(false); - signature->setStaticCallAP((mvm::Code*) + signature->setStaticCallAP((intptr_t) mvm::jit::executionEngine->getPointerToGlobal(staticAPFunction)); } return staticAPFunction; Modified: vmkit/trunk/lib/JnJVM/VMCore/JnjvmModuleProvider.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/VMCore/JnjvmModuleProvider.cpp?rev=52715&r1=52714&r2=52715&view=diff ============================================================================== --- vmkit/trunk/lib/JnJVM/VMCore/JnjvmModuleProvider.cpp (original) +++ vmkit/trunk/lib/JnJVM/VMCore/JnjvmModuleProvider.cpp Wed Jun 25 07:06:15 2008 @@ -110,6 +110,25 @@ void* res = mvm::jit::executionEngine->getPointerToGlobal(func); mvm::Code* m = mvm::jit::getCodeFromPointer(res); if (m) m->setMetaInfo(meth); + + /* + if (compilingMethod->name == + compilingClass->isolate->asciizConstructUTF8("main")) { + llvmFunction->print(llvm::cout); + printf("\n"); + void* res = mvm::jit::executionEngine->getPointerToGlobal(llvmFunction); + void* base = res; + while (base < (void*)((char*)res + 100)) { + printf("%08x\t", (unsigned)base); + int n= mvm::jit::disassemble((unsigned int *)base); + printf("\n"); + base= ((void *)((char *)base + n)); + } + printf("\n"); + fflush(stdout); + } + */ + return res; } Modified: vmkit/trunk/lib/Makefile URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/Makefile?rev=52715&r1=52714&r2=52715&view=diff ============================================================================== --- vmkit/trunk/lib/Makefile (original) +++ vmkit/trunk/lib/Makefile Wed Jun 25 07:06:15 2008 @@ -8,7 +8,18 @@ ##===----------------------------------------------------------------------===## LEVEL = .. -PARALLEL_DIRS = Mvm JnJVM N3 +PARALLEL_DIRS = Mvm + +include $(LEVEL)/Makefile.config + +ifeq ($(WITH_JNJVM), 1) +PARALLEL_DIRS += JnJVM +endif + +ifeq ($(WITH_N3), 1) +PARALLEL_DIRS += N3 +endif + LIBRARYNAME = Main include $(LEVEL)/Makefile.common Modified: vmkit/trunk/lib/Mvm/CommandLine.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/Mvm/CommandLine.cpp?rev=52715&r1=52714&r2=52715&view=diff ============================================================================== --- vmkit/trunk/lib/Mvm/CommandLine.cpp (original) +++ vmkit/trunk/lib/Mvm/CommandLine.cpp Wed Jun 25 07:06:15 2008 @@ -131,7 +131,7 @@ return; } - boot_t func = (boot_t)dlsym(handle, "boot"); + boot_t func = (boot_t)(intptr_t)dlsym(handle, "boot"); if (func == 0) { fprintf(stderr, "\t Unable to find %s boot method\n", argv[1]); @@ -140,7 +140,7 @@ } func(); - vmlet_main_t vmlet = (vmlet_main_t)dlsym(handle, "start_app"); + vmlet_main_t vmlet = (vmlet_main_t)(intptr_t)dlsym(handle, "start_app"); vmlets[argv[1]] = vmlet; Modified: vmkit/trunk/lib/N3/VMCore/CLIJit.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/N3/VMCore/CLIJit.cpp?rev=52715&r1=52714&r2=52715&view=diff ============================================================================== --- vmkit/trunk/lib/N3/VMCore/CLIJit.cpp (original) +++ vmkit/trunk/lib/N3/VMCore/CLIJit.cpp Wed Jun 25 07:06:15 2008 @@ -1988,6 +1988,7 @@ Constant* CLIJit::constantVMObjectNull; +#if N3_EXECUTE > 1 static void printArgs(std::vector args, BasicBlock* insertAt) { for (std::vector::iterator i = args.begin(), e = args.end(); i!= e; ++i) { @@ -2009,6 +2010,7 @@ } } +#endif Value* CLIJit::invoke(Value *F, std::vector args, const char* Name, Modified: vmkit/trunk/lib/N3/VMCore/Opcodes.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/N3/VMCore/Opcodes.cpp?rev=52715&r1=52714&r2=52715&view=diff ============================================================================== --- vmkit/trunk/lib/N3/VMCore/Opcodes.cpp (original) +++ vmkit/trunk/lib/N3/VMCore/Opcodes.cpp Wed Jun 25 07:06:15 2008 @@ -217,8 +217,8 @@ PRINT_DEBUG(N3_COMPILE, 1, COLOR_NORMAL, "\t[at %5d] %-5d ", i, bytecodes[i]); PRINT_DEBUG(N3_COMPILE, 1, LIGHT_BLUE, "compiling %s::", compilingMethod->printString()); - PRINT_DEBUG(N3_COMPILE, 1, LIGHT_CYAN, OpcodeNames[bytecodes[i]]); - PRINT_DEBUG(N3_COMPILE, 1, LIGHT_BLUE, "\n"); + PRINT_DEBUG(N3_COMPILE, 1, LIGHT_CYAN, OpcodeNames[bytecodes[i]], 0); + PRINT_DEBUG(N3_COMPILE, 1, LIGHT_BLUE, "\n", 0); } Opinfo* opinfo = &(opcodeInfos[i]); @@ -1779,8 +1779,8 @@ PRINT_DEBUG(N3_COMPILE, 1, COLOR_NORMAL, "\t[at %5d] %-5d ", i, bytecodes[i + 1]); PRINT_DEBUG(N3_COMPILE, 1, LIGHT_BLUE, "compiling %s::", compilingMethod->printString()); - PRINT_DEBUG(N3_COMPILE, 1, LIGHT_CYAN, OpcodeNamesFE[bytecodes[i + 1]]); - PRINT_DEBUG(N3_COMPILE, 1, LIGHT_BLUE, "\n"); + PRINT_DEBUG(N3_COMPILE, 1, LIGHT_CYAN, OpcodeNamesFE[bytecodes[i + 1]], 0); + PRINT_DEBUG(N3_COMPILE, 1, LIGHT_BLUE, "\n", 0); switch (bytecodes[++i]) { @@ -1951,8 +1951,8 @@ PRINT_DEBUG(N3_COMPILE, 1, COLOR_NORMAL, "\t[at %5d] %-5d ", i, bytecodes[i]); PRINT_DEBUG(N3_COMPILE, 1, LIGHT_BLUE, "exploring %s::", compilingMethod->printString()); - PRINT_DEBUG(N3_COMPILE, 1, LIGHT_CYAN, OpcodeNames[bytecodes[i]]); - PRINT_DEBUG(N3_COMPILE, 1, LIGHT_BLUE, "\n"); + PRINT_DEBUG(N3_COMPILE, 1, LIGHT_CYAN, OpcodeNames[bytecodes[i]], 0); + PRINT_DEBUG(N3_COMPILE, 1, LIGHT_BLUE, "\n", 0); } switch (bytecodes[i]) { @@ -2380,9 +2380,9 @@ PRINT_DEBUG(N3_COMPILE, 1, COLOR_NORMAL, "\t[at %5d] %-5d ", i, bytecodes[i + 1]); - PRINT_DEBUG(N3_COMPILE, 1, LIGHT_BLUE, "exploring "); - PRINT_DEBUG(N3_COMPILE, 1, LIGHT_CYAN, OpcodeNamesFE[bytecodes[i + 1]]); - PRINT_DEBUG(N3_COMPILE, 1, LIGHT_BLUE, "\n"); + PRINT_DEBUG(N3_COMPILE, 1, LIGHT_BLUE, "exploring ", 0); + PRINT_DEBUG(N3_COMPILE, 1, LIGHT_CYAN, OpcodeNamesFE[bytecodes[i + 1]], 0); + PRINT_DEBUG(N3_COMPILE, 1, LIGHT_BLUE, "\n", 0); switch (bytecodes[++i]) { Modified: vmkit/trunk/lib/N3/VMCore/PNetLib.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/N3/VMCore/PNetLib.cpp?rev=52715&r1=52714&r2=52715&view=diff ============================================================================== --- vmkit/trunk/lib/N3/VMCore/PNetLib.cpp (original) +++ vmkit/trunk/lib/N3/VMCore/PNetLib.cpp Wed Jun 25 07:06:15 2008 @@ -1204,7 +1204,6 @@ void NativeUtil::initialise() { - void* p; - p = (void*)&System_Runtime_CompilerServices_RuntimeHelpers_InitializeArray; - p = (void*)&System_Type_GetTypeFromHandle; + intptr_t p; + p = (intptr_t)&System_Runtime_CompilerServices_RuntimeHelpers_InitializeArray; } Modified: vmkit/trunk/lib/N3/VMCore/VMClass.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/N3/VMCore/VMClass.cpp?rev=52715&r1=52714&r2=52715&view=diff ============================================================================== --- vmkit/trunk/lib/N3/VMCore/VMClass.cpp (original) +++ vmkit/trunk/lib/N3/VMCore/VMClass.cpp Wed Jun 25 07:06:15 2008 @@ -215,14 +215,15 @@ VMMethod* meth = cl->lookupMethodDontThrow(N3::clinitName, args, true, false); - PRINT_DEBUG(N3_LOAD, 0, COLOR_NORMAL, "; "); - PRINT_DEBUG(N3_LOAD, 0, LIGHT_GREEN, "clinit "); + PRINT_DEBUG(N3_LOAD, 0, COLOR_NORMAL, "; ", 0); + PRINT_DEBUG(N3_LOAD, 0, LIGHT_GREEN, "clinit ", 0); PRINT_DEBUG(N3_LOAD, 0, COLOR_NORMAL, "%s::%s\n", printString(), cl->printString()); if (meth) { llvm::Function* pred = meth->compiledPtr(); - clinit_t res = (clinit_t)mvm::jit::executionEngine->getPointerToGlobal(pred); + clinit_t res = (clinit_t) + (intptr_t)mvm::jit::executionEngine->getPointerToGlobal(pred); res(); } Modified: vmkit/trunk/tools/Makefile URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/tools/Makefile?rev=52715&r1=52714&r2=52715&view=diff ============================================================================== --- vmkit/trunk/tools/Makefile (original) +++ vmkit/trunk/tools/Makefile Wed Jun 25 07:06:15 2008 @@ -8,7 +8,18 @@ ##===----------------------------------------------------------------------===## LEVEL = .. -PARALLEL_DIRS = jnjvm n3 +PARALLEL_DIRS = + +include $(LEVEL)/Makefile.config + +ifeq ($(WITH_JNJVM), 1) + PARALLEL_DIRS += jnjvm +endif + +ifeq ($(WITH_N3), 1) + PARALLEL_DIRS += n3 +endif + include $(LEVEL)/Makefile.common From nicolas.geoffray at lip6.fr Wed Jun 25 07:23:54 2008 From: nicolas.geoffray at lip6.fr (Nicolas Geoffray) Date: Wed, 25 Jun 2008 12:23:54 -0000 Subject: [llvm-commits] [vmkit] r52716 - in /vmkit/trunk: Makefile.common.in lib/Mvm/GCMmap2/gc.cpp Message-ID: <200806251223.m5PCNsRo009203@zion.cs.uiuc.edu> Author: geoffray Date: Wed Jun 25 07:23:54 2008 New Revision: 52716 URL: http://llvm.org/viewvc/llvm-project?rev=52716&view=rev Log: Add the -ansi and -Werror flags to C++ flags. Remove a warning in GCMmap2. Modified: vmkit/trunk/Makefile.common.in vmkit/trunk/lib/Mvm/GCMmap2/gc.cpp Modified: vmkit/trunk/Makefile.common.in URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/Makefile.common.in?rev=52716&r1=52715&r2=52716&view=diff ============================================================================== --- vmkit/trunk/Makefile.common.in (original) +++ vmkit/trunk/Makefile.common.in Wed Jun 25 07:23:54 2008 @@ -23,7 +23,7 @@ # Include LLVM's Master Makefile. include $(LLVM_OBJ_ROOT)/Makefile.common -CXX.Flags += @GC_FLAGS@ -Wno-variadic-macros -fno-omit-frame-pointer +CXX.Flags += @GC_FLAGS@ -Wno-variadic-macros -fno-omit-frame-pointer -ansi -Werror # GNU Classpath flags CLASSPATH_FLAGS = -I at classpathinclude@ Modified: vmkit/trunk/lib/Mvm/GCMmap2/gc.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/Mvm/GCMmap2/gc.cpp?rev=52716&r1=52715&r2=52716&view=diff ============================================================================== --- vmkit/trunk/lib/Mvm/GCMmap2/gc.cpp (original) +++ vmkit/trunk/lib/Mvm/GCMmap2/gc.cpp Wed Jun 25 07:23:54 2008 @@ -234,7 +234,8 @@ if(!loc) /* a key is being destroyed */ COLLECTOR threads->another_mark(); else { - register unsigned int **cur = (unsigned int **)&cur; + unsigned int* top; + register unsigned int **cur = ⊤ register unsigned int **max = loc->base_sp(); GCChunkNode *node; From nicolas.geoffray at lip6.fr Wed Jun 25 08:53:19 2008 From: nicolas.geoffray at lip6.fr (Nicolas Geoffray) Date: Wed, 25 Jun 2008 13:53:19 -0000 Subject: [llvm-commits] [vmkit] r52717 - /vmkit/trunk/lib/Mvm/JIT.cpp Message-ID: <200806251353.m5PDrJS8011885@zion.cs.uiuc.edu> Author: geoffray Date: Wed Jun 25 08:53:19 2008 New Revision: 52717 URL: http://llvm.org/viewvc/llvm-project?rev=52717&view=rev Log: Move to new atomic compare and swap intrinsic name. Modified: vmkit/trunk/lib/Mvm/JIT.cpp Modified: vmkit/trunk/lib/Mvm/JIT.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/Mvm/JIT.cpp?rev=52717&r1=52716&r2=52717&view=diff ============================================================================== --- vmkit/trunk/lib/Mvm/JIT.cpp (original) +++ vmkit/trunk/lib/Mvm/JIT.cpp Wed Jun 25 08:53:19 2008 @@ -527,7 +527,7 @@ llvm_atomic_lcs_i32 = Function::Create( /*Type=*/FuncTy_4, /*Linkage=*/GlobalValue::ExternalLinkage, - /*Name=*/"llvm.atomic.lcs.i32", module); // (external, no body) + /*Name=*/"llvm.atomic.cmp.swap.i32", module); // (external, no body) } From baldrick at free.fr Wed Jun 25 09:13:58 2008 From: baldrick at free.fr (Duncan Sands) Date: Wed, 25 Jun 2008 16:13:58 +0200 Subject: [llvm-commits] [llvm-gcc-4.2] r52711 - /llvm-gcc-4.2/trunk/gcc/llvm-debug.cpp In-Reply-To: <200806251041.m5PAfZan005619@zion.cs.uiuc.edu> References: <200806251041.m5PAfZan005619@zion.cs.uiuc.edu> Message-ID: <200806251613.58778.baldrick@free.fr> Hi Bill, > Convert: > > >> ATOMIC_LCS => ATOMIC_CMP_SWAP > >> ATOMIC_LAS => ATOMIC_LOAD_ADD > >> ATOMIC_LSS => ATOMIC_LOAD_SUB your patch doesn't do that, it only deletes a #include... Ciao, Duncan. From sabre at nondot.org Wed Jun 25 11:03:43 2008 From: sabre at nondot.org (Chris Lattner) Date: Wed, 25 Jun 2008 16:03:43 -0000 Subject: [llvm-commits] [llvm] r52721 - /llvm/trunk/test/Scripts/count Message-ID: <200806251603.m5PG3hAV016497@zion.cs.uiuc.edu> Author: lattner Date: Wed Jun 25 11:03:42 2008 New Revision: 52721 URL: http://llvm.org/viewvc/llvm-project?rev=52721&view=rev Log: simplify shell syntax to work better on solaris, patch by Nathan Keynes! Modified: llvm/trunk/test/Scripts/count Modified: llvm/trunk/test/Scripts/count URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Scripts/count?rev=52721&r1=52720&r2=52721&view=diff ============================================================================== --- llvm/trunk/test/Scripts/count (original) +++ llvm/trunk/test/Scripts/count Wed Jun 25 11:03:42 2008 @@ -9,7 +9,7 @@ set -e set -u -input_lines=$(wc -l) +input_lines=`wc -l` if [ "$input_lines" -ne "$1" ]; then echo "count: expected $1 lines and got ${input_lines}." exit 1 From gohman at apple.com Wed Jun 25 11:07:49 2008 From: gohman at apple.com (Dan Gohman) Date: Wed, 25 Jun 2008 16:07:49 -0000 Subject: [llvm-commits] [llvm] r52722 - in /llvm/trunk: include/llvm/CodeGen/SelectionDAG.h include/llvm/CodeGen/SelectionDAGNodes.h lib/CodeGen/SelectionDAG/LegalizeDAG.cpp lib/CodeGen/SelectionDAG/SelectionDAG.cpp lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp lib/Target/TargetSelectionDAG.td lib/Target/X86/X86ISelLowering.cpp Message-ID: <200806251607.m5PG7o3j016629@zion.cs.uiuc.edu> Author: djg Date: Wed Jun 25 11:07:49 2008 New Revision: 52722 URL: http://llvm.org/viewvc/llvm-project?rev=52722&view=rev Log: Remove the OrigVT member from AtomicSDNode, as it is redundant with the base SDNode's VTList. Modified: llvm/trunk/include/llvm/CodeGen/SelectionDAG.h llvm/trunk/include/llvm/CodeGen/SelectionDAGNodes.h llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp llvm/trunk/lib/Target/TargetSelectionDAG.td llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Modified: llvm/trunk/include/llvm/CodeGen/SelectionDAG.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/SelectionDAG.h?rev=52722&r1=52721&r2=52722&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/SelectionDAG.h (original) +++ llvm/trunk/include/llvm/CodeGen/SelectionDAG.h Wed Jun 25 11:07:49 2008 @@ -370,13 +370,13 @@ /// getAtomic - Gets a node for an atomic op, produces result and chain, takes /// 3 operands SDOperand getAtomic(unsigned Opcode, SDOperand Chain, SDOperand Ptr, - SDOperand Cmp, SDOperand Swp, MVT VT, const Value* PtrVal, + SDOperand Cmp, SDOperand Swp, const Value* PtrVal, unsigned Alignment=0); /// getAtomic - Gets a node for an atomic op, produces result and chain, takes /// 2 operands SDOperand getAtomic(unsigned Opcode, SDOperand Chain, SDOperand Ptr, - SDOperand Val, MVT VT, const Value* PtrVal, + SDOperand Val, const Value* PtrVal, unsigned Alignment = 0); /// getLoad - Loads are not normal binary operators: their result type is not Modified: llvm/trunk/include/llvm/CodeGen/SelectionDAGNodes.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/SelectionDAGNodes.h?rev=52722&r1=52721&r2=52722&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/SelectionDAGNodes.h (original) +++ llvm/trunk/include/llvm/CodeGen/SelectionDAGNodes.h Wed Jun 25 11:07:49 2008 @@ -1491,7 +1491,6 @@ class AtomicSDNode : public MemSDNode { virtual void ANCHOR(); // Out-of-line virtual method to give class a home. SDUse Ops[4]; - MVT OrigVT; public: // Opc: opcode for atomic @@ -1500,13 +1499,12 @@ // Ptr: address to update as a SDOperand // Cmp: compare value // Swp: swap value - // VT: resulting value type // SrcVal: address to update as a Value (used for MemOperand) // Align: alignment of memory AtomicSDNode(unsigned Opc, SDVTList VTL, SDOperand Chain, SDOperand Ptr, - SDOperand Cmp, SDOperand Swp, MVT VT, const Value* SrcVal, + SDOperand Cmp, SDOperand Swp, const Value* SrcVal, unsigned Align=0) - : MemSDNode(Opc, VTL, SrcVal, Align), OrigVT(VT) { + : MemSDNode(Opc, VTL, SrcVal, Align) { Ops[0] = Chain; Ops[1] = Ptr; Ops[2] = Swp; @@ -1514,15 +1512,14 @@ InitOperands(Ops, 4); } AtomicSDNode(unsigned Opc, SDVTList VTL, SDOperand Chain, SDOperand Ptr, - SDOperand Val, MVT VT, const Value* SrcVal, unsigned Align=0) - : MemSDNode(Opc, VTL, SrcVal, Align), OrigVT(VT) { + SDOperand Val, const Value* SrcVal, unsigned Align=0) + : MemSDNode(Opc, VTL, SrcVal, Align) { Ops[0] = Chain; Ops[1] = Ptr; Ops[2] = Val; InitOperands(Ops, 3); } - MVT getVT() const { return OrigVT; } const SDOperand &getChain() const { return getOperand(0); } const SDOperand &getBasePtr() const { return getOperand(1); } const SDOperand &getVal() const { return getOperand(2); } Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp?rev=52722&r1=52721&r2=52722&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Wed Jun 25 11:07:49 2008 @@ -4276,7 +4276,7 @@ Tmp3 = PromoteOp(Node->getOperand(3)); Result = DAG.getAtomic(Node->getOpcode(), AtomNode->getChain(), AtomNode->getBasePtr(), Tmp2, Tmp3, - AtomNode->getVT(), AtomNode->getSrcValue(), + AtomNode->getSrcValue(), AtomNode->getAlignment()); // Remember that we legalized the chain. AddLegalizedOperand(Op.getValue(1), LegalizeOp(Result.getValue(1))); @@ -4297,7 +4297,7 @@ Tmp2 = PromoteOp(Node->getOperand(2)); Result = DAG.getAtomic(Node->getOpcode(), AtomNode->getChain(), AtomNode->getBasePtr(), Tmp2, - AtomNode->getVT(), AtomNode->getSrcValue(), + AtomNode->getSrcValue(), AtomNode->getAlignment()); // Remember that we legalized the chain. AddLegalizedOperand(Op.getValue(1), LegalizeOp(Result.getValue(1))); Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp?rev=52722&r1=52721&r2=52722&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Wed Jun 25 11:07:49 2008 @@ -2989,7 +2989,7 @@ SDOperand SelectionDAG::getAtomic(unsigned Opcode, SDOperand Chain, SDOperand Ptr, SDOperand Cmp, - SDOperand Swp, MVT VT, const Value* PtrVal, + SDOperand Swp, const Value* PtrVal, unsigned Alignment) { assert(Opcode == ISD::ATOMIC_CMP_SWAP && "Invalid Atomic Op"); assert(Cmp.getValueType() == Swp.getValueType() && "Invalid Atomic Op Types"); @@ -2997,11 +2997,10 @@ FoldingSetNodeID ID; SDOperand Ops[] = {Chain, Ptr, Cmp, Swp}; AddNodeIDNode(ID, Opcode, VTs, Ops, 4); - ID.AddInteger(VT.getRawBits()); void* IP = 0; if (SDNode *E = CSEMap.FindNodeOrInsertPos(ID, IP)) return SDOperand(E, 0); - SDNode* N = new AtomicSDNode(Opcode, VTs, Chain, Ptr, Cmp, Swp, VT, + SDNode* N = new AtomicSDNode(Opcode, VTs, Chain, Ptr, Cmp, Swp, PtrVal, Alignment); CSEMap.InsertNode(N, IP); AllNodes.push_back(N); @@ -3010,7 +3009,7 @@ SDOperand SelectionDAG::getAtomic(unsigned Opcode, SDOperand Chain, SDOperand Ptr, SDOperand Val, - MVT VT, const Value* PtrVal, + const Value* PtrVal, unsigned Alignment) { assert(( Opcode == ISD::ATOMIC_LOAD_ADD || Opcode == ISD::ATOMIC_LOAD_SUB || Opcode == ISD::ATOMIC_SWAP || Opcode == ISD::ATOMIC_LOAD_AND @@ -3023,11 +3022,10 @@ FoldingSetNodeID ID; SDOperand Ops[] = {Chain, Ptr, Val}; AddNodeIDNode(ID, Opcode, VTs, Ops, 3); - ID.AddInteger(VT.getRawBits()); void* IP = 0; if (SDNode *E = CSEMap.FindNodeOrInsertPos(ID, IP)) return SDOperand(E, 0); - SDNode* N = new AtomicSDNode(Opcode, VTs, Chain, Ptr, Val, VT, + SDNode* N = new AtomicSDNode(Opcode, VTs, Chain, Ptr, Val, PtrVal, Alignment); CSEMap.InsertNode(N, IP); AllNodes.push_back(N); @@ -4217,7 +4215,7 @@ /// getMemOperand - Return a MachineMemOperand object describing the memory /// reference performed by this atomic. MachineMemOperand AtomicSDNode::getMemOperand() const { - int Size = (getVT().getSizeInBits() + 7) >> 3; + int Size = (getValueType(0).getSizeInBits() + 7) >> 3; int Flags = MachineMemOperand::MOLoad | MachineMemOperand::MOStore; if (isVolatile()) Flags |= MachineMemOperand::MOVolatile; Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp?rev=52722&r1=52721&r2=52722&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Wed Jun 25 11:07:49 2008 @@ -3085,10 +3085,9 @@ const char * SelectionDAGLowering::implVisitBinaryAtomic(CallInst& I, ISD::NodeType Op) { SDOperand Root = getRoot(); - SDOperand O2 = getValue(I.getOperand(2)); SDOperand L = DAG.getAtomic(Op, Root, getValue(I.getOperand(1)), - O2, O2.getValueType(), + getValue(I.getOperand(2)), I.getOperand(1)); setValue(&I, L); DAG.setRoot(L.getValue(1)); @@ -3521,11 +3520,10 @@ } case Intrinsic::atomic_cmp_swap: { SDOperand Root = getRoot(); - SDOperand O3 = getValue(I.getOperand(3)); SDOperand L = DAG.getAtomic(ISD::ATOMIC_CMP_SWAP, Root, getValue(I.getOperand(1)), getValue(I.getOperand(2)), - O3, O3.getValueType(), + getValue(I.getOperand(3)), I.getOperand(1)); setValue(&I, L); DAG.setRoot(L.getValue(1)); Modified: llvm/trunk/lib/Target/TargetSelectionDAG.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/TargetSelectionDAG.td?rev=52722&r1=52721&r2=52722&view=diff ============================================================================== --- llvm/trunk/lib/Target/TargetSelectionDAG.td (original) +++ llvm/trunk/lib/Target/TargetSelectionDAG.td Wed Jun 25 11:07:49 2008 @@ -768,75 +768,75 @@ def atomic_cmp_swap_8 : PatFrag<(ops node:$ptr, node:$cmp, node:$swp), (atomic_cmp_swap node:$ptr, node:$cmp, node:$swp), [{ if (AtomicSDNode* V = dyn_cast(N)) - return V->getVT() == MVT::i8; + return V->getValueType(0) == MVT::i8; return false; }]>; def atomic_cmp_swap_16 : PatFrag<(ops node:$ptr, node:$cmp, node:$swp), (atomic_cmp_swap node:$ptr, node:$cmp, node:$swp), [{ if (AtomicSDNode* V = dyn_cast(N)) - return V->getVT() == MVT::i16; + return V->getValueType(0) == MVT::i16; return false; }]>; def atomic_cmp_swap_32 : PatFrag<(ops node:$ptr, node:$cmp, node:$swp), (atomic_cmp_swap node:$ptr, node:$cmp, node:$swp), [{ if (AtomicSDNode* V = dyn_cast(N)) - return V->getVT() == MVT::i32; + return V->getValueType(0) == MVT::i32; return false; }]>; def atomic_cmp_swap_64 : PatFrag<(ops node:$ptr, node:$cmp, node:$swp), (atomic_cmp_swap node:$ptr, node:$cmp, node:$swp), [{ if (AtomicSDNode* V = dyn_cast(N)) - return V->getVT() == MVT::i64; + return V->getValueType(0) == MVT::i64; return false; }]>; def atomic_load_add_8 : PatFrag<(ops node:$ptr, node:$inc), (atomic_load_add node:$ptr, node:$inc), [{ if (AtomicSDNode* V = dyn_cast(N)) - return V->getVT() == MVT::i8; + return V->getValueType(0) == MVT::i8; return false; }]>; def atomic_load_add_16 : PatFrag<(ops node:$ptr, node:$inc), (atomic_load_add node:$ptr, node:$inc), [{ if (AtomicSDNode* V = dyn_cast(N)) - return V->getVT() == MVT::i16; + return V->getValueType(0) == MVT::i16; return false; }]>; def atomic_load_add_32 : PatFrag<(ops node:$ptr, node:$inc), (atomic_load_add node:$ptr, node:$inc), [{ if (AtomicSDNode* V = dyn_cast(N)) - return V->getVT() == MVT::i32; + return V->getValueType(0) == MVT::i32; return false; }]>; def atomic_load_add_64 : PatFrag<(ops node:$ptr, node:$inc), (atomic_load_add node:$ptr, node:$inc), [{ if (AtomicSDNode* V = dyn_cast(N)) - return V->getVT() == MVT::i64; + return V->getValueType(0) == MVT::i64; return false; }]>; def atomic_swap_8 : PatFrag<(ops node:$ptr, node:$inc), (atomic_swap node:$ptr, node:$inc), [{ if (AtomicSDNode* V = dyn_cast(N)) - return V->getVT() == MVT::i8; + return V->getValueType(0) == MVT::i8; return false; }]>; def atomic_swap_16 : PatFrag<(ops node:$ptr, node:$inc), (atomic_swap node:$ptr, node:$inc), [{ if (AtomicSDNode* V = dyn_cast(N)) - return V->getVT() == MVT::i16; + return V->getValueType(0) == MVT::i16; return false; }]>; def atomic_swap_32 : PatFrag<(ops node:$ptr, node:$inc), (atomic_swap node:$ptr, node:$inc), [{ if (AtomicSDNode* V = dyn_cast(N)) - return V->getVT() == MVT::i32; + return V->getValueType(0) == MVT::i32; return false; }]>; def atomic_swap_64 : PatFrag<(ops node:$ptr, node:$inc), (atomic_swap node:$ptr, node:$inc), [{ if (AtomicSDNode* V = dyn_cast(N)) - return V->getVT() == MVT::i64; + return V->getValueType(0) == MVT::i64; return false; }]>; Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.cpp?rev=52722&r1=52721&r2=52722&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original) +++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Wed Jun 25 11:07:49 2008 @@ -5656,7 +5656,7 @@ } SDOperand X86TargetLowering::LowerCMP_SWAP(SDOperand Op, SelectionDAG &DAG) { - MVT T = cast(Op.Val)->getVT(); + MVT T = Op.getValueType(); unsigned Reg = 0; unsigned size = 0; switch(T.getSimpleVT()) { @@ -5687,7 +5687,7 @@ } SDNode* X86TargetLowering::ExpandATOMIC_CMP_SWAP(SDNode* Op, SelectionDAG &DAG) { - MVT T = cast(Op)->getVT(); + MVT T = Op->getValueType(0); assert (T == MVT::i64 && "Only know how to expand i64 Cmp and Swap"); SDOperand cpInL, cpInH; cpInL = DAG.getNode(ISD::EXTRACT_ELEMENT, MVT::i32, Op->getOperand(3), @@ -5723,12 +5723,12 @@ } SDNode* X86TargetLowering::ExpandATOMIC_LOAD_SUB(SDNode* Op, SelectionDAG &DAG) { - MVT T = cast(Op)->getVT(); + MVT T = Op->getValueType(0); assert (T == MVT::i32 && "Only know how to expand i32 Atomic Load Sub"); SDOperand negOp = DAG.getNode(ISD::SUB, T, DAG.getConstant(0, T), Op->getOperand(2)); return DAG.getAtomic(ISD::ATOMIC_LOAD_ADD, Op->getOperand(0), - Op->getOperand(1), negOp, T, + Op->getOperand(1), negOp, cast(Op)->getSrcValue(), cast(Op)->getAlignment()).Val; } From baldrick at free.fr Wed Jun 25 11:31:19 2008 From: baldrick at free.fr (Duncan Sands) Date: Wed, 25 Jun 2008 16:31:19 -0000 Subject: [llvm-commits] [llvm] r52723 - /llvm/trunk/lib/Transforms/IPO/DeadArgumentElimination.cpp Message-ID: <200806251631.m5PGVJxp017561@zion.cs.uiuc.edu> Author: baldrick Date: Wed Jun 25 11:31:18 2008 New Revision: 52723 URL: http://llvm.org/viewvc/llvm-project?rev=52723&view=rev Log: Pacify gcc-4.3. Modified: llvm/trunk/lib/Transforms/IPO/DeadArgumentElimination.cpp Modified: llvm/trunk/lib/Transforms/IPO/DeadArgumentElimination.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/DeadArgumentElimination.cpp?rev=52723&r1=52722&r2=52723&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/IPO/DeadArgumentElimination.cpp (original) +++ llvm/trunk/lib/Transforms/IPO/DeadArgumentElimination.cpp Wed Jun 25 11:31:18 2008 @@ -613,7 +613,7 @@ ++NumRetValsEliminated; Changed = true; } - if (RetTypes.size() > 1 || STy && STy->getNumElements() == RetTypes.size()) + if (RetTypes.size() > 1 || (STy && STy->getNumElements()==RetTypes.size())) // More than one return type? Return a struct with them. Also, if we used // to return a struct and didn't change the number of return values, // return a struct again. This prevents changing {something} into something From baldrick at free.fr Wed Jun 25 11:34:21 2008 From: baldrick at free.fr (Duncan Sands) Date: Wed, 25 Jun 2008 16:34:21 -0000 Subject: [llvm-commits] [llvm] r52724 - in /llvm/trunk/lib/CodeGen/SelectionDAG: LegalizeFloatTypes.cpp LegalizeIntegerTypes.cpp LegalizeTypes.h Message-ID: <200806251634.m5PGYMHu017709@zion.cs.uiuc.edu> Author: baldrick Date: Wed Jun 25 11:34:21 2008 New Revision: 52724 URL: http://llvm.org/viewvc/llvm-project?rev=52724&view=rev Log: Add/complete support for integer and float select_cc and friends. This code could be factorized a bit but I'm not sure that it's worth it. Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeFloatTypes.cpp llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.h Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeFloatTypes.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeFloatTypes.cpp?rev=52724&r1=52723&r2=52724&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeFloatTypes.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeFloatTypes.cpp Wed Jun 25 11:34:21 2008 @@ -332,7 +332,11 @@ assert(0 && "Do not know how to convert this operator's operand!"); abort(); - case ISD::BIT_CONVERT: Res = SoftenFloatOp_BIT_CONVERT(N); break; + case ISD::BIT_CONVERT: Res = SoftenFloatOp_BIT_CONVERT(N); break; + + case ISD::BR_CC: Res = SoftenFloatOp_BR_CC(N); break; + case ISD::SELECT_CC: Res = SoftenFloatOp_BR_CC(N); break; + case ISD::SETCC: Res = SoftenFloatOp_BR_CC(N); break; } } @@ -356,11 +360,148 @@ return false; } +/// SoftenSetCCOperands - Soften the operands of a comparison. This code is +/// shared among BR_CC, SELECT_CC, and SETCC handlers. +void DAGTypeLegalizer::SoftenSetCCOperands(SDOperand &NewLHS, SDOperand &NewRHS, + ISD::CondCode &CCCode) { + SDOperand LHSInt = GetSoftenedFloat(NewLHS); + SDOperand RHSInt = GetSoftenedFloat(NewRHS); + MVT VT = NewLHS.getValueType(); + MVT NVT = LHSInt.getValueType(); + + assert((VT == MVT::f32 || VT == MVT::f64) && "Unsupported setcc type!"); + + // Expand into one or more soft-fp libcall(s). + RTLIB::Libcall LC1, LC2 = RTLIB::UNKNOWN_LIBCALL; + switch (CCCode) { + case ISD::SETEQ: + case ISD::SETOEQ: + LC1 = (VT == MVT::f32) ? RTLIB::OEQ_F32 : RTLIB::OEQ_F64; + break; + case ISD::SETNE: + case ISD::SETUNE: + LC1 = (VT == MVT::f32) ? RTLIB::UNE_F32 : RTLIB::UNE_F64; + break; + case ISD::SETGE: + case ISD::SETOGE: + LC1 = (VT == MVT::f32) ? RTLIB::OGE_F32 : RTLIB::OGE_F64; + break; + case ISD::SETLT: + case ISD::SETOLT: + LC1 = (VT == MVT::f32) ? RTLIB::OLT_F32 : RTLIB::OLT_F64; + break; + case ISD::SETLE: + case ISD::SETOLE: + LC1 = (VT == MVT::f32) ? RTLIB::OLE_F32 : RTLIB::OLE_F64; + break; + case ISD::SETGT: + case ISD::SETOGT: + LC1 = (VT == MVT::f32) ? RTLIB::OGT_F32 : RTLIB::OGT_F64; + break; + case ISD::SETUO: + LC1 = (VT == MVT::f32) ? RTLIB::UO_F32 : RTLIB::UO_F64; + break; + case ISD::SETO: + break; + default: + LC1 = (VT == MVT::f32) ? RTLIB::UO_F32 : RTLIB::UO_F64; + switch (CCCode) { + case ISD::SETONE: + // SETONE = SETOLT | SETOGT + LC1 = (VT == MVT::f32) ? RTLIB::OLT_F32 : RTLIB::OLT_F64; + // Fallthrough + case ISD::SETUGT: + LC2 = (VT == MVT::f32) ? RTLIB::OGT_F32 : RTLIB::OGT_F64; + break; + case ISD::SETUGE: + LC2 = (VT == MVT::f32) ? RTLIB::OGE_F32 : RTLIB::OGE_F64; + break; + case ISD::SETULT: + LC2 = (VT == MVT::f32) ? RTLIB::OLT_F32 : RTLIB::OLT_F64; + break; + case ISD::SETULE: + LC2 = (VT == MVT::f32) ? RTLIB::OLE_F32 : RTLIB::OLE_F64; + break; + case ISD::SETUEQ: + LC2 = (VT == MVT::f32) ? RTLIB::OEQ_F32 : RTLIB::OEQ_F64; + break; + default: assert(false && "Do not know how to soften this setcc!"); + } + } + + SDOperand Ops[2] = { LHSInt, RHSInt }; + NewLHS = MakeLibCall(LC1, NVT, Ops, 2, false/*sign irrelevant*/); + NewRHS = DAG.getConstant(0, NVT); + if (LC2 != RTLIB::UNKNOWN_LIBCALL) { + SDOperand Tmp = DAG.getNode(ISD::SETCC, TLI.getSetCCResultType(NewLHS), + NewLHS, NewRHS, + DAG.getCondCode(TLI.getCmpLibcallCC(LC1))); + NewLHS = MakeLibCall(LC2, NVT, Ops, 2, false/*sign irrelevant*/); + NewLHS = DAG.getNode(ISD::SETCC, TLI.getSetCCResultType(NewLHS), NewLHS, + NewRHS, DAG.getCondCode(TLI.getCmpLibcallCC(LC2))); + NewLHS = DAG.getNode(ISD::OR, Tmp.getValueType(), Tmp, NewLHS); + NewRHS = SDOperand(); + } +} + SDOperand DAGTypeLegalizer::SoftenFloatOp_BIT_CONVERT(SDNode *N) { return DAG.getNode(ISD::BIT_CONVERT, N->getValueType(0), GetSoftenedFloat(N->getOperand(0))); } +SDOperand DAGTypeLegalizer::SoftenFloatOp_BR_CC(SDNode *N) { + SDOperand NewLHS = N->getOperand(2), NewRHS = N->getOperand(3); + ISD::CondCode CCCode = cast(N->getOperand(1))->get(); + SoftenSetCCOperands(NewLHS, NewRHS, CCCode); + + // If SoftenSetCCOperands returned a scalar, we need to compare the result + // against zero to select between true and false values. + if (NewRHS.Val == 0) { + NewRHS = DAG.getConstant(0, NewLHS.getValueType()); + CCCode = ISD::SETNE; + } + + // Update N to have the operands specified. + return DAG.UpdateNodeOperands(SDOperand(N, 0), N->getOperand(0), + DAG.getCondCode(CCCode), NewLHS, NewRHS, + N->getOperand(4)); +} + +SDOperand DAGTypeLegalizer::SoftenFloatOp_SELECT_CC(SDNode *N) { + SDOperand NewLHS = N->getOperand(0), NewRHS = N->getOperand(1); + ISD::CondCode CCCode = cast(N->getOperand(4))->get(); + SoftenSetCCOperands(NewLHS, NewRHS, CCCode); + + // If SoftenSetCCOperands returned a scalar, we need to compare the result + // against zero to select between true and false values. + if (NewRHS.Val == 0) { + NewRHS = DAG.getConstant(0, NewLHS.getValueType()); + CCCode = ISD::SETNE; + } + + // Update N to have the operands specified. + return DAG.UpdateNodeOperands(SDOperand(N, 0), NewLHS, NewRHS, + N->getOperand(2), N->getOperand(3), + DAG.getCondCode(CCCode)); +} + +SDOperand DAGTypeLegalizer::SoftenFloatOp_SETCC(SDNode *N) { + SDOperand NewLHS = N->getOperand(0), NewRHS = N->getOperand(1); + ISD::CondCode CCCode = cast(N->getOperand(2))->get(); + SoftenSetCCOperands(NewLHS, NewRHS, CCCode); + + // If SoftenSetCCOperands returned a scalar, use it. + if (NewRHS.Val == 0) { + assert(NewLHS.getValueType() == N->getValueType(0) && + "Unexpected setcc expansion!"); + return NewLHS; + } + + // Otherwise, update N to have the operands specified. + return DAG.UpdateNodeOperands(SDOperand(N, 0), NewLHS, NewRHS, + DAG.getCondCode(CCCode)); +} + //===----------------------------------------------------------------------===// // Float Result Expansion @@ -477,6 +618,10 @@ case ISD::BUILD_VECTOR: Res = ExpandOp_BUILD_VECTOR(N); break; case ISD::EXTRACT_ELEMENT: Res = ExpandOp_EXTRACT_ELEMENT(N); break; + case ISD::BR_CC: Res = ExpandFloatOp_BR_CC(N); break; + case ISD::SELECT_CC: Res = ExpandFloatOp_BR_CC(N); break; + case ISD::SETCC: Res = ExpandFloatOp_BR_CC(N); break; + case ISD::STORE: Res = ExpandFloatOp_STORE(cast(N), OpNo); break; @@ -502,6 +647,87 @@ return false; } +/// FloatExpandSetCCOperands - Expand the operands of a comparison. This code +/// is shared among BR_CC, SELECT_CC, and SETCC handlers. +void DAGTypeLegalizer::FloatExpandSetCCOperands(SDOperand &NewLHS, + SDOperand &NewRHS, + ISD::CondCode &CCCode) { + SDOperand LHSLo, LHSHi, RHSLo, RHSHi; + GetExpandedFloat(NewLHS, LHSLo, LHSHi); + GetExpandedFloat(NewRHS, RHSLo, RHSHi); + + MVT VT = NewLHS.getValueType(); + assert(VT == MVT::ppcf128 && "Unsupported setcc type!"); + + // FIXME: This generated code sucks. We want to generate + // FCMP crN, hi1, hi2 + // BNE crN, L: + // FCMP crN, lo1, lo2 + // The following can be improved, but not that much. + SDOperand Tmp1, Tmp2, Tmp3; + Tmp1 = DAG.getSetCC(TLI.getSetCCResultType(LHSHi), LHSHi, RHSHi, ISD::SETEQ); + Tmp2 = DAG.getSetCC(TLI.getSetCCResultType(LHSLo), LHSLo, RHSLo, CCCode); + Tmp3 = DAG.getNode(ISD::AND, Tmp1.getValueType(), Tmp1, Tmp2); + Tmp1 = DAG.getSetCC(TLI.getSetCCResultType(LHSHi), LHSHi, RHSHi, ISD::SETNE); + Tmp2 = DAG.getSetCC(TLI.getSetCCResultType(LHSHi), LHSHi, RHSHi, CCCode); + Tmp1 = DAG.getNode(ISD::AND, Tmp1.getValueType(), Tmp1, Tmp2); + NewLHS = DAG.getNode(ISD::OR, Tmp1.getValueType(), Tmp1, Tmp3); + NewRHS = SDOperand(); // LHS is the result, not a compare. +} + +SDOperand DAGTypeLegalizer::ExpandFloatOp_BR_CC(SDNode *N) { + SDOperand NewLHS = N->getOperand(2), NewRHS = N->getOperand(3); + ISD::CondCode CCCode = cast(N->getOperand(1))->get(); + FloatExpandSetCCOperands(NewLHS, NewRHS, CCCode); + + // If ExpandSetCCOperands returned a scalar, we need to compare the result + // against zero to select between true and false values. + if (NewRHS.Val == 0) { + NewRHS = DAG.getConstant(0, NewLHS.getValueType()); + CCCode = ISD::SETNE; + } + + // Update N to have the operands specified. + return DAG.UpdateNodeOperands(SDOperand(N, 0), N->getOperand(0), + DAG.getCondCode(CCCode), NewLHS, NewRHS, + N->getOperand(4)); +} + +SDOperand DAGTypeLegalizer::ExpandFloatOp_SELECT_CC(SDNode *N) { + SDOperand NewLHS = N->getOperand(0), NewRHS = N->getOperand(1); + ISD::CondCode CCCode = cast(N->getOperand(4))->get(); + FloatExpandSetCCOperands(NewLHS, NewRHS, CCCode); + + // If ExpandSetCCOperands returned a scalar, we need to compare the result + // against zero to select between true and false values. + if (NewRHS.Val == 0) { + NewRHS = DAG.getConstant(0, NewLHS.getValueType()); + CCCode = ISD::SETNE; + } + + // Update N to have the operands specified. + return DAG.UpdateNodeOperands(SDOperand(N, 0), NewLHS, NewRHS, + N->getOperand(2), N->getOperand(3), + DAG.getCondCode(CCCode)); +} + +SDOperand DAGTypeLegalizer::ExpandFloatOp_SETCC(SDNode *N) { + SDOperand NewLHS = N->getOperand(0), NewRHS = N->getOperand(1); + ISD::CondCode CCCode = cast(N->getOperand(2))->get(); + FloatExpandSetCCOperands(NewLHS, NewRHS, CCCode); + + // If ExpandSetCCOperands returned a scalar, use it. + if (NewRHS.Val == 0) { + assert(NewLHS.getValueType() == N->getValueType(0) && + "Unexpected setcc expansion!"); + return NewLHS; + } + + // Otherwise, update N to have the operands specified. + return DAG.UpdateNodeOperands(SDOperand(N, 0), NewLHS, NewRHS, + DAG.getCondCode(CCCode)); +} + SDOperand DAGTypeLegalizer::ExpandFloatOp_STORE(SDNode *N, unsigned OpNo) { if (ISD::isNormalStore(N)) return ExpandOp_NormalStore(N, OpNo); Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp?rev=52724&r1=52723&r2=52724&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp Wed Jun 25 11:34:21 2008 @@ -441,9 +441,9 @@ case ISD::UINT_TO_FP: Res = PromoteIntOp_INT_TO_FP(N); break; case ISD::BUILD_PAIR: Res = PromoteIntOp_BUILD_PAIR(N); break; - case ISD::SELECT: Res = PromoteIntOp_SELECT(N, OpNo); break; case ISD::BRCOND: Res = PromoteIntOp_BRCOND(N, OpNo); break; case ISD::BR_CC: Res = PromoteIntOp_BR_CC(N, OpNo); break; + case ISD::SELECT: Res = PromoteIntOp_SELECT(N, OpNo); break; case ISD::SETCC: Res = PromoteIntOp_SETCC(N, OpNo); break; case ISD::STORE: Res = PromoteIntOp_STORE(cast(N), @@ -601,10 +601,6 @@ NewLHS = GetPromotedInteger(NewLHS); NewRHS = GetPromotedInteger(NewRHS); - // If this is an FP compare, the operands have already been extended. - if (!NewLHS.getValueType().isInteger()) - return; - // Otherwise, we have to insert explicit sign or zero extends. Note // that we could insert sign extends for ALL conditions, but zero extend // is cheaper on many machines (an AND instead of two shifts), so prefer @@ -622,7 +618,7 @@ // usually a simpler/cheaper operation, so prefer it. NewLHS = DAG.getZeroExtendInReg(NewLHS, VT); NewRHS = DAG.getZeroExtendInReg(NewRHS, VT); - return; + break; case ISD::SETGE: case ISD::SETGT: case ISD::SETLT: @@ -631,7 +627,7 @@ DAG.getValueType(VT)); NewRHS = DAG.getNode(ISD::SIGN_EXTEND_INREG, NewRHS.getValueType(), NewRHS, DAG.getValueType(VT)); - return; + break; } } @@ -1610,8 +1606,9 @@ Res = ExpandIntOp_UINT_TO_FP(N->getOperand(0), N->getValueType(0)); break; - case ISD::BR_CC: Res = ExpandIntOp_BR_CC(N); break; - case ISD::SETCC: Res = ExpandIntOp_SETCC(N); break; + case ISD::BR_CC: Res = ExpandIntOp_BR_CC(N); break; + case ISD::SELECT_CC: Res = ExpandIntOp_SELECT_CC(N); break; + case ISD::SETCC: Res = ExpandIntOp_SETCC(N); break; case ISD::STORE: Res = ExpandIntOp_STORE(cast(N), OpNo); @@ -1735,7 +1732,7 @@ SDOperand DAGTypeLegalizer::ExpandIntOp_BR_CC(SDNode *N) { SDOperand NewLHS = N->getOperand(2), NewRHS = N->getOperand(3); ISD::CondCode CCCode = cast(N->getOperand(1))->get(); - ExpandSetCCOperands(NewLHS, NewRHS, CCCode); + IntegerExpandSetCCOperands(NewLHS, NewRHS, CCCode); // If ExpandSetCCOperands returned a scalar, we need to compare the result // against zero to select between true and false values. @@ -1750,55 +1747,63 @@ N->getOperand(4)); } +SDOperand DAGTypeLegalizer::ExpandIntOp_SELECT_CC(SDNode *N) { + SDOperand NewLHS = N->getOperand(0), NewRHS = N->getOperand(1); + ISD::CondCode CCCode = cast(N->getOperand(4))->get(); + IntegerExpandSetCCOperands(NewLHS, NewRHS, CCCode); + + // If ExpandSetCCOperands returned a scalar, we need to compare the result + // against zero to select between true and false values. + if (NewRHS.Val == 0) { + NewRHS = DAG.getConstant(0, NewLHS.getValueType()); + CCCode = ISD::SETNE; + } + + // Update N to have the operands specified. + return DAG.UpdateNodeOperands(SDOperand(N, 0), NewLHS, NewRHS, + N->getOperand(2), N->getOperand(3), + DAG.getCondCode(CCCode)); +} + SDOperand DAGTypeLegalizer::ExpandIntOp_SETCC(SDNode *N) { SDOperand NewLHS = N->getOperand(0), NewRHS = N->getOperand(1); ISD::CondCode CCCode = cast(N->getOperand(2))->get(); - ExpandSetCCOperands(NewLHS, NewRHS, CCCode); + IntegerExpandSetCCOperands(NewLHS, NewRHS, CCCode); // If ExpandSetCCOperands returned a scalar, use it. - if (NewRHS.Val == 0) return NewLHS; + if (NewRHS.Val == 0) { + assert(NewLHS.getValueType() == N->getValueType(0) && + "Unexpected setcc expansion!"); + return NewLHS; + } // Otherwise, update N to have the operands specified. return DAG.UpdateNodeOperands(SDOperand(N, 0), NewLHS, NewRHS, DAG.getCondCode(CCCode)); } -/// ExpandSetCCOperands - Expand the operands of a comparison. This code is -/// shared among BR_CC, SELECT_CC, and SETCC handlers. -void DAGTypeLegalizer::ExpandSetCCOperands(SDOperand &NewLHS, SDOperand &NewRHS, - ISD::CondCode &CCCode) { +/// IntegerExpandSetCCOperands - Expand the operands of a comparison. This code +/// is shared among BR_CC, SELECT_CC, and SETCC handlers. +void DAGTypeLegalizer::IntegerExpandSetCCOperands(SDOperand &NewLHS, + SDOperand &NewRHS, + ISD::CondCode &CCCode) { SDOperand LHSLo, LHSHi, RHSLo, RHSHi; GetExpandedInteger(NewLHS, LHSLo, LHSHi); GetExpandedInteger(NewRHS, RHSLo, RHSHi); MVT VT = NewLHS.getValueType(); - if (VT == MVT::ppcf128) { - // FIXME: This generated code sucks. We want to generate - // FCMP crN, hi1, hi2 - // BNE crN, L: - // FCMP crN, lo1, lo2 - // The following can be improved, but not that much. - SDOperand Tmp1, Tmp2, Tmp3; - Tmp1 = DAG.getSetCC(TLI.getSetCCResultType(LHSHi), LHSHi, RHSHi, ISD::SETEQ); - Tmp2 = DAG.getSetCC(TLI.getSetCCResultType(LHSLo), LHSLo, RHSLo, CCCode); - Tmp3 = DAG.getNode(ISD::AND, Tmp1.getValueType(), Tmp1, Tmp2); - Tmp1 = DAG.getSetCC(TLI.getSetCCResultType(LHSHi), LHSHi, RHSHi, ISD::SETNE); - Tmp2 = DAG.getSetCC(TLI.getSetCCResultType(LHSHi), LHSHi, RHSHi, CCCode); - Tmp1 = DAG.getNode(ISD::AND, Tmp1.getValueType(), Tmp1, Tmp2); - NewLHS = DAG.getNode(ISD::OR, Tmp1.getValueType(), Tmp1, Tmp3); - NewRHS = SDOperand(); // LHS is the result, not a compare. - return; - } if (CCCode == ISD::SETEQ || CCCode == ISD::SETNE) { - if (RHSLo == RHSHi) - if (ConstantSDNode *RHSCST = dyn_cast(RHSLo)) + if (RHSLo == RHSHi) { + if (ConstantSDNode *RHSCST = dyn_cast(RHSLo)) { if (RHSCST->isAllOnesValue()) { // Equality comparison to -1. NewLHS = DAG.getNode(ISD::AND, LHSLo.getValueType(), LHSLo, LHSHi); NewRHS = RHSLo; return; } + } + } NewLHS = DAG.getNode(ISD::XOR, LHSLo.getValueType(), LHSLo, RHSLo); NewRHS = DAG.getNode(ISD::XOR, LHSLo.getValueType(), LHSHi, RHSHi); Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.h?rev=52724&r1=52723&r2=52724&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.h (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.h Wed Jun 25 11:34:21 2008 @@ -301,14 +301,15 @@ SDOperand ExpandIntOp_BR_CC(SDNode *N); SDOperand ExpandIntOp_BUILD_VECTOR(SDNode *N); SDOperand ExpandIntOp_EXTRACT_ELEMENT(SDNode *N); + SDOperand ExpandIntOp_SELECT_CC(SDNode *N); SDOperand ExpandIntOp_SETCC(SDNode *N); SDOperand ExpandIntOp_SINT_TO_FP(SDOperand Source, MVT DestTy); SDOperand ExpandIntOp_STORE(StoreSDNode *N, unsigned OpNo); SDOperand ExpandIntOp_TRUNCATE(SDNode *N); SDOperand ExpandIntOp_UINT_TO_FP(SDOperand Source, MVT DestTy); - void ExpandSetCCOperands(SDOperand &NewLHS, SDOperand &NewRHS, - ISD::CondCode &CCCode); + void IntegerExpandSetCCOperands(SDOperand &NewLHS, SDOperand &NewRHS, + ISD::CondCode &CCCode); //===--------------------------------------------------------------------===// // Float to Integer Conversion Support: LegalizeFloatTypes.cpp @@ -337,6 +338,12 @@ // Operand Float to Integer Conversion. bool SoftenFloatOperand(SDNode *N, unsigned OpNo); SDOperand SoftenFloatOp_BIT_CONVERT(SDNode *N); + SDOperand SoftenFloatOp_BR_CC(SDNode *N); + SDOperand SoftenFloatOp_SELECT_CC(SDNode *N); + SDOperand SoftenFloatOp_SETCC(SDNode *N); + + void SoftenSetCCOperands(SDOperand &NewLHS, SDOperand &NewRHS, + ISD::CondCode &CCCode); //===--------------------------------------------------------------------===// // Float Expansion Support: LegalizeFloatTypes.cpp @@ -351,8 +358,14 @@ // Float Operand Expansion. bool ExpandFloatOperand(SDNode *N, unsigned OperandNo); + SDOperand ExpandFloatOp_BR_CC(SDNode *N); + SDOperand ExpandFloatOp_SELECT_CC(SDNode *N); + SDOperand ExpandFloatOp_SETCC(SDNode *N); SDOperand ExpandFloatOp_STORE(SDNode *N, unsigned OpNo); + void FloatExpandSetCCOperands(SDOperand &NewLHS, SDOperand &NewRHS, + ISD::CondCode &CCCode); + //===--------------------------------------------------------------------===// // Scalarization Support: LegalizeVectorTypes.cpp //===--------------------------------------------------------------------===// From gohman at apple.com Wed Jun 25 11:39:03 2008 From: gohman at apple.com (Dan Gohman) Date: Wed, 25 Jun 2008 16:39:03 -0000 Subject: [llvm-commits] [llvm] r52725 - /llvm/trunk/lib/Target/Alpha/Alpha.h Message-ID: <200806251639.m5PGd5eW017934@zion.cs.uiuc.edu> Author: djg Date: Wed Jun 25 11:38:59 2008 New Revision: 52725 URL: http://llvm.org/viewvc/llvm-project?rev=52725&view=rev Log: SimpleInstructionSelector is here no more. Modified: llvm/trunk/lib/Target/Alpha/Alpha.h Modified: llvm/trunk/lib/Target/Alpha/Alpha.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Alpha/Alpha.h?rev=52725&r1=52724&r2=52725&view=diff ============================================================================== --- llvm/trunk/lib/Target/Alpha/Alpha.h (original) +++ llvm/trunk/lib/Target/Alpha/Alpha.h Wed Jun 25 11:38:59 2008 @@ -24,7 +24,6 @@ class TargetMachine; class MachineCodeEmitter; - FunctionPass *createAlphaSimpleInstructionSelector(TargetMachine &TM); FunctionPass *createAlphaISelDag(AlphaTargetMachine &TM); FunctionPass *createAlphaCodePrinterPass(std::ostream &OS, TargetMachine &TM); From sabre at nondot.org Wed Jun 25 11:44:10 2008 From: sabre at nondot.org (Chris Lattner) Date: Wed, 25 Jun 2008 16:44:10 -0000 Subject: [llvm-commits] [llvm] r52726 - /llvm/trunk/tools/llvm-ld/Optimize.cpp Message-ID: <200806251644.m5PGiBui018075@zion.cs.uiuc.edu> Author: lattner Date: Wed Jun 25 11:44:08 2008 New Revision: 52726 URL: http://llvm.org/viewvc/llvm-project?rev=52726&view=rev Log: remove some dead options. Modified: llvm/trunk/tools/llvm-ld/Optimize.cpp Modified: llvm/trunk/tools/llvm-ld/Optimize.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-ld/Optimize.cpp?rev=52726&r1=52725&r2=52726&view=diff ============================================================================== --- llvm/trunk/tools/llvm-ld/Optimize.cpp (original) +++ llvm/trunk/tools/llvm-ld/Optimize.cpp Wed Jun 25 11:44:08 2008 @@ -35,35 +35,6 @@ //Don't verify at the end static cl::opt DontVerify("disable-verify", cl::ReallyHidden); -// Optimization Enumeration -enum OptimizationLevels { - OPT_FAST_COMPILE = 1, - OPT_SIMPLE = 2, - OPT_AGGRESSIVE = 3, - OPT_LINK_TIME = 4, - OPT_AGGRESSIVE_LINK_TIME = 5 -}; - -// Optimization Options -static cl::opt OptLevel( - cl::desc("Choose level of optimization to apply:"), - cl::init(OPT_FAST_COMPILE), cl::values( - clEnumValN(OPT_FAST_COMPILE,"O0", - "An alias for the -O1 option."), - clEnumValN(OPT_FAST_COMPILE,"O1", - "Optimize for linking speed, not execution speed."), - clEnumValN(OPT_SIMPLE,"O2", - "Perform only required/minimal optimizations"), - clEnumValN(OPT_AGGRESSIVE,"O3", - "An alias for the -O2 option."), - clEnumValN(OPT_LINK_TIME,"O4", - "Perform standard link time optimizations"), - clEnumValN(OPT_AGGRESSIVE_LINK_TIME,"O5", - "Perform aggressive link time optimizations"), - clEnumValEnd - ) -); - static cl::opt DisableInline("disable-inlining", cl::desc("Do not run the inliner pass")); From sabre at nondot.org Wed Jun 25 11:44:53 2008 From: sabre at nondot.org (Chris Lattner) Date: Wed, 25 Jun 2008 16:44:53 -0000 Subject: [llvm-commits] [llvm] r52727 - /llvm/trunk/docs/CommandGuide/llvm-ld.pod Message-ID: <200806251644.m5PGirhd018104@zion.cs.uiuc.edu> Author: lattner Date: Wed Jun 25 11:44:52 2008 New Revision: 52727 URL: http://llvm.org/viewvc/llvm-project?rev=52727&view=rev Log: remove a bunch of dead options that never did anything. Modified: llvm/trunk/docs/CommandGuide/llvm-ld.pod Modified: llvm/trunk/docs/CommandGuide/llvm-ld.pod URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/CommandGuide/llvm-ld.pod?rev=52727&r1=52726&r2=52727&view=diff ============================================================================== --- llvm/trunk/docs/CommandGuide/llvm-ld.pod (original) +++ llvm/trunk/docs/CommandGuide/llvm-ld.pod Wed Jun 25 11:44:52 2008 @@ -159,34 +159,6 @@ =over -=item B<-O0> - -An alias for the -O1 option. - -=item B<-O1> - -Optimize for linking speed, not execution speed. The optimizer will attempt to -reduce the size of the linked program to reduce I/O but will not otherwise -perform any link-time optimizations. - -=item B<-O2> - -Perform only the minimal or required set of scalar optimizations. - -=item B<-03> - -An alias for the -O2 option. - -=item B<-04> - -Perform the standard link time inter-procedural optimizations. This will -attempt to optimize the program taking the entire program into consideration. - -=item B<-O5> - -Perform aggressive link time optimizations. This is the same as -O4 but works -more aggressively to optimize the program. - =item B<-disable-inlining> Do not run the inlining pass. Functions will not be inlined into other From sabre at nondot.org Wed Jun 25 11:51:57 2008 From: sabre at nondot.org (Chris Lattner) Date: Wed, 25 Jun 2008 16:51:57 -0000 Subject: [llvm-commits] [llvm] r52728 - /llvm/trunk/tools/llvm-ld/Optimize.cpp Message-ID: <200806251651.m5PGpvdf018346@zion.cs.uiuc.edu> Author: lattner Date: Wed Jun 25 11:51:55 2008 New Revision: 52728 URL: http://llvm.org/viewvc/llvm-project?rev=52728&view=rev Log: run mem2reg after the second jump threading pass in llvm-ld. Modified: llvm/trunk/tools/llvm-ld/Optimize.cpp Modified: llvm/trunk/tools/llvm-ld/Optimize.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-ld/Optimize.cpp?rev=52728&r1=52727&r2=52728&view=diff ============================================================================== --- llvm/trunk/tools/llvm-ld/Optimize.cpp (original) +++ llvm/trunk/tools/llvm-ld/Optimize.cpp Wed Jun 25 11:51:55 2008 @@ -148,7 +148,8 @@ addPass(Passes, createInstructionCombiningPass()); addPass(Passes, createJumpThreadingPass()); // Thread jumps. - + addPass(Passes, createPromoteMemoryToRegisterPass()); // Cleanup jumpthread. + // Delete basic blocks, which optimization passes may have killed... addPass(Passes, createCFGSimplificationPass()); From sabre at nondot.org Wed Jun 25 11:54:22 2008 From: sabre at nondot.org (Chris Lattner) Date: Wed, 25 Jun 2008 16:54:22 -0000 Subject: [llvm-commits] [llvm] r52729 - /llvm/trunk/tools/lto2/LTOCodeGenerator.cpp Message-ID: <200806251654.m5PGsMf4018421@zion.cs.uiuc.edu> Author: lattner Date: Wed Jun 25 11:54:18 2008 New Revision: 52729 URL: http://llvm.org/viewvc/llvm-project?rev=52729&view=rev Log: jump threading can introduce allocas, make sure we promote them back to registers! Modified: llvm/trunk/tools/lto2/LTOCodeGenerator.cpp Modified: llvm/trunk/tools/lto2/LTOCodeGenerator.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/lto2/LTOCodeGenerator.cpp?rev=52729&r1=52728&r2=52729&view=diff ============================================================================== --- llvm/trunk/tools/lto2/LTOCodeGenerator.cpp (original) +++ llvm/trunk/tools/lto2/LTOCodeGenerator.cpp Wed Jun 25 11:54:18 2008 @@ -386,6 +386,8 @@ // Cleanup and simplify the code after the scalar optimizations. passes.add(createInstructionCombiningPass()); passes.add(createJumpThreadingPass()); // Thread jumps. + passes.add(createPromoteMemoryToRegisterPass()); // Cleanup after threading. + // Delete basic blocks, which optimization passes may have killed... passes.add(createCFGSimplificationPass()); From baldrick at free.fr Wed Jun 25 11:58:06 2008 From: baldrick at free.fr (Duncan Sands) Date: Wed, 25 Jun 2008 16:58:06 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r52730 - /llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp Message-ID: <200806251658.m5PGw6GI018523@zion.cs.uiuc.edu> Author: baldrick Date: Wed Jun 25 11:58:04 2008 New Revision: 52730 URL: http://llvm.org/viewvc/llvm-project?rev=52730&view=rev Log: Adjust atomic intrinsic names due to name change. 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=52730&r1=52729&r2=52730&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp (original) +++ llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp Wed Jun 25 11:58:04 2008 @@ -4507,7 +4507,7 @@ Result = Builder.CreateCall(Intrinsic::getDeclaration(TheModule, - Intrinsic::atomic_lcs, + Intrinsic::atomic_cmp_swap, &Ty, 1), C, C + 3); if (((DECL_FUNCTION_CODE(fndecl)) == BUILT_IN_BOOL_COMPARE_AND_SWAP_1) || @@ -4539,7 +4539,7 @@ C[1] = Builder.CreateIntCast(C[1], Ty, "cast"); Result = Builder.CreateCall(Intrinsic::getDeclaration(TheModule, - Intrinsic::atomic_las, + Intrinsic::atomic_load_add, &Ty, 1), C, C + 2); Result = Builder.CreateIntToPtr(Result, OrigTy); @@ -4564,7 +4564,7 @@ C[1] = Builder.CreateIntCast(C[1], Ty, "cast"); Result = Builder.CreateCall(Intrinsic::getDeclaration(TheModule, - Intrinsic::atomic_lss, + Intrinsic::atomic_load_sub, &Ty, 1), C, C + 2); Result = Builder.CreateIntToPtr(Result, OrigTy); @@ -4716,7 +4716,7 @@ C[1] = Builder.CreateIntCast(C[1], Ty, "cast"); Result = Builder.CreateCall(Intrinsic::getDeclaration(TheModule, - Intrinsic::atomic_las, + Intrinsic::atomic_load_add, &Ty, 1), C, C + 2); Result = Builder.CreateAdd(Result, C[1]); @@ -4742,7 +4742,7 @@ C[1] = Builder.CreateIntCast(C[1], Ty, "cast"); Result = Builder.CreateCall(Intrinsic::getDeclaration(TheModule, - Intrinsic::atomic_lss, + Intrinsic::atomic_load_sub, &Ty, 1), C, C + 2); Result = Builder.CreateSub(Result, C[1]); From clattner at apple.com Wed Jun 25 12:04:54 2008 From: clattner at apple.com (Chris Lattner) Date: Wed, 25 Jun 2008 10:04:54 -0700 Subject: [llvm-commits] [llvm] r52217 - in /llvm/trunk: lib/Transforms/Scalar/InstructionCombining.cpp test/Transforms/InstCombine/extractvalue.ll In-Reply-To: <20080624182240.GH438@katherina.student.utwente.nl> References: <200806111405.m5BE55rj002564@zion.cs.uiuc.edu> <20080624083305.GX3816@katherina.student.utwente.nl> <889C13AE-3A76-4343-8282-A65A7DFD31AB@apple.com> <20080624182240.GH438@katherina.student.utwente.nl> Message-ID: <76FD647C-5E38-4DA7-9A7F-9AFE5BAD5117@apple.com> On Jun 24, 2008, at 11:22 AM, Matthijs Kooijman wrote: > Hi Chris, > >> X = call {a,b,c} @foo() >> >> %a = extract X, 0 >> %b = extract X, 1 >> %c = extract X, 2 >> >> >> %A = insert undef, %a, 0 >> %B = insert %A, %b, 1 >> %C = insert %B, %c, 2 >> call void @bar(%C) > I have no intention to make instcombine change the above into a call > @bar(X) > so that should work out. However, if the front end already emits > that, I don't > think we will turn it into the above. Ok. > I have been playing with a though, however, of making a multiple > return > canonicalize (or rather, a first class aggregate canonicalize) that > puts all > extractvalue instructions directly after their aggregate argument and > insertvalue instructions directly before their use. Also, it could > prevent > aggregate return values from being used directly (ie, only through > extractvalue) and force aggregate arguments to be built just before > a call > using insertvalues. Not sure what the gain from this would be yet, > though, but > it might make other passes slightly simpler. I mainly care about keeping the compiler simple... canonical forms can be great for that! > Also, I was planning on committing my flatten return value patch > sometime > soon, which also makes things slightly less complicated :-) Ok, cool. >> Seem reasonable? > I'll whip up something and we'll see what happens :-) Thanks again Matthijs! -Chris From sabre at nondot.org Wed Jun 25 12:14:12 2008 From: sabre at nondot.org (Chris Lattner) Date: Wed, 25 Jun 2008 17:14:12 -0000 Subject: [llvm-commits] [llvm] r52731 - in /llvm/trunk: include/llvm/System/Memory.h lib/System/Memory.cpp Message-ID: <200806251714.m5PHECRT019050@zion.cs.uiuc.edu> Author: lattner Date: Wed Jun 25 12:14:10 2008 New Revision: 52731 URL: http://llvm.org/viewvc/llvm-project?rev=52731&view=rev Log: Add a new InvalidateInstructionCache method to sys::Memory. Modified: llvm/trunk/include/llvm/System/Memory.h llvm/trunk/lib/System/Memory.cpp Modified: llvm/trunk/include/llvm/System/Memory.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/System/Memory.h?rev=52731&r1=52730&r2=52731&view=diff ============================================================================== --- llvm/trunk/include/llvm/System/Memory.h (original) +++ llvm/trunk/include/llvm/System/Memory.h Wed Jun 25 12:14:10 2008 @@ -39,33 +39,36 @@ /// @since 1.4 /// @brief An abstraction for memory operations. class Memory { - /// @name Functions - /// @{ - public: - /// This method allocates a block of Read/Write/Execute memory that is - /// suitable for executing dynamically generated code (e.g. JIT). An - /// attempt to allocate \p NumBytes bytes of virtual memory is made. - /// \p NearBlock may point to an existing allocation in which case - /// an attempt is made to allocate more memory near the existing block. - /// - /// On success, this returns a non-null memory block, otherwise it returns - /// a null memory block and fills in *ErrMsg. - /// - /// @brief Allocate Read/Write/Execute memory. - static MemoryBlock AllocateRWX(unsigned NumBytes, - const MemoryBlock *NearBlock, - std::string *ErrMsg = 0); + public: + /// This method allocates a block of Read/Write/Execute memory that is + /// suitable for executing dynamically generated code (e.g. JIT). An + /// attempt to allocate \p NumBytes bytes of virtual memory is made. + /// \p NearBlock may point to an existing allocation in which case + /// an attempt is made to allocate more memory near the existing block. + /// + /// On success, this returns a non-null memory block, otherwise it returns + /// a null memory block and fills in *ErrMsg. + /// + /// @brief Allocate Read/Write/Execute memory. + static MemoryBlock AllocateRWX(unsigned NumBytes, + const MemoryBlock *NearBlock, + std::string *ErrMsg = 0); - /// This method releases a block of Read/Write/Execute memory that was - /// allocated with the AllocateRWX method. It should not be used to - /// release any memory block allocated any other way. - /// - /// On success, this returns false, otherwise it returns true and fills - /// in *ErrMsg. - /// @throws std::string if an error occurred. - /// @brief Release Read/Write/Execute memory. - static bool ReleaseRWX(MemoryBlock &block, std::string *ErrMsg = 0); - /// @} + /// This method releases a block of Read/Write/Execute memory that was + /// allocated with the AllocateRWX method. It should not be used to + /// release any memory block allocated any other way. + /// + /// On success, this returns false, otherwise it returns true and fills + /// in *ErrMsg. + /// @throws std::string if an error occurred. + /// @brief Release Read/Write/Execute memory. + static bool ReleaseRWX(MemoryBlock &block, std::string *ErrMsg = 0); + + + /// InvalidateInstructionCache - Before the JIT can run a block of code + /// that has been emitted it must invalidate the instruction cache on some + /// platforms. + static void InvalidateInstructionCache(const void *Addr, size_t Len); }; } } Modified: llvm/trunk/lib/System/Memory.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/System/Memory.cpp?rev=52731&r1=52730&r2=52731&view=diff ============================================================================== --- llvm/trunk/lib/System/Memory.cpp (original) +++ llvm/trunk/lib/System/Memory.cpp Wed Jun 25 12:14:10 2008 @@ -17,12 +17,6 @@ namespace llvm { using namespace sys; - -//===----------------------------------------------------------------------===// -//=== WARNING: Implementation here must contain only TRULY operating system -//=== independent code. -//===----------------------------------------------------------------------===// - } // Include the platform-specific parts of this class. @@ -32,3 +26,34 @@ #ifdef LLVM_ON_WIN32 #include "Win32/Memory.inc" #endif + +/// InvalidateInstructionCache - Before the JIT can run a block of code +/// that has been emitted it must invalidate the instruction cache on some +/// platforms. +void llvm::sys::Memory::InvalidateInstructionCache(const void *Addr, + size_t Len) { + +// icache invalidation for PPC. +#if (defined(__POWERPC__) || defined (__ppc__) || \ + defined(_POWER) || defined(_ARCH_PPC)) + #if defined(__APPLE__) + extern "C" void sys_icache_invalidate(const void *Addr, size_t len); + sys_icache_invalidate(Addr, len); + #elif defined(__GNUC__) + const size_t LineSize = 32; + + const intptr_t Mask = ~(LineSize - 1); + const intptr_t StartLine = ((intptr_t) Addr) & Mask; + const intptr_t EndLine = ((intptr_t) Addr + len + LineSize - 1) & Mask; + + for (intptr_t Line = StartLine; Line < EndLine; Line += LineSize) + asm volatile("dcbf 0, %0" : : "r"(Line)); + asm volatile("sync"); + + for (intptr_t Line = StartLine; Line < EndLine; Line += LineSize) + asm volatile("icbi 0, %0" : : "r"(Line)); + asm volatile("isync"); + #endif +#endif // end PPC + +} \ No newline at end of file From sabre at nondot.org Wed Jun 25 12:18:02 2008 From: sabre at nondot.org (Chris Lattner) Date: Wed, 25 Jun 2008 17:18:02 -0000 Subject: [llvm-commits] [llvm] r52733 - /llvm/trunk/lib/System/Memory.cpp Message-ID: <200806251718.m5PHI3H2019193@zion.cs.uiuc.edu> Author: lattner Date: Wed Jun 25 12:17:53 2008 New Revision: 52733 URL: http://llvm.org/viewvc/llvm-project?rev=52733&view=rev Log: fix compilation errors in my previous patch Modified: llvm/trunk/lib/System/Memory.cpp Modified: llvm/trunk/lib/System/Memory.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/System/Memory.cpp?rev=52733&r1=52732&r2=52733&view=diff ============================================================================== --- llvm/trunk/lib/System/Memory.cpp (original) +++ llvm/trunk/lib/System/Memory.cpp Wed Jun 25 12:17:53 2008 @@ -27,6 +27,8 @@ #include "Win32/Memory.inc" #endif +extern "C" void sys_icache_invalidate(const void *Addr, size_t len); + /// InvalidateInstructionCache - Before the JIT can run a block of code /// that has been emitted it must invalidate the instruction cache on some /// platforms. @@ -37,14 +39,13 @@ #if (defined(__POWERPC__) || defined (__ppc__) || \ defined(_POWER) || defined(_ARCH_PPC)) #if defined(__APPLE__) - extern "C" void sys_icache_invalidate(const void *Addr, size_t len); - sys_icache_invalidate(Addr, len); + sys_icache_invalidate(Addr, Len); #elif defined(__GNUC__) const size_t LineSize = 32; const intptr_t Mask = ~(LineSize - 1); const intptr_t StartLine = ((intptr_t) Addr) & Mask; - const intptr_t EndLine = ((intptr_t) Addr + len + LineSize - 1) & Mask; + const intptr_t EndLine = ((intptr_t) Addr + Len + LineSize - 1) & Mask; for (intptr_t Line = StartLine; Line < EndLine; Line += LineSize) asm volatile("dcbf 0, %0" : : "r"(Line)); @@ -56,4 +57,4 @@ #endif #endif // end PPC -} \ No newline at end of file +} From sabre at nondot.org Wed Jun 25 12:18:44 2008 From: sabre at nondot.org (Chris Lattner) Date: Wed, 25 Jun 2008 17:18:44 -0000 Subject: [llvm-commits] [llvm] r52734 - in /llvm/trunk: include/llvm/Target/TargetJITInfo.h lib/ExecutionEngine/JIT/JITEmitter.cpp lib/Target/PowerPC/PPCJITInfo.cpp lib/Target/PowerPC/PPCJITInfo.h Message-ID: <200806251718.m5PHIiS5019231@zion.cs.uiuc.edu> Author: lattner Date: Wed Jun 25 12:18:44 2008 New Revision: 52734 URL: http://llvm.org/viewvc/llvm-project?rev=52734&view=rev Log: Switch the PPC backend and target-independent JIT to use the libsystem InvalidateInstructionCache method instead of calling through a hook on the JIT. This is a host feature, not a target feature. Modified: llvm/trunk/include/llvm/Target/TargetJITInfo.h llvm/trunk/lib/ExecutionEngine/JIT/JITEmitter.cpp llvm/trunk/lib/Target/PowerPC/PPCJITInfo.cpp llvm/trunk/lib/Target/PowerPC/PPCJITInfo.h Modified: llvm/trunk/include/llvm/Target/TargetJITInfo.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetJITInfo.h?rev=52734&r1=52733&r2=52734&view=diff ============================================================================== --- llvm/trunk/include/llvm/Target/TargetJITInfo.h (original) +++ llvm/trunk/include/llvm/Target/TargetJITInfo.h Wed Jun 25 12:18:44 2008 @@ -94,11 +94,6 @@ assert(NumRelocs == 0 && "This target does not have relocations!"); } - /// InvalidateInstructionCache - Before the JIT can run a block of code - // that has been emitted it must invalidate the instruction cache on some - // platforms. - virtual void InvalidateInstructionCache(const void *Addr, unsigned len) {} - /// needsGOT - Allows a target to specify that it would like the // JIT to manage a GOT for it. bool needsGOT() const { return useGOT; } Modified: llvm/trunk/lib/ExecutionEngine/JIT/JITEmitter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/JIT/JITEmitter.cpp?rev=52734&r1=52733&r2=52734&view=diff ============================================================================== --- llvm/trunk/lib/ExecutionEngine/JIT/JITEmitter.cpp (original) +++ llvm/trunk/lib/ExecutionEngine/JIT/JITEmitter.cpp Wed Jun 25 12:18:44 2008 @@ -32,6 +32,7 @@ #include "llvm/Support/Debug.h" #include "llvm/Support/MutexGuard.h" #include "llvm/System/Disassembler.h" +#include "llvm/System/Memory.h" #include "llvm/Target/TargetInstrInfo.h" #include "llvm/ADT/Statistic.h" #include @@ -742,7 +743,7 @@ } // Invalidate the icache if necessary. - TheJIT->getJITInfo().InvalidateInstructionCache(FnStart, FnEnd-FnStart); + sys::Memory::InvalidateInstructionCache(FnStart, FnEnd-FnStart); // Add it to the JIT symbol table if the host wants it. AddFunctionToSymbolTable(F.getFunction()->getNameStart(), Modified: llvm/trunk/lib/Target/PowerPC/PPCJITInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/PPCJITInfo.cpp?rev=52734&r1=52733&r2=52734&view=diff ============================================================================== --- llvm/trunk/lib/Target/PowerPC/PPCJITInfo.cpp (original) +++ llvm/trunk/lib/Target/PowerPC/PPCJITInfo.cpp Wed Jun 25 12:18:44 2008 @@ -17,7 +17,7 @@ #include "PPCTargetMachine.h" #include "llvm/Function.h" #include "llvm/CodeGen/MachineCodeEmitter.h" -#include "llvm/Config/alloca.h" +#include "llvm/System/Memory.h" #include "llvm/Support/Debug.h" #include using namespace llvm; @@ -330,29 +330,6 @@ extern "C" void sys_icache_invalidate(const void *Addr, size_t len); #endif -void PPCJITInfo::InvalidateInstructionCache(const void *Addr, unsigned len) { -#if (defined(__POWERPC__) || defined (__ppc__) || \ - defined(_POWER) || defined(_ARCH_PPC)) -# if defined(__APPLE__) - sys_icache_invalidate(Addr, len); -# elif defined(__GNUC__) - const size_t LineSize = 32; - - const intptr_t Mask = ~(LineSize - 1); - const intptr_t StartLine = ((intptr_t) Addr) & Mask; - const intptr_t EndLine = ((intptr_t) Addr + len + LineSize - 1) & Mask; - - for (intptr_t Line = StartLine; Line < EndLine; Line += LineSize) - asm volatile("dcbf 0, %0" : : "r"(Line)); - asm volatile("sync"); - - for (intptr_t Line = StartLine; Line < EndLine; Line += LineSize) - asm volatile("icbi 0, %0" : : "r"(Line)); - asm volatile("isync"); -# endif -#endif -} - void *PPCJITInfo::emitFunctionStub(const Function* F, void *Fn, MachineCodeEmitter &MCE) { // If this is just a call to an external function, emit a branch instead of a @@ -369,7 +346,7 @@ MCE.emitWordBE(0); MCE.emitWordBE(0); EmitBranchToAt(Addr, (intptr_t)Fn, false, is64Bit); - InvalidateInstructionCache((void*)Addr, 7*4); + sys::Memory::InvalidateInstructionCache((void*)Addr, 7*4); return MCE.finishFunctionStub(F); } @@ -397,7 +374,7 @@ MCE.emitWordBE(0); MCE.emitWordBE(0); EmitBranchToAt(BranchAddr, (intptr_t)Fn, true, is64Bit); - InvalidateInstructionCache((void*)Addr, 10*4); + sys::Memory::InvalidateInstructionCache((void*)Addr, 10*4); return MCE.finishFunctionStub(F); } Modified: llvm/trunk/lib/Target/PowerPC/PPCJITInfo.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/PPCJITInfo.h?rev=52734&r1=52733&r2=52734&view=diff ============================================================================== --- llvm/trunk/lib/Target/PowerPC/PPCJITInfo.h (original) +++ llvm/trunk/lib/Target/PowerPC/PPCJITInfo.h Wed Jun 25 12:18:44 2008 @@ -41,11 +41,6 @@ /// code. /// virtual void replaceMachineCodeForFunction(void *Old, void *New); - - /// InvalidateInstructionCache - Before the JIT can run a block of code - // that has been emitted it must invalidate the instruction cache on some - // platforms. - virtual void InvalidateInstructionCache(const void *Addr, unsigned len); }; } From nicholas at mxc.ca Wed Jun 25 12:41:11 2008 From: nicholas at mxc.ca (Nick Lewycky) Date: Wed, 25 Jun 2008 10:41:11 -0700 Subject: [llvm-commits] [llvm-gcc-4.2] r52711 - /llvm-gcc-4.2/trunk/gcc/llvm-debug.cpp In-Reply-To: <200806251041.m5PAfZan005619@zion.cs.uiuc.edu> References: <200806251041.m5PAfZan005619@zion.cs.uiuc.edu> Message-ID: <48628337.4010002@mxc.ca> Hi Bill, This commit message does not match the code change. Did you forget to commit another modified file? Bill Wendling wrote: > Author: void > Date: Wed Jun 25 05:41:27 2008 > New Revision: 52711 > > URL: http://llvm.org/viewvc/llvm-project?rev=52711&view=rev > Log: > Convert: > > >>> ATOMIC_LCS => ATOMIC_CMP_SWAP >>> ATOMIC_LAS => ATOMIC_LOAD_ADD >>> ATOMIC_LSS => ATOMIC_LOAD_SUB >>> > > > 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=52711&r1=52710&r2=52711&view=diff > > ============================================================================== > --- llvm-gcc-4.2/trunk/gcc/llvm-debug.cpp (original) > +++ llvm-gcc-4.2/trunk/gcc/llvm-debug.cpp Wed Jun 25 05:41:27 2008 > @@ -39,8 +39,6 @@ > #include "llvm/ADT/SmallVector.h" > #include "llvm/CodeGen/MachineModuleInfo.h" > > -#include > - > extern "C" { > #include "langhooks.h" > #include "toplev.h" > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits > From csdavec at swansea.ac.uk Wed Jun 25 12:50:58 2008 From: csdavec at swansea.ac.uk (David Chisnall) Date: Wed, 25 Jun 2008 18:50:58 +0100 Subject: [llvm-commits] Small JIT Fix Message-ID: <20925FEB-39A6-4844-AE92-C5245033FCBA@swan.ac.uk> Hi, This fixes assert failures when trying to JIT code containing global aliases. David -------------- next part -------------- A non-text attachment was scrubbed... Name: jit.diff Type: application/octet-stream Size: 617 bytes Desc: not available Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20080625/d4a7046e/attachment.obj -------------- next part -------------- From isanbard at gmail.com Wed Jun 25 12:58:00 2008 From: isanbard at gmail.com (Bill Wendling) Date: Wed, 25 Jun 2008 10:58:00 -0700 Subject: [llvm-commits] [llvm-gcc-4.2] r52711 - /llvm-gcc-4.2/trunk/gcc/llvm-debug.cpp In-Reply-To: <48628337.4010002@mxc.ca> References: <200806251041.m5PAfZan005619@zion.cs.uiuc.edu> <48628337.4010002@mxc.ca> Message-ID: <16e5fdf90806251058g69c8ae1cg8032c690efe7e842@mail.gmail.com> I did...doh! My excuse was it was late and I had insomnia. :-) It looks like someone (Duncan?) fixed it. -bw On Wed, Jun 25, 2008 at 10:41 AM, Nick Lewycky wrote: > Hi Bill, > > This commit message does not match the code change. Did you forget to > commit another modified file? > > Bill Wendling wrote: >> Author: void >> Date: Wed Jun 25 05:41:27 2008 >> New Revision: 52711 >> >> URL: http://llvm.org/viewvc/llvm-project?rev=52711&view=rev >> Log: >> Convert: >> >> >>>> ATOMIC_LCS => ATOMIC_CMP_SWAP >>>> ATOMIC_LAS => ATOMIC_LOAD_ADD >>>> ATOMIC_LSS => ATOMIC_LOAD_SUB >>>> >> >> >> 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=52711&r1=52710&r2=52711&view=diff >> >> ============================================================================== >> --- llvm-gcc-4.2/trunk/gcc/llvm-debug.cpp (original) >> +++ llvm-gcc-4.2/trunk/gcc/llvm-debug.cpp Wed Jun 25 05:41:27 2008 >> @@ -39,8 +39,6 @@ >> #include "llvm/ADT/SmallVector.h" >> #include "llvm/CodeGen/MachineModuleInfo.h" >> >> -#include >> - >> extern "C" { >> #include "langhooks.h" >> #include "toplev.h" >> >> >> _______________________________________________ >> 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 Wed Jun 25 12:59:03 2008 From: evan.cheng at apple.com (Evan Cheng) Date: Wed, 25 Jun 2008 10:59:03 -0700 Subject: [llvm-commits] [llvm] r52677 - in /llvm/trunk: lib/Transforms/IPO/DeadArgumentElimination.cpp test/Transforms/DeadArgElim/2008-06-23-DeadAfterLive.ll test/Transforms/DeadArgElim/deadretval2.ll test/Transforms/DeadArgElim/multdeadretval.ll In-Reply-To: <200806241630.m5OGUROm009102@zion.cs.uiuc.edu> References: <200806241630.m5OGUROm009102@zion.cs.uiuc.edu> Message-ID: <77A96C06-9C33-49DE-A06F-F8D4C48BC9F6@apple.com> Hi Matthijs, This is breaking SPEC/CFP2006/447.dealII. (Note cbe has never worked because this test uses exception handling). Do you have access to SPEC 2006? Sorry to pick on this patch. :-) I'll back this out for now. Evan On Jun 24, 2008, at 9:30 AM, Matthijs Kooijman wrote: > Author: matthijs > Date: Tue Jun 24 11:30:26 2008 > New Revision: 52677 > > URL: http://llvm.org/viewvc/llvm-project?rev=52677&view=rev > Log: > Commit the new DeadArgElim pass again, this time with the gcc > bootstrap failures fixed. > > Also add a testcase to reproduce the gcc bootstrap failure in very > much reduced form. > > Added: > llvm/trunk/test/Transforms/DeadArgElim/2008-06-23-DeadAfterLive.ll > llvm/trunk/test/Transforms/DeadArgElim/multdeadretval.ll > - copied, changed from r52595, llvm/trunk/test/Transforms/ > DeadArgElim/multdeadretval.ll > Modified: > llvm/trunk/lib/Transforms/IPO/DeadArgumentElimination.cpp > llvm/trunk/test/Transforms/DeadArgElim/deadretval2.ll > > Modified: llvm/trunk/lib/Transforms/IPO/DeadArgumentElimination.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/DeadArgumentElimination.cpp?rev=52677&r1=52676&r2=52677&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/lib/Transforms/IPO/DeadArgumentElimination.cpp > (original) > +++ llvm/trunk/lib/Transforms/IPO/DeadArgumentElimination.cpp Tue > Jun 24 11:30:26 2008 > @@ -10,10 +10,10 @@ > // This pass deletes dead arguments from internal functions. Dead > argument > // elimination removes arguments which are directly dead, as well as > arguments > // only passed into function calls as dead arguments of other > functions. This > -// pass also deletes dead arguments in a similar way. > +// pass also deletes dead return values in a similar way. > // > // This pass is often useful as a cleanup pass to run after aggressive > -// interprocedural passes, which add possibly-dead arguments. > +// interprocedural passes, which add possibly-dead arguments or > return values. > // > // > = > = > = > ----------------------------------------------------------------------= > ==// > > @@ -42,40 +42,72 @@ > /// DAE - The dead argument elimination pass. > /// > class VISIBILITY_HIDDEN DAE : public ModulePass { > + public: > + > + /// Struct that represent either a (part of a) return value or > a function > + /// argument. Used so that arguments and return values can be > used > + /// interchangably. > + struct RetOrArg { > + RetOrArg(const Function* F, unsigned Idx, bool IsArg) : F(F), > Idx(Idx), > + IsArg(IsArg) {} > + const Function *F; > + unsigned Idx; > + bool IsArg; > + > + /// Make RetOrArg comparable, so we can put it into a map > + bool operator<(const RetOrArg &O) const { > + if (F != O.F) > + return F < O.F; > + else if (Idx != O.Idx) > + return Idx < O.Idx; > + else > + return IsArg < O.IsArg; > + } > + > + /// Make RetOrArg comparable, so we can easily iterate the > multimap > + bool operator==(const RetOrArg &O) const { > + return F == O.F && Idx == O.Idx && IsArg == O.IsArg; > + } > + }; > + > /// Liveness enum - During our initial pass over the program, we > determine > - /// that things are either definately alive, definately dead, > or in need of > - /// interprocedural analysis (MaybeLive). > - /// > - enum Liveness { Live, MaybeLive, Dead }; > - > - /// LiveArguments, MaybeLiveArguments, DeadArguments - These > sets contain > - /// all of the arguments in the program. The Dead set contains > arguments > - /// which are completely dead (never used in the function). > The MaybeLive > - /// set contains arguments which are only passed into other > function calls, > - /// thus may be live and may be dead. The Live set contains > arguments which > - /// are known to be alive. > - /// > - std::set DeadArguments, MaybeLiveArguments, > LiveArguments; > - > - /// DeadRetVal, MaybeLiveRetVal, LifeRetVal - These sets > contain all of the > - /// functions in the program. The Dead set contains functions > whose return > - /// value is known to be dead. The MaybeLive set contains > functions whose > - /// return values are only used by return instructions, and the > Live set > - /// contains functions whose return values are used, functions > that are > - /// external, and functions that already return void. > - /// > - std::set DeadRetVal, MaybeLiveRetVal, LiveRetVal; > - > - /// InstructionsToInspect - As we mark arguments and return > values > - /// MaybeLive, we keep track of which instructions could make > the values > - /// live here. Once the entire program has had the return > value and > - /// arguments analyzed, this set is scanned to promote the > MaybeLive objects > - /// to be Live if they really are used. > - std::vector InstructionsToInspect; > - > - /// CallSites - Keep track of the call sites of functions that > have > - /// MaybeLive arguments or return values. > - std::multimap CallSites; > + /// that things are either alive or maybe alive. We don't mark > anything > + /// explicitely dead (even if we know they are), since anything > not alive > + /// with no registered uses (in Uses) will never be marked > alive and will > + /// thus become dead in the end. > + enum Liveness { Live, MaybeLive }; > + > + /// Convenience wrapper > + RetOrArg CreateRet(const Function *F, unsigned Idx) { > + return RetOrArg(F, Idx, false); > + } > + /// Convenience wrapper > + RetOrArg CreateArg(const Function *F, unsigned Idx) { > + return RetOrArg(F, Idx, true); > + } > + > + typedef std::multimap UseMap; > + /// This map maps a return value or argument to all return > values or > + /// arguments it uses. > + /// For example (indices are left out for clarity): > + /// - Uses[ret F] = ret G > + /// This means that F calls G, and F returns the value > returned by G. > + /// - Uses[arg F] = ret G > + /// This means that some function calls G and passes its > result as an > + /// argument to F. > + /// - Uses[ret F] = arg F > + /// This means that F returns one of its own arguments. > + /// - Uses[arg F] = arg G > + /// This means that G calls F and passes one of its own > (G's) arguments > + /// directly to F. > + UseMap Uses; > + > + typedef std::set LiveSet; > + > + /// This set contains all values that have been determined to > be live > + LiveSet LiveValues; > + > + typedef SmallVector UseVector; > > public: > static char ID; // Pass identification, replacement for typeid > @@ -85,20 +117,21 @@ > virtual bool ShouldHackArguments() const { return false; } > > private: > - Liveness getArgumentLiveness(const Argument &A); > - bool isMaybeLiveArgumentNowLive(Argument *Arg); > - > + Liveness IsMaybeLive(RetOrArg Use, UseVector &MaybeLiveUses); > + Liveness SurveyUse(Value::use_iterator U, UseVector > &MaybeLiveUses, > + unsigned RetValNum = 0); > + Liveness SurveyUses(Value *V, UseVector &MaybeLiveUses); > + > + void SurveyFunction(Function &F); > + void MarkValue(const RetOrArg &RA, Liveness L, > + const UseVector &MaybeLiveUses); > + void MarkLive(RetOrArg RA); > + bool RemoveDeadStuffFromFunction(Function *F); > bool DeleteDeadVarargs(Function &Fn); > - void SurveyFunction(Function &Fn); > - > - void MarkArgumentLive(Argument *Arg); > - void MarkRetValLive(Function *F); > - void MarkReturnInstArgumentLive(ReturnInst *RI); > - > - void RemoveDeadArgumentsFromFunction(Function *F); > }; > } > > + > char DAE::ID = 0; > static RegisterPass > X("deadargelim", "Dead Argument Elimination"); > @@ -155,7 +188,7 @@ > // remove the "..." and adjust all the calls. > > // Start by computing a new prototype for the function, which is > the same as > - // the old function, but has fewer arguments. > + // the old function, but doesn't have isVarArg set. > const FunctionType *FTy = Fn.getFunctionType(); > std::vector Params(FTy->param_begin(), FTy- > >param_end()); > FunctionType *NFTy = FunctionType::get(FTy->getReturnType(), > Params, false); > @@ -233,74 +266,154 @@ > return true; > } > > +/// Convenience function that returns the number of return values. > It returns 0 > +/// for void functions and 1 for functions not returning a struct. > It returns > +/// the number of struct elements for functions returning a struct. > +static unsigned NumRetVals(const Function *F) { > + if (F->getReturnType() == Type::VoidTy) > + return 0; > + else if (const StructType *STy = dyn_cast(F- > >getReturnType())) > + return STy->getNumElements(); > + else > + return 1; > +} > > -static inline bool CallPassesValueThoughVararg(Instruction *Call, > - const Value *Arg) { > - CallSite CS = CallSite::get(Call); > - const Type *CalledValueTy = CS.getCalledValue()->getType(); > - const Type *FTy = cast(CalledValueTy)- > >getElementType(); > - unsigned NumFixedArgs = cast(FTy)->getNumParams(); > - for (CallSite::arg_iterator AI = CS.arg_begin()+NumFixedArgs; > - AI != CS.arg_end(); ++AI) > - if (AI->get() == Arg) > - return true; > - return false; > -} > - > -// getArgumentLiveness - Inspect an argument, determining if is > known Live > -// (used in a computation), MaybeLive (only passed as an argument > to a call), or > -// Dead (not used). > -DAE::Liveness DAE::getArgumentLiveness(const Argument &A) { > - const Function *F = A.getParent(); > - > - // If this is the return value of a struct function, it's not > really dead. > - if (F->hasStructRetAttr() && &*(F->arg_begin()) == &A) > +/// IsMaybeAlive - This checks Use for liveness. If Use is live, > returns Live, > +/// else returns MaybeLive. Also, adds Use to MaybeLiveUses in the > latter case. > +DAE::Liveness DAE::IsMaybeLive(RetOrArg Use, UseVector > &MaybeLiveUses) { > + // We're live if our use is already marked as live > + if (LiveValues.count(Use)) > return Live; > - > - if (A.use_empty()) // First check, directly dead? > - return Dead; > - > - // Scan through all of the uses, looking for non-argument passing > uses. > - for (Value::use_const_iterator I = A.use_begin(), E = > A.use_end(); I!=E;++I) { > - // Return instructions do not immediately effect liveness. > - if (isa(*I)) > - continue; > - > - CallSite CS = CallSite::get(const_cast(*I)); > - if (!CS.getInstruction()) { > - // If its used by something that is not a call or invoke, > it's alive! > - return Live; > - } > - // If it's an indirect call, mark it alive... > - Function *Callee = CS.getCalledFunction(); > - if (!Callee) return Live; > - > - // Check to see if it's passed through a va_arg area: if so, we > cannot > - // remove it. > - if (CallPassesValueThoughVararg(CS.getInstruction(), &A)) > - return Live; // If passed through va_arg area, we cannot > remove it > - } > > - return MaybeLive; // It must be used, but only as argument to a > function > + // We're maybe live otherwise, but remember that we must become > live if > + // Use becomes live. > + MaybeLiveUses.push_back(Use); > + return MaybeLive; > } > > > +/// SurveyUse - This looks at a single use of an argument or return > value > +/// and determines if it should be alive or not. Adds this use to > MaybeLiveUses > +/// if it causes the used value to become MaybeAlive. > +/// > +/// RetValNum is the return value number to use when this use is > used in a > +/// return instruction. This is used in the recursion, you should > always leave > +/// it at 0. > +DAE::Liveness DAE::SurveyUse(Value::use_iterator U, UseVector > &MaybeLiveUses, > + unsigned RetValNum) { > + Value *V = *U; > + if (ReturnInst *RI = dyn_cast(V)) { > + // The value is returned from another function. It's only > live when the > + // caller's return value is live > + RetOrArg Use = CreateRet(RI->getParent()->getParent(), > RetValNum); > + // We might be live, depending on the liveness of Use > + return IsMaybeLive(Use, MaybeLiveUses); > + } > + if (InsertValueInst *IV = dyn_cast(V)) { > + if (U.getOperandNo() != > InsertValueInst::getAggregateOperandIndex() > + && IV->hasIndices()) > + // The use we are examining is inserted into an aggregate. > Our liveness > + // depends on all uses of that aggregate, but if it is used > as a return > + // value, only index at which we were inserted counts. > + RetValNum = *IV->idx_begin(); > + > + // Note that if we are used as the aggregate operand to the > insertvalue, > + // we don't change RetValNum, but do survey all our uses. > + > + Liveness Result = MaybeLive; > + for (Value::use_iterator I = IV->use_begin(), > + E = V->use_end(); I != E; ++I) { > + Result = SurveyUse(I, MaybeLiveUses, RetValNum); > + if (Result == Live) > + break; > + } > + return Result; > + } > + CallSite CS = CallSite::get(V); > + if (CS.getInstruction()) { > + Function *F = CS.getCalledFunction(); > + if (F) { > + // Used in a direct call > + > + // Check for vararg. Do - 1 to skip the first operand to > call (the > + // function itself). > + if (U.getOperandNo() - 1 >= F->getFunctionType()- > >getNumParams()) > + // The value is passed in through a vararg! Must be live. > + return Live; > + > + // Value passed to a normal call. It's only live when the > corresponding > + // argument (operand number - 1 to skip the function > pointer operand) to > + // the called function turns out live > + RetOrArg Use = CreateArg(F, U.getOperandNo() - 1); > + return IsMaybeLive(Use, MaybeLiveUses); > + } else { > + // Used in any other way? Value must be live. > + return Live; > + } > + } > + // Used in any other way? Value must be live. > + return Live; > +} > + > +/// SurveyUses - This looks at all the uses of the given return value > +/// (possibly a partial return value from a function returning a > struct). > +/// Returns the Liveness deduced from the uses of this value. > +/// > +/// Adds all uses that cause the result to be MaybeLive to > MaybeLiveRetUses. > +DAE::Liveness DAE::SurveyUses(Value *V, UseVector &MaybeLiveUses) { > + // Assume it's dead (which will only hold if there are no uses at > all..) > + Liveness Result = MaybeLive; > + // Check each use > + for (Value::use_iterator I = V->use_begin(), > + E = V->use_end(); I != E; ++I) { > + Result = SurveyUse(I, MaybeLiveUses); > + if (Result == Live) > + break; > + } > + return Result; > +} > + > // SurveyFunction - This performs the initial survey of the > specified function, > // checking out whether or not it uses any of its incoming arguments > or whether > // any callers use the return value. This fills in the > -// (Dead|MaybeLive|Live)(Arguments|RetVal) sets. > +// LiveValues set and Uses map. > // > // We consider arguments of non-internal functions to be > intrinsically alive as > // well as arguments to functions which have their "address taken". > // > void DAE::SurveyFunction(Function &F) { > bool FunctionIntrinsicallyLive = false; > - Liveness RetValLiveness = F.getReturnType() == Type::VoidTy ? > Live : Dead; > + unsigned RetCount = NumRetVals(&F); > + // Assume all return values are dead > + typedef SmallVector RetVals; > + RetVals RetValLiveness(RetCount, MaybeLive); > + > + // These vectors maps each return value to the uses that make it > MaybeLive, so > + // we can add those to the MaybeLiveRetVals list if the return > value > + // really turns out to be MaybeLive. Initializes to RetCount > empty vectors > + typedef SmallVector RetUses; > + // Intialized to a list of RetCount empty lists > + RetUses MaybeLiveRetUses(RetCount); > > - if (!F.hasInternalLinkage() && > - (!ShouldHackArguments() || F.isIntrinsic())) > + for (Function::iterator BB = F.begin(), E = F.end(); BB != E; ++BB) > + if (ReturnInst *RI = dyn_cast(BB->getTerminator())) > + if (RI->getNumOperands() != 0 && RI->getOperand(0)->getType() > + != F.getFunctionType()->getReturnType()) { > + // We don't support old style multiple return values > + FunctionIntrinsicallyLive = true; > + break; > + } > + > + if (!F.hasInternalLinkage() && (!ShouldHackArguments() || > F.isIntrinsic())) > FunctionIntrinsicallyLive = true; > - else > + > + if (!FunctionIntrinsicallyLive) { > + DOUT << "DAE - Inspecting callers for fn: " << F.getName() << > "\n"; > + // Keep track of the number of live retvals, so we can skip > checks once all > + // of them turn out to be live. > + unsigned NumLiveRetVals = 0; > + const Type *STy = dyn_cast(F.getReturnType()); > + // Loop all uses of the function > for (Value::use_iterator I = F.use_begin(), E = F.use_end(); I ! > = E; ++I) { > // If the function is PASSED IN as an argument, its address > has been taken > if (I.getOperandNo() != 0) { > @@ -316,190 +429,142 @@ > break; > } > > - // Check to see if the return value is used... > - if (RetValLiveness != Live) > - for (Value::use_iterator I = TheCall->use_begin(), > - E = TheCall->use_end(); I != E; ++I) > - if (isa(cast(*I))) { > - RetValLiveness = MaybeLive; > - } else if (isa(cast(*I)) || > - isa(cast(*I))) { > - if (CallPassesValueThoughVararg(cast(*I), > TheCall) || > - ! > CallSite::get(cast(*I)).getCalledFunction()) { > - RetValLiveness = Live; > - break; > + // If we end up here, we are looking at a direct call to our > function. > + > + // Now, check how our return value(s) is/are used in this > caller. Don't > + // bother checking return values if all of them are live > already > + if (NumLiveRetVals != RetCount) { > + if (STy) { > + // Check all uses of the return value > + for (Value::use_iterator I = TheCall->use_begin(), > + E = TheCall->use_end(); I != E; ++I) { > + ExtractValueInst *Ext = dyn_cast(*I); > + if (Ext && Ext->hasIndices()) { > + // This use uses a part of our return value, survey > the uses of > + // that part and store the results for this index only. > + unsigned Idx = *Ext->idx_begin(); > + if (RetValLiveness[Idx] != Live) { > + RetValLiveness[Idx] = SurveyUses(Ext, > MaybeLiveRetUses[Idx]); > + if (RetValLiveness[Idx] == Live) > + NumLiveRetVals++; > + } > } else { > - RetValLiveness = MaybeLive; > + // Used by something else than extractvalue. Mark all > + // return values as live. > + for (unsigned i = 0; i != RetCount; ++i ) > + RetValLiveness[i] = Live; > + NumLiveRetVals = RetCount; > + break; > } > - } else { > - RetValLiveness = Live; > - break; > } > + } else { > + // Single return value > + RetValLiveness[0] = SurveyUses(TheCall, > MaybeLiveRetUses[0]); > + if (RetValLiveness[0] == Live) > + NumLiveRetVals = RetCount; > + } > + } > } > - > + } > if (FunctionIntrinsicallyLive) { > - DOUT << " Intrinsically live fn: " << F.getName() << "\n"; > + DOUT << "DAE - Intrinsically live fn: " << F.getName() << "\n"; > + // Mark all arguments as live > + unsigned i = 0; > for (Function::arg_iterator AI = F.arg_begin(), E = F.arg_end(); > - AI != E; ++AI) > - LiveArguments.insert(AI); > - LiveRetVal.insert(&F); > + AI != E; ++AI, ++i) > + MarkLive(CreateArg(&F, i)); > + // Mark all return values as live > + i = 0; > + for (unsigned i = 0, e = RetValLiveness.size(); i != e; ++i) > + MarkLive(CreateRet(&F, i)); > return; > } > > - switch (RetValLiveness) { > - case Live: LiveRetVal.insert(&F); break; > - case MaybeLive: MaybeLiveRetVal.insert(&F); break; > - case Dead: DeadRetVal.insert(&F); break; > + // Now we've inspected all callers, record the liveness of our > return values. > + for (unsigned i = 0, e = RetValLiveness.size(); i != e; ++i) { > + RetOrArg Ret = CreateRet(&F, i); > + // Mark the result down > + MarkValue(Ret, RetValLiveness[i], MaybeLiveRetUses[i]); > + } > + DOUT << "DAE - Inspecting args for fn: " << F.getName() << "\n"; > + > + // Now, check all of our arguments > + unsigned i = 0; > + UseVector MaybeLiveArgUses; > + for (Function::arg_iterator AI = F.arg_begin(), > + E = F.arg_end(); AI != E; ++AI, ++i) { > + // See what the effect of this use is (recording any uses that > cause > + // MaybeLive in MaybeLiveArgUses) > + Liveness Result = SurveyUses(AI, MaybeLiveArgUses); > + RetOrArg Arg = CreateArg(&F, i); > + // Mark the result down > + MarkValue(Arg, Result, MaybeLiveArgUses); > + // Clear the vector again for the next iteration > + MaybeLiveArgUses.clear(); > } > +} > > - DOUT << " Inspecting args for fn: " << F.getName() << "\n"; > - > - // If it is not intrinsically alive, we know that all users of the > - // function are call sites. Mark all of the arguments live which > are > - // directly used, and keep track of all of the call sites of this > function > - // if there are any arguments we assume that are dead. > - // > - bool AnyMaybeLiveArgs = false; > - for (Function::arg_iterator AI = F.arg_begin(), E = F.arg_end(); > - AI != E; ++AI) > - switch (getArgumentLiveness(*AI)) { > - case Live: > - DOUT << " Arg live by use: " << AI->getName() << "\n"; > - LiveArguments.insert(AI); > - break; > - case Dead: > - DOUT << " Arg definitely dead: " << AI->getName() <<"\n"; > - DeadArguments.insert(AI); > - break; > +/// MarkValue - This function marks the liveness of RA depending on > L. If L is > +/// MaybeLive, it also records any uses in MaybeLiveUses such that > RA will be > +/// marked live if any use in MaybeLiveUses gets marked live later > on. > +void DAE::MarkValue(const RetOrArg &RA, Liveness L, > + const UseVector &MaybeLiveUses) { > + switch (L) { > + case Live: MarkLive(RA); break; > case MaybeLive: > - DOUT << " Arg only passed to calls: " << AI->getName() << > "\n"; > - AnyMaybeLiveArgs = true; > - MaybeLiveArguments.insert(AI); > + { > + // Note any uses of this value, so this return value can be > + // marked live whenever one of the uses becomes live. > + UseMap::iterator Where = Uses.begin(); > + for (UseVector::const_iterator UI = MaybeLiveUses.begin(), > + UE = MaybeLiveUses.end(); UI != UE; ++UI) > + Where = Uses.insert(Where, UseMap::value_type(*UI, RA)); > break; > } > - > - // If there are any "MaybeLive" arguments, we need to check > callees of > - // this function when/if they become alive. Record which > functions are > - // callees... > - if (AnyMaybeLiveArgs || RetValLiveness == MaybeLive) > - for (Value::use_iterator I = F.use_begin(), E = F.use_end(); > - I != E; ++I) { > - if (AnyMaybeLiveArgs) > - CallSites.insert(std::make_pair(&F, CallSite::get(*I))); > - > - if (RetValLiveness == MaybeLive) > - for (Value::use_iterator UI = I->use_begin(), E = I- > >use_end(); > - UI != E; ++UI) > - InstructionsToInspect.push_back(cast(*UI)); > - } > -} > - > -// isMaybeLiveArgumentNowLive - Check to see if Arg is alive. At > this point, we > -// know that the only uses of Arg are to be passed in as an > argument to a > -// function call or return. Check to see if the formal argument > passed in is in > -// the LiveArguments set. If so, return true. > -// > -bool DAE::isMaybeLiveArgumentNowLive(Argument *Arg) { > - for (Value::use_iterator I = Arg->use_begin(), E = Arg- > >use_end(); I!=E; ++I){ > - if (isa(*I)) { > - if (LiveRetVal.count(Arg->getParent())) return true; > - continue; > - } > - > - CallSite CS = CallSite::get(*I); > - > - // We know that this can only be used for direct calls... > - Function *Callee = CS.getCalledFunction(); > - > - // Loop over all of the arguments (because Arg may be passed > into the call > - // multiple times) and check to see if any are now alive... > - CallSite::arg_iterator CSAI = CS.arg_begin(); > - for (Function::arg_iterator AI = Callee->arg_begin(), E = > Callee->arg_end(); > - AI != E; ++AI, ++CSAI) > - // If this is the argument we are looking for, check to see > if it's alive > - if (*CSAI == Arg && LiveArguments.count(AI)) > - return true; > - } > - return false; > -} > - > -/// MarkArgumentLive - The MaybeLive argument 'Arg' is now known to > be alive. > -/// Mark it live in the specified sets and recursively mark > arguments in callers > -/// live that are needed to pass in a value. > -/// > -void DAE::MarkArgumentLive(Argument *Arg) { > - std::set::iterator It = > MaybeLiveArguments.lower_bound(Arg); > - if (It == MaybeLiveArguments.end() || *It != Arg) return; > - > - DOUT << " MaybeLive argument now live: " << Arg->getName() <<"\n"; > - MaybeLiveArguments.erase(It); > - LiveArguments.insert(Arg); > - > - // Loop over all of the call sites of the function, making any > arguments > - // passed in to provide a value for this argument live as > necessary. > - // > - Function *Fn = Arg->getParent(); > - unsigned ArgNo = std::distance(Fn->arg_begin(), > Function::arg_iterator(Arg)); > - > - std::multimap::iterator I = > CallSites.lower_bound(Fn); > - for (; I != CallSites.end() && I->first == Fn; ++I) { > - CallSite CS = I->second; > - Value *ArgVal = *(CS.arg_begin()+ArgNo); > - if (Argument *ActualArg = dyn_cast(ArgVal)) { > - MarkArgumentLive(ActualArg); > - } else { > - // If the value passed in at this call site is a return value > computed by > - // some other call site, make sure to mark the return value > at the other > - // call site as being needed. > - CallSite ArgCS = CallSite::get(ArgVal); > - if (ArgCS.getInstruction()) > - if (Function *Fn = ArgCS.getCalledFunction()) > - MarkRetValLive(Fn); > - } > } > } > > -/// MarkArgumentLive - The MaybeLive return value for the specified > function is > -/// now known to be alive. Propagate this fact to the return > instructions which > -/// produce it. > -void DAE::MarkRetValLive(Function *F) { > - assert(F && "Shame shame, we can't have null pointers here!"); > - > - // Check to see if we already knew it was live > - std::set::iterator I = MaybeLiveRetVal.lower_bound(F); > - if (I == MaybeLiveRetVal.end() || *I != F) return; // It's > already alive! > - > - DOUT << " MaybeLive retval now live: " << F->getName() << "\n"; > - > - MaybeLiveRetVal.erase(I); > - LiveRetVal.insert(F); // It is now known to be live! > - > - // Loop over all of the functions, noticing that the return value > is now live. > - for (Function::iterator BB = F->begin(), E = F->end(); BB != E; + > +BB) > - if (ReturnInst *RI = dyn_cast(BB->getTerminator())) > - MarkReturnInstArgumentLive(RI); > -} > - > -void DAE::MarkReturnInstArgumentLive(ReturnInst *RI) { > - Value *Op = RI->getOperand(0); > - if (Argument *A = dyn_cast(Op)) { > - MarkArgumentLive(A); > - } else if (CallInst *CI = dyn_cast(Op)) { > - if (Function *F = CI->getCalledFunction()) > - MarkRetValLive(F); > - } else if (InvokeInst *II = dyn_cast(Op)) { > - if (Function *F = II->getCalledFunction()) > - MarkRetValLive(F); > - } > -} > +/// MarkLive - Mark the given return value or argument as live. > Additionally, > +/// mark any values that are used by this value (according to Uses) > live as > +/// well. > +void DAE::MarkLive(RetOrArg RA) { > + if (!LiveValues.insert(RA).second) > + return; // We were already marked Live > + > + if (RA.IsArg) > + DOUT << "DAE - Marking argument " << RA.Idx << " to function " > + << RA.F->getNameStart() << " live\n"; > + else > + DOUT << "DAE - Marking return value " << RA.Idx << " of > function " > + << RA.F->getNameStart() << " live\n"; > > -// RemoveDeadArgumentsFromFunction - We know that F has dead > arguments, as > + // We don't use upper_bound (or equal_range) here, because our > recursive call > + // to ourselves is likely to mark the upper_bound (which is the > first value > + // not belonging to RA) to become erased and the iterator > invalidated. > + UseMap::iterator Begin = Uses.lower_bound(RA); > + UseMap::iterator E = Uses.end(); > + UseMap::iterator I; > + for (I = Begin; I != E && I->first == RA; ++I) > + MarkLive(I->second); > + > + // Erase RA from the Uses map (from the lower bound to wherever > we ended up > + // after the loop). > + Uses.erase(Begin, I); > +} > + > +// RemoveDeadStuffFromFunction - Remove any arguments and return > values from F > +// that are not in LiveValues. This function is a noop for any > Function created > +// by this function before, or any function that was not inspected > for liveness. > // specified by the DeadArguments list. Transform the function and > all of the > // callees of the function to not have these arguments. > // > -void DAE::RemoveDeadArgumentsFromFunction(Function *F) { > +bool DAE::RemoveDeadStuffFromFunction(Function *F) { > + // Quick exit path for external functions > + if (!F->hasInternalLinkage() && (!ShouldHackArguments() || F- > >isIntrinsic())) > + return false; > + > // Start by computing a new prototype for the function, which is > the same as > - // the old function, but has fewer arguments. > + // the old function, but has fewer arguments and a different > return type. > const FunctionType *FTy = F->getFunctionType(); > std::vector Params; > > @@ -510,28 +575,92 @@ > // The existing function return attributes. > ParameterAttributes RAttrs = PAL.getParamAttrs(0); > > - // Make the function return void if the return value is dead. > + > + // Find out the new return value > + > const Type *RetTy = FTy->getReturnType(); > - if (DeadRetVal.count(F)) { > - RetTy = Type::VoidTy; > - RAttrs &= ~ParamAttr::typeIncompatible(RetTy); > - DeadRetVal.erase(F); > + const Type *NRetTy; > + unsigned RetCount = NumRetVals(F); > + // Explicitely track if anything changed, for debugging > + bool Changed = false; > + // -1 means unused, other numbers are the new index > + SmallVector NewRetIdxs(RetCount, -1); > + std::vector RetTypes; > + if (RetTy != Type::VoidTy) { > + const StructType *STy = dyn_cast(RetTy); > + if (STy) > + // Look at each of the original return values individually > + for (unsigned i = 0; i != RetCount; ++i) { > + RetOrArg Ret = CreateRet(F, i); > + if (LiveValues.erase(Ret)) { > + RetTypes.push_back(STy->getElementType(i)); > + NewRetIdxs[i] = RetTypes.size() - 1; > + } else { > + ++NumRetValsEliminated; > + DOUT << "DAE - Removing return value " << i << " from " > + << F->getNameStart() << "\n"; > + Changed = true; > + } > + } > + else > + // We used to return a single value > + if (LiveValues.erase(CreateRet(F, 0))) { > + RetTypes.push_back(RetTy); > + NewRetIdxs[0] = 0; > + } else { > + DOUT << "DAE - Removing return value from " << F- > >getNameStart() > + << "\n"; > + ++NumRetValsEliminated; > + Changed = true; > + } > + if (RetTypes.size() > 1 || STy && STy->getNumElements() == > RetTypes.size()) > + // More than one return type? Return a struct with them. > Also, if we used > + // to return a struct and didn't change the number of return > values, > + // return a struct again. This prevents chaning {something} > into something > + // and {} into void. > + // Make the new struct packed if we used to return a packed > struct > + // already. > + NRetTy = StructType::get(RetTypes, STy->isPacked()); > + else if (RetTypes.size() == 1) > + // One return type? Just a simple value then, but only if we > didn't use to > + // return a struct with that simple value before. > + NRetTy = RetTypes.front(); > + else if (RetTypes.size() == 0) > + // No return types? Make it void, but only if we didn't use > to return {} > + NRetTy = Type::VoidTy; > + } else { > + NRetTy = Type::VoidTy; > } > > + // Remove any incompatible attributes > + RAttrs &= ~ParamAttr::typeIncompatible(NRetTy); > if (RAttrs) > ParamAttrsVec.push_back(ParamAttrsWithIndex::get(0, RAttrs)); > > + // Remember which arguments are still alive > + SmallVector ArgAlive(FTy->getNumParams(), false); > // Construct the new parameter list from non-dead arguments. Also > construct > - // a new set of parameter attributes to correspond. > - unsigned index = 1; > - for (Function::arg_iterator I = F->arg_begin(), E = F->arg_end(); > I != E; > - ++I, ++index) > - if (!DeadArguments.count(I)) { > + // a new set of parameter attributes to correspond. Skip the > first parameter > + // attribute, since that belongs to the return value. > + unsigned i = 0; > + for (Function::arg_iterator I = F->arg_begin(), E = F->arg_end(); > + I != E; ++I, ++i) { > + RetOrArg Arg = CreateArg(F, i); > + if (LiveValues.erase(Arg)) { > Params.push_back(I->getType()); > - > - if (ParameterAttributes Attrs = PAL.getParamAttrs(index)) > + ArgAlive[i] = true; > + > + // Get the original parameter attributes (skipping the first > one, that is > + // for the return value > + if (ParameterAttributes Attrs = PAL.getParamAttrs(i + 1)) > > ParamAttrsVec.push_back(ParamAttrsWithIndex::get(Params.size(), > Attrs)); > + } else { > + ++NumArgumentsEliminated; > + DOUT << "DAE - Removing argument " << i << " (" << I- > >getNameStart() > + << ") from " << F->getNameStart() << "\n"; > + Changed = true; > } > + } > > // Reconstruct the ParamAttrsList based on the vector we > constructed. > PAListPtr NewPAL = PAListPtr::get(ParamAttrsVec.begin(), > ParamAttrsVec.end()); > @@ -539,19 +668,33 @@ > // Work around LLVM bug PR56: the CWriter cannot emit varargs > functions which > // have zero fixed arguments. > // > + // Not that we apply this hack for a vararg fuction that does not > have any > + // arguments anymore, but did have them before (so don't bother > fixing > + // functions that were already broken wrt CWriter). > bool ExtraArgHack = false; > - if (Params.empty() && FTy->isVarArg()) { > + if (Params.empty() && FTy->isVarArg() && FTy->getNumParams() != > 0) { > ExtraArgHack = true; > Params.push_back(Type::Int32Ty); > } > > // Create the new function type based on the recomputed parameters. > - FunctionType *NFTy = FunctionType::get(RetTy, Params, FTy- > >isVarArg()); > + FunctionType *NFTy = FunctionType::get(NRetTy, Params, FTy- > >isVarArg()); > + > + // No change? > + if (NFTy == FTy) > + return false; > + > + // The function type is only allowed to be different if we > actually left out > + // an argument or return value > + assert(Changed && "Function type changed while no arguments or > retrurn values" > + "were removed!"); > > // Create the new function body and insert it into the module... > Function *NF = Function::Create(NFTy, F->getLinkage()); > NF->copyAttributesFrom(F); > NF->setParamAttrs(NewPAL); > + // Insert the new function before the old function, so we won't > be processing > + // it again > F->getParent()->getFunctionList().insert(F, NF); > NF->takeName(F); > > @@ -562,6 +705,7 @@ > while (!F->use_empty()) { > CallSite CS = CallSite::get(F->use_back()); > Instruction *Call = CS.getInstruction(); > + > ParamAttrsVec.clear(); > const PAListPtr &CallPAL = CS.getParamAttrs(); > > @@ -572,14 +716,17 @@ > if (RAttrs) > ParamAttrsVec.push_back(ParamAttrsWithIndex::get(0, RAttrs)); > > - // Loop over the operands, deleting dead ones... > - CallSite::arg_iterator AI = CS.arg_begin(); > - index = 1; > - for (Function::arg_iterator I = F->arg_begin(), E = F->arg_end(); > - I != E; ++I, ++AI, ++index) > - if (!DeadArguments.count(I)) { // Remove operands for dead > arguments > - Args.push_back(*AI); > - if (ParameterAttributes Attrs = CallPAL.getParamAttrs(index)) > + // Declare these outside of the loops, so we can reuse them for > the second > + // loop, which loops the varargs > + CallSite::arg_iterator I = CS.arg_begin(); > + unsigned i = 0; > + // Loop over those operands, corresponding to the normal > arguments to the > + // original function, and add those that are still alive. > + for (unsigned e = FTy->getNumParams(); i != e; ++I, ++i) > + if (ArgAlive[i]) { > + Args.push_back(*I); > + // Get original parameter attributes, but skip return > attributes > + if (ParameterAttributes Attrs = CallPAL.getParamAttrs(i + 1)) > > ParamAttrsVec.push_back(ParamAttrsWithIndex::get(Args.size(), Attrs)); > } > > @@ -587,9 +734,9 @@ > Args.push_back(UndefValue::get(Type::Int32Ty)); > > // Push any varargs arguments on the list. Don't forget their > attributes. > - for (; AI != CS.arg_end(); ++AI) { > - Args.push_back(*AI); > - if (ParameterAttributes Attrs = CallPAL.getParamAttrs(index++)) > + for (CallSite::arg_iterator E = CS.arg_end(); I != E; ++I, ++i) { > + Args.push_back(*I); > + if (ParameterAttributes Attrs = CallPAL.getParamAttrs(i + 1)) > > ParamAttrsVec.push_back(ParamAttrsWithIndex::get(Args.size(), Attrs)); > } > > @@ -613,11 +760,55 @@ > Args.clear(); > > if (!Call->use_empty()) { > - if (New->getType() == Type::VoidTy) > - Call->replaceAllUsesWith(Constant::getNullValue(Call- > >getType())); > - else { > + if (New->getType() == Call->getType()) { > + // Return type not changed? Just replace users then > Call->replaceAllUsesWith(New); > New->takeName(Call); > + } else if (New->getType() == Type::VoidTy) { > + // Our return value has uses, but they will get removed > later on. > + // Replace by null for now. > + Call->replaceAllUsesWith(Constant::getNullValue(Call- > >getType())); > + } else { > + assert(isa(RetTy) && "Return type changed, but > not into a" > + "void. The old return type > must have" > + "been a struct!"); > + // The original return value was a struct, update all uses > (which are > + // all extractvalue instructions). > + for (Value::use_iterator I = Call->use_begin(), E = Call- > >use_end(); > + I != E;) { > + assert(isa(*I) && "Return value not > only used by" > + "extractvalue?"); > + ExtractValueInst *EV = cast(*I); > + // Increment now, since we're about to throw away this use. > + ++I; > + assert(EV->hasIndices() && "Return value used by > extractvalue without" > + "indices?"); > + unsigned Idx = *EV->idx_begin(); > + if (NewRetIdxs[Idx] != -1) { > + if (RetTypes.size() > 1) { > + // We're still returning a struct, create a new > extractvalue > + // instruction with the first index updated > + std::vector NewIdxs(EV->idx_begin(), EV- > >idx_end()); > + NewIdxs[0] = NewRetIdxs[Idx]; > + Value *NEV = ExtractValueInst::Create(New, > NewIdxs.begin(), > + NewIdxs.end(), > "retval", > + EV); > + EV->replaceAllUsesWith(NEV); > + EV->eraseFromParent(); > + } else { > + // We are now only returning a simple value, remove the > + // extractvalue > + EV->replaceAllUsesWith(New); > + EV->eraseFromParent(); > + } > + } else { > + // Value unused, replace uses by null for now, they > will get removed > + // later on > + EV->replaceAllUsesWith(Constant::getNullValue(EV- > >getType())); > + EV->eraseFromParent(); > + } > + } > + New->takeName(Call); > } > } > > @@ -632,13 +823,11 @@ > NF->getBasicBlockList().splice(NF->begin(), F->getBasicBlockList()); > > // Loop over the argument list, transfering uses of the old > arguments over to > - // the new arguments, also transfering over the names as well. > While we're at > - // it, remove the dead arguments from the DeadArguments list. > - // > + // the new arguments, also transfering over the names as well. > + i = 0; > for (Function::arg_iterator I = F->arg_begin(), E = F->arg_end(), > - I2 = NF->arg_begin(); > - I != E; ++I) > - if (!DeadArguments.count(I)) { > + I2 = NF->arg_begin(); I != E; ++I, ++i) > + if (ArgAlive[i]) { > // If this is a live argument, move the name and users over to > the new > // version. > I->replaceAllUsesWith(I2); > @@ -646,10 +835,8 @@ > ++I2; > } else { > // If this argument is dead, replace any uses of it with null > constants > - // (these are guaranteed to only be operands to call > instructions which > - // will later be simplified). > + // (these are guaranteed to become unused later on) > I->replaceAllUsesWith(Constant::getNullValue(I->getType())); > - DeadArguments.erase(I); > } > > // If we change the return value of the function we must rewrite > any return > @@ -657,12 +844,47 @@ > if (F->getReturnType() != NF->getReturnType()) > for (Function::iterator BB = NF->begin(), E = NF->end(); BB != > E; ++BB) > if (ReturnInst *RI = dyn_cast(BB- > >getTerminator())) { > - ReturnInst::Create(0, RI); > + Value *RetVal; > + > + if (NFTy->getReturnType() == Type::VoidTy) { > + RetVal = 0; > + } else { > + assert (isa(RetTy)); > + // The original return value was a struct, insert > + // extractvalue/insertvalue chains to extract only the > values we need > + // to return and insert them into our new result. > + // This does generate messy code, but we'll let it to > instcombine to > + // clean that up > + Value *OldRet = RI->getOperand(0); > + // Start out building up our return value from undef > + RetVal = llvm::UndefValue::get(NRetTy); > + for (unsigned i = 0; i != RetCount; ++i) > + if (NewRetIdxs[i] != -1) { > + ExtractValueInst *EV = > ExtractValueInst::Create(OldRet, i, > + > "newret", RI); > + if (RetTypes.size() > 1) { > + // We're still returning a struct, so reinsert the > value into > + // our new return value at the new index > + > + RetVal = InsertValueInst::Create(RetVal, EV, > NewRetIdxs[i], > + "oldret"); > + } else { > + // We are now only returning a simple value, so > just return the > + // extracted value > + RetVal = EV; > + } > + } > + } > + // Replace the return instruction with one returning the > new return > + // value (possibly 0 if we became void). > + ReturnInst::Create(RetVal, RI); > BB->getInstList().erase(RI); > } > > // Now that the old function is dead, delete it. > F->eraseFromParent(); > + > + return true; > } > > bool DAE::runOnModule(Module &M) { > @@ -677,7 +899,7 @@ > if (F.getFunctionType()->isVarArg()) > Changed |= DeleteDeadVarargs(F); > } > - > + > // Second phase:loop through the module, determining which > arguments are live. > // We assume all arguments are dead unless proven otherwise > (allowing us to > // determine that dead arguments passed into recursive functions > are dead). > @@ -686,85 +908,14 @@ > for (Module::iterator I = M.begin(), E = M.end(); I != E; ++I) > SurveyFunction(*I); > > - // Loop over the instructions to inspect, propagating liveness > among arguments > - // and return values which are MaybeLive. > - while (!InstructionsToInspect.empty()) { > - Instruction *I = InstructionsToInspect.back(); > - InstructionsToInspect.pop_back(); > - > - if (ReturnInst *RI = dyn_cast(I)) { > - // For return instructions, we just have to check to see if > the return > - // value for the current function is known now to be alive. > If so, any > - // arguments used by it are now alive, and any call > instruction return > - // value is alive as well. > - if (LiveRetVal.count(RI->getParent()->getParent())) > - MarkReturnInstArgumentLive(RI); > - > - } else { > - CallSite CS = CallSite::get(I); > - assert(CS.getInstruction() && "Unknown instruction for the > I2I list!"); > - > - Function *Callee = CS.getCalledFunction(); > - > - // If we found a call or invoke instruction on this list, > that means that > - // an argument of the function is a call instruction. If the > argument is > - // live, then the return value of the called instruction is > now live. > - // > - CallSite::arg_iterator AI = CS.arg_begin(); // ActualIterator > - for (Function::arg_iterator FI = Callee->arg_begin(), > - E = Callee->arg_end(); FI != E; ++AI, ++FI) { > - // If this argument is another call... > - CallSite ArgCS = CallSite::get(*AI); > - if (ArgCS.getInstruction() && LiveArguments.count(FI)) > - if (Function *Callee = ArgCS.getCalledFunction()) > - MarkRetValLive(Callee); > - } > - } > + // Now, remove all dead arguments and return values from each > function in > + // turn > + for (Module::iterator I = M.begin(), E = M.end(); I != E; ) { > + // Increment now, because the function will probably get > removed (ie > + // replaced by a new one) > + Function *F = I++; > + Changed |= RemoveDeadStuffFromFunction(F); > } > > - // Now we loop over all of the MaybeLive arguments, promoting > them to be live > - // arguments if one of the calls that uses the arguments to the > calls they are > - // passed into requires them to be live. Of course this could > make other > - // arguments live, so process callers recursively. > - // > - // Because elements can be removed from the MaybeLiveArguments > set, copy it to > - // a temporary vector. > - // > - std::vector TmpArgList(MaybeLiveArguments.begin(), > - MaybeLiveArguments.end()); > - for (unsigned i = 0, e = TmpArgList.size(); i != e; ++i) { > - Argument *MLA = TmpArgList[i]; > - if (MaybeLiveArguments.count(MLA) && > - isMaybeLiveArgumentNowLive(MLA)) > - MarkArgumentLive(MLA); > - } > - > - // Recover memory early... > - CallSites.clear(); > - > - // At this point, we know that all arguments in DeadArguments and > - // MaybeLiveArguments are dead. If the two sets are empty, there > is nothing > - // to do. > - if (MaybeLiveArguments.empty() && DeadArguments.empty() && > - MaybeLiveRetVal.empty() && DeadRetVal.empty()) > - return Changed; > - > - // Otherwise, compact into one set, and start eliminating the > arguments from > - // the functions. > - DeadArguments.insert(MaybeLiveArguments.begin(), > MaybeLiveArguments.end()); > - MaybeLiveArguments.clear(); > - DeadRetVal.insert(MaybeLiveRetVal.begin(), MaybeLiveRetVal.end()); > - MaybeLiveRetVal.clear(); > - > - LiveArguments.clear(); > - LiveRetVal.clear(); > - > - NumArgumentsEliminated += DeadArguments.size(); > - NumRetValsEliminated += DeadRetVal.size(); > - while (!DeadArguments.empty()) > - RemoveDeadArgumentsFromFunction((*DeadArguments.begin())- > >getParent()); > - > - while (!DeadRetVal.empty()) > - RemoveDeadArgumentsFromFunction(*DeadRetVal.begin()); > - return true; > + return Changed; > } > > Added: llvm/trunk/test/Transforms/DeadArgElim/2008-06-23- > DeadAfterLive.ll > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/DeadArgElim/2008-06-23-DeadAfterLive.ll?rev=52677&view=auto > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/test/Transforms/DeadArgElim/2008-06-23- > DeadAfterLive.ll (added) > +++ llvm/trunk/test/Transforms/DeadArgElim/2008-06-23- > DeadAfterLive.ll Tue Jun 24 11:30:26 2008 > @@ -0,0 +1,23 @@ > +; RUN: llvm-as < %s | opt -deadargelim -die | llvm-dis > %t > +; RUN: cat %t | grep 123 > + > +; This test tries to catch wrongful removal of return values for a > specific case > +; that was break llvm-gcc builds. > + > +; This function has a live return value, it is used by @alive. > +define internal i32 @test5() { > + ret i32 123 > +} > + > +; This function doesn't use the return value @test5 and tries to > lure DAE into > +; marking @test5's return value dead because only this call is > unused. > +define i32 @dead() { > + %DEAD = call i32 @test5() > + ret i32 0 > +} > + > +; This function ensures the retval of @test5 is live. > +define i32 @alive() { > + %LIVE = call i32 @test5() > + ret i32 %LIVE > +} > > Modified: llvm/trunk/test/Transforms/DeadArgElim/deadretval2.ll > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/DeadArgElim/deadretval2.ll?rev=52677&r1=52676&r2=52677&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/test/Transforms/DeadArgElim/deadretval2.ll (original) > +++ llvm/trunk/test/Transforms/DeadArgElim/deadretval2.ll Tue Jun 24 > 11:30:26 2008 > @@ -1,4 +1,6 @@ > -; RUN: llvm-as < %s | opt -deadargelim -die | llvm-dis | not grep > DEAD > +; RUN: llvm-as < %s | opt -deadargelim -die | llvm-dis > %t > +; RUN: cat %t | not grep DEAD > +; RUN: cat %t | grep LIVE | count 4 > > @P = external global i32 ; [#uses=1] > > @@ -31,3 +33,27 @@ > %DEAD2 = call i32 @id( i32 %DEAD ) ; > [#uses=0] > ret void > } > + > +; These test if returning another functions return value properly > marks that > +; other function's return value as live. We do this twice, with the > functions in > +; different orders (ie, first the caller, than the callee and first > the callee > +; and then the caller) since DAE processes functions one by one and > handles > +; these cases slightly different. > + > +define internal i32 @test5() { > + ret i32 123 > +} > + > +define i32 @test6() { > + %LIVE = call i32 @test5() > + ret i32 %LIVE > +} > + > +define i32 @test7() { > + %LIVE = call i32 @test8() > + ret i32 %LIVE > +} > + > +define internal i32 @test8() { > + ret i32 124 > +} > > Copied: llvm/trunk/test/Transforms/DeadArgElim/multdeadretval.ll > (from r52595, llvm/trunk/test/Transforms/DeadArgElim/ > multdeadretval.ll) > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/DeadArgElim/multdeadretval.ll?p2=llvm/trunk/test/Transforms/DeadArgElim/multdeadretval.ll&p1=llvm/trunk/test/Transforms/DeadArgElim/multdeadretval.ll&r1=52595&r2=52677&rev=52677&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/test/Transforms/DeadArgElim/multdeadretval.ll > (original) > +++ llvm/trunk/test/Transforms/DeadArgElim/multdeadretval.ll Tue Jun > 24 11:30:26 2008 > @@ -0,0 +1,39 @@ > +; This test sees if return values (and arguments) are properly > removed when they > +; are unused. All unused values are typed i16, so we can easily > check. We also > +; run instcombine to fold insert/extractvalue chains and we run dce > to clean up > +; any remaining dead stuff. > +; RUN: llvm-as < %s | opt -deadargelim -instcombine -dce | llvm-dis > | not grep i16 > + > +define internal {i16, i32} @test(i16 %DEADARG) { > + %A = insertvalue {i16,i32} undef, i16 1, 0 > + %B = insertvalue {i16,i32} %A, i32 1001, 1 > + ret {i16,i32} %B > +} > + > +define internal {i32, i16} @test2() { > + %DEAD = call i16 @test4() > + %A = insertvalue {i32,i16} undef, i32 1, 0 > + %B = insertvalue {i32,i16} %A, i16 %DEAD, 1 > + ret {i32,i16} %B > +} > + > +define internal i32 @test3(i16 %A) { > + %ret = call {i16, i32} @test( i16 %A ) ; > [#uses=0] > + %DEAD = extractvalue {i16, i32} %ret, 0 > + %LIVE = extractvalue {i16, i32} %ret, 1 > + ret i32 %LIVE > +} > + > +define internal i16 @test4() { > + ret i16 0 > +} > + > +define i32 @main() { > + %ret = call {i32, i16} @test2() ; > [#uses=1] > + %LIVE = extractvalue {i32, i16} %ret, 0 > + %DEAD = extractvalue {i32, i16} %ret, 1 > + %Y = add i32 %LIVE, -123 ; [#uses=1] > + %LIVE2 = call i32 @test3(i16 %DEAD) ; > [#uses=1] > + %Z = add i32 %LIVE2, %Y ; [#uses=1] > + ret i32 %Z > +} > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From evan.cheng at apple.com Wed Jun 25 13:10:11 2008 From: evan.cheng at apple.com (Evan Cheng) Date: Wed, 25 Jun 2008 18:10:11 -0000 Subject: [llvm-commits] [llvm] r52736 - /llvm/trunk/lib/Transforms/IPO/DeadArgumentElimination.cpp Message-ID: <200806251810.m5PIABnu020870@zion.cs.uiuc.edu> Author: evancheng Date: Wed Jun 25 13:10:09 2008 New Revision: 52736 URL: http://llvm.org/viewvc/llvm-project?rev=52736&view=rev Log: Restore DeadArgElim back to 52570. It's breaking 447.dealII. Modified: llvm/trunk/lib/Transforms/IPO/DeadArgumentElimination.cpp Modified: llvm/trunk/lib/Transforms/IPO/DeadArgumentElimination.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/DeadArgumentElimination.cpp?rev=52736&r1=52735&r2=52736&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/IPO/DeadArgumentElimination.cpp (original) +++ llvm/trunk/lib/Transforms/IPO/DeadArgumentElimination.cpp Wed Jun 25 13:10:09 2008 @@ -10,10 +10,10 @@ // This pass deletes dead arguments from internal functions. Dead argument // elimination removes arguments which are directly dead, as well as arguments // only passed into function calls as dead arguments of other functions. This -// pass also deletes dead return values in a similar way. +// pass also deletes dead arguments in a similar way. // // This pass is often useful as a cleanup pass to run after aggressive -// interprocedural passes, which add possibly-dead arguments or return values. +// interprocedural passes, which add possibly-dead arguments. // //===----------------------------------------------------------------------===// @@ -42,72 +42,40 @@ /// DAE - The dead argument elimination pass. /// class VISIBILITY_HIDDEN DAE : public ModulePass { - public: - - /// Struct that represent either a (part of a) return value or a function - /// argument. Used so that arguments and return values can be used - /// interchangably. - struct RetOrArg { - RetOrArg(const Function* F, unsigned Idx, bool IsArg) : F(F), Idx(Idx), - IsArg(IsArg) {} - const Function *F; - unsigned Idx; - bool IsArg; - - /// Make RetOrArg comparable, so we can put it into a map - bool operator<(const RetOrArg &O) const { - if (F != O.F) - return F < O.F; - else if (Idx != O.Idx) - return Idx < O.Idx; - else - return IsArg < O.IsArg; - } - - /// Make RetOrArg comparable, so we can easily iterate the multimap - bool operator==(const RetOrArg &O) const { - return F == O.F && Idx == O.Idx && IsArg == O.IsArg; - } - }; - /// Liveness enum - During our initial pass over the program, we determine - /// that things are either alive or maybe alive. We don't mark anything - /// explicitly dead (even if we know they are), since anything not alive - /// with no registered uses (in Uses) will never be marked alive and will - /// thus become dead in the end. - enum Liveness { Live, MaybeLive }; - - /// Convenience wrapper - RetOrArg CreateRet(const Function *F, unsigned Idx) { - return RetOrArg(F, Idx, false); - } - /// Convenience wrapper - RetOrArg CreateArg(const Function *F, unsigned Idx) { - return RetOrArg(F, Idx, true); - } - - typedef std::multimap UseMap; - /// This map maps a return value or argument to all return values or - /// arguments it uses. - /// For example (indices are left out for clarity): - /// - Uses[ret F] = ret G - /// This means that F calls G, and F returns the value returned by G. - /// - Uses[arg F] = ret G - /// This means that some function calls G and passes its result as an - /// argument to F. - /// - Uses[ret F] = arg F - /// This means that F returns one of its own arguments. - /// - Uses[arg F] = arg G - /// This means that G calls F and passes one of its own (G's) arguments - /// directly to F. - UseMap Uses; - - typedef std::set LiveSet; - - /// This set contains all values that have been determined to be live - LiveSet LiveValues; - - typedef SmallVector UseVector; + /// that things are either definately alive, definately dead, or in need of + /// interprocedural analysis (MaybeLive). + /// + enum Liveness { Live, MaybeLive, Dead }; + + /// LiveArguments, MaybeLiveArguments, DeadArguments - These sets contain + /// all of the arguments in the program. The Dead set contains arguments + /// which are completely dead (never used in the function). The MaybeLive + /// set contains arguments which are only passed into other function calls, + /// thus may be live and may be dead. The Live set contains arguments which + /// are known to be alive. + /// + std::set DeadArguments, MaybeLiveArguments, LiveArguments; + + /// DeadRetVal, MaybeLiveRetVal, LifeRetVal - These sets contain all of the + /// functions in the program. The Dead set contains functions whose return + /// value is known to be dead. The MaybeLive set contains functions whose + /// return values are only used by return instructions, and the Live set + /// contains functions whose return values are used, functions that are + /// external, and functions that already return void. + /// + std::set DeadRetVal, MaybeLiveRetVal, LiveRetVal; + + /// InstructionsToInspect - As we mark arguments and return values + /// MaybeLive, we keep track of which instructions could make the values + /// live here. Once the entire program has had the return value and + /// arguments analyzed, this set is scanned to promote the MaybeLive objects + /// to be Live if they really are used. + std::vector InstructionsToInspect; + + /// CallSites - Keep track of the call sites of functions that have + /// MaybeLive arguments or return values. + std::multimap CallSites; public: static char ID; // Pass identification, replacement for typeid @@ -117,21 +85,20 @@ virtual bool ShouldHackArguments() const { return false; } private: - Liveness IsMaybeLive(RetOrArg Use, UseVector &MaybeLiveUses); - Liveness SurveyUse(Value::use_iterator U, UseVector &MaybeLiveUses, - unsigned RetValNum = 0); - Liveness SurveyUses(Value *V, UseVector &MaybeLiveUses); - - void SurveyFunction(Function &F); - void MarkValue(const RetOrArg &RA, Liveness L, - const UseVector &MaybeLiveUses); - void MarkLive(RetOrArg RA); - bool RemoveDeadStuffFromFunction(Function *F); + Liveness getArgumentLiveness(const Argument &A); + bool isMaybeLiveArgumentNowLive(Argument *Arg); + bool DeleteDeadVarargs(Function &Fn); + void SurveyFunction(Function &Fn); + + void MarkArgumentLive(Argument *Arg); + void MarkRetValLive(Function *F); + void MarkReturnInstArgumentLive(ReturnInst *RI); + + void RemoveDeadArgumentsFromFunction(Function *F); }; } - char DAE::ID = 0; static RegisterPass X("deadargelim", "Dead Argument Elimination"); @@ -188,7 +155,7 @@ // remove the "..." and adjust all the calls. // Start by computing a new prototype for the function, which is the same as - // the old function, but doesn't have isVarArg set. + // the old function, but has fewer arguments. const FunctionType *FTy = Fn.getFunctionType(); std::vector Params(FTy->param_begin(), FTy->param_end()); FunctionType *NFTy = FunctionType::get(FTy->getReturnType(), Params, false); @@ -266,154 +233,74 @@ return true; } -/// Convenience function that returns the number of return values. It returns 0 -/// for void functions and 1 for functions not returning a struct. It returns -/// the number of struct elements for functions returning a struct. -static unsigned NumRetVals(const Function *F) { - if (F->getReturnType() == Type::VoidTy) - return 0; - else if (const StructType *STy = dyn_cast(F->getReturnType())) - return STy->getNumElements(); - else - return 1; -} -/// IsMaybeAlive - This checks Use for liveness. If Use is live, returns Live, -/// else returns MaybeLive. Also, adds Use to MaybeLiveUses in the latter case. -DAE::Liveness DAE::IsMaybeLive(RetOrArg Use, UseVector &MaybeLiveUses) { - // We're live if our use is already marked as live - if (LiveValues.count(Use)) +static inline bool CallPassesValueThoughVararg(Instruction *Call, + const Value *Arg) { + CallSite CS = CallSite::get(Call); + const Type *CalledValueTy = CS.getCalledValue()->getType(); + const Type *FTy = cast(CalledValueTy)->getElementType(); + unsigned NumFixedArgs = cast(FTy)->getNumParams(); + for (CallSite::arg_iterator AI = CS.arg_begin()+NumFixedArgs; + AI != CS.arg_end(); ++AI) + if (AI->get() == Arg) + return true; + return false; +} + +// getArgumentLiveness - Inspect an argument, determining if is known Live +// (used in a computation), MaybeLive (only passed as an argument to a call), or +// Dead (not used). +DAE::Liveness DAE::getArgumentLiveness(const Argument &A) { + const Function *F = A.getParent(); + + // If this is the return value of a struct function, it's not really dead. + if (F->hasStructRetAttr() && &*(F->arg_begin()) == &A) return Live; + + if (A.use_empty()) // First check, directly dead? + return Dead; + + // Scan through all of the uses, looking for non-argument passing uses. + for (Value::use_const_iterator I = A.use_begin(), E = A.use_end(); I!=E;++I) { + // Return instructions do not immediately effect liveness. + if (isa(*I)) + continue; + + CallSite CS = CallSite::get(const_cast(*I)); + if (!CS.getInstruction()) { + // If its used by something that is not a call or invoke, it's alive! + return Live; + } + // If it's an indirect call, mark it alive... + Function *Callee = CS.getCalledFunction(); + if (!Callee) return Live; + + // Check to see if it's passed through a va_arg area: if so, we cannot + // remove it. + if (CallPassesValueThoughVararg(CS.getInstruction(), &A)) + return Live; // If passed through va_arg area, we cannot remove it + } - // We're maybe live otherwise, but remember that we must become live if - // Use becomes live. - MaybeLiveUses.push_back(Use); - return MaybeLive; -} - - -/// SurveyUse - This looks at a single use of an argument or return value -/// and determines if it should be alive or not. Adds this use to MaybeLiveUses -/// if it causes the used value to become MaybeAlive. -/// -/// RetValNum is the return value number to use when this use is used in a -/// return instruction. This is used in the recursion, you should always leave -/// it at 0. -DAE::Liveness DAE::SurveyUse(Value::use_iterator U, UseVector &MaybeLiveUses, - unsigned RetValNum) { - Value *V = *U; - if (ReturnInst *RI = dyn_cast(V)) { - // The value is returned from another function. It's only live when the - // caller's return value is live - RetOrArg Use = CreateRet(RI->getParent()->getParent(), RetValNum); - // We might be live, depending on the liveness of Use - return IsMaybeLive(Use, MaybeLiveUses); - } - if (InsertValueInst *IV = dyn_cast(V)) { - if (U.getOperandNo() != InsertValueInst::getAggregateOperandIndex() - && IV->hasIndices()) - // The use we are examining is inserted into an aggregate. Our liveness - // depends on all uses of that aggregate, but if it is used as a return - // value, only index at which we were inserted counts. - RetValNum = *IV->idx_begin(); - - // Note that if we are used as the aggregate operand to the insertvalue, - // we don't change RetValNum, but do survey all our uses. - - Liveness Result = MaybeLive; - for (Value::use_iterator I = IV->use_begin(), - E = V->use_end(); I != E; ++I) { - Result = SurveyUse(I, MaybeLiveUses, RetValNum); - if (Result == Live) - break; - } - return Result; - } - CallSite CS = CallSite::get(V); - if (CS.getInstruction()) { - Function *F = CS.getCalledFunction(); - if (F) { - // Used in a direct call - - // Check for vararg. Do - 1 to skip the first operand to call (the - // function itself). - if (U.getOperandNo() - 1 >= F->getFunctionType()->getNumParams()) - // The value is passed in through a vararg! Must be live. - return Live; - - // Value passed to a normal call. It's only live when the corresponding - // argument (operand number - 1 to skip the function pointer operand) to - // the called function turns out live - RetOrArg Use = CreateArg(F, U.getOperandNo() - 1); - return IsMaybeLive(Use, MaybeLiveUses); - } else { - // Used in any other way? Value must be live. - return Live; - } - } - // Used in any other way? Value must be live. - return Live; + return MaybeLive; // It must be used, but only as argument to a function } -/// SurveyUses - This looks at all the uses of the given return value -/// (possibly a partial return value from a function returning a struct). -/// Returns the Liveness deduced from the uses of this value. -/// -/// Adds all uses that cause the result to be MaybeLive to MaybeLiveRetUses. -DAE::Liveness DAE::SurveyUses(Value *V, UseVector &MaybeLiveUses) { - // Assume it's dead (which will only hold if there are no uses at all..) - Liveness Result = MaybeLive; - // Check each use - for (Value::use_iterator I = V->use_begin(), - E = V->use_end(); I != E; ++I) { - Result = SurveyUse(I, MaybeLiveUses); - if (Result == Live) - break; - } - return Result; -} // SurveyFunction - This performs the initial survey of the specified function, // checking out whether or not it uses any of its incoming arguments or whether // any callers use the return value. This fills in the -// LiveValues set and Uses map. +// (Dead|MaybeLive|Live)(Arguments|RetVal) sets. // // We consider arguments of non-internal functions to be intrinsically alive as // well as arguments to functions which have their "address taken". // void DAE::SurveyFunction(Function &F) { bool FunctionIntrinsicallyLive = false; - unsigned RetCount = NumRetVals(&F); - // Assume all return values are dead - typedef SmallVector RetVals; - RetVals RetValLiveness(RetCount, MaybeLive); - - // These vectors maps each return value to the uses that make it MaybeLive, so - // we can add those to the MaybeLiveRetVals list if the return value - // really turns out to be MaybeLive. Initializes to RetCount empty vectors - typedef SmallVector RetUses; - // Intialized to a list of RetCount empty lists - RetUses MaybeLiveRetUses(RetCount); + Liveness RetValLiveness = F.getReturnType() == Type::VoidTy ? Live : Dead; - for (Function::iterator BB = F.begin(), E = F.end(); BB != E; ++BB) - if (ReturnInst *RI = dyn_cast(BB->getTerminator())) - if (RI->getNumOperands() != 0 && RI->getOperand(0)->getType() - != F.getFunctionType()->getReturnType()) { - // We don't support old style multiple return values - FunctionIntrinsicallyLive = true; - break; - } - - if (!F.hasInternalLinkage() && (!ShouldHackArguments() || F.isIntrinsic())) + if (!F.hasInternalLinkage() && + (!ShouldHackArguments() || F.isIntrinsic())) FunctionIntrinsicallyLive = true; - - if (!FunctionIntrinsicallyLive) { - DOUT << "DAE - Inspecting callers for fn: " << F.getName() << "\n"; - // Keep track of the number of live retvals, so we can skip checks once all - // of them turn out to be live. - unsigned NumLiveRetVals = 0; - const Type *STy = dyn_cast(F.getReturnType()); - // Loop all uses of the function + else for (Value::use_iterator I = F.use_begin(), E = F.use_end(); I != E; ++I) { // If the function is PASSED IN as an argument, its address has been taken if (I.getOperandNo() != 0) { @@ -429,142 +316,190 @@ break; } - // If we end up here, we are looking at a direct call to our function. - - // Now, check how our return value(s) is/are used in this caller. Don't - // bother checking return values if all of them are live already - if (NumLiveRetVals != RetCount) { - if (STy) { - // Check all uses of the return value - for (Value::use_iterator I = TheCall->use_begin(), - E = TheCall->use_end(); I != E; ++I) { - ExtractValueInst *Ext = dyn_cast(*I); - if (Ext && Ext->hasIndices()) { - // This use uses a part of our return value, survey the uses of - // that part and store the results for this index only. - unsigned Idx = *Ext->idx_begin(); - if (RetValLiveness[Idx] != Live) { - RetValLiveness[Idx] = SurveyUses(Ext, MaybeLiveRetUses[Idx]); - if (RetValLiveness[Idx] == Live) - NumLiveRetVals++; - } - } else { - // Used by something else than extractvalue. Mark all - // return values as live. - for (unsigned i = 0; i != RetCount; ++i ) - RetValLiveness[i] = Live; - NumLiveRetVals = RetCount; + // Check to see if the return value is used... + if (RetValLiveness != Live) + for (Value::use_iterator I = TheCall->use_begin(), + E = TheCall->use_end(); I != E; ++I) + if (isa(cast(*I))) { + RetValLiveness = MaybeLive; + } else if (isa(cast(*I)) || + isa(cast(*I))) { + if (CallPassesValueThoughVararg(cast(*I), TheCall) || + !CallSite::get(cast(*I)).getCalledFunction()) { + RetValLiveness = Live; break; + } else { + RetValLiveness = MaybeLive; } + } else { + RetValLiveness = Live; + break; } - } else { - // Single return value - RetValLiveness[0] = SurveyUses(TheCall, MaybeLiveRetUses[0]); - if (RetValLiveness[0] == Live) - NumLiveRetVals = RetCount; - } - } } - } + if (FunctionIntrinsicallyLive) { - DOUT << "DAE - Intrinsically live fn: " << F.getName() << "\n"; - // Mark all arguments as live - unsigned i = 0; + DOUT << " Intrinsically live fn: " << F.getName() << "\n"; for (Function::arg_iterator AI = F.arg_begin(), E = F.arg_end(); - AI != E; ++AI, ++i) - MarkLive(CreateArg(&F, i)); - // Mark all return values as live - i = 0; - for (unsigned i = 0, e = RetValLiveness.size(); i != e; ++i) - MarkLive(CreateRet(&F, i)); + AI != E; ++AI) + LiveArguments.insert(AI); + LiveRetVal.insert(&F); return; } - // Now we've inspected all callers, record the liveness of our return values. - for (unsigned i = 0, e = RetValLiveness.size(); i != e; ++i) { - RetOrArg Ret = CreateRet(&F, i); - // Mark the result down - MarkValue(Ret, RetValLiveness[i], MaybeLiveRetUses[i]); - } - DOUT << "DAE - Inspecting args for fn: " << F.getName() << "\n"; - - // Now, check all of our arguments - unsigned i = 0; - UseVector MaybeLiveArgUses; - for (Function::arg_iterator AI = F.arg_begin(), - E = F.arg_end(); AI != E; ++AI, ++i) { - // See what the effect of this use is (recording any uses that cause - // MaybeLive in MaybeLiveArgUses) - Liveness Result = SurveyUses(AI, MaybeLiveArgUses); - RetOrArg Arg = CreateArg(&F, i); - // Mark the result down - MarkValue(Arg, Result, MaybeLiveArgUses); - // Clear the vector again for the next iteration - MaybeLiveArgUses.clear(); + switch (RetValLiveness) { + case Live: LiveRetVal.insert(&F); break; + case MaybeLive: MaybeLiveRetVal.insert(&F); break; + case Dead: DeadRetVal.insert(&F); break; } -} -/// MarkValue - This function marks the liveness of RA depending on L. If L is -/// MaybeLive, it also records any uses in MaybeLiveUses such that RA will be -/// marked live if any use in MaybeLiveUses gets marked live later on. -void DAE::MarkValue(const RetOrArg &RA, Liveness L, - const UseVector &MaybeLiveUses) { - switch (L) { - case Live: MarkLive(RA); break; + DOUT << " Inspecting args for fn: " << F.getName() << "\n"; + + // If it is not intrinsically alive, we know that all users of the + // function are call sites. Mark all of the arguments live which are + // directly used, and keep track of all of the call sites of this function + // if there are any arguments we assume that are dead. + // + bool AnyMaybeLiveArgs = false; + for (Function::arg_iterator AI = F.arg_begin(), E = F.arg_end(); + AI != E; ++AI) + switch (getArgumentLiveness(*AI)) { + case Live: + DOUT << " Arg live by use: " << AI->getName() << "\n"; + LiveArguments.insert(AI); + break; + case Dead: + DOUT << " Arg definitely dead: " << AI->getName() <<"\n"; + DeadArguments.insert(AI); + break; case MaybeLive: - { - // Note any uses of this value, so this return value can be - // marked live whenever one of the uses becomes live. - UseMap::iterator Where = Uses.begin(); - for (UseVector::const_iterator UI = MaybeLiveUses.begin(), - UE = MaybeLiveUses.end(); UI != UE; ++UI) - Where = Uses.insert(Where, UseMap::value_type(*UI, RA)); + DOUT << " Arg only passed to calls: " << AI->getName() << "\n"; + AnyMaybeLiveArgs = true; + MaybeLiveArguments.insert(AI); break; } + + // If there are any "MaybeLive" arguments, we need to check callees of + // this function when/if they become alive. Record which functions are + // callees... + if (AnyMaybeLiveArgs || RetValLiveness == MaybeLive) + for (Value::use_iterator I = F.use_begin(), E = F.use_end(); + I != E; ++I) { + if (AnyMaybeLiveArgs) + CallSites.insert(std::make_pair(&F, CallSite::get(*I))); + + if (RetValLiveness == MaybeLive) + for (Value::use_iterator UI = I->use_begin(), E = I->use_end(); + UI != E; ++UI) + InstructionsToInspect.push_back(cast(*UI)); + } +} + +// isMaybeLiveArgumentNowLive - Check to see if Arg is alive. At this point, we +// know that the only uses of Arg are to be passed in as an argument to a +// function call or return. Check to see if the formal argument passed in is in +// the LiveArguments set. If so, return true. +// +bool DAE::isMaybeLiveArgumentNowLive(Argument *Arg) { + for (Value::use_iterator I = Arg->use_begin(), E = Arg->use_end(); I!=E; ++I){ + if (isa(*I)) { + if (LiveRetVal.count(Arg->getParent())) return true; + continue; + } + + CallSite CS = CallSite::get(*I); + + // We know that this can only be used for direct calls... + Function *Callee = CS.getCalledFunction(); + + // Loop over all of the arguments (because Arg may be passed into the call + // multiple times) and check to see if any are now alive... + CallSite::arg_iterator CSAI = CS.arg_begin(); + for (Function::arg_iterator AI = Callee->arg_begin(), E = Callee->arg_end(); + AI != E; ++AI, ++CSAI) + // If this is the argument we are looking for, check to see if it's alive + if (*CSAI == Arg && LiveArguments.count(AI)) + return true; + } + return false; +} + +/// MarkArgumentLive - The MaybeLive argument 'Arg' is now known to be alive. +/// Mark it live in the specified sets and recursively mark arguments in callers +/// live that are needed to pass in a value. +/// +void DAE::MarkArgumentLive(Argument *Arg) { + std::set::iterator It = MaybeLiveArguments.lower_bound(Arg); + if (It == MaybeLiveArguments.end() || *It != Arg) return; + + DOUT << " MaybeLive argument now live: " << Arg->getName() <<"\n"; + MaybeLiveArguments.erase(It); + LiveArguments.insert(Arg); + + // Loop over all of the call sites of the function, making any arguments + // passed in to provide a value for this argument live as necessary. + // + Function *Fn = Arg->getParent(); + unsigned ArgNo = std::distance(Fn->arg_begin(), Function::arg_iterator(Arg)); + + std::multimap::iterator I = CallSites.lower_bound(Fn); + for (; I != CallSites.end() && I->first == Fn; ++I) { + CallSite CS = I->second; + Value *ArgVal = *(CS.arg_begin()+ArgNo); + if (Argument *ActualArg = dyn_cast(ArgVal)) { + MarkArgumentLive(ActualArg); + } else { + // If the value passed in at this call site is a return value computed by + // some other call site, make sure to mark the return value at the other + // call site as being needed. + CallSite ArgCS = CallSite::get(ArgVal); + if (ArgCS.getInstruction()) + if (Function *Fn = ArgCS.getCalledFunction()) + MarkRetValLive(Fn); + } } } -/// MarkLive - Mark the given return value or argument as live. Additionally, -/// mark any values that are used by this value (according to Uses) live as -/// well. -void DAE::MarkLive(RetOrArg RA) { - if (!LiveValues.insert(RA).second) - return; // We were already marked Live - - if (RA.IsArg) - DOUT << "DAE - Marking argument " << RA.Idx << " to function " - << RA.F->getNameStart() << " live\n"; - else - DOUT << "DAE - Marking return value " << RA.Idx << " of function " - << RA.F->getNameStart() << " live\n"; +/// MarkArgumentLive - The MaybeLive return value for the specified function is +/// now known to be alive. Propagate this fact to the return instructions which +/// produce it. +void DAE::MarkRetValLive(Function *F) { + assert(F && "Shame shame, we can't have null pointers here!"); + + // Check to see if we already knew it was live + std::set::iterator I = MaybeLiveRetVal.lower_bound(F); + if (I == MaybeLiveRetVal.end() || *I != F) return; // It's already alive! + + DOUT << " MaybeLive retval now live: " << F->getName() << "\n"; + + MaybeLiveRetVal.erase(I); + LiveRetVal.insert(F); // It is now known to be live! + + // Loop over all of the functions, noticing that the return value is now live. + for (Function::iterator BB = F->begin(), E = F->end(); BB != E; ++BB) + if (ReturnInst *RI = dyn_cast(BB->getTerminator())) + MarkReturnInstArgumentLive(RI); +} - // We don't use upper_bound (or equal_range) here, because our recursive call - // to ourselves is likely to mark the upper_bound (which is the first value - // not belonging to RA) to become erased and the iterator invalidated. - UseMap::iterator Begin = Uses.lower_bound(RA); - UseMap::iterator E = Uses.end(); - UseMap::iterator I; - for (I = Begin; I != E && I->first == RA; ++I) - MarkLive(I->second); - - // Erase RA from the Uses map (from the lower bound to wherever we ended up - // after the loop). - Uses.erase(Begin, I); -} - -// RemoveDeadStuffFromFunction - Remove any arguments and return values from F -// that are not in LiveValues. This function is a noop for any Function created -// by this function before, or any function that was not inspected for liveness. +void DAE::MarkReturnInstArgumentLive(ReturnInst *RI) { + Value *Op = RI->getOperand(0); + if (Argument *A = dyn_cast(Op)) { + MarkArgumentLive(A); + } else if (CallInst *CI = dyn_cast(Op)) { + if (Function *F = CI->getCalledFunction()) + MarkRetValLive(F); + } else if (InvokeInst *II = dyn_cast(Op)) { + if (Function *F = II->getCalledFunction()) + MarkRetValLive(F); + } +} + +// RemoveDeadArgumentsFromFunction - We know that F has dead arguments, as // specified by the DeadArguments list. Transform the function and all of the // callees of the function to not have these arguments. // -bool DAE::RemoveDeadStuffFromFunction(Function *F) { - // Quick exit path for external functions - if (!F->hasInternalLinkage() && (!ShouldHackArguments() || F->isIntrinsic())) - return false; - +void DAE::RemoveDeadArgumentsFromFunction(Function *F) { // Start by computing a new prototype for the function, which is the same as - // the old function, but has fewer arguments and a different return type. + // the old function, but has fewer arguments. const FunctionType *FTy = F->getFunctionType(); std::vector Params; @@ -575,94 +510,28 @@ // The existing function return attributes. ParameterAttributes RAttrs = PAL.getParamAttrs(0); - - // Find out the new return value - + // Make the function return void if the return value is dead. const Type *RetTy = FTy->getReturnType(); - const Type *NRetTy = NULL; - unsigned RetCount = NumRetVals(F); - // Explicitely track if anything changed, for debugging - bool Changed = false; - // -1 means unused, other numbers are the new index - SmallVector NewRetIdxs(RetCount, -1); - std::vector RetTypes; - if (RetTy != Type::VoidTy) { - const StructType *STy = dyn_cast(RetTy); - if (STy) - // Look at each of the original return values individually - for (unsigned i = 0; i != RetCount; ++i) { - RetOrArg Ret = CreateRet(F, i); - if (LiveValues.erase(Ret)) { - RetTypes.push_back(STy->getElementType(i)); - NewRetIdxs[i] = RetTypes.size() - 1; - } else { - ++NumRetValsEliminated; - DOUT << "DAE - Removing return value " << i << " from " - << F->getNameStart() << "\n"; - Changed = true; - } - } - else - // We used to return a single value - if (LiveValues.erase(CreateRet(F, 0))) { - RetTypes.push_back(RetTy); - NewRetIdxs[0] = 0; - } else { - DOUT << "DAE - Removing return value from " << F->getNameStart() - << "\n"; - ++NumRetValsEliminated; - Changed = true; - } - if (RetTypes.size() > 1 || (STy && STy->getNumElements()==RetTypes.size())) - // More than one return type? Return a struct with them. Also, if we used - // to return a struct and didn't change the number of return values, - // return a struct again. This prevents changing {something} into something - // and {} into void. - // Make the new struct packed if we used to return a packed struct - // already. - NRetTy = StructType::get(RetTypes, STy->isPacked()); - else if (RetTypes.size() == 1) - // One return type? Just a simple value then, but only if we didn't use to - // return a struct with that simple value before. - NRetTy = RetTypes.front(); - else if (RetTypes.size() == 0) - // No return types? Make it void, but only if we didn't use to return {}. - NRetTy = Type::VoidTy; - } else { - NRetTy = Type::VoidTy; + if (DeadRetVal.count(F)) { + RetTy = Type::VoidTy; + RAttrs &= ~ParamAttr::typeIncompatible(RetTy); + DeadRetVal.erase(F); } - assert(NRetTy && "No new return type found?"); - - // Remove any incompatible attributes - RAttrs &= ~ParamAttr::typeIncompatible(NRetTy); if (RAttrs) ParamAttrsVec.push_back(ParamAttrsWithIndex::get(0, RAttrs)); - // Remember which arguments are still alive - SmallVector ArgAlive(FTy->getNumParams(), false); // Construct the new parameter list from non-dead arguments. Also construct - // a new set of parameter attributes to correspond. Skip the first parameter - // attribute, since that belongs to the return value. - unsigned i = 0; - for (Function::arg_iterator I = F->arg_begin(), E = F->arg_end(); - I != E; ++I, ++i) { - RetOrArg Arg = CreateArg(F, i); - if (LiveValues.erase(Arg)) { + // a new set of parameter attributes to correspond. + unsigned index = 1; + for (Function::arg_iterator I = F->arg_begin(), E = F->arg_end(); I != E; + ++I, ++index) + if (!DeadArguments.count(I)) { Params.push_back(I->getType()); - ArgAlive[i] = true; - - // Get the original parameter attributes (skipping the first one, that is - // for the return value - if (ParameterAttributes Attrs = PAL.getParamAttrs(i + 1)) + + if (ParameterAttributes Attrs = PAL.getParamAttrs(index)) ParamAttrsVec.push_back(ParamAttrsWithIndex::get(Params.size(), Attrs)); - } else { - ++NumArgumentsEliminated; - DOUT << "DAE - Removing argument " << i << " (" << I->getNameStart() - << ") from " << F->getNameStart() << "\n"; - Changed = true; } - } // Reconstruct the ParamAttrsList based on the vector we constructed. PAListPtr NewPAL = PAListPtr::get(ParamAttrsVec.begin(), ParamAttrsVec.end()); @@ -670,33 +539,19 @@ // Work around LLVM bug PR56: the CWriter cannot emit varargs functions which // have zero fixed arguments. // - // Not that we apply this hack for a vararg fuction that does not have any - // arguments anymore, but did have them before (so don't bother fixing - // functions that were already broken wrt CWriter). bool ExtraArgHack = false; - if (Params.empty() && FTy->isVarArg() && FTy->getNumParams() != 0) { + if (Params.empty() && FTy->isVarArg()) { ExtraArgHack = true; Params.push_back(Type::Int32Ty); } // Create the new function type based on the recomputed parameters. - FunctionType *NFTy = FunctionType::get(NRetTy, Params, FTy->isVarArg()); - - // No change? - if (NFTy == FTy) - return false; - - // The function type is only allowed to be different if we actually left out - // an argument or return value. - assert(Changed && "Function type changed while no arguments or return values" - "were removed!"); + FunctionType *NFTy = FunctionType::get(RetTy, Params, FTy->isVarArg()); // Create the new function body and insert it into the module... Function *NF = Function::Create(NFTy, F->getLinkage()); NF->copyAttributesFrom(F); NF->setParamAttrs(NewPAL); - // Insert the new function before the old function, so we won't be processing - // it again. F->getParent()->getFunctionList().insert(F, NF); NF->takeName(F); @@ -707,7 +562,6 @@ while (!F->use_empty()) { CallSite CS = CallSite::get(F->use_back()); Instruction *Call = CS.getInstruction(); - ParamAttrsVec.clear(); const PAListPtr &CallPAL = CS.getParamAttrs(); @@ -718,17 +572,14 @@ if (RAttrs) ParamAttrsVec.push_back(ParamAttrsWithIndex::get(0, RAttrs)); - // Declare these outside of the loops, so we can reuse them for the second - // loop, which loops the varargs - CallSite::arg_iterator I = CS.arg_begin(); - unsigned i = 0; - // Loop over those operands, corresponding to the normal arguments to the - // original function, and add those that are still alive. - for (unsigned e = FTy->getNumParams(); i != e; ++I, ++i) - if (ArgAlive[i]) { - Args.push_back(*I); - // Get original parameter attributes, but skip return attributes - if (ParameterAttributes Attrs = CallPAL.getParamAttrs(i + 1)) + // Loop over the operands, deleting dead ones... + CallSite::arg_iterator AI = CS.arg_begin(); + index = 1; + for (Function::arg_iterator I = F->arg_begin(), E = F->arg_end(); + I != E; ++I, ++AI, ++index) + if (!DeadArguments.count(I)) { // Remove operands for dead arguments + Args.push_back(*AI); + if (ParameterAttributes Attrs = CallPAL.getParamAttrs(index)) ParamAttrsVec.push_back(ParamAttrsWithIndex::get(Args.size(), Attrs)); } @@ -736,9 +587,9 @@ Args.push_back(UndefValue::get(Type::Int32Ty)); // Push any varargs arguments on the list. Don't forget their attributes. - for (CallSite::arg_iterator E = CS.arg_end(); I != E; ++I, ++i) { - Args.push_back(*I); - if (ParameterAttributes Attrs = CallPAL.getParamAttrs(i + 1)) + for (; AI != CS.arg_end(); ++AI) { + Args.push_back(*AI); + if (ParameterAttributes Attrs = CallPAL.getParamAttrs(index++)) ParamAttrsVec.push_back(ParamAttrsWithIndex::get(Args.size(), Attrs)); } @@ -762,54 +613,10 @@ Args.clear(); if (!Call->use_empty()) { - if (New->getType() == Call->getType()) { - // Return type not changed? Just replace users then - Call->replaceAllUsesWith(New); - New->takeName(Call); - } else if (New->getType() == Type::VoidTy) { - // Our return value has uses, but they will get removed later on. - // Replace by null for now. + if (New->getType() == Type::VoidTy) Call->replaceAllUsesWith(Constant::getNullValue(Call->getType())); - } else { - assert(isa(RetTy) && "Return type changed, but not into a" - "void. The old return type must have" - "been a struct!"); - // The original return value was a struct, update all uses (which are - // all extractvalue instructions). - for (Value::use_iterator I = Call->use_begin(), E = Call->use_end(); - I != E;) { - assert(isa(*I) && "Return value not only used by" - "extractvalue?"); - ExtractValueInst *EV = cast(*I); - // Increment now, since we're about to throw away this use. - ++I; - assert(EV->hasIndices() && "Return value used by extractvalue without" - "indices?"); - unsigned Idx = *EV->idx_begin(); - if (NewRetIdxs[Idx] != -1) { - if (RetTypes.size() > 1) { - // We're still returning a struct, create a new extractvalue - // instruction with the first index updated - std::vector NewIdxs(EV->idx_begin(), EV->idx_end()); - NewIdxs[0] = NewRetIdxs[Idx]; - Value *NEV = ExtractValueInst::Create(New, NewIdxs.begin(), - NewIdxs.end(), "retval", - EV); - EV->replaceAllUsesWith(NEV); - EV->eraseFromParent(); - } else { - // We are now only returning a simple value, remove the - // extractvalue - EV->replaceAllUsesWith(New); - EV->eraseFromParent(); - } - } else { - // Value unused, replace uses by null for now, they will get removed - // later on - EV->replaceAllUsesWith(Constant::getNullValue(EV->getType())); - EV->eraseFromParent(); - } - } + else { + Call->replaceAllUsesWith(New); New->takeName(Call); } } @@ -825,11 +632,13 @@ NF->getBasicBlockList().splice(NF->begin(), F->getBasicBlockList()); // Loop over the argument list, transfering uses of the old arguments over to - // the new arguments, also transfering over the names as well. - i = 0; + // the new arguments, also transfering over the names as well. While we're at + // it, remove the dead arguments from the DeadArguments list. + // for (Function::arg_iterator I = F->arg_begin(), E = F->arg_end(), - I2 = NF->arg_begin(); I != E; ++I, ++i) - if (ArgAlive[i]) { + I2 = NF->arg_begin(); + I != E; ++I) + if (!DeadArguments.count(I)) { // If this is a live argument, move the name and users over to the new // version. I->replaceAllUsesWith(I2); @@ -837,8 +646,10 @@ ++I2; } else { // If this argument is dead, replace any uses of it with null constants - // (these are guaranteed to become unused later on) + // (these are guaranteed to only be operands to call instructions which + // will later be simplified). I->replaceAllUsesWith(Constant::getNullValue(I->getType())); + DeadArguments.erase(I); } // If we change the return value of the function we must rewrite any return @@ -846,47 +657,12 @@ if (F->getReturnType() != NF->getReturnType()) for (Function::iterator BB = NF->begin(), E = NF->end(); BB != E; ++BB) if (ReturnInst *RI = dyn_cast(BB->getTerminator())) { - Value *RetVal; - - if (NFTy->getReturnType() == Type::VoidTy) { - RetVal = 0; - } else { - assert (isa(RetTy)); - // The original return value was a struct, insert - // extractvalue/insertvalue chains to extract only the values we need - // to return and insert them into our new result. - // This does generate messy code, but we'll let it to instcombine to - // clean that up - Value *OldRet = RI->getOperand(0); - // Start out building up our return value from undef - RetVal = llvm::UndefValue::get(NRetTy); - for (unsigned i = 0; i != RetCount; ++i) - if (NewRetIdxs[i] != -1) { - ExtractValueInst *EV = ExtractValueInst::Create(OldRet, i, - "newret", RI); - if (RetTypes.size() > 1) { - // We're still returning a struct, so reinsert the value into - // our new return value at the new index - - RetVal = InsertValueInst::Create(RetVal, EV, NewRetIdxs[i], - "oldret"); - } else { - // We are now only returning a simple value, so just return the - // extracted value - RetVal = EV; - } - } - } - // Replace the return instruction with one returning the new return - // value (possibly 0 if we became void). - ReturnInst::Create(RetVal, RI); + ReturnInst::Create(0, RI); BB->getInstList().erase(RI); } // Now that the old function is dead, delete it. F->eraseFromParent(); - - return true; } bool DAE::runOnModule(Module &M) { @@ -901,7 +677,7 @@ if (F.getFunctionType()->isVarArg()) Changed |= DeleteDeadVarargs(F); } - + // Second phase:loop through the module, determining which arguments are live. // We assume all arguments are dead unless proven otherwise (allowing us to // determine that dead arguments passed into recursive functions are dead). @@ -910,14 +686,85 @@ for (Module::iterator I = M.begin(), E = M.end(); I != E; ++I) SurveyFunction(*I); - // Now, remove all dead arguments and return values from each function in - // turn - for (Module::iterator I = M.begin(), E = M.end(); I != E; ) { - // Increment now, because the function will probably get removed (ie - // replaced by a new one) - Function *F = I++; - Changed |= RemoveDeadStuffFromFunction(F); + // Loop over the instructions to inspect, propagating liveness among arguments + // and return values which are MaybeLive. + while (!InstructionsToInspect.empty()) { + Instruction *I = InstructionsToInspect.back(); + InstructionsToInspect.pop_back(); + + if (ReturnInst *RI = dyn_cast(I)) { + // For return instructions, we just have to check to see if the return + // value for the current function is known now to be alive. If so, any + // arguments used by it are now alive, and any call instruction return + // value is alive as well. + if (LiveRetVal.count(RI->getParent()->getParent())) + MarkReturnInstArgumentLive(RI); + + } else { + CallSite CS = CallSite::get(I); + assert(CS.getInstruction() && "Unknown instruction for the I2I list!"); + + Function *Callee = CS.getCalledFunction(); + + // If we found a call or invoke instruction on this list, that means that + // an argument of the function is a call instruction. If the argument is + // live, then the return value of the called instruction is now live. + // + CallSite::arg_iterator AI = CS.arg_begin(); // ActualIterator + for (Function::arg_iterator FI = Callee->arg_begin(), + E = Callee->arg_end(); FI != E; ++AI, ++FI) { + // If this argument is another call... + CallSite ArgCS = CallSite::get(*AI); + if (ArgCS.getInstruction() && LiveArguments.count(FI)) + if (Function *Callee = ArgCS.getCalledFunction()) + MarkRetValLive(Callee); + } + } } - return Changed; + // Now we loop over all of the MaybeLive arguments, promoting them to be live + // arguments if one of the calls that uses the arguments to the calls they are + // passed into requires them to be live. Of course this could make other + // arguments live, so process callers recursively. + // + // Because elements can be removed from the MaybeLiveArguments set, copy it to + // a temporary vector. + // + std::vector TmpArgList(MaybeLiveArguments.begin(), + MaybeLiveArguments.end()); + for (unsigned i = 0, e = TmpArgList.size(); i != e; ++i) { + Argument *MLA = TmpArgList[i]; + if (MaybeLiveArguments.count(MLA) && + isMaybeLiveArgumentNowLive(MLA)) + MarkArgumentLive(MLA); + } + + // Recover memory early... + CallSites.clear(); + + // At this point, we know that all arguments in DeadArguments and + // MaybeLiveArguments are dead. If the two sets are empty, there is nothing + // to do. + if (MaybeLiveArguments.empty() && DeadArguments.empty() && + MaybeLiveRetVal.empty() && DeadRetVal.empty()) + return Changed; + + // Otherwise, compact into one set, and start eliminating the arguments from + // the functions. + DeadArguments.insert(MaybeLiveArguments.begin(), MaybeLiveArguments.end()); + MaybeLiveArguments.clear(); + DeadRetVal.insert(MaybeLiveRetVal.begin(), MaybeLiveRetVal.end()); + MaybeLiveRetVal.clear(); + + LiveArguments.clear(); + LiveRetVal.clear(); + + NumArgumentsEliminated += DeadArguments.size(); + NumRetValsEliminated += DeadRetVal.size(); + while (!DeadArguments.empty()) + RemoveDeadArgumentsFromFunction((*DeadArguments.begin())->getParent()); + + while (!DeadRetVal.empty()) + RemoveDeadArgumentsFromFunction(*DeadRetVal.begin()); + return true; } From tilmann.scheller at googlemail.com Wed Jun 25 13:57:22 2008 From: tilmann.scheller at googlemail.com (Tilmann Scheller) Date: Wed, 25 Jun 2008 18:57:22 -0000 Subject: [llvm-commits] [vmkit] r52737 - /vmkit/trunk/lib/Main.cpp Message-ID: <200806251857.m5PIvM8N022606@zion.cs.uiuc.edu> Author: tilmann Date: Wed Jun 25 13:57:20 2008 New Revision: 52737 URL: http://llvm.org/viewvc/llvm-project?rev=52737&view=rev Log: test commit Modified: vmkit/trunk/lib/Main.cpp Modified: vmkit/trunk/lib/Main.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/Main.cpp?rev=52737&r1=52736&r2=52737&view=diff ============================================================================== --- vmkit/trunk/lib/Main.cpp (original) +++ vmkit/trunk/lib/Main.cpp Wed Jun 25 13:57:20 2008 @@ -16,7 +16,6 @@ using namespace mvm; - extern "C" int boot(); extern "C" int start_app(int, char**); From sabre at nondot.org Wed Jun 25 15:21:54 2008 From: sabre at nondot.org (Chris Lattner) Date: Wed, 25 Jun 2008 20:21:54 -0000 Subject: [llvm-commits] [llvm] r52738 - /llvm/trunk/lib/ExecutionEngine/JIT/JITEmitter.cpp Message-ID: <200806252022.m5PKM0uk025378@zion.cs.uiuc.edu> Author: lattner Date: Wed Jun 25 15:21:35 2008 New Revision: 52738 URL: http://llvm.org/viewvc/llvm-project?rev=52738&view=rev Log: Implement JIT support for global aliases, patch by David Chisnall! Modified: llvm/trunk/lib/ExecutionEngine/JIT/JITEmitter.cpp Modified: llvm/trunk/lib/ExecutionEngine/JIT/JITEmitter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/JIT/JITEmitter.cpp?rev=52738&r1=52737&r2=52738&view=diff ============================================================================== --- llvm/trunk/lib/ExecutionEngine/JIT/JITEmitter.cpp (original) +++ llvm/trunk/lib/ExecutionEngine/JIT/JITEmitter.cpp Wed Jun 25 15:21:35 2008 @@ -551,6 +551,8 @@ /// global immediately instead of queuing it for codegen later! return TheJIT->getOrEmitGlobalVariable(GV); } + if (GlobalAlias *GA = dyn_cast(V)) + return TheJIT->getPointerToGlobal(GA->resolveAliasedGlobal()); // If we have already compiled the function, return a pointer to its body. Function *F = cast(V); From clattner at apple.com Wed Jun 25 15:23:07 2008 From: clattner at apple.com (Chris Lattner) Date: Wed, 25 Jun 2008 13:23:07 -0700 Subject: [llvm-commits] Small JIT Fix In-Reply-To: <20925FEB-39A6-4844-AE92-C5245033FCBA@swan.ac.uk> References: <20925FEB-39A6-4844-AE92-C5245033FCBA@swan.ac.uk> Message-ID: <10AB37A2-2F54-4007-89B8-065331F0F208@apple.com> On Jun 25, 2008, at 10:50 AM, David Chisnall wrote: > Hi, > > This fixes assert failures when trying to JIT code containing global > aliases. Applied, thanks! http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20080623/064166.html From baldrick at free.fr Wed Jun 25 15:24:59 2008 From: baldrick at free.fr (Duncan Sands) Date: Wed, 25 Jun 2008 20:24:59 -0000 Subject: [llvm-commits] [llvm] r52739 - in /llvm/trunk: include/llvm/CodeGen/RuntimeLibcalls.h include/llvm/CodeGen/SelectionDAGNodes.h lib/CodeGen/SelectionDAG/LegalizeFloatTypes.cpp lib/CodeGen/SelectionDAG/LegalizeTypes.h lib/CodeGen/SelectionDAG/SelectionDAG.cpp lib/CodeGen/SelectionDAG/TargetLowering.cpp Message-ID: <200806252025.m5PKP2Mt025477@zion.cs.uiuc.edu> Author: baldrick Date: Wed Jun 25 15:24:48 2008 New Revision: 52739 URL: http://llvm.org/viewvc/llvm-project?rev=52739&view=rev Log: Add support for expanding PPC 128 bit floats. For this it is convenient to permit floats to be used with EXTRACT_ELEMENT, so I tweaked things to allow that. I also added libcalls for ppcf128 to i32 forms of FP_TO_XINT, since they exist in libgcc and this case can certainly occur (and does occur in the testsuite) - before the i64 libcall was being used. Also, the XINT_TO_FP result seemed to be wrong when the argument is an i128: the wrong fudge factor was added (the i32 and i64 cases were handled directly, but the i128 code fell through to some generic softening code which seemed to think it was i64 to f32!). So I fixed it by adding a fudge factor that I found in my breakfast cereal. Modified: llvm/trunk/include/llvm/CodeGen/RuntimeLibcalls.h llvm/trunk/include/llvm/CodeGen/SelectionDAGNodes.h llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeFloatTypes.cpp llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.h llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp llvm/trunk/lib/CodeGen/SelectionDAG/TargetLowering.cpp Modified: llvm/trunk/include/llvm/CodeGen/RuntimeLibcalls.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/RuntimeLibcalls.h?rev=52739&r1=52738&r2=52739&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/RuntimeLibcalls.h (original) +++ llvm/trunk/include/llvm/CodeGen/RuntimeLibcalls.h Wed Jun 25 15:24:48 2008 @@ -99,6 +99,7 @@ FPTOSINT_F64_I128, FPTOSINT_F80_I64, FPTOSINT_F80_I128, + FPTOSINT_PPCF128_I32, FPTOSINT_PPCF128_I64, FPTOSINT_PPCF128_I128, FPTOUINT_F32_I32, @@ -110,6 +111,7 @@ FPTOUINT_F80_I32, FPTOUINT_F80_I64, FPTOUINT_F80_I128, + FPTOUINT_PPCF128_I32, FPTOUINT_PPCF128_I64, FPTOUINT_PPCF128_I128, SINTTOFP_I32_F32, Modified: llvm/trunk/include/llvm/CodeGen/SelectionDAGNodes.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/SelectionDAGNodes.h?rev=52739&r1=52738&r2=52739&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/SelectionDAGNodes.h (original) +++ llvm/trunk/include/llvm/CodeGen/SelectionDAGNodes.h Wed Jun 25 15:24:48 2008 @@ -193,16 +193,16 @@ CALL, // EXTRACT_ELEMENT - This is used to get the lower or upper (determined by - // a Constant, which is required to be operand #1) half of the integer value - // specified as operand #0. This is only for use before legalization, for - // values that will be broken into multiple registers. + // a Constant, which is required to be operand #1) half of the integer or + // float value specified as operand #0. This is only for use before + // legalization, for values that will be broken into multiple registers. EXTRACT_ELEMENT, // BUILD_PAIR - This is the opposite of EXTRACT_ELEMENT in some ways. Given // two values of the same integer value type, this produces a value twice as // big. Like EXTRACT_ELEMENT, this can only be used before legalization. BUILD_PAIR, - + // MERGE_VALUES - This node takes multiple discrete operands and returns // them all as its individual results. This nodes has exactly the same // number of inputs and outputs, and is only valid before legalization. Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeFloatTypes.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeFloatTypes.cpp?rev=52739&r1=52738&r2=52739&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeFloatTypes.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeFloatTypes.cpp Wed Jun 25 15:24:48 2008 @@ -118,7 +118,7 @@ RTLIB::ADD_F64, RTLIB::ADD_F80, RTLIB::ADD_PPCF128), - NVT, Ops, 2, false/*sign irrelevant*/); + NVT, Ops, 2, false); } SDOperand DAGTypeLegalizer::SoftenFloatRes_FCOPYSIGN(SDNode *N) { @@ -169,7 +169,7 @@ RTLIB::MUL_F64, RTLIB::MUL_F80, RTLIB::MUL_PPCF128), - NVT, Ops, 2, false/*sign irrelevant*/); + NVT, Ops, 2, false); } SDOperand DAGTypeLegalizer::SoftenFloatRes_FSUB(SDNode *N) { @@ -181,7 +181,7 @@ RTLIB::SUB_F64, RTLIB::SUB_F80, RTLIB::SUB_PPCF128), - NVT, Ops, 2, false/*sign irrelevant*/); + NVT, Ops, 2, false); } SDOperand DAGTypeLegalizer::SoftenFloatRes_LOAD(SDNode *N) { @@ -547,7 +547,14 @@ case ISD::EXTRACT_ELEMENT: ExpandRes_EXTRACT_ELEMENT(N, Lo, Hi); break; case ISD::EXTRACT_VECTOR_ELT: ExpandRes_EXTRACT_VECTOR_ELT(N, Lo, Hi); break; - case ISD::LOAD: ExpandFloatRes_LOAD(N, Lo, Hi); break; + case ISD::ConstantFP: ExpandFloatRes_ConstantFP(N, Lo, Hi); break; + case ISD::FADD: ExpandFloatRes_FADD(N, Lo, Hi); break; + case ISD::FDIV: ExpandFloatRes_FDIV(N, Lo, Hi); break; + case ISD::FMUL: ExpandFloatRes_FMUL(N, Lo, Hi); break; + case ISD::FSUB: ExpandFloatRes_FSUB(N, Lo, Hi); break; + case ISD::LOAD: ExpandFloatRes_LOAD(N, Lo, Hi); break; + case ISD::SINT_TO_FP: + case ISD::UINT_TO_FP: ExpandFloatRes_XINT_TO_FP(N, Lo, Hi); break; } // If Lo/Hi is null, the sub-method took care of registering results etc. @@ -555,6 +562,74 @@ SetExpandedFloat(SDOperand(N, ResNo), Lo, Hi); } +void DAGTypeLegalizer::ExpandFloatRes_ConstantFP(SDNode *N, SDOperand &Lo, + SDOperand &Hi) { + MVT NVT = TLI.getTypeToTransformTo(N->getValueType(0)); + assert(NVT.getSizeInBits() == integerPartWidth && + "Do not know how to expand this float constant!"); + APInt C = cast(N)->getValueAPF().convertToAPInt(); + Lo = DAG.getConstantFP(APFloat(APInt(integerPartWidth, 1, + &C.getRawData()[1])), NVT); + Hi = DAG.getConstantFP(APFloat(APInt(integerPartWidth, 1, + &C.getRawData()[0])), NVT); +} + +void DAGTypeLegalizer::ExpandFloatRes_FADD(SDNode *N, SDOperand &Lo, + SDOperand &Hi) { + SDOperand Ops[2] = { N->getOperand(0), N->getOperand(1) }; + SDOperand Call = MakeLibCall(GetFPLibCall(N->getValueType(0), + RTLIB::ADD_F32, + RTLIB::ADD_F64, + RTLIB::ADD_F80, + RTLIB::ADD_PPCF128), + N->getValueType(0), Ops, 2, + false); + assert(Call.Val->getOpcode() == ISD::BUILD_PAIR && "Call lowered wrongly!"); + Lo = Call.getOperand(0); Hi = Call.getOperand(1); +} + +void DAGTypeLegalizer::ExpandFloatRes_FDIV(SDNode *N, SDOperand &Lo, + SDOperand &Hi) { + SDOperand Ops[2] = { N->getOperand(0), N->getOperand(1) }; + SDOperand Call = MakeLibCall(GetFPLibCall(N->getValueType(0), + RTLIB::DIV_F32, + RTLIB::DIV_F64, + RTLIB::DIV_F80, + RTLIB::DIV_PPCF128), + N->getValueType(0), Ops, 2, + false); + assert(Call.Val->getOpcode() == ISD::BUILD_PAIR && "Call lowered wrongly!"); + Lo = Call.getOperand(0); Hi = Call.getOperand(1); +} + +void DAGTypeLegalizer::ExpandFloatRes_FMUL(SDNode *N, SDOperand &Lo, + SDOperand &Hi) { + SDOperand Ops[2] = { N->getOperand(0), N->getOperand(1) }; + SDOperand Call = MakeLibCall(GetFPLibCall(N->getValueType(0), + RTLIB::MUL_F32, + RTLIB::MUL_F64, + RTLIB::MUL_F80, + RTLIB::MUL_PPCF128), + N->getValueType(0), Ops, 2, + false); + assert(Call.Val->getOpcode() == ISD::BUILD_PAIR && "Call lowered wrongly!"); + Lo = Call.getOperand(0); Hi = Call.getOperand(1); +} + +void DAGTypeLegalizer::ExpandFloatRes_FSUB(SDNode *N, SDOperand &Lo, + SDOperand &Hi) { + SDOperand Ops[2] = { N->getOperand(0), N->getOperand(1) }; + SDOperand Call = MakeLibCall(GetFPLibCall(N->getValueType(0), + RTLIB::SUB_F32, + RTLIB::SUB_F64, + RTLIB::SUB_F80, + RTLIB::SUB_PPCF128), + N->getValueType(0), Ops, 2, + false); + assert(Call.Val->getOpcode() == ISD::BUILD_PAIR && "Call lowered wrongly!"); + Lo = Call.getOperand(0); Hi = Call.getOperand(1); +} + void DAGTypeLegalizer::ExpandFloatRes_LOAD(SDNode *N, SDOperand &Lo, SDOperand &Hi) { if (ISD::isNormalLoad(N)) { @@ -587,6 +662,71 @@ ReplaceValueWith(SDOperand(LD, 1), Chain); } +void DAGTypeLegalizer::ExpandFloatRes_XINT_TO_FP(SDNode *N, SDOperand &Lo, + SDOperand &Hi) { + assert(N->getValueType(0) == MVT::ppcf128 && "Unsupported XINT_TO_FP!"); + MVT VT = N->getValueType(0); + MVT NVT = TLI.getTypeToTransformTo(VT); + SDOperand Src = N->getOperand(0); + MVT SrcVT = Src.getValueType(); + + // First do an SINT_TO_FP, whether the original was signed or unsigned. + if (SrcVT.bitsLE(MVT::i32)) { + // The integer can be represented exactly in an f64. + Src = DAG.getNode(ISD::SIGN_EXTEND, MVT::i32, Src); + Lo = DAG.getConstantFP(APFloat(APInt(NVT.getSizeInBits(), 0)), NVT); + Hi = DAG.getNode(ISD::SINT_TO_FP, NVT, Src); + } else { + RTLIB::Libcall LC = RTLIB::UNKNOWN_LIBCALL; + if (SrcVT.bitsLE(MVT::i64)) { + Src = DAG.getNode(ISD::SIGN_EXTEND, MVT::i64, Src); + LC = RTLIB::SINTTOFP_I64_PPCF128; + } else if (SrcVT.bitsLE(MVT::i128)) { + Src = DAG.getNode(ISD::SIGN_EXTEND, MVT::i128, Src); + LC = RTLIB::SINTTOFP_I128_PPCF128; + } + assert(LC != RTLIB::UNKNOWN_LIBCALL && "Unsupported XINT_TO_FP!"); + + Hi = MakeLibCall(LC, VT, &Src, 1, true); + assert(Hi.Val->getOpcode() == ISD::BUILD_PAIR && "Call lowered wrongly!"); + Lo = Hi.getOperand(0); Hi = Hi.getOperand(1); + } + + if (N->getOpcode() == ISD::SINT_TO_FP) + return; + + // Unsigned - fix up the SINT_TO_FP value just calculated. + Hi = DAG.getNode(ISD::BUILD_PAIR, VT, Lo, Hi); + SrcVT = Src.getValueType(); + + // x>=0 ? (ppcf128)(iN)x : (ppcf128)(iN)x + 2^N; N=32,64,128. + static const uint64_t TwoE32[] = { 0x41f0000000000000LL, 0 }; + static const uint64_t TwoE64[] = { 0x43f0000000000000LL, 0 }; + static const uint64_t TwoE128[] = { 0x47f0000000000000LL, 0 }; + const uint64_t *Parts = 0; + + switch (SrcVT.getSimpleVT()) { + default: + assert(false && "Unsupported UINT_TO_FP!"); + case MVT::i32: + Parts = TwoE32; + case MVT::i64: + Parts = TwoE64; + case MVT::i128: + Parts = TwoE128; + } + + Lo = DAG.getNode(ISD::FADD, VT, Hi, + DAG.getConstantFP(APFloat(APInt(128, 2, Parts)), + MVT::ppcf128)); + Lo = DAG.getNode(ISD::SELECT_CC, VT, Src, DAG.getConstant(0, SrcVT), Lo, Hi, + DAG.getCondCode(ISD::SETLT)); + Hi = DAG.getNode(ISD::EXTRACT_ELEMENT, NVT, Lo, + DAG.getConstant(1, TLI.getPointerTy())); + Lo = DAG.getNode(ISD::EXTRACT_ELEMENT, NVT, Lo, + DAG.getConstant(0, TLI.getPointerTy())); +} + //===----------------------------------------------------------------------===// // Float Operand Expansion @@ -622,6 +762,10 @@ case ISD::SELECT_CC: Res = ExpandFloatOp_BR_CC(N); break; case ISD::SETCC: Res = ExpandFloatOp_BR_CC(N); break; + case ISD::FP_ROUND: Res = ExpandFloatOp_FP_ROUND(N); break; + case ISD::FP_TO_SINT: Res = ExpandFloatOp_FP_TO_SINT(N); break; + case ISD::FP_TO_UINT: Res = ExpandFloatOp_FP_TO_UINT(N); break; + case ISD::STORE: Res = ExpandFloatOp_STORE(cast(N), OpNo); break; @@ -728,6 +872,58 @@ DAG.getCondCode(CCCode)); } +SDOperand DAGTypeLegalizer::ExpandFloatOp_FP_TO_UINT(SDNode *N) { + assert(N->getOperand(0).getValueType() == MVT::ppcf128 && + "Unsupported FP_TO_UINT!"); + + RTLIB::Libcall LC = RTLIB::UNKNOWN_LIBCALL; + switch (N->getValueType(0).getSimpleVT()) { + default: + assert(false && "Unsupported FP_TO_UINT!"); + case MVT::i32: + LC = RTLIB::FPTOUINT_PPCF128_I32; + break; + case MVT::i64: + LC = RTLIB::FPTOUINT_PPCF128_I64; + break; + case MVT::i128: + LC = RTLIB::FPTOUINT_PPCF128_I128; + break; + } + + return MakeLibCall(LC, N->getValueType(0), &N->getOperand(0), 1, false); +} + +SDOperand DAGTypeLegalizer::ExpandFloatOp_FP_TO_SINT(SDNode *N) { + assert(N->getOperand(0).getValueType() == MVT::ppcf128 && + "Unsupported FP_TO_SINT!"); + + RTLIB::Libcall LC = RTLIB::UNKNOWN_LIBCALL; + switch (N->getValueType(0).getSimpleVT()) { + default: + assert(false && "Unsupported FP_TO_SINT!"); + case MVT::i32: + LC = RTLIB::FPTOSINT_PPCF128_I32; + case MVT::i64: + LC = RTLIB::FPTOSINT_PPCF128_I64; + break; + case MVT::i128: + LC = RTLIB::FPTOSINT_PPCF128_I64; + break; + } + + return MakeLibCall(LC, N->getValueType(0), &N->getOperand(0), 1, false); +} + +SDOperand DAGTypeLegalizer::ExpandFloatOp_FP_ROUND(SDNode *N) { + assert(N->getOperand(0).getValueType() == MVT::ppcf128 && + "Logic only correct for ppcf128!"); + SDOperand Lo, Hi; + GetExpandedFloat(N->getOperand(0), Lo, Hi); + // Round it the rest of the way (e.g. to f32) if needed. + return DAG.getNode(ISD::FP_ROUND, N->getValueType(0), Hi, N->getOperand(1)); +} + SDOperand DAGTypeLegalizer::ExpandFloatOp_STORE(SDNode *N, unsigned OpNo) { if (ISD::isNormalStore(N)) return ExpandOp_NormalStore(N, OpNo); Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.h?rev=52739&r1=52738&r2=52739&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.h (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.h Wed Jun 25 15:24:48 2008 @@ -354,11 +354,20 @@ // Float Result Expansion. void ExpandFloatResult(SDNode *N, unsigned ResNo); - void ExpandFloatRes_LOAD(SDNode *N, SDOperand &Lo, SDOperand &Hi); + void ExpandFloatRes_ConstantFP(SDNode *N, SDOperand &Lo, SDOperand &Hi); + void ExpandFloatRes_FADD (SDNode *N, SDOperand &Lo, SDOperand &Hi); + void ExpandFloatRes_FDIV (SDNode *N, SDOperand &Lo, SDOperand &Hi); + void ExpandFloatRes_FMUL (SDNode *N, SDOperand &Lo, SDOperand &Hi); + void ExpandFloatRes_FSUB (SDNode *N, SDOperand &Lo, SDOperand &Hi); + void ExpandFloatRes_LOAD (SDNode *N, SDOperand &Lo, SDOperand &Hi); + void ExpandFloatRes_XINT_TO_FP(SDNode *N, SDOperand &Lo, SDOperand &Hi); // Float Operand Expansion. bool ExpandFloatOperand(SDNode *N, unsigned OperandNo); SDOperand ExpandFloatOp_BR_CC(SDNode *N); + SDOperand ExpandFloatOp_FP_ROUND(SDNode *N); + SDOperand ExpandFloatOp_FP_TO_SINT(SDNode *N); + SDOperand ExpandFloatOp_FP_TO_UINT(SDNode *N); SDOperand ExpandFloatOp_SELECT_CC(SDNode *N); SDOperand ExpandFloatOp_SETCC(SDNode *N); SDOperand ExpandFloatOp_STORE(SDNode *N, unsigned OpNo); Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp?rev=52739&r1=52738&r2=52739&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Wed Jun 25 15:24:48 2008 @@ -2244,10 +2244,9 @@ break; case ISD::EXTRACT_ELEMENT: assert(N2C && (unsigned)N2C->getValue() < 2 && "Bad EXTRACT_ELEMENT!"); - assert(!N1.getValueType().isVector() && - N1.getValueType().isInteger() && - !VT.isVector() && VT.isInteger() && - "EXTRACT_ELEMENT only applies to integers!"); + assert(!N1.getValueType().isVector() && !VT.isVector() && + (N1.getValueType().isInteger() == VT.isInteger()) && + "Wrong types for EXTRACT_ELEMENT!"); // EXTRACT_ELEMENT of BUILD_PAIR is often formed while legalize is expanding // 64-bit integers into 32-bit parts. Instead of building the extract of Modified: llvm/trunk/lib/CodeGen/SelectionDAG/TargetLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/TargetLowering.cpp?rev=52739&r1=52738&r2=52739&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/TargetLowering.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/TargetLowering.cpp Wed Jun 25 15:24:48 2008 @@ -97,6 +97,7 @@ Names[RTLIB::FPTOSINT_F64_I128] = "__fixdfti"; Names[RTLIB::FPTOSINT_F80_I64] = "__fixxfdi"; Names[RTLIB::FPTOSINT_F80_I128] = "__fixxfti"; + Names[RTLIB::FPTOSINT_PPCF128_I32] = "__fixtfsi"; Names[RTLIB::FPTOSINT_PPCF128_I64] = "__fixtfdi"; Names[RTLIB::FPTOSINT_PPCF128_I128] = "__fixtfti"; Names[RTLIB::FPTOUINT_F32_I32] = "__fixunssfsi"; @@ -108,6 +109,7 @@ Names[RTLIB::FPTOUINT_F80_I32] = "__fixunsxfsi"; Names[RTLIB::FPTOUINT_F80_I64] = "__fixunsxfdi"; Names[RTLIB::FPTOUINT_F80_I128] = "__fixunsxfti"; + Names[RTLIB::FPTOUINT_PPCF128_I32] = "__fixunstfsi"; Names[RTLIB::FPTOUINT_PPCF128_I64] = "__fixunstfdi"; Names[RTLIB::FPTOUINT_PPCF128_I128] = "__fixunstfti"; Names[RTLIB::SINTTOFP_I32_F32] = "__floatsisf"; From evan.cheng at apple.com Wed Jun 25 15:53:01 2008 From: evan.cheng at apple.com (Evan Cheng) Date: Wed, 25 Jun 2008 20:53:01 -0000 Subject: [llvm-commits] [llvm] r52740 - in /llvm/trunk: lib/CodeGen/SelectionDAG/SelectionDAG.cpp lib/Target/X86/README-SSE.txt lib/Target/X86/X86ISelLowering.cpp test/CodeGen/X86/2008-06-25-VecISelBug.ll Message-ID: <200806252053.m5PKr2Nb026321@zion.cs.uiuc.edu> Author: evancheng Date: Wed Jun 25 15:52:59 2008 New Revision: 52740 URL: http://llvm.org/viewvc/llvm-project?rev=52740&view=rev Log: - Fix a x86 vector isel bug: illegal transformation of a vector_shuffle into a shift. - Add a readme entry for a missing vector_shuffle optimization that results in awful codegen. Added: llvm/trunk/test/CodeGen/X86/2008-06-25-VecISelBug.ll Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp llvm/trunk/lib/Target/X86/README-SSE.txt llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp?rev=52740&r1=52739&r2=52740&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Wed Jun 25 15:52:59 2008 @@ -1859,12 +1859,16 @@ /// getShuffleScalarElt - Returns the scalar element that will make up the ith /// element of the result of the vector shuffle. -SDOperand SelectionDAG::getShuffleScalarElt(const SDNode *N, unsigned Idx) { +SDOperand SelectionDAG::getShuffleScalarElt(const SDNode *N, unsigned i) { MVT VT = N->getValueType(0); SDOperand PermMask = N->getOperand(2); + SDOperand Idx = PermMask.getOperand(i); + if (Idx.getOpcode() == ISD::UNDEF) + return getNode(ISD::UNDEF, VT.getVectorElementType()); + unsigned Index = cast(Idx)->getValue(); unsigned NumElems = PermMask.getNumOperands(); - SDOperand V = (Idx < NumElems) ? N->getOperand(0) : N->getOperand(1); - Idx %= NumElems; + SDOperand V = (Index < NumElems) ? N->getOperand(0) : N->getOperand(1); + Index %= NumElems; if (V.getOpcode() == ISD::BIT_CONVERT) { V = V.getOperand(0); @@ -1872,16 +1876,12 @@ return SDOperand(); } if (V.getOpcode() == ISD::SCALAR_TO_VECTOR) - return (Idx == 0) ? V.getOperand(0) + return (Index == 0) ? V.getOperand(0) : getNode(ISD::UNDEF, VT.getVectorElementType()); if (V.getOpcode() == ISD::BUILD_VECTOR) - return V.getOperand(Idx); - if (V.getOpcode() == ISD::VECTOR_SHUFFLE) { - SDOperand Elt = PermMask.getOperand(Idx); - if (Elt.getOpcode() == ISD::UNDEF) - return getNode(ISD::UNDEF, VT.getVectorElementType()); - return getShuffleScalarElt(V.Val,cast(Elt)->getValue()); - } + return V.getOperand(Index); + if (V.getOpcode() == ISD::VECTOR_SHUFFLE) + return getShuffleScalarElt(V.Val, Index); return SDOperand(); } Modified: llvm/trunk/lib/Target/X86/README-SSE.txt URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/README-SSE.txt?rev=52740&r1=52739&r2=52740&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/README-SSE.txt (original) +++ llvm/trunk/lib/Target/X86/README-SSE.txt Wed Jun 25 15:52:59 2008 @@ -808,3 +808,34 @@ With SSE4, it should be movdqa .LC0(%rip), %xmm0 pinsrb $6, %edi, %xmm0 + +//===---------------------------------------------------------------------===// + +We should transform a shuffle of two vectors of constants into a single vector +of constants. Also, insertelement of a constant into a vector of constants +should also result in a vector of constants. e.g. 2008-06-25-VecISelBug.ll. + +We compiled it to something horrible: + + .align 4 +LCPI1_1: ## float + .long 1065353216 ## float 1 + .const + + .align 4 +LCPI1_0: ## <4 x float> + .space 4 + .long 1065353216 ## float 1 + .space 4 + .long 1065353216 ## float 1 + .text + .align 4,0x90 + .globl _t +_t: + xorps %xmm0, %xmm0 + movhps LCPI1_0, %xmm0 + movss LCPI1_1, %xmm1 + movaps %xmm0, %xmm2 + shufps $2, %xmm1, %xmm2 + shufps $132, %xmm2, %xmm0 + movaps %xmm0, 0 Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.cpp?rev=52740&r1=52739&r2=52740&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original) +++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Wed Jun 25 15:52:59 2008 @@ -2933,12 +2933,12 @@ SelectionDAG &DAG) { unsigned NumZeros = 0; for (unsigned i = 0; i < NumElems; ++i) { - SDOperand Idx = Mask.getOperand(Low ? i : NumElems-i-1); + unsigned Index = Low ? i : NumElems-i-1; + SDOperand Idx = Mask.getOperand(Index); if (Idx.getOpcode() == ISD::UNDEF) { ++NumZeros; continue; } - unsigned Index = cast(Idx)->getValue(); SDOperand Elt = DAG.getShuffleScalarElt(Op.Val, Index); if (Elt.Val && isZeroNode(Elt)) ++NumZeros; @@ -6373,8 +6373,7 @@ continue; } - unsigned Index = cast(Idx)->getValue(); - SDOperand Elt = DAG.getShuffleScalarElt(N, Index); + SDOperand Elt = DAG.getShuffleScalarElt(N, i); if (!Elt.Val || (Elt.getOpcode() != ISD::UNDEF && !ISD::isNON_EXTLoad(Elt.Val))) return false; Added: llvm/trunk/test/CodeGen/X86/2008-06-25-VecISelBug.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/2008-06-25-VecISelBug.ll?rev=52740&view=auto ============================================================================== --- llvm/trunk/test/CodeGen/X86/2008-06-25-VecISelBug.ll (added) +++ llvm/trunk/test/CodeGen/X86/2008-06-25-VecISelBug.ll Wed Jun 25 15:52:59 2008 @@ -0,0 +1,9 @@ +; RUN: llvm-as < %s | llc -march=x86 -mattr=+sse2 | not grep pslldq + +define void @t() nounwind { +entry: + %tmp1 = shufflevector <4 x float> zeroinitializer, <4 x float> < float 0.000000e+00, float 1.000000e+00, float 0.000000e+00, float 1.000000e+00 >, <4 x i32> < i32 0, i32 1, i32 4, i32 5 > + %tmp2 = insertelement <4 x float> %tmp1, float 1.000000e+00, i32 3 + store <4 x float> %tmp2, <4 x float>* null, align 16 + unreachable +} From kremenek at apple.com Wed Jun 25 16:49:18 2008 From: kremenek at apple.com (Ted Kremenek) Date: Wed, 25 Jun 2008 21:49:18 -0000 Subject: [llvm-commits] [llvm] r52742 - /llvm/tags/checker/checker-45/ Message-ID: <200806252149.m5PLnI76027921@zion.cs.uiuc.edu> Author: kremenek Date: Wed Jun 25 16:49:09 2008 New Revision: 52742 URL: http://llvm.org/viewvc/llvm-project?rev=52742&view=rev Log: Tagging checker-45. Added: llvm/tags/checker/checker-45/ - copied from r52741, llvm/trunk/ From gohman at apple.com Wed Jun 25 17:14:54 2008 From: gohman at apple.com (Dan Gohman) Date: Wed, 25 Jun 2008 22:14:54 -0000 Subject: [llvm-commits] [llvm] r52744 - /llvm/trunk/lib/CodeGen/LiveVariables.cpp Message-ID: <200806252214.m5PMEtCa028679@zion.cs.uiuc.edu> Author: djg Date: Wed Jun 25 17:14:43 2008 New Revision: 52744 URL: http://llvm.org/viewvc/llvm-project?rev=52744&view=rev Log: Fix the text in an assert string. Modified: llvm/trunk/lib/CodeGen/LiveVariables.cpp Modified: llvm/trunk/lib/CodeGen/LiveVariables.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/LiveVariables.cpp?rev=52744&r1=52743&r2=52744&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/LiveVariables.cpp (original) +++ llvm/trunk/lib/CodeGen/LiveVariables.cpp Wed Jun 25 17:14:43 2008 @@ -602,7 +602,7 @@ I = MF->getRegInfo().liveout_begin(), E = MF->getRegInfo().liveout_end(); I != E; ++I) { assert(TargetRegisterInfo::isPhysicalRegister(*I) && - "Cannot have a live-in virtual register!"); + "Cannot have a live-out virtual register!"); HandlePhysRegUse(*I, Ret); // Add live-out registers as implicit uses. From resistor at mac.com Wed Jun 25 18:39:41 2008 From: resistor at mac.com (Owen Anderson) Date: Wed, 25 Jun 2008 23:39:41 -0000 Subject: [llvm-commits] [llvm] r52745 - in /llvm/trunk: include/llvm/CodeGen/LiveIntervalAnalysis.h lib/CodeGen/LiveIntervalAnalysis.cpp Message-ID: <200806252339.m5PNdfJ3030984@zion.cs.uiuc.edu> Author: resistor Date: Wed Jun 25 18:39:39 2008 New Revision: 52745 URL: http://llvm.org/viewvc/llvm-project?rev=52745&view=rev Log: Remember which MachineOperand we were processing, so we don't have to scan the list to find it again later. This speeds up live intervals from 0.37s to 0.30s on instcombine. Modified: llvm/trunk/include/llvm/CodeGen/LiveIntervalAnalysis.h llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp Modified: llvm/trunk/include/llvm/CodeGen/LiveIntervalAnalysis.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/LiveIntervalAnalysis.h?rev=52745&r1=52744&r2=52745&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/LiveIntervalAnalysis.h (original) +++ llvm/trunk/include/llvm/CodeGen/LiveIntervalAnalysis.h Wed Jun 25 18:39:39 2008 @@ -328,20 +328,20 @@ /// handleVirtualRegisterDef) void handleRegisterDef(MachineBasicBlock *MBB, MachineBasicBlock::iterator MI, unsigned MIIdx, - unsigned reg); + MachineOperand& MO); /// handleVirtualRegisterDef - update intervals for a virtual /// register def void handleVirtualRegisterDef(MachineBasicBlock *MBB, MachineBasicBlock::iterator MI, - unsigned MIIdx, + unsigned MIIdx, MachineOperand& MO, LiveInterval& interval); /// handlePhysicalRegisterDef - update intervals for a physical register /// def. void handlePhysicalRegisterDef(MachineBasicBlock* mbb, MachineBasicBlock::iterator mi, - unsigned MIIdx, + unsigned MIIdx, MachineOperand& MO, LiveInterval &interval, MachineInstr *CopyMI); Modified: llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp?rev=52745&r1=52744&r2=52745&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp (original) +++ llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp Wed Jun 25 18:39:39 2008 @@ -297,7 +297,7 @@ void LiveIntervals::handleVirtualRegisterDef(MachineBasicBlock *mbb, MachineBasicBlock::iterator mi, - unsigned MIIdx, + unsigned MIIdx, MachineOperand& MO, LiveInterval &interval) { DOUT << "\t\tregister: "; DEBUG(printRegName(interval.reg)); LiveVariables::VarInfo& vi = lv_->getVarInfo(interval.reg); @@ -428,7 +428,7 @@ // If this redefinition is dead, we need to add a dummy unit live // range covering the def slot. - if (mi->registerDefIsDead(interval.reg, tri_)) + if (MO.isDead()) interval.addRange(LiveRange(RedefIndex, RedefIndex+1, OldValNo)); DOUT << " RESULT: "; @@ -491,6 +491,7 @@ void LiveIntervals::handlePhysicalRegisterDef(MachineBasicBlock *MBB, MachineBasicBlock::iterator mi, unsigned MIIdx, + MachineOperand& MO, LiveInterval &interval, MachineInstr *CopyMI) { // A physical register cannot be live across basic block, so its @@ -504,7 +505,7 @@ // If it is not used after definition, it is considered dead at // the instruction defining it. Hence its interval is: // [defSlot(def), defSlot(def)+1) - if (mi->registerDefIsDead(interval.reg, tri_)) { + if (MO.isDead()) { DOUT << " dead"; end = getDefIndex(start) + 1; goto exit; @@ -552,23 +553,26 @@ void LiveIntervals::handleRegisterDef(MachineBasicBlock *MBB, MachineBasicBlock::iterator MI, unsigned MIIdx, - unsigned reg) { - if (TargetRegisterInfo::isVirtualRegister(reg)) - handleVirtualRegisterDef(MBB, MI, MIIdx, getOrCreateInterval(reg)); - else if (allocatableRegs_[reg]) { + MachineOperand& MO) { + if (TargetRegisterInfo::isVirtualRegister(MO.getReg())) + handleVirtualRegisterDef(MBB, MI, MIIdx, MO, + getOrCreateInterval(MO.getReg())); + else if (allocatableRegs_[MO.getReg()]) { MachineInstr *CopyMI = NULL; unsigned SrcReg, DstReg; if (MI->getOpcode() == TargetInstrInfo::EXTRACT_SUBREG || MI->getOpcode() == TargetInstrInfo::INSERT_SUBREG || tii_->isMoveInstr(*MI, SrcReg, DstReg)) CopyMI = MI; - handlePhysicalRegisterDef(MBB, MI, MIIdx, getOrCreateInterval(reg), CopyMI); + handlePhysicalRegisterDef(MBB, MI, MIIdx, MO, + getOrCreateInterval(MO.getReg()), CopyMI); // Def of a register also defines its sub-registers. - for (const unsigned* AS = tri_->getSubRegisters(reg); *AS; ++AS) + for (const unsigned* AS = tri_->getSubRegisters(MO.getReg()); *AS; ++AS) // If MI also modifies the sub-register explicitly, avoid processing it // more than once. Do not pass in TRI here so it checks for exact match. if (!MI->modifiesRegister(*AS)) - handlePhysicalRegisterDef(MBB, MI, MIIdx, getOrCreateInterval(*AS), 0); + handlePhysicalRegisterDef(MBB, MI, MIIdx, MO, + getOrCreateInterval(*AS), 0); } } @@ -656,7 +660,7 @@ MachineOperand &MO = MI->getOperand(i); // handle register defs - build intervals if (MO.isRegister() && MO.getReg() && MO.isDef()) - handleRegisterDef(MBB, MI, MIIndex, MO.getReg()); + handleRegisterDef(MBB, MI, MIIndex, MO); } MIIndex += InstrSlots::NUM; From sabre at nondot.org Wed Jun 25 19:16:49 2008 From: sabre at nondot.org (Chris Lattner) Date: Thu, 26 Jun 2008 00:16:49 -0000 Subject: [llvm-commits] [llvm] r52747 - in /llvm/trunk: lib/CodeGen/SelectionDAG/DAGCombiner.cpp test/CodeGen/X86/uint_to_fp.ll Message-ID: <200806260016.m5Q0Gnl5031985@zion.cs.uiuc.edu> Author: lattner Date: Wed Jun 25 19:16:49 2008 New Revision: 52747 URL: http://llvm.org/viewvc/llvm-project?rev=52747&view=rev Log: when we know the signbit of an input to uint_to_fp is zero, change it to sint_to_fp on targets where that is cheaper (and visaversa of course). This allows us to compile uint_to_fp to: _test: movl 4(%esp), %eax shrl $23, %eax cvtsi2ss %eax, %xmm0 movl 8(%esp), %eax movss %xmm0, (%eax) ret instead of: .align 3 LCPI1_0: ## double .long 0 ## double least significant word 4.5036e+15 .long 1127219200 ## double most significant word 4.5036e+15 .text .align 4,0x90 .globl _test _test: subl $12, %esp movl 16(%esp), %eax shrl $23, %eax movl %eax, (%esp) movl $1127219200, 4(%esp) movsd (%esp), %xmm0 subsd LCPI1_0, %xmm0 cvtsd2ss %xmm0, %xmm0 movl 20(%esp), %eax movss %xmm0, (%eax) addl $12, %esp ret Added: llvm/trunk/test/CodeGen/X86/uint_to_fp.ll Modified: llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Modified: llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp?rev=52747&r1=52746&r2=52747&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Wed Jun 25 19:16:49 2008 @@ -3844,10 +3844,22 @@ SDOperand N0 = N->getOperand(0); ConstantSDNode *N0C = dyn_cast(N0); MVT VT = N->getValueType(0); - + MVT OpVT = N0.getValueType(); + // fold (sint_to_fp c1) -> c1fp - if (N0C && N0.getValueType() != MVT::ppcf128) + if (N0C && OpVT != MVT::ppcf128) return DAG.getNode(ISD::SINT_TO_FP, VT, N0); + + // If the input is a legal type, and SINT_TO_FP is not legal on this target, + // but UINT_TO_FP is legal on this target, try to convert. + if (TLI.isTypeLegal(OpVT) && !TLI.isOperationLegal(ISD::SINT_TO_FP, OpVT) && + TLI.isOperationLegal(ISD::UINT_TO_FP, OpVT)) { + // If the sign bit is known to be zero, we can change this to UINT_TO_FP. + if (DAG.SignBitIsZero(N0)) + return DAG.getNode(ISD::UINT_TO_FP, VT, N0); + } + + return SDOperand(); } @@ -3855,10 +3867,21 @@ SDOperand N0 = N->getOperand(0); ConstantSDNode *N0C = dyn_cast(N0); MVT VT = N->getValueType(0); + MVT OpVT = N0.getValueType(); // fold (uint_to_fp c1) -> c1fp - if (N0C && N0.getValueType() != MVT::ppcf128) + if (N0C && OpVT != MVT::ppcf128) return DAG.getNode(ISD::UINT_TO_FP, VT, N0); + + // If the input is a legal type, and UINT_TO_FP is not legal on this target, + // but SINT_TO_FP is legal on this target, try to convert. + if (TLI.isTypeLegal(OpVT) && !TLI.isOperationLegal(ISD::UINT_TO_FP, OpVT) && + TLI.isOperationLegal(ISD::SINT_TO_FP, OpVT)) { + // If the sign bit is known to be zero, we can change this to SINT_TO_FP. + if (DAG.SignBitIsZero(N0)) + return DAG.getNode(ISD::SINT_TO_FP, VT, N0); + } + return SDOperand(); } Added: llvm/trunk/test/CodeGen/X86/uint_to_fp.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/uint_to_fp.ll?rev=52747&view=auto ============================================================================== --- llvm/trunk/test/CodeGen/X86/uint_to_fp.ll (added) +++ llvm/trunk/test/CodeGen/X86/uint_to_fp.ll Wed Jun 25 19:16:49 2008 @@ -0,0 +1,13 @@ +; RUN: llvm-as < %s | llc -march=x86 -mcpu=yonah | not grep {sub.*esp} +; rdar://6034396 + +target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128" +target triple = "i386-apple-darwin8" + +define void @test(i32 %x, float* %y) nounwind { +entry: + lshr i32 %x, 23 ; :0 [#uses=1] + uitofp i32 %0 to float ; :1 [#uses=1] + store float %1, float* %y + ret void +} From echristo at apple.com Wed Jun 25 19:31:13 2008 From: echristo at apple.com (Eric Christopher) Date: Thu, 26 Jun 2008 00:31:13 -0000 Subject: [llvm-commits] [llvm] r52748 - in /llvm/trunk: include/llvm/Analysis/ValueTracking.h include/llvm/Constant.h include/llvm/IntrinsicInst.h lib/Analysis/ValueTracking.cpp lib/CodeGen/MachineModuleInfo.cpp lib/CodeGen/SelectionDAG/SelectionDAG.cpp lib/Debugger/ProgramInfo.cpp lib/Transforms/Scalar/InstructionCombining.cpp lib/VMCore/Constants.cpp lib/VMCore/IntrinsicInst.cpp Message-ID: <200806260031.m5Q0VDU5032390@zion.cs.uiuc.edu> Author: echristo Date: Wed Jun 25 19:31:12 2008 New Revision: 52748 URL: http://llvm.org/viewvc/llvm-project?rev=52748&view=rev Log: Move GetConstantStringInfo to lib/Analysis. Remove string output routine from Constant. Update all callers. Change debug intrinsic api slightly to accomodate move of routine, these now return values instead of strings. Modified: llvm/trunk/include/llvm/Analysis/ValueTracking.h llvm/trunk/include/llvm/Constant.h llvm/trunk/include/llvm/IntrinsicInst.h llvm/trunk/lib/Analysis/ValueTracking.cpp llvm/trunk/lib/CodeGen/MachineModuleInfo.cpp llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp llvm/trunk/lib/Debugger/ProgramInfo.cpp llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp llvm/trunk/lib/VMCore/Constants.cpp llvm/trunk/lib/VMCore/IntrinsicInst.cpp Modified: llvm/trunk/include/llvm/Analysis/ValueTracking.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/ValueTracking.h?rev=52748&r1=52747&r2=52748&view=diff ============================================================================== --- llvm/trunk/include/llvm/Analysis/ValueTracking.h (original) +++ llvm/trunk/include/llvm/Analysis/ValueTracking.h Wed Jun 25 19:31:12 2008 @@ -15,6 +15,8 @@ #ifndef LLVM_ANALYSIS_VALUETRACKING_H #define LLVM_ANALYSIS_VALUETRACKING_H +#include + namespace llvm { class Value; class Instruction; @@ -70,6 +72,11 @@ const unsigned Idxs[1] = { Idx }; return FindInsertedValue(V, &Idxs[0], &Idxs[1], InsertBefore); } + + /// GetConstantStringInfo - This function computes the length of a + /// null-terminated C string pointed to by V. If successful, it returns true + /// and returns the string in Str. If unsuccessful, it returns false. + bool GetConstantStringInfo(Value *V, std::string &Str); } // end namespace llvm #endif Modified: llvm/trunk/include/llvm/Constant.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Constant.h?rev=52748&r1=52747&r2=52748&view=diff ============================================================================== --- llvm/trunk/include/llvm/Constant.h (original) +++ llvm/trunk/include/llvm/Constant.h Wed Jun 25 19:31:12 2008 @@ -115,13 +115,6 @@ "implemented for all constants that have operands!"); assert(0 && "Constants that do not have operands cannot be using 'From'!"); } - - /// getStringValue - Turn an LLVM constant pointer that eventually points to a - /// global into a string value. Return an empty string if we can't do it. - /// Parameter Chop determines if the result is chopped at the first null - /// terminator. - /// - std::string getStringValue(bool Chop = true, unsigned Offset = 0); }; } // End llvm namespace Modified: llvm/trunk/include/llvm/IntrinsicInst.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/IntrinsicInst.h?rev=52748&r1=52747&r2=52748&view=diff ============================================================================== --- llvm/trunk/include/llvm/IntrinsicInst.h (original) +++ llvm/trunk/include/llvm/IntrinsicInst.h Wed Jun 25 19:31:12 2008 @@ -96,8 +96,8 @@ return unsigned(cast(getOperand(2))->getZExtValue()); } - std::string getFileName() const; - std::string getDirectory() const; + Value* getFileName() const; + Value* getDirectory() const; // Methods for support type inquiry through isa, cast, and dyn_cast: static inline bool classof(const DbgStopPointInst *) { return true; } Modified: llvm/trunk/lib/Analysis/ValueTracking.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/ValueTracking.cpp?rev=52748&r1=52747&r2=52748&view=diff ============================================================================== --- llvm/trunk/lib/Analysis/ValueTracking.cpp (original) +++ llvm/trunk/lib/Analysis/ValueTracking.cpp Wed Jun 25 19:31:12 2008 @@ -15,6 +15,7 @@ #include "llvm/Analysis/ValueTracking.h" #include "llvm/Constants.h" #include "llvm/Instructions.h" +#include "llvm/GlobalVariable.h" #include "llvm/IntrinsicInst.h" #include "llvm/Target/TargetData.h" #include "llvm/Support/GetElementPtrTypeIterator.h" @@ -930,3 +931,88 @@ // or load instruction) return 0; } + +/// GetConstantStringInfo - This function computes the length of a +/// null-terminated C string pointed to by V. If successful, it returns true +/// and returns the string in Str. If unsuccessful, it returns false. +bool llvm::GetConstantStringInfo(Value *V, std::string &Str) { + // If V is NULL then return false; + if (V == NULL) return false; + + // Look through bitcast instructions. + if (BitCastInst *BCI = dyn_cast(V)) + return GetConstantStringInfo(BCI->getOperand(0), Str); + + // If the value is not a GEP instruction nor a constant expression with a + // GEP instruction, then return false because ConstantArray can't occur + // any other way + User *GEP = 0; + if (GetElementPtrInst *GEPI = dyn_cast(V)) { + GEP = GEPI; + } else if (ConstantExpr *CE = dyn_cast(V)) { + if (CE->getOpcode() != Instruction::GetElementPtr) + return false; + GEP = CE; + } else { + return false; + } + + // Make sure the GEP has exactly three arguments. + if (GEP->getNumOperands() != 3) + return false; + + // Check to make sure that the first operand of the GEP is an integer and + // has value 0 so that we are sure we're indexing into the initializer. + if (ConstantInt *Idx = dyn_cast(GEP->getOperand(1))) { + if (!Idx->isZero()) + return false; + } else + return false; + + // If the second index isn't a ConstantInt, then this is a variable index + // into the array. If this occurs, we can't say anything meaningful about + // the string. + uint64_t StartIdx = 0; + if (ConstantInt *CI = dyn_cast(GEP->getOperand(2))) + StartIdx = CI->getZExtValue(); + else + return false; + + // 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. + GlobalVariable* GV = dyn_cast(GEP->getOperand(0)); + if (!GV || !GV->isConstant() || !GV->hasInitializer()) + return false; + Constant *GlobalInit = GV->getInitializer(); + + // Handle the ConstantAggregateZero case + if (isa(GlobalInit)) { + // This is a degenerate case. The initializer is constant zero so the + // length of the string must be zero. + Str.clear(); + return true; + } + + // Must be a Constant Array + ConstantArray *Array = dyn_cast(GlobalInit); + if (Array == 0 || Array->getType()->getElementType() != Type::Int8Ty) + return false; + + // Get the number of elements in the array + uint64_t NumElts = Array->getType()->getNumElements(); + + // Traverse the constant array from StartIdx (derived above) which is + // the place the GEP refers to in the array. + for (unsigned i = StartIdx; i < NumElts; ++i) { + Constant *Elt = Array->getOperand(i); + ConstantInt *CI = dyn_cast(Elt); + if (!CI) // This array isn't suitable, non-int initializer. + return false; + if (CI->isZero()) + return true; // we found end of string, success! + Str += (char)CI->getZExtValue(); + } + + return false; // The array isn't null terminated. +} Modified: llvm/trunk/lib/CodeGen/MachineModuleInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachineModuleInfo.cpp?rev=52748&r1=52747&r2=52748&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/MachineModuleInfo.cpp (original) +++ llvm/trunk/lib/CodeGen/MachineModuleInfo.cpp Wed Jun 25 19:31:12 2008 @@ -10,6 +10,7 @@ #include "llvm/CodeGen/MachineModuleInfo.h" #include "llvm/Constants.h" +#include "llvm/Analysis/ValueTracking.h" #include "llvm/CodeGen/MachineFunctionPass.h" #include "llvm/CodeGen/MachineFunction.h" #include "llvm/CodeGen/MachineLocation.h" @@ -230,7 +231,11 @@ } virtual void Apply(std::string &Field) { Constant *C = CI->getOperand(I++); - Field = C->getStringValue(); + std::string S; + if (GetConstantStringInfo(C, S)) + Field = S; + else + Field = ""; } virtual void Apply(DebugInfoDesc *&Field) { Constant *C = CI->getOperand(I++); Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp?rev=52748&r1=52747&r2=52748&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Wed Jun 25 19:31:12 2008 @@ -12,6 +12,7 @@ //===----------------------------------------------------------------------===// #include "llvm/CodeGen/SelectionDAG.h" #include "llvm/Constants.h" +#include "llvm/Analysis/ValueTracking.h" #include "llvm/GlobalAlias.h" #include "llvm/GlobalVariable.h" #include "llvm/Intrinsics.h" @@ -2594,8 +2595,7 @@ GlobalVariable *GV = dyn_cast(G->getGlobal()); if (GV && GV->isConstant()) { - Str = GV->getStringValue(false); - if (!Str.empty()) { + if (GetConstantStringInfo(GV, Str)) { SrcOff += SrcDelta; return true; } Modified: llvm/trunk/lib/Debugger/ProgramInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Debugger/ProgramInfo.cpp?rev=52748&r1=52747&r2=52748&view=diff ============================================================================== --- llvm/trunk/lib/Debugger/ProgramInfo.cpp (original) +++ llvm/trunk/lib/Debugger/ProgramInfo.cpp Wed Jun 25 19:31:12 2008 @@ -14,6 +14,7 @@ #include "llvm/Debugger/ProgramInfo.h" #include "llvm/Constants.h" +#include "llvm/Analysis/ValueTracking.h" #include "llvm/DerivedTypes.h" #include "llvm/Intrinsics.h" #include "llvm/IntrinsicInst.h" @@ -115,8 +116,10 @@ if (ConstantInt *CUI = dyn_cast(CS->getOperand(1))) Version = CUI->getZExtValue(); - BaseName = CS->getOperand(3)->getStringValue(); - Directory = CS->getOperand(4)->getStringValue(); + if (!GetConstantStringInfo(CS->getOperand(3), BaseName)) + BaseName = ""; + if (!GetConstantStringInfo(CS->getOperand(4), Directory)) + Directory = ""; } } @@ -156,7 +159,8 @@ SourceFile = &PI.getSourceFile(GV); // Entry #2 is the function name. - Name = CS->getOperand(2)->getStringValue(); + if (!GetConstantStringInfo(CS->getOperand(2), Name)) + Name = ""; } } Modified: llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp?rev=52748&r1=52747&r2=52748&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp Wed Jun 25 19:31:12 2008 @@ -9973,8 +9973,8 @@ if (ConstantExpr *CE = dyn_cast(CI)) { // Instead of loading constant c string, use corresponding integer value // directly if string length is small enough. - const std::string &Str = CE->getOperand(0)->getStringValue(); - if (!Str.empty()) { + std::string Str; + if (GetConstantStringInfo(CE->getOperand(0), Str) && !Str.empty()) { unsigned len = Str.length(); const Type *Ty = cast(CE->getType())->getElementType(); unsigned numBits = Ty->getPrimitiveSizeInBits(); Modified: llvm/trunk/lib/VMCore/Constants.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Constants.cpp?rev=52748&r1=52747&r2=52748&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/Constants.cpp (original) +++ llvm/trunk/lib/VMCore/Constants.cpp Wed Jun 25 19:31:12 2008 @@ -2658,44 +2658,4 @@ // Delete the old constant! destroyConstant(); -} - - -/// getStringValue - Turn an LLVM constant pointer that eventually points to a -/// global into a string value. Return an empty string if we can't do it. -/// Parameter Chop determines if the result is chopped at the first null -/// terminator. -/// -std::string Constant::getStringValue(bool Chop, unsigned Offset) { - if (GlobalVariable *GV = dyn_cast(this)) { - if (GV->hasInitializer() && isa(GV->getInitializer())) { - ConstantArray *Init = cast(GV->getInitializer()); - if (Init->isString()) { - std::string Result = Init->getAsString(); - if (Offset < Result.size()) { - // If we are pointing INTO The string, erase the beginning... - Result.erase(Result.begin(), Result.begin()+Offset); - - // Take off the null terminator, and any string fragments after it. - if (Chop) { - std::string::size_type NullPos = Result.find_first_of((char)0); - if (NullPos != std::string::npos) - Result.erase(Result.begin()+NullPos, Result.end()); - } - return Result; - } - } - } - } else if (ConstantExpr *CE = dyn_cast(this)) { - if (CE->getOpcode() == Instruction::GetElementPtr) { - // Turn a gep into the specified offset. - if (CE->getNumOperands() == 3 && - cast(CE->getOperand(1))->isNullValue() && - isa(CE->getOperand(2))) { - Offset += cast(CE->getOperand(2))->getZExtValue(); - return CE->getOperand(0)->getStringValue(Chop, Offset); - } - } - } - return ""; -} +} \ No newline at end of file Modified: llvm/trunk/lib/VMCore/IntrinsicInst.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/IntrinsicInst.cpp?rev=52748&r1=52747&r2=52748&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/IntrinsicInst.cpp (original) +++ llvm/trunk/lib/VMCore/IntrinsicInst.cpp Wed Jun 25 19:31:12 2008 @@ -28,6 +28,7 @@ #include "llvm/IntrinsicInst.h" #include "llvm/Constants.h" #include "llvm/GlobalVariable.h" +#include "llvm/Analysis/ValueTracking.h" #include "llvm/CodeGen/MachineModuleInfo.h" using namespace llvm; @@ -57,20 +58,20 @@ /// DbgStopPointInst - This represents the llvm.dbg.stoppoint instruction. /// -std::string DbgStopPointInst::getFileName() const { +Value *DbgStopPointInst::getFileName() const { // Once the operand indices are verified, update this assert assert(LLVMDebugVersion == (6 << 16) && "Verify operand indices"); GlobalVariable *GV = cast(getContext()); - if (!GV->hasInitializer()) return ""; + if (!GV->hasInitializer()) return NULL; ConstantStruct *CS = cast(GV->getInitializer()); - return CS->getOperand(3)->getStringValue(); + return CS->getOperand(4); } -std::string DbgStopPointInst::getDirectory() const { +Value *DbgStopPointInst::getDirectory() const { // Once the operand indices are verified, update this assert assert(LLVMDebugVersion == (6 << 16) && "Verify operand indices"); GlobalVariable *GV = cast(getContext()); - if (!GV->hasInitializer()) return ""; + if (!GV->hasInitializer()) return NULL; ConstantStruct *CS = cast(GV->getInitializer()); - return CS->getOperand(4)->getStringValue(); + return CS->getOperand(4); } From echristo at apple.com Wed Jun 25 20:19:35 2008 From: echristo at apple.com (Eric Christopher) Date: Thu, 26 Jun 2008 01:19:35 -0000 Subject: [llvm-commits] [llvm] r52749 - /llvm/trunk/lib/Transforms/Scalar/SimplifyLibCalls.cpp Message-ID: <200806260119.m5Q1JZ4Q001274@zion.cs.uiuc.edu> Author: echristo Date: Wed Jun 25 20:19:35 2008 New Revision: 52749 URL: http://llvm.org/viewvc/llvm-project?rev=52749&view=rev Log: Remove unused function. Modified: llvm/trunk/lib/Transforms/Scalar/SimplifyLibCalls.cpp Modified: llvm/trunk/lib/Transforms/Scalar/SimplifyLibCalls.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/SimplifyLibCalls.cpp?rev=52749&r1=52748&r2=52749&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/SimplifyLibCalls.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/SimplifyLibCalls.cpp Wed Jun 25 20:19:35 2008 @@ -23,6 +23,7 @@ #include "llvm/Module.h" #include "llvm/Pass.h" #include "llvm/Support/IRBuilder.h" +#include "llvm/Analysis/ValueTracking.h" #include "llvm/Target/TargetData.h" #include "llvm/ADT/SmallPtrSet.h" #include "llvm/ADT/StringMap.h" @@ -229,88 +230,6 @@ // Helper Functions //===----------------------------------------------------------------------===// -/// GetConstantStringInfo - This function computes the length of a -/// null-terminated C string pointed to by V. If successful, it returns true -/// and returns the string in Str. If unsuccessful, it returns false. -static bool GetConstantStringInfo(Value *V, std::string &Str) { - // Look bitcast instructions. - if (BitCastInst *BCI = dyn_cast(V)) - return GetConstantStringInfo(BCI->getOperand(0), Str); - - // If the value is not a GEP instruction nor a constant expression with a - // GEP instruction, then return false because ConstantArray can't occur - // any other way - User *GEP = 0; - if (GetElementPtrInst *GEPI = dyn_cast(V)) { - GEP = GEPI; - } else if (ConstantExpr *CE = dyn_cast(V)) { - if (CE->getOpcode() != Instruction::GetElementPtr) - return false; - GEP = CE; - } else { - return false; - } - - // Make sure the GEP has exactly three arguments. - if (GEP->getNumOperands() != 3) - return false; - - // Check to make sure that the first operand of the GEP is an integer and - // has value 0 so that we are sure we're indexing into the initializer. - if (ConstantInt *Idx = dyn_cast(GEP->getOperand(1))) { - if (!Idx->isZero()) - return false; - } else - return false; - - // If the second index isn't a ConstantInt, then this is a variable index - // into the array. If this occurs, we can't say anything meaningful about - // the string. - uint64_t StartIdx = 0; - if (ConstantInt *CI = dyn_cast(GEP->getOperand(2))) - StartIdx = CI->getZExtValue(); - else - return false; - - // 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. - GlobalVariable* GV = dyn_cast(GEP->getOperand(0)); - if (!GV || !GV->isConstant() || !GV->hasInitializer()) - return false; - Constant *GlobalInit = GV->getInitializer(); - - // Handle the ConstantAggregateZero case - if (isa(GlobalInit)) { - // This is a degenerate case. The initializer is constant zero so the - // length of the string must be zero. - Str.clear(); - return true; - } - - // Must be a Constant Array - ConstantArray *Array = dyn_cast(GlobalInit); - if (Array == 0 || Array->getType()->getElementType() != Type::Int8Ty) - return false; - - // Get the number of elements in the array - uint64_t NumElts = Array->getType()->getNumElements(); - - // Traverse the constant array from StartIdx (derived above) which is - // the place the GEP refers to in the array. - for (unsigned i = StartIdx; i < NumElts; ++i) { - Constant *Elt = Array->getOperand(i); - ConstantInt *CI = dyn_cast(Elt); - if (!CI) // This array isn't suitable, non-int initializer. - return false; - if (CI->isZero()) - return true; // we found end of string, success! - Str += (char)CI->getZExtValue(); - } - - return false; // The array isn't null terminated. -} - /// GetStringLengthH - If we can compute the length of the string pointed to by /// the specified pointer, return 'len+1'. If we can't, return 0. static uint64_t GetStringLengthH(Value *V, SmallPtrSet &PHIs) { From dalej at apple.com Wed Jun 25 20:51:13 2008 From: dalej at apple.com (Dale Johannesen) Date: Thu, 26 Jun 2008 01:51:13 -0000 Subject: [llvm-commits] [llvm] r52750 - in /llvm/trunk: include/llvm/Target/TargetRegisterInfo.h lib/CodeGen/PrologEpilogInserter.cpp lib/Target/X86/X86RegisterInfo.cpp utils/TableGen/RegisterInfoEmitter.cpp Message-ID: <200806260151.m5Q1pDwg002183@zion.cs.uiuc.edu> Author: johannes Date: Wed Jun 25 20:51:13 2008 New Revision: 52750 URL: http://llvm.org/viewvc/llvm-project?rev=52750&view=rev Log: Fixes the last x86-64 test failure in compat.exp: <16 x float> is 64-byte aligned (for some reason), which gets us into the stack realignment code. The computation changing FP-relative offsets to SP-relative was broken, assiging a spill temp to a location also used for parameter passing. This fixes it by rounding up the stack frame to a multiple of the largest alignment (I concluded it wasn't fixable without doing this, but I'm not very sure.) Modified: llvm/trunk/include/llvm/Target/TargetRegisterInfo.h llvm/trunk/lib/CodeGen/PrologEpilogInserter.cpp llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp llvm/trunk/utils/TableGen/RegisterInfoEmitter.cpp Modified: llvm/trunk/include/llvm/Target/TargetRegisterInfo.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetRegisterInfo.h?rev=52750&r1=52749&r2=52750&view=diff ============================================================================== --- llvm/trunk/include/llvm/Target/TargetRegisterInfo.h (original) +++ llvm/trunk/include/llvm/Target/TargetRegisterInfo.h Wed Jun 25 20:51:13 2008 @@ -516,6 +516,13 @@ return !hasFP(MF); } + // needsStackRealignment - true if storage within the function requires the + // stack pointer to be aligned more than the normal calling convention calls + // for. + virtual bool needsStackRealignment(const MachineFunction &MF) const { + return false; + } + /// getCallFrameSetup/DestroyOpcode - These methods return the opcode of the /// frame setup/destroy instructions if they exist (-1 otherwise). Some /// targets use pseudo instructions in order to abstract away the difference Modified: llvm/trunk/lib/CodeGen/PrologEpilogInserter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/PrologEpilogInserter.cpp?rev=52750&r1=52749&r2=52750&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/PrologEpilogInserter.cpp (original) +++ llvm/trunk/lib/CodeGen/PrologEpilogInserter.cpp Wed Jun 25 20:51:13 2008 @@ -459,15 +459,19 @@ // Round up the size to a multiple of the alignment, but only if there are // calls or alloca's in the function. This ensures that any calls to // subroutines have their stack frames suitable aligned. + // Also do this if we need runtime alignment of the stack. In this case + // offsets will be relative to SP not FP; round up the stack size so this + // works. if (!RegInfo->targetHandlesStackFrameRounding() && - (FFI->hasCalls() || FFI->hasVarSizedObjects())) { + (FFI->hasCalls() || FFI->hasVarSizedObjects() || + RegInfo->needsStackRealignment(Fn))) { // If we have reserved argument space for call sites in the function // immediately on entry to the current function, count it as part of the // overall stack size. if (RegInfo->hasReservedCallFrame(Fn)) Offset += FFI->getMaxCallFrameSize(); - unsigned AlignMask = TFI.getStackAlignment() - 1; + unsigned AlignMask = std::max(TFI.getStackAlignment(),MaxAlign) - 1; Offset = (Offset + AlignMask) & ~uint64_t(AlignMask); } Modified: llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp?rev=52750&r1=52749&r2=52750&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp (original) +++ llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp Wed Jun 25 20:51:13 2008 @@ -302,11 +302,9 @@ // Skip the saved EBP Offset += SlotSize; else { - unsigned MaxAlign = MF.getFrameInfo()->getMaxAlignment(); - uint64_t FrameSize = - (StackSize - SlotSize + MaxAlign - 1)/MaxAlign*MaxAlign; - - return Offset + FrameSize - SlotSize; + unsigned Align = MF.getFrameInfo()->getObjectAlignment(FI); + assert( (-(Offset + StackSize)) % Align == 0); + return Offset + StackSize; } // FIXME: Support tail calls Modified: llvm/trunk/utils/TableGen/RegisterInfoEmitter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/RegisterInfoEmitter.cpp?rev=52750&r1=52749&r2=52750&view=diff ============================================================================== --- llvm/trunk/utils/TableGen/RegisterInfoEmitter.cpp (original) +++ llvm/trunk/utils/TableGen/RegisterInfoEmitter.cpp Wed Jun 25 20:51:13 2008 @@ -64,6 +64,8 @@ << " virtual int getDwarfRegNumFull(unsigned RegNum, " << "unsigned Flavour) const;\n" << " virtual int getDwarfRegNum(unsigned RegNum, bool isEH) const = 0;\n" + << " virtual bool needsStackRealignment(const MachineFunction &) const\n" + << " { return false; }\n" << " unsigned getSubReg(unsigned RegNo, unsigned Index) const;\n" << "};\n\n"; From dalej at apple.com Wed Jun 25 20:55:32 2008 From: dalej at apple.com (Dale Johannesen) Date: Thu, 26 Jun 2008 01:55:32 -0000 Subject: [llvm-commits] [llvm] r52751 - /llvm/trunk/test/CodeGen/X86/mingw-alloca.ll Message-ID: <200806260155.m5Q1tWQa002294@zion.cs.uiuc.edu> Author: johannes Date: Wed Jun 25 20:55:32 2008 New Revision: 52751 URL: http://llvm.org/viewvc/llvm-project?rev=52751&view=rev Log: Allow for rounding up of stack frame. Modified: llvm/trunk/test/CodeGen/X86/mingw-alloca.ll Modified: llvm/trunk/test/CodeGen/X86/mingw-alloca.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/mingw-alloca.ll?rev=52751&r1=52750&r2=52751&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/X86/mingw-alloca.ll (original) +++ llvm/trunk/test/CodeGen/X86/mingw-alloca.ll Wed Jun 25 20:55:32 2008 @@ -2,7 +2,7 @@ ; RUN: grep __alloca %t | count 2 ; RUN: grep 4294967288 %t ; RUN: grep {pushl %eax} %t -; RUN: grep 8012 %t | count 2 +; RUN: grep 8028 %t | count 2 target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64" target triple = "i386-mingw32" From dalej at apple.com Wed Jun 25 20:56:27 2008 From: dalej at apple.com (Dale Johannesen) Date: Thu, 26 Jun 2008 01:56:27 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r52752 - /llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386-target.h Message-ID: <200806260156.m5Q1uRKY002324@zion.cs.uiuc.edu> Author: johannes Date: Wed Jun 25 20:56:27 2008 New Revision: 52752 URL: http://llvm.org/viewvc/llvm-project?rev=52752&view=rev Log: x86-64 byval vectors use 8 byte alignment. Modified: llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386-target.h Modified: llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386-target.h URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386-target.h?rev=52752&r1=52751&r2=52752&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386-target.h (original) +++ llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386-target.h Wed Jun 25 20:56:27 2008 @@ -85,10 +85,12 @@ #ifdef LLVM_ABI_H -/* Objects containing SSE vectors are 16 byte aligned, everything else 4. */ +/* On x86-32 objects containing SSE vectors are 16 byte aligned, everything + else 4. On x86-64 vectors are 8-byte aligned, everything else can + be figured out by the back end. */ extern "C" bool contains_128bit_aligned_vector_p(tree); #define LLVM_BYVAL_ALIGNMENT(T) \ - (TARGET_64BIT ? 0 : \ + (TARGET_64BIT ? (TREE_CODE(T)==VECTOR_TYPE ? 8 : 0) : \ TARGET_SSE && contains_128bit_aligned_vector_p(T) ? 16 : 4) extern tree llvm_x86_should_return_selt_struct_as_scalar(tree); From resistor at mac.com Wed Jun 25 23:47:41 2008 From: resistor at mac.com (Owen Anderson) Date: Thu, 26 Jun 2008 04:47:41 -0000 Subject: [llvm-commits] [llvm] r52763 - /llvm/trunk/lib/Analysis/ValueTracking.cpp Message-ID: <200806260447.m5Q4lfKc007278@zion.cs.uiuc.edu> Author: resistor Date: Wed Jun 25 23:47:41 2008 New Revision: 52763 URL: http://llvm.org/viewvc/llvm-project?rev=52763&view=rev Log: Reserve the size we'll need in advance. Modified: llvm/trunk/lib/Analysis/ValueTracking.cpp Modified: llvm/trunk/lib/Analysis/ValueTracking.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/ValueTracking.cpp?rev=52763&r1=52762&r2=52763&view=diff ============================================================================== --- llvm/trunk/lib/Analysis/ValueTracking.cpp (original) +++ llvm/trunk/lib/Analysis/ValueTracking.cpp Wed Jun 25 23:47:41 2008 @@ -1004,6 +1004,7 @@ // Traverse the constant array from StartIdx (derived above) which is // the place the GEP refers to in the array. + Str.reserve(NumElts); for (unsigned i = StartIdx; i < NumElts; ++i) { Constant *Elt = Array->getOperand(i); ConstantInt *CI = dyn_cast(Elt); From sabre at nondot.org Thu Jun 26 00:17:19 2008 From: sabre at nondot.org (Chris Lattner) Date: Thu, 26 Jun 2008 05:17:19 -0000 Subject: [llvm-commits] [llvm] r52766 - /llvm/trunk/lib/System/Path.cpp Message-ID: <200806260517.m5Q5HJSP008225@zion.cs.uiuc.edu> Author: lattner Date: Thu Jun 26 00:17:18 2008 New Revision: 52766 URL: http://llvm.org/viewvc/llvm-project?rev=52766&view=rev Log: "An improved Mach-O file type detection for sys::IdentifyFileType() This patch add supports for single architecture mach-o files (the current implementation only support Universal Binary), and solve the signature conflict between java class and Universal Binary magics. Note that this function will always returned dynamic library for Universal Binaries (like the current implementation) because the binary type is not include in the file header." Patch by Jean-Daniel Dupas! Modified: llvm/trunk/lib/System/Path.cpp Modified: llvm/trunk/lib/System/Path.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/System/Path.cpp?rev=52766&r1=52765&r2=52766&view=diff ============================================================================== --- llvm/trunk/lib/System/Path.cpp (original) +++ llvm/trunk/lib/System/Path.cpp Thu Jun 26 00:17:18 2008 @@ -80,26 +80,40 @@ break; case 0xCA: - // This is complicated by an overlap with Java class files. - // See the Mach-O section in /usr/share/file/magic for details. if (magic[1] == char(0xFE) && magic[2] == char(0xBA) && magic[3] == char(0xBE)) { - return Mach_O_DynamicallyLinkedSharedLib_FileType; - - // FIXME: How does this work? - if (length >= 14 && magic[13] == 0) - switch (magic[12]) { - default: break; - case 1: return Mach_O_Object_FileType; - case 2: return Mach_O_Executable_FileType; - case 3: return Mach_O_FixedVirtualMemorySharedLib_FileType; - case 4: return Mach_O_Core_FileType; - case 5: return Mach_O_PreloadExectuable_FileType; - case 6: return Mach_O_DynamicallyLinkedSharedLib_FileType; - case 7: return Mach_O_DynamicLinker_FileType; - case 8: return Mach_O_Bundle_FileType; - case 9: return Mach_O_DynamicallyLinkedSharedLibStub_FileType; - } + // This is complicated by an overlap with Java class files. + // See the Mach-O section in /usr/share/file/magic for details. + if (length >= 8 && magic[7] < 43) + // FIXME: Universal Binary of any type. + return Mach_O_DynamicallyLinkedSharedLib_FileType; + } + break; + + case 0xFE: + case 0xCE: + uint16_t type; + if (magic[0] == char(0xFE) && magic[1] == char(0xED) && + magic[2] == char(0xFA) && magic[3] == char(0xCE)) { + /* Native endian */ + if (length >= 16) type = magic[14] << 8 | magic[15]; + } else if (magic[0] == char(0xCE) && magic[1] == char(0xFA) && + magic[2] == char(0xED) && magic[3] == char(0xFE)) { + /* Reverse endian */ + if (length >= 14) type = magic[13] << 8 | magic[12]; + } + switch (type) { + default: break; + case 1: return Mach_O_Object_FileType; + case 2: return Mach_O_Executable_FileType; + case 3: return Mach_O_FixedVirtualMemorySharedLib_FileType; + case 4: return Mach_O_Core_FileType; + case 5: return Mach_O_PreloadExectuable_FileType; + case 6: return Mach_O_DynamicallyLinkedSharedLib_FileType; + case 7: return Mach_O_DynamicLinker_FileType; + case 8: return Mach_O_Bundle_FileType; + case 9: return Mach_O_DynamicallyLinkedSharedLibStub_FileType; + case 10: break; // FIXME: MH_DSYM companion file with only debug. } break; From isanbard at gmail.com Thu Jun 26 03:16:48 2008 From: isanbard at gmail.com (Bill Wendling) Date: Thu, 26 Jun 2008 08:16:48 -0000 Subject: [llvm-commits] [llvm] r52773 - /llvm/tags/Apple/llvmCore-2050/ Message-ID: <200806260816.m5Q8Gm9h024196@zion.cs.uiuc.edu> Author: void Date: Thu Jun 26 03:16:48 2008 New Revision: 52773 URL: http://llvm.org/viewvc/llvm-project?rev=52773&view=rev Log: Creating llvmCore-2050 branch Added: llvm/tags/Apple/llvmCore-2050/ - copied from r52772, llvm/trunk/ From isanbard at gmail.com Thu Jun 26 03:16:54 2008 From: isanbard at gmail.com (Bill Wendling) Date: Thu, 26 Jun 2008 08:16:54 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r52774 - /llvm-gcc-4.2/tags/Apple/llvmgcc42-2050/ Message-ID: <200806260816.m5Q8Gs6k024209@zion.cs.uiuc.edu> Author: void Date: Thu Jun 26 03:16:54 2008 New Revision: 52774 URL: http://llvm.org/viewvc/llvm-project?rev=52774&view=rev Log: Creating llvmgcc42-2050 branch Added: llvm-gcc-4.2/tags/Apple/llvmgcc42-2050/ - copied from r52773, llvm-gcc-4.2/trunk/ From isanbard at gmail.com Thu Jun 26 03:32:05 2008 From: isanbard at gmail.com (Bill Wendling) Date: Thu, 26 Jun 2008 08:32:05 -0000 Subject: [llvm-commits] [llvm] r52775 - /llvm/trunk/lib/System/Path.cpp Message-ID: <200806260832.m5Q8W6ov024714@zion.cs.uiuc.edu> Author: void Date: Thu Jun 26 03:32:05 2008 New Revision: 52775 URL: http://llvm.org/viewvc/llvm-project?rev=52775&view=rev Log: Cleanup for unitialized types. Patch by Jean-Daniel Dupas! Modified: llvm/trunk/lib/System/Path.cpp Modified: llvm/trunk/lib/System/Path.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/System/Path.cpp?rev=52775&r1=52774&r2=52775&view=diff ============================================================================== --- llvm/trunk/lib/System/Path.cpp (original) +++ llvm/trunk/lib/System/Path.cpp Thu Jun 26 03:32:05 2008 @@ -91,8 +91,8 @@ break; case 0xFE: - case 0xCE: - uint16_t type; + case 0xCE: { + uint16_t type = 0; if (magic[0] == char(0xFE) && magic[1] == char(0xED) && magic[2] == char(0xFA) && magic[3] == char(0xCE)) { /* Native endian */ @@ -101,7 +101,7 @@ magic[2] == char(0xED) && magic[3] == char(0xFE)) { /* Reverse endian */ if (length >= 14) type = magic[13] << 8 | magic[12]; - } + } switch (type) { default: break; case 1: return Mach_O_Object_FileType; @@ -116,7 +116,7 @@ case 10: break; // FIXME: MH_DSYM companion file with only debug. } break; - + } case 0xF0: // PowerPC Windows case 0x83: // Alpha 32-bit case 0x84: // Alpha 64-bit From baldrick at free.fr Thu Jun 26 03:32:10 2008 From: baldrick at free.fr (Duncan Sands) Date: Thu, 26 Jun 2008 10:32:10 +0200 Subject: [llvm-commits] [llvm] r52747 - in /llvm/trunk: lib/CodeGen/SelectionDAG/DAGCombiner.cpp test/CodeGen/X86/uint_to_fp.ll In-Reply-To: <200806260016.m5Q0Gnl5031985@zion.cs.uiuc.edu> References: <200806260016.m5Q0Gnl5031985@zion.cs.uiuc.edu> Message-ID: <200806261032.10723.baldrick@free.fr> Hi Chris, > + // If the input is a legal type, and UINT_TO_FP is not legal on this target, > + // but SINT_TO_FP is legal on this target, try to convert. > + if (TLI.isTypeLegal(OpVT) && !TLI.isOperationLegal(ISD::UINT_TO_FP, OpVT) && > + TLI.isOperationLegal(ISD::SINT_TO_FP, OpVT)) { there is no need to test for a legal type, since if the type is illegal then isOperationLegal will return false. Ciao, Duncan. From tilmann.scheller at googlemail.com Thu Jun 26 04:41:08 2008 From: tilmann.scheller at googlemail.com (Tilmann Scheller) Date: Thu, 26 Jun 2008 09:41:08 -0000 Subject: [llvm-commits] [vmkit] r52778 - in /vmkit/trunk: include/debug.h lib/N3/VMCore/Assembly.cpp lib/N3/VMCore/Assembly.h lib/N3/VMCore/CLIJit.cpp lib/N3/VMCore/CLISignature.cpp lib/N3/VMCore/Opcodes.cpp lib/N3/VMCore/VMClass.cpp lib/N3/VMCore/VMClass.h lib/N3/VMCore/VirtualTables.cpp Message-ID: <200806260941.m5Q9f8Ae027383@zion.cs.uiuc.edu> Author: tilmann Date: Thu Jun 26 04:41:06 2008 New Revision: 52778 URL: http://llvm.org/viewvc/llvm-project?rev=52778&view=rev Log: add preliminary support for generic classes to N3 Modified: vmkit/trunk/include/debug.h vmkit/trunk/lib/N3/VMCore/Assembly.cpp vmkit/trunk/lib/N3/VMCore/Assembly.h vmkit/trunk/lib/N3/VMCore/CLIJit.cpp vmkit/trunk/lib/N3/VMCore/CLISignature.cpp vmkit/trunk/lib/N3/VMCore/Opcodes.cpp vmkit/trunk/lib/N3/VMCore/VMClass.cpp vmkit/trunk/lib/N3/VMCore/VMClass.h vmkit/trunk/lib/N3/VMCore/VirtualTables.cpp Modified: vmkit/trunk/include/debug.h URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/include/debug.h?rev=52778&r1=52777&r2=52778&view=diff ============================================================================== --- vmkit/trunk/include/debug.h (original) +++ vmkit/trunk/include/debug.h Thu Jun 26 04:41:06 2008 @@ -10,6 +10,12 @@ #ifndef DEBUG_H #define DEBUG_H +#define DEBUG 0 +#define N3_COMPILE 0 //2 +#define N3_EXECUTE 0 +#define DEBUG_LOAD 0 //2 +#define N3_LOAD 0 //1 + #define ESC "\033[" #define COLOR_NORMAL "" #define END "m" Modified: vmkit/trunk/lib/N3/VMCore/Assembly.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/N3/VMCore/Assembly.cpp?rev=52778&r1=52777&r2=52778&view=diff ============================================================================== --- vmkit/trunk/lib/N3/VMCore/Assembly.cpp (original) +++ vmkit/trunk/lib/N3/VMCore/Assembly.cpp Thu Jun 26 04:41:06 2008 @@ -215,6 +215,11 @@ STRING(CONSTANT_FILE_NAME) BLOB(CONSTANT_FILE_HASH_VALUE)) +DEF_TABLE_MASK(METHOD_GenericParam, 4, + INT16(CONSTANT_GENERIC_PARAM_NUMBER) + INT16(CONSTANT_GENERIC_PARAM_FLAGS) + TYPE_OR_METHODDEF(CONSTANT_GENERIC_PARAM_OWNER) + STRING(CONSTANT_GENERIC_PARAM_NAME)) void Header::print(mvm::PrintBuffer* buf) const { buf->write("Header<>"); @@ -332,7 +337,52 @@ VMClass* cl = (VMClass*)loadedNameClasses->lookupOrCreate(CC, this, classDup); loadedTokenClasses->lookupOrCreate(token, cl); cl->token = token; - cl->assembly = this; + return cl; +} + +static VMCommonClass* genClassDup(ClassNameCmp &cmp, Assembly* ass) { + VMClass* cl = gc_new(VMGenericClass)(); + cl->initialise(ass->vm, false); + cl->name = cmp.name; + cl->nameSpace = cmp.nameSpace; + cl->virtualTracer = 0; + cl->staticInstance = 0; + cl->virtualInstance = 0; + cl->virtualType = 0; + cl->super = 0; + cl->status = hashed; + cl->assembly = ass; + return cl; +} + +VMGenericClass* Assembly::constructGenericClass(const UTF8* name, + const UTF8* nameSpace, std::vector genArgs, uint32 token) { + uint32 size = name->size + 2; + sint32 i = 0; + for (std::vector::iterator it = genArgs.begin(), e = genArgs.end(); it!= e; ++it) { + size += (*it)->name->size + 1; + } + uint16* buf = (uint16*) alloca(sizeof(uint16) * size); + for (i = 0; i < name->size; i++) { + buf[i] = name->at(i); + } + buf[i++] = '<'; + for (std::vector::iterator it = genArgs.begin(), e = genArgs.end(); it!= e; ++it) { + for (int j = 0; j < (*it)->name->size; i++, j++) { + buf[i] = (*it)->name->at(j); + } + buf[i++] = ','; + } + buf[i] = '>'; + const UTF8* genName = UTF8::readerConstruct(VMThread::get()->vm, buf, size); + printf("%s\n", genName->printString()); + + ClassNameCmp CC(genName, nameSpace); + VMGenericClass* cl = (VMGenericClass*) loadedNameClasses->lookupOrCreate(CC, this, genClassDup); + + cl->genericParams = genArgs; // TODO GC safe? + cl->token = token; + return cl; } @@ -377,6 +427,7 @@ ass->assemblyRefs = 0; ass->isRead = false; ass->name = name; + ass->currGenericClass = 0; return ass; } @@ -429,7 +480,7 @@ unimplemented, // 0x27 METHOD_ManifestResource, // 0x28 METHOD_NestedClass, // 0x29 - unimplemented, // 0x2A + METHOD_GenericParam, // 0x2A METHOD_MethodSpec, // 0x2B METHOD_GenericParamConstraint,// 0x2C unimplemented, @@ -496,7 +547,7 @@ "unimplemented", // 0x27 "METHOD_ManifestResource", // 0x28 "METHOD_NestedClass", // 0x29 - "unimplemented", // 0x2A + "METHOD_GenericParam", // 0x2A "METHOD_MethodSpec", // 0x2B "METHOD_GenericParamConstraint", // 0x2C "unimplemented", @@ -909,6 +960,10 @@ } VMClass* Assembly::readTypeDef(N3* vm, uint32 index) { + return readTypeDef(vm, index, (std::vector) 0); +} + +VMClass* Assembly::readTypeDef(N3* vm, uint32 index, std::vector genArgs) { uint32 token = (CONSTANT_TypeDef << 24) + index; uint32 stringOffset = CLIHeader->stringStream->realOffset; @@ -929,9 +984,18 @@ //Table* methodTable = CLIHeader->tables[CONSTANT_MethodDef]; //uint32 methodSize = methodTable->rowsNumber; - VMClass* type = constructClass(readString(vm, name + stringOffset), + VMClass* type; + + if (genArgs == (std::vector) 0) { + type = constructClass(readString(vm, name + stringOffset), + readString(vm, nameSpace + stringOffset), + token); + } else { + // generic type + type = constructGenericClass(readString(vm, name + stringOffset), readString(vm, nameSpace + stringOffset), - token); + genArgs, token); + } type->vm = vm; @@ -991,10 +1055,15 @@ } } +VMCommonClass* Assembly::loadType(N3* vm, uint32 token, bool resolve, + bool resolveStatic, bool clinit, bool dothrow) { + return loadType(vm, token, resolve, resolveStatic, clinit, dothrow, (std::vector) 0); +} VMCommonClass* Assembly::loadType(N3* vm, uint32 token, bool resolve, - bool resolveStatic, bool clinit, bool dothrow) { + bool resolveStatic, bool clinit, bool dothrow, + std::vector genArgs) { VMCommonClass* type = lookupClassFromToken(token); if (!type || type->status == hashed) { @@ -1002,7 +1071,7 @@ uint32 index = token & 0xffff; if (table == CONSTANT_TypeDef) { - type = readTypeDef(vm, index); + type = readTypeDef(vm, index, genArgs); } else if (table == CONSTANT_TypeRef) { type = readTypeRef(vm, index); } else if (table == CONSTANT_TypeSpec) { @@ -1027,6 +1096,9 @@ } void Assembly::readClass(VMCommonClass* cl) { + // temporarily store the class being read in case it is a generic class + currGenericClass = dynamic_cast(cl); + uint32 index = cl->token & 0xffff; Table* typeTable = CLIHeader->tables[CONSTANT_TypeDef]; uint32 typeSize = typeTable->rowsNumber; @@ -1077,6 +1149,9 @@ } } } + + // we have stopped reading a generic class + currGenericClass = 0; } void Assembly::readCustomAttributes(uint32 offset, std::vector& args, VMMethod* meth) { @@ -1233,6 +1308,8 @@ if (rva) { meth->offset = textSection->rawAddress + (rva - textSection->virtualAddress); + } else { + meth->offset = 0; } if (paramList && paramTable != 0 && paramList <= paramSize) { @@ -1580,16 +1657,26 @@ case 3: VMThread::get()->vm->error("implement me %d", table); break; case 4: { VMClass* type = (VMClass*)readTypeSpec(vm, index); - VMMethod* meth = gc_new(VMMethod)(); - bool virt = extractMethodSignature(offset, type, args); - bool structReturn = false; - const llvm::FunctionType* signature = VMMethod::resolveSignature(args, virt, structReturn); - meth->_signature = signature; - meth->classDef = type; - meth->name = name; - meth->virt = virt; - meth->structReturn = structReturn; - return meth; + + VMGenericClass* genClass = dynamic_cast(type); + + if (genClass) { + bool virt = extractMethodSignature(offset, type, args); + VMMethod* meth = type->lookupMethod(name, args, !virt, true); + return meth; + } else { + VMMethod* meth = gc_new(VMMethod)(); + bool virt = extractMethodSignature(offset, type, args); + bool structReturn = false; + const llvm::FunctionType* signature = VMMethod::resolveSignature(args, virt, structReturn); + meth->_signature = signature; + meth->classDef = type; + meth->name = name; + meth->virt = virt; + meth->structReturn = structReturn; + meth->parameters = args; // TODO check whether this fix is correct + return meth; + } } default: VMThread::get()->vm->error("unknown MemberRefParent tag %d", table); Modified: vmkit/trunk/lib/N3/VMCore/Assembly.h URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/N3/VMCore/Assembly.h?rev=52778&r1=52777&r2=52778&view=diff ============================================================================== --- vmkit/trunk/lib/N3/VMCore/Assembly.h (original) +++ vmkit/trunk/lib/N3/VMCore/Assembly.h Thu Jun 26 04:41:06 2008 @@ -42,6 +42,7 @@ class UTF8; class VirtualMachine; class VMClass; +class VMGenericClass; class VMClassArray; class VMClassPointer; class VMCommonClass; @@ -142,6 +143,10 @@ uint32 dims); VMClass* constructClass(const UTF8* name, const UTF8* nameSpace, uint32 token); + VMGenericClass* constructGenericClass(const UTF8* name, + const UTF8* nameSpace, + std::vector genArgs, + uint32 token); VMField* constructField(VMClass* cl, const UTF8* name, VMCommonClass* signature, uint32 token); VMMethod* constructMethod(VMClass* cl, const UTF8* name, @@ -155,6 +160,9 @@ ClassTokenMap* loadedTokenClasses; MethodTokenMap* loadedTokenMethods; FieldTokenMap* loadedTokenFields; + + // helper which points to the current generic class while it is being read in readClass() + VMGenericClass* currGenericClass; mvm::Lock* lockVar; mvm::Cond* condVar; @@ -202,6 +210,8 @@ uint32 getTypeDefTokenFromMethod(uint32 token); VMCommonClass* loadType(N3* vm, uint32 token, bool resolveFunc, bool resolve, bool clinit, bool dothrow); + VMCommonClass* loadType(N3* vm, uint32 token, bool resolveFunc, bool resolve, + bool clinit, bool dothrow, std::vector genArgs); VMCommonClass* loadTypeFromName(const UTF8* name, const UTF8* nameSpace, bool resolveFunc, bool resolve, @@ -213,6 +223,7 @@ VMField* readField(uint32 index, VMCommonClass* cl); Param* readParam(uint32 index, VMMethod* meth); VMClass* readTypeDef(N3* vm, uint32 index); + VMClass* readTypeDef(N3* vm, uint32 index, std::vector genArgs); VMCommonClass* readTypeSpec(N3* vm, uint32 index); Assembly* readAssemblyRef(N3* vm, uint32 index); VMCommonClass* readTypeRef(N3* vm, uint32 index); @@ -704,6 +715,11 @@ #define CONSTANT_FILE_NAME 1 #define CONSTANT_FILE_HASH_VALUE 2 +#define CONSTANT_GENERIC_PARAM_NUMBER 0 +#define CONSTANT_GENERIC_PARAM_FLAGS 1 +#define CONSTANT_GENERIC_PARAM_OWNER 2 +#define CONSTANT_GENERIC_PARAM_NAME 3 + } // end namespace n3 #endif Modified: vmkit/trunk/lib/N3/VMCore/CLIJit.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/N3/VMCore/CLIJit.cpp?rev=52778&r1=52777&r2=52778&view=diff ============================================================================== --- vmkit/trunk/lib/N3/VMCore/CLIJit.cpp (original) +++ vmkit/trunk/lib/N3/VMCore/CLIJit.cpp Thu Jun 26 04:41:06 2008 @@ -7,9 +7,9 @@ // //===----------------------------------------------------------------------===// -#define DEBUG 0 -#define N3_COMPILE 0 -#define N3_EXECUTE 0 +//#define DEBUG 0 +//#define N3_COMPILE 0 +//#define N3_EXECUTE 0 #include "debug.h" #include "types.h" @@ -458,12 +458,23 @@ CLIJit* jit = gc_new(CLIJit)(); jit->compilingClass = meth->classDef; jit->compilingMethod = meth; + + // save current class in case of recursive calls to compile() + VMGenericClass* old = jit->compilingClass->assembly->currGenericClass; + // temporarily store the class being compiled in case it is a generic class + jit->compilingClass->assembly->currGenericClass = dynamic_cast(jit->compilingClass); + + jit->unifiedUnreachable = unifiedUnreachable; jit->inlineMethods = inlineMethods; jit->inlineMethods[meth] = true; Instruction* ret = jit->inlineCompile(llvmFunction, currentBlock, currentExceptionBlock, args); inlineMethods[meth] = false; + + // restore saved class + jit->compilingClass = old; + return ret; } @@ -915,7 +926,7 @@ Function* CLIJit::compileNative() { PRINT_DEBUG(N3_COMPILE, 1, COLOR_NORMAL, "native compile %s\n", compilingMethod->printString()); - + const FunctionType *funcType = compilingMethod->getSignature(); Function* func = llvmFunction = compilingMethod->methPtr; @@ -1409,6 +1420,11 @@ jit->compilingClass = cl; jit->compilingMethod = meth; + // save current class in case of recursive calls to compile() + VMGenericClass* old = cl->assembly->currGenericClass; + // temporarily store the class being compiled in case it is a generic class + cl->assembly->currGenericClass = dynamic_cast(cl); + meth->getSignature(); if (isInternal(meth->implFlags)) { return jit->compileNative(); @@ -1417,6 +1433,9 @@ } else { return jit->compileFatOrTiny(); } + + // restore saved class + cl->assembly->currGenericClass = old; } llvm::Function *VMMethod::compiledPtr() { Modified: vmkit/trunk/lib/N3/VMCore/CLISignature.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/N3/VMCore/CLISignature.cpp?rev=52778&r1=52777&r2=52778&view=diff ============================================================================== --- vmkit/trunk/lib/N3/VMCore/CLISignature.cpp (original) +++ vmkit/trunk/lib/N3/VMCore/CLISignature.cpp Thu Jun 26 04:41:06 2008 @@ -136,9 +136,11 @@ } static VMCommonClass* METHOD_ElementTypeVar(uint32 op, Assembly* ass, uint32& offset) { + uint32 number = ass->uncompressSignature(offset); + return ass->currGenericClass->genericParams[number]; //uint32 type = READ_U4(ass->bytes, offset); - VMThread::get()->vm->error("implement me"); - return 0; + //VMThread::get()->vm->error("implement me"); + //return 0; } static VMCommonClass* METHOD_ElementTypeArray(uint32 op, Assembly* ass, uint32& offset) { @@ -167,8 +169,54 @@ } static VMCommonClass* METHOD_ElementTypeGenericInst(uint32 op, Assembly* ass, uint32& offset) { - VMThread::get()->vm->error("implement me"); - return 0; + // offset points to (CLASS | VALUETYPE) TypeDefOrRefEncoded + + // skip generic type definition + offset++; // this is (CLASS | VALUETYPE) + + // save starting offset for later use + uint32 genericTypeOffset = offset; + + ass->uncompressSignature(offset); // TypeDefOrRefEncoded + + //VMCommonClass* cl = ass->exploreType(offset); + + uint32 argCount = ass->uncompressSignature(offset); + + std::vector args; + + // Get generic arguments. + for (uint32 i = 0; i < argCount; ++i) { + args.push_back(ass->exploreType(offset)); + } + + // save offset + uint32 endOffset = offset; + // restore starting offset + offset = genericTypeOffset; + + // TypeDefOrRefEncoded + uint32 value = ass->uncompressSignature(offset); + uint32 table = value & 3; + uint32 index = value >> 2; + uint32 token = 0; + + switch (table) { + case 0: table = CONSTANT_TypeDef; break; + case 1: table = CONSTANT_TypeRef; break; + case 2: table = CONSTANT_TypeSpec; break; + default: + VMThread::get()->vm->error("unknown TypeDefOrRefEncoded %d", index); + break; + } + + token = (table << 24) + index; + VMCommonClass* cl = ass->loadType((N3*)(VMThread::get()->vm), token, false, + false, false, true, args); + // restore endOffset + offset = endOffset; + + return cl; } static VMCommonClass* METHOD_ElementTypeTypedByRef(uint32 op, Assembly* ass, uint32& offset) { Modified: vmkit/trunk/lib/N3/VMCore/Opcodes.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/N3/VMCore/Opcodes.cpp?rev=52778&r1=52777&r2=52778&view=diff ============================================================================== --- vmkit/trunk/lib/N3/VMCore/Opcodes.cpp (original) +++ vmkit/trunk/lib/N3/VMCore/Opcodes.cpp Thu Jun 26 04:41:06 2008 @@ -7,9 +7,9 @@ // //===----------------------------------------------------------------------===// -#define DEBUG 0 -#define N3_COMPILE 0 -#define N3_EXECUTE 0 +//#define DEBUG 0 +//#define N3_COMPILE 0 +//#define N3_EXECUTE 0 #include Modified: vmkit/trunk/lib/N3/VMCore/VMClass.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/N3/VMCore/VMClass.cpp?rev=52778&r1=52777&r2=52778&view=diff ============================================================================== --- vmkit/trunk/lib/N3/VMCore/VMClass.cpp (original) +++ vmkit/trunk/lib/N3/VMCore/VMClass.cpp Thu Jun 26 04:41:06 2008 @@ -395,6 +395,7 @@ void VMCommonClass::resolveType(bool stat, bool clinit) { VMCommonClass* cl = this; + //printf("*** Resolving: %s\n", cl->printString()); if (cl->status < resolved) { cl->aquire(); int status = cl->status; @@ -815,3 +816,7 @@ } return true; } + +void VMGenericClass::print(mvm::PrintBuffer* buf) const { + buf->write("Generic Class"); +} Modified: vmkit/trunk/lib/N3/VMCore/VMClass.h URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/N3/VMCore/VMClass.h?rev=52778&r1=52777&r2=52778&view=diff ============================================================================== --- vmkit/trunk/lib/N3/VMCore/VMClass.h (original) +++ vmkit/trunk/lib/N3/VMCore/VMClass.h Thu Jun 26 04:41:06 2008 @@ -147,6 +147,15 @@ uint32 explicitLayoutSize; }; +class VMGenericClass : public VMClass { +public: + static VirtualTable* VT; + virtual void print(mvm::PrintBuffer* buf) const; + virtual void TRACER; + + std::vector genericParams; +}; + class VMClassArray : public VMCommonClass { public: static VirtualTable* VT; Modified: vmkit/trunk/lib/N3/VMCore/VirtualTables.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/N3/VMCore/VirtualTables.cpp?rev=52778&r1=52777&r2=52778&view=diff ============================================================================== --- vmkit/trunk/lib/N3/VMCore/VirtualTables.cpp (original) +++ vmkit/trunk/lib/N3/VMCore/VirtualTables.cpp Thu Jun 26 04:41:06 2008 @@ -40,6 +40,7 @@ INIT(UTF8); INIT(VMCommonClass); INIT(VMClass); + INIT(VMGenericClass); INIT(VMClassArray); INIT(VMClassPointer); INIT(VMMethod); @@ -169,6 +170,11 @@ outerClass->MARK_AND_TRACE; } +void VMGenericClass::TRACER { + VMClass::PARENT_TRACER; + TRACE_VECTOR(VMCommonClass*, genericParams, std::allocator); +} + void VMClassArray::TRACER { VMCommonClass::PARENT_TRACER; baseClass->MARK_AND_TRACE; From matthijs at stdin.nl Thu Jun 26 04:48:11 2008 From: matthijs at stdin.nl (Matthijs Kooijman) Date: Thu, 26 Jun 2008 09:48:11 -0000 Subject: [llvm-commits] [llvm] r52779 - /llvm/trunk/include/llvm/Transforms/IPO.h Message-ID: <200806260948.m5Q9mCYL027736@zion.cs.uiuc.edu> Author: matthijs Date: Thu Jun 26 04:48:11 2008 New Revision: 52779 URL: http://llvm.org/viewvc/llvm-project?rev=52779&view=rev Log: Improve comments wrt createInternalize. Modified: llvm/trunk/include/llvm/Transforms/IPO.h Modified: llvm/trunk/include/llvm/Transforms/IPO.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Transforms/IPO.h?rev=52779&r1=52778&r2=52779&view=diff ============================================================================== --- llvm/trunk/include/llvm/Transforms/IPO.h (original) +++ llvm/trunk/include/llvm/Transforms/IPO.h Thu Jun 26 04:48:11 2008 @@ -106,14 +106,19 @@ /// of the api. If a list of symbols is specified with the /// -internalize-public-api-* command line options, those symbols are not /// internalized and all others are. Otherwise if AllButMain is set and the -/// main function is found, all other globals are marked as internal. +/// main function is found, all other globals are marked as internal. If no api +/// is supplied and AllButMain is not set, or no main function is found, nothing +/// is internalized. /// ModulePass *createInternalizePass(bool AllButMain); /// createInternalizePass - This pass loops over all of the functions in the /// input module, internalizing all globals (functions and variables) not in the /// given exportList. -ModulePass *createInternalizePass(const std::vector &exportList); +/// +/// Note that commandline options that are used with the above function are not +/// used now! Also, when exportList is empty, nothing is internalized. +ModulePass *createInternalizePass(const std::vector &exportList) //===----------------------------------------------------------------------===// /// createDeadArgEliminationPass - This pass removes arguments from functions From matthijs at stdin.nl Thu Jun 26 04:49:39 2008 From: matthijs at stdin.nl (Matthijs Kooijman) Date: Thu, 26 Jun 2008 09:49:39 -0000 Subject: [llvm-commits] [llvm] r52780 - /llvm/trunk/include/llvm/Transforms/IPO.h Message-ID: <200806260949.m5Q9ndth027784@zion.cs.uiuc.edu> Author: matthijs Date: Thu Jun 26 04:49:38 2008 New Revision: 52780 URL: http://llvm.org/viewvc/llvm-project?rev=52780&view=rev Log: Add missing semicolumn in my last commit. Modified: llvm/trunk/include/llvm/Transforms/IPO.h Modified: llvm/trunk/include/llvm/Transforms/IPO.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Transforms/IPO.h?rev=52780&r1=52779&r2=52780&view=diff ============================================================================== --- llvm/trunk/include/llvm/Transforms/IPO.h (original) +++ llvm/trunk/include/llvm/Transforms/IPO.h Thu Jun 26 04:49:38 2008 @@ -118,7 +118,7 @@ /// /// Note that commandline options that are used with the above function are not /// used now! Also, when exportList is empty, nothing is internalized. -ModulePass *createInternalizePass(const std::vector &exportList) +ModulePass *createInternalizePass(const std::vector &exportList); //===----------------------------------------------------------------------===// /// createDeadArgEliminationPass - This pass removes arguments from functions From matthijs at stdin.nl Thu Jun 26 05:37:00 2008 From: matthijs at stdin.nl (Matthijs Kooijman) Date: Thu, 26 Jun 2008 10:37:00 -0000 Subject: [llvm-commits] [llvm] r52781 - in /llvm/trunk: autoconf/configure.ac configure lib/System/Mutex.cpp lib/Target/CBackend/CBackend.cpp test/FrontendC/extern-weak.c Message-ID: <200806261037.m5QAb2rk029165@zion.cs.uiuc.edu> Author: matthijs Date: Thu Jun 26 05:36:58 2008 New Revision: 52781 URL: http://llvm.org/viewvc/llvm-project?rev=52781&view=rev Log: Make LLVM compile on DragonFly BSD (PR2499). Patch by Hasso Tepper! Modified: llvm/trunk/autoconf/configure.ac llvm/trunk/configure llvm/trunk/lib/System/Mutex.cpp llvm/trunk/lib/Target/CBackend/CBackend.cpp llvm/trunk/test/FrontendC/extern-weak.c Modified: llvm/trunk/autoconf/configure.ac URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/autoconf/configure.ac?rev=52781&r1=52780&r2=52781&view=diff ============================================================================== --- llvm/trunk/autoconf/configure.ac (original) +++ llvm/trunk/autoconf/configure.ac Thu Jun 26 05:36:58 2008 @@ -140,6 +140,11 @@ llvm_cv_no_link_all_option="-Wl,--no-whole-archive" llvm_cv_os_type="NetBSD" llvm_cv_platform_type="Unix" ;; + *-*-dragonfly*) + llvm_cv_link_all_option="-Wl,--whole-archive" + llvm_cv_no_link_all_option="-Wl,--no-whole-archive" + llvm_cv_os_type="DragonFly" + llvm_cv_platform_type="Unix" ;; *-*-hpux*) llvm_cv_link_all_option="-Wl,--whole-archive" llvm_cv_no_link_all_option="-Wl,--no-whole-archive" Modified: llvm/trunk/configure URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/configure?rev=52781&r1=52780&r2=52781&view=diff ============================================================================== --- llvm/trunk/configure (original) +++ llvm/trunk/configure Thu Jun 26 05:36:58 2008 @@ -2287,6 +2287,11 @@ llvm_cv_no_link_all_option="-Wl,--no-whole-archive" llvm_cv_os_type="NetBSD" llvm_cv_platform_type="Unix" ;; + *-*-dragonfly*) + llvm_cv_link_all_option="-Wl,--whole-archive" + llvm_cv_no_link_all_option="-Wl,--no-whole-archive" + llvm_cv_os_type="DragonFly" + llvm_cv_platform_type="Unix" ;; *-*-hpux*) llvm_cv_link_all_option="-Wl,--whole-archive" llvm_cv_no_link_all_option="-Wl,--no-whole-archive" @@ -10641,7 +10646,7 @@ lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext < conftest.$ac_ext + echo '#line 12793 "configure"' > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? @@ -14503,11 +14508,11 @@ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:14506: $lt_compile\"" >&5) + (eval echo "\"\$as_me:14511: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:14510: \$? = $ac_status" >&5 + echo "$as_me:14515: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -14771,11 +14776,11 @@ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:14774: $lt_compile\"" >&5) + (eval echo "\"\$as_me:14779: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:14778: \$? = $ac_status" >&5 + echo "$as_me:14783: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -14875,11 +14880,11 @@ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:14878: $lt_compile\"" >&5) + (eval echo "\"\$as_me:14883: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:14882: \$? = $ac_status" >&5 + echo "$as_me:14887: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -17327,7 +17332,7 @@ lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext < conftest.$ac_ext <&5) + (eval echo "\"\$as_me:19803: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:19802: \$? = $ac_status" >&5 + echo "$as_me:19807: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -19899,11 +19904,11 @@ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:19902: $lt_compile\"" >&5) + (eval echo "\"\$as_me:19907: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:19906: \$? = $ac_status" >&5 + echo "$as_me:19911: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -21469,11 +21474,11 @@ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:21472: $lt_compile\"" >&5) + (eval echo "\"\$as_me:21477: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:21476: \$? = $ac_status" >&5 + echo "$as_me:21481: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -21573,11 +21578,11 @@ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:21576: $lt_compile\"" >&5) + (eval echo "\"\$as_me:21581: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:21580: \$? = $ac_status" >&5 + echo "$as_me:21585: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -23808,11 +23813,11 @@ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:23811: $lt_compile\"" >&5) + (eval echo "\"\$as_me:23816: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:23815: \$? = $ac_status" >&5 + echo "$as_me:23820: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -24076,11 +24081,11 @@ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:24079: $lt_compile\"" >&5) + (eval echo "\"\$as_me:24084: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:24083: \$? = $ac_status" >&5 + echo "$as_me:24088: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -24180,11 +24185,11 @@ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:24183: $lt_compile\"" >&5) + (eval echo "\"\$as_me:24188: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:24187: \$? = $ac_status" >&5 + echo "$as_me:24192: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized Modified: llvm/trunk/lib/System/Mutex.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/System/Mutex.cpp?rev=52781&r1=52780&r2=52781&view=diff ============================================================================== --- llvm/trunk/lib/System/Mutex.cpp (original) +++ llvm/trunk/lib/System/Mutex.cpp Thu Jun 26 05:36:58 2008 @@ -75,7 +75,7 @@ errorcode = pthread_mutexattr_settype(&attr, kind); assert(errorcode == 0); -#if !defined(__FreeBSD__) && !defined(__OpenBSD__) && !defined(__NetBSD__) +#if !defined(__FreeBSD__) && !defined(__OpenBSD__) && !defined(__NetBSD__) && !defined(__DragonFly__) // Make it a process local mutex errorcode = pthread_mutexattr_setpshared(&attr, PTHREAD_PROCESS_PRIVATE); #endif Modified: llvm/trunk/lib/Target/CBackend/CBackend.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/CBackend/CBackend.cpp?rev=52781&r1=52780&r2=52781&view=diff ============================================================================== --- llvm/trunk/lib/Target/CBackend/CBackend.cpp (original) +++ llvm/trunk/lib/Target/CBackend/CBackend.cpp Thu Jun 26 05:36:58 2008 @@ -1415,7 +1415,7 @@ << "extern void *__builtin_alloca(unsigned int);\n" << "#endif\n" << "#define alloca(x) __builtin_alloca(x)\n" - << "#elif defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__)\n" + << "#elif defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__DragonFly__)\n" << "#define alloca(x) __builtin_alloca(x)\n" << "#elif defined(_MSC_VER)\n" << "#define inline _inline\n" Modified: llvm/trunk/test/FrontendC/extern-weak.c URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/FrontendC/extern-weak.c?rev=52781&r1=52780&r2=52781&view=diff ============================================================================== --- llvm/trunk/test/FrontendC/extern-weak.c (original) +++ llvm/trunk/test/FrontendC/extern-weak.c Thu Jun 26 05:36:58 2008 @@ -2,7 +2,7 @@ // RUN: %llvmgcc -O3 -S -o - -emit-llvm %s | llvm-as | llc #if !defined(__linux__) && !defined(__FreeBSD__) && \ - !defined(__OpenBSD__) && !defined(__CYGWIN__) + !defined(__OpenBSD__) && !defined(__CYGWIN__) && !defined(__DragonFly__) void foo() __attribute__((weak_import)); #else void foo() __attribute__((weak)); From nicolas.geoffray at lip6.fr Thu Jun 26 10:46:11 2008 From: nicolas.geoffray at lip6.fr (Nicolas Geoffray) Date: Thu, 26 Jun 2008 15:46:11 -0000 Subject: [llvm-commits] [vmkit] r52783 - in /vmkit/trunk: include/debug.h lib/N3/VMCore/Opcodes.cpp Message-ID: <200806261546.m5QFkBCJ007196@zion.cs.uiuc.edu> Author: geoffray Date: Thu Jun 26 10:46:10 2008 New Revision: 52783 URL: http://llvm.org/viewvc/llvm-project?rev=52783&view=rev Log: Remove warnings when compiling N3 with debugging. Modified: vmkit/trunk/include/debug.h vmkit/trunk/lib/N3/VMCore/Opcodes.cpp Modified: vmkit/trunk/include/debug.h URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/include/debug.h?rev=52783&r1=52782&r2=52783&view=diff ============================================================================== --- vmkit/trunk/include/debug.h (original) +++ vmkit/trunk/include/debug.h Thu Jun 26 10:46:10 2008 @@ -53,23 +53,23 @@ #if DEBUG > 0 #ifdef WITH_COLOR - #define PRINT_DEBUG(symb, level, color, fmt, args...) \ + #define PRINT_DEBUG(symb, level, color, args...) \ if (symb > level) { \ printf("%s%s%s", ESC, color, END); \ - printf(fmt, ##args); \ + printf(##args); \ printf("%s%s%s", ESC, COLOR_NORMAL, END); \ fflush(stdout); \ } #else #define PRINT_DEBUG(symb, level, color, fmt, args...) \ if (symb > level) { \ - printf(fmt, ##args); \ + printf(##args); \ fflush(stdout); \ } #endif #else -#define PRINT_DEBUG(symb, level, color, fmt, args...) do {} while(0); +#define PRINT_DEBUG(symb, level, color, args...) do {} while(0); #endif Modified: vmkit/trunk/lib/N3/VMCore/Opcodes.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/N3/VMCore/Opcodes.cpp?rev=52783&r1=52782&r2=52783&view=diff ============================================================================== --- vmkit/trunk/lib/N3/VMCore/Opcodes.cpp (original) +++ vmkit/trunk/lib/N3/VMCore/Opcodes.cpp Thu Jun 26 10:46:10 2008 @@ -217,8 +217,8 @@ PRINT_DEBUG(N3_COMPILE, 1, COLOR_NORMAL, "\t[at %5d] %-5d ", i, bytecodes[i]); PRINT_DEBUG(N3_COMPILE, 1, LIGHT_BLUE, "compiling %s::", compilingMethod->printString()); - PRINT_DEBUG(N3_COMPILE, 1, LIGHT_CYAN, OpcodeNames[bytecodes[i]], 0); - PRINT_DEBUG(N3_COMPILE, 1, LIGHT_BLUE, "\n", 0); + PRINT_DEBUG(N3_COMPILE, 1, LIGHT_CYAN, OpcodeNames[bytecodes[i]]); + PRINT_DEBUG(N3_COMPILE, 1, LIGHT_BLUE, "\n"); } Opinfo* opinfo = &(opcodeInfos[i]); @@ -1779,8 +1779,8 @@ PRINT_DEBUG(N3_COMPILE, 1, COLOR_NORMAL, "\t[at %5d] %-5d ", i, bytecodes[i + 1]); PRINT_DEBUG(N3_COMPILE, 1, LIGHT_BLUE, "compiling %s::", compilingMethod->printString()); - PRINT_DEBUG(N3_COMPILE, 1, LIGHT_CYAN, OpcodeNamesFE[bytecodes[i + 1]], 0); - PRINT_DEBUG(N3_COMPILE, 1, LIGHT_BLUE, "\n", 0); + PRINT_DEBUG(N3_COMPILE, 1, LIGHT_CYAN, OpcodeNamesFE[bytecodes[i + 1]]); + PRINT_DEBUG(N3_COMPILE, 1, LIGHT_BLUE, "\n"); switch (bytecodes[++i]) { @@ -1951,8 +1951,8 @@ PRINT_DEBUG(N3_COMPILE, 1, COLOR_NORMAL, "\t[at %5d] %-5d ", i, bytecodes[i]); PRINT_DEBUG(N3_COMPILE, 1, LIGHT_BLUE, "exploring %s::", compilingMethod->printString()); - PRINT_DEBUG(N3_COMPILE, 1, LIGHT_CYAN, OpcodeNames[bytecodes[i]], 0); - PRINT_DEBUG(N3_COMPILE, 1, LIGHT_BLUE, "\n", 0); + PRINT_DEBUG(N3_COMPILE, 1, LIGHT_CYAN, OpcodeNames[bytecodes[i]]); + PRINT_DEBUG(N3_COMPILE, 1, LIGHT_BLUE, "\n"); } switch (bytecodes[i]) { @@ -2380,9 +2380,9 @@ PRINT_DEBUG(N3_COMPILE, 1, COLOR_NORMAL, "\t[at %5d] %-5d ", i, bytecodes[i + 1]); - PRINT_DEBUG(N3_COMPILE, 1, LIGHT_BLUE, "exploring ", 0); - PRINT_DEBUG(N3_COMPILE, 1, LIGHT_CYAN, OpcodeNamesFE[bytecodes[i + 1]], 0); - PRINT_DEBUG(N3_COMPILE, 1, LIGHT_BLUE, "\n", 0); + PRINT_DEBUG(N3_COMPILE, 1, LIGHT_BLUE, "exploring "); + PRINT_DEBUG(N3_COMPILE, 1, LIGHT_CYAN, OpcodeNamesFE[bytecodes[i + 1]]); + PRINT_DEBUG(N3_COMPILE, 1, LIGHT_BLUE, "\n"); switch (bytecodes[++i]) { From resistor at mac.com Thu Jun 26 12:03:28 2008 From: resistor at mac.com (Owen Anderson) Date: Thu, 26 Jun 2008 17:03:28 -0000 Subject: [llvm-commits] [llvm] r52784 - /llvm/trunk/test/Transforms/GVN/local-pre.ll Message-ID: <200806261703.m5QH3Tj0009465@zion.cs.uiuc.edu> Author: resistor Date: Thu Jun 26 12:03:28 2008 New Revision: 52784 URL: http://llvm.org/viewvc/llvm-project?rev=52784&view=rev Log: Use the -enable-pre flag so this test doesn't fail. Modified: llvm/trunk/test/Transforms/GVN/local-pre.ll Modified: llvm/trunk/test/Transforms/GVN/local-pre.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/GVN/local-pre.ll?rev=52784&r1=52783&r2=52784&view=diff ============================================================================== --- llvm/trunk/test/Transforms/GVN/local-pre.ll (original) +++ llvm/trunk/test/Transforms/GVN/local-pre.ll Thu Jun 26 12:03:28 2008 @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -gvn | llvm-dis | grep {b.pre} +; RUN: llvm-as < %s | opt -gvn -enable-pre | llvm-dis | grep {b.pre} define i32 @main(i32 %p) { block1: From resistor at mac.com Thu Jun 26 12:06:02 2008 From: resistor at mac.com (Owen Anderson) Date: Thu, 26 Jun 2008 17:06:02 -0000 Subject: [llvm-commits] [llvm] r52785 - /llvm/trunk/lib/CodeGen/MachineModuleInfo.cpp Message-ID: <200806261706.m5QH625k009545@zion.cs.uiuc.edu> Author: resistor Date: Thu Jun 26 12:06:02 2008 New Revision: 52785 URL: http://llvm.org/viewvc/llvm-project?rev=52785&view=rev Log: Don't create a whole new string just to copy the elements into it. Modified: llvm/trunk/lib/CodeGen/MachineModuleInfo.cpp Modified: llvm/trunk/lib/CodeGen/MachineModuleInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachineModuleInfo.cpp?rev=52785&r1=52784&r2=52785&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/MachineModuleInfo.cpp (original) +++ llvm/trunk/lib/CodeGen/MachineModuleInfo.cpp Thu Jun 26 12:06:02 2008 @@ -231,11 +231,9 @@ } virtual void Apply(std::string &Field) { Constant *C = CI->getOperand(I++); - std::string S; - if (GetConstantStringInfo(C, S)) - Field = S; - else - Field = ""; + // Fills in the string if it succeeds + if (!GetConstantStringInfo(C, Field)) + Field.clear(); } virtual void Apply(DebugInfoDesc *&Field) { Constant *C = CI->getOperand(I++); From sabre at nondot.org Thu Jun 26 12:16:00 2008 From: sabre at nondot.org (Chris Lattner) Date: Thu, 26 Jun 2008 17:16:00 -0000 Subject: [llvm-commits] [llvm] r52786 - /llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Message-ID: <200806261716.m5QHG0Up009842@zion.cs.uiuc.edu> Author: lattner Date: Thu Jun 26 12:16:00 2008 New Revision: 52786 URL: http://llvm.org/viewvc/llvm-project?rev=52786&view=rev Log: duncan points out that isOperationLegal includes a check for type legality. Thanks Duncan! Modified: llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Modified: llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp?rev=52786&r1=52785&r2=52786&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Thu Jun 26 12:16:00 2008 @@ -3852,7 +3852,7 @@ // If the input is a legal type, and SINT_TO_FP is not legal on this target, // but UINT_TO_FP is legal on this target, try to convert. - if (TLI.isTypeLegal(OpVT) && !TLI.isOperationLegal(ISD::SINT_TO_FP, OpVT) && + if (!TLI.isOperationLegal(ISD::SINT_TO_FP, OpVT) && TLI.isOperationLegal(ISD::UINT_TO_FP, OpVT)) { // If the sign bit is known to be zero, we can change this to UINT_TO_FP. if (DAG.SignBitIsZero(N0)) @@ -3875,7 +3875,7 @@ // If the input is a legal type, and UINT_TO_FP is not legal on this target, // but SINT_TO_FP is legal on this target, try to convert. - if (TLI.isTypeLegal(OpVT) && !TLI.isOperationLegal(ISD::UINT_TO_FP, OpVT) && + if (!TLI.isOperationLegal(ISD::UINT_TO_FP, OpVT) && TLI.isOperationLegal(ISD::SINT_TO_FP, OpVT)) { // If the sign bit is known to be zero, we can change this to SINT_TO_FP. if (DAG.SignBitIsZero(N0)) From resistor at mac.com Thu Jun 26 12:20:16 2008 From: resistor at mac.com (Owen Anderson) Date: Thu, 26 Jun 2008 17:20:16 -0000 Subject: [llvm-commits] [llvm] r52787 - /llvm/trunk/include/llvm/Support/Mangler.h Message-ID: <200806261720.m5QHKG2K009989@zion.cs.uiuc.edu> Author: resistor Date: Thu Jun 26 12:20:16 2008 New Revision: 52787 URL: http://llvm.org/viewvc/llvm-project?rev=52787&view=rev Log: Use a DenseMap instead of an std::map for mangled name lookup. This is improves AsmPrinter runtime on instcombine from 0.3920s to 0.3836s. Modified: llvm/trunk/include/llvm/Support/Mangler.h Modified: llvm/trunk/include/llvm/Support/Mangler.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/Mangler.h?rev=52787&r1=52786&r2=52787&view=diff ============================================================================== --- llvm/trunk/include/llvm/Support/Mangler.h (original) +++ llvm/trunk/include/llvm/Support/Mangler.h Thu Jun 26 12:20:16 2008 @@ -14,6 +14,7 @@ #ifndef LLVM_SUPPORT_MANGLER_H #define LLVM_SUPPORT_MANGLER_H +#include "llvm/ADT/DenseMap.h" #include #include #include @@ -40,7 +41,7 @@ /// Memo - This is used to remember the name that we assign a value. /// - std::map Memo; + DenseMap Memo; /// Count - This simple counter is used to unique value names. /// From kremenek at apple.com Thu Jun 26 12:53:12 2008 From: kremenek at apple.com (Ted Kremenek) Date: Thu, 26 Jun 2008 17:53:12 -0000 Subject: [llvm-commits] [llvm] r52789 - in /llvm/trunk/win32: Support/Support.vcproj clang.sln Message-ID: <200806261753.m5QHrD0q011124@zion.cs.uiuc.edu> Author: kremenek Date: Thu Jun 26 12:53:12 2008 New Revision: 52789 URL: http://llvm.org/viewvc/llvm-project?rev=52789&view=rev Log: Update VS project files. The clang executable now depends on the LLVM Analysis library. Modified: llvm/trunk/win32/Support/Support.vcproj llvm/trunk/win32/clang.sln Modified: llvm/trunk/win32/Support/Support.vcproj URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/win32/Support/Support.vcproj?rev=52789&r1=52788&r2=52789&view=diff ============================================================================== --- llvm/trunk/win32/Support/Support.vcproj (original) +++ llvm/trunk/win32/Support/Support.vcproj Thu Jun 26 12:53:12 2008 @@ -680,6 +680,10 @@ > + + Modified: llvm/trunk/win32/clang.sln URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/win32/clang.sln?rev=52789&r1=52788&r2=52789&view=diff ============================================================================== --- llvm/trunk/win32/clang.sln (original) +++ llvm/trunk/win32/clang.sln Thu Jun 26 12:53:12 2008 @@ -4,10 +4,6 @@ ProjectSection(ProjectDependencies) = postProject {19514E48-456C-4B9D-8637-F2285476461E} = {19514E48-456C-4B9D-8637-F2285476461E} EndProjectSection - ProjectSection(WebsiteProperties) = preProject - Debug.AspNetCompiler.Debug = "True" - Release.AspNetCompiler.Debug = "False" - EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TableGen", "TableGen\TableGen.vcproj", "{339C2249-26B6-4172-B484-85653029AF57}" ProjectSection(ProjectDependencies) = postProject @@ -15,10 +11,6 @@ {19514E48-456C-4B9D-8637-F2285476461E} = {19514E48-456C-4B9D-8637-F2285476461E} {28AA9146-3482-4F41-9CC6-407B1D258508} = {28AA9146-3482-4F41-9CC6-407B1D258508} EndProjectSection - ProjectSection(WebsiteProperties) = preProject - Debug.AspNetCompiler.Debug = "True" - Release.AspNetCompiler.Debug = "False" - EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Fibonacci", "Fibonacci\Fibonacci.vcproj", "{48FB551D-E37E-42EC-BC97-FF7219774867}" ProjectSection(ProjectDependencies) = postProject @@ -31,39 +23,23 @@ {28AA9146-3482-4F41-9CC6-407B1D258508} = {28AA9146-3482-4F41-9CC6-407B1D258508} {0622E827-8464-489D-8B1C-B0B496F35C08} = {0622E827-8464-489D-8B1C-B0B496F35C08} EndProjectSection - ProjectSection(WebsiteProperties) = preProject - Debug.AspNetCompiler.Debug = "True" - Release.AspNetCompiler.Debug = "False" - EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ExecutionEngine", "ExecutionEngine\ExecutionEngine.vcproj", "{76295AE8-A083-460E-9F80-6F2B8923264A}" ProjectSection(ProjectDependencies) = postProject {45CD78D7-C5D9-47FE-AD12-F3251EEDAFFB} = {45CD78D7-C5D9-47FE-AD12-F3251EEDAFFB} {19514E48-456C-4B9D-8637-F2285476461E} = {19514E48-456C-4B9D-8637-F2285476461E} EndProjectSection - ProjectSection(WebsiteProperties) = preProject - Debug.AspNetCompiler.Debug = "True" - Release.AspNetCompiler.Debug = "False" - EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "VMCore", "VMCore\VMCore.vcproj", "{45CD78D7-C5D9-47FE-AD12-F3251EEDAFFB}" ProjectSection(ProjectDependencies) = postProject {339C2249-26B6-4172-B484-85653029AF57} = {339C2249-26B6-4172-B484-85653029AF57} {19514E48-456C-4B9D-8637-F2285476461E} = {19514E48-456C-4B9D-8637-F2285476461E} EndProjectSection - ProjectSection(WebsiteProperties) = preProject - Debug.AspNetCompiler.Debug = "True" - Release.AspNetCompiler.Debug = "False" - EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Target", "Target\Target.vcproj", "{059FBAB8-C76D-48A0-AA75-3C57BD3EAFE4}" ProjectSection(ProjectDependencies) = postProject {19514E48-456C-4B9D-8637-F2285476461E} = {19514E48-456C-4B9D-8637-F2285476461E} EndProjectSection - ProjectSection(WebsiteProperties) = preProject - Debug.AspNetCompiler.Debug = "True" - Release.AspNetCompiler.Debug = "False" - EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CodeGen", "CodeGen\CodeGen.vcproj", "{08CEB1BB-C2A4-4587-B9A9-AEDB8FB44897}" ProjectSection(ProjectDependencies) = postProject @@ -71,29 +47,17 @@ {339C2249-26B6-4172-B484-85653029AF57} = {339C2249-26B6-4172-B484-85653029AF57} {19514E48-456C-4B9D-8637-F2285476461E} = {19514E48-456C-4B9D-8637-F2285476461E} EndProjectSection - ProjectSection(WebsiteProperties) = preProject - Debug.AspNetCompiler.Debug = "True" - Release.AspNetCompiler.Debug = "False" - EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "System", "System\System.vcproj", "{0F8407F3-FA23-4CF1-83A9-DCBE0B361489}" ProjectSection(ProjectDependencies) = postProject {19514E48-456C-4B9D-8637-F2285476461E} = {19514E48-456C-4B9D-8637-F2285476461E} EndProjectSection - ProjectSection(WebsiteProperties) = preProject - Debug.AspNetCompiler.Debug = "True" - Release.AspNetCompiler.Debug = "False" - EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Analysis", "Analysis\Analysis.vcproj", "{0622E827-8464-489D-8B1C-B0B496F35C08}" ProjectSection(ProjectDependencies) = postProject {45CD78D7-C5D9-47FE-AD12-F3251EEDAFFB} = {45CD78D7-C5D9-47FE-AD12-F3251EEDAFFB} {19514E48-456C-4B9D-8637-F2285476461E} = {19514E48-456C-4B9D-8637-F2285476461E} EndProjectSection - ProjectSection(WebsiteProperties) = preProject - Debug.AspNetCompiler.Debug = "True" - Release.AspNetCompiler.Debug = "False" - EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "x86", "x86\x86.vcproj", "{144EEBF6-8C9B-4473-B715-2C821666AF6C}" ProjectSection(ProjectDependencies) = postProject @@ -102,10 +66,6 @@ {339C2249-26B6-4172-B484-85653029AF57} = {339C2249-26B6-4172-B484-85653029AF57} {19514E48-456C-4B9D-8637-F2285476461E} = {19514E48-456C-4B9D-8637-F2285476461E} EndProjectSection - ProjectSection(WebsiteProperties) = preProject - Debug.AspNetCompiler.Debug = "True" - Release.AspNetCompiler.Debug = "False" - EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Transforms", "Transforms\Transforms.vcproj", "{C59374C1-9FC0-4147-B836-327DFDC52D99}" ProjectSection(ProjectDependencies) = postProject @@ -113,16 +73,8 @@ {339C2249-26B6-4172-B484-85653029AF57} = {339C2249-26B6-4172-B484-85653029AF57} {19514E48-456C-4B9D-8637-F2285476461E} = {19514E48-456C-4B9D-8637-F2285476461E} EndProjectSection - ProjectSection(WebsiteProperties) = preProject - Debug.AspNetCompiler.Debug = "True" - Release.AspNetCompiler.Debug = "False" - EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Configure", "Configure\Configure.vcproj", "{19514E48-456C-4B9D-8637-F2285476461E}" - ProjectSection(WebsiteProperties) = preProject - Debug.AspNetCompiler.Debug = "True" - Release.AspNetCompiler.Debug = "False" - EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "lli", "lli\lli.vcproj", "{FB6FFD68-C1E4-4DCF-AB02-36D205D5263E}" ProjectSection(ProjectDependencies) = postProject @@ -136,10 +88,6 @@ {28AA9146-3482-4F41-9CC6-407B1D258508} = {28AA9146-3482-4F41-9CC6-407B1D258508} {0622E827-8464-489D-8B1C-B0B496F35C08} = {0622E827-8464-489D-8B1C-B0B496F35C08} EndProjectSection - ProjectSection(WebsiteProperties) = preProject - Debug.AspNetCompiler.Debug = "True" - Release.AspNetCompiler.Debug = "False" - EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "llc", "llc\llc.vcproj", "{ADE86BDC-B04C-43DF-B9BB-90492C7B14AC}" ProjectSection(ProjectDependencies) = postProject @@ -153,10 +101,6 @@ {28AA9146-3482-4F41-9CC6-407B1D258508} = {28AA9146-3482-4F41-9CC6-407B1D258508} {0622E827-8464-489D-8B1C-B0B496F35C08} = {0622E827-8464-489D-8B1C-B0B496F35C08} EndProjectSection - ProjectSection(WebsiteProperties) = preProject - Debug.AspNetCompiler.Debug = "True" - Release.AspNetCompiler.Debug = "False" - EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "llvm-dis", "llvm-dis\llvm-dis.vcproj", "{B13476BC-30AB-4EA0-BC1E-212C0A459405}" ProjectSection(ProjectDependencies) = postProject @@ -166,10 +110,6 @@ {19514E48-456C-4B9D-8637-F2285476461E} = {19514E48-456C-4B9D-8637-F2285476461E} {28AA9146-3482-4F41-9CC6-407B1D258508} = {28AA9146-3482-4F41-9CC6-407B1D258508} EndProjectSection - ProjectSection(WebsiteProperties) = preProject - Debug.AspNetCompiler.Debug = "True" - Release.AspNetCompiler.Debug = "False" - EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "llvm-as", "llvm-as\llvm-as.vcproj", "{4FBC40A5-E626-4A6C-A9D3-FAE5C28D30CC}" ProjectSection(ProjectDependencies) = postProject @@ -180,19 +120,11 @@ {19514E48-456C-4B9D-8637-F2285476461E} = {19514E48-456C-4B9D-8637-F2285476461E} {28AA9146-3482-4F41-9CC6-407B1D258508} = {28AA9146-3482-4F41-9CC6-407B1D258508} EndProjectSection - ProjectSection(WebsiteProperties) = preProject - Debug.AspNetCompiler.Debug = "True" - Release.AspNetCompiler.Debug = "False" - EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "AsmParser", "AsmParser\AsmParser.vcproj", "{3DC216F5-1DDD-478A-84F8-C124E5C31982}" ProjectSection(ProjectDependencies) = postProject {19514E48-456C-4B9D-8637-F2285476461E} = {19514E48-456C-4B9D-8637-F2285476461E} EndProjectSection - ProjectSection(WebsiteProperties) = preProject - Debug.AspNetCompiler.Debug = "True" - Release.AspNetCompiler.Debug = "False" - EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "llvm-ar", "llvm-ar\llvm-ar.vcproj", "{0FF2B75C-49C1-4B49-A44A-531C93000296}" ProjectSection(ProjectDependencies) = postProject @@ -203,10 +135,6 @@ {19514E48-456C-4B9D-8637-F2285476461E} = {19514E48-456C-4B9D-8637-F2285476461E} {28AA9146-3482-4F41-9CC6-407B1D258508} = {28AA9146-3482-4F41-9CC6-407B1D258508} EndProjectSection - ProjectSection(WebsiteProperties) = preProject - Debug.AspNetCompiler.Debug = "True" - Release.AspNetCompiler.Debug = "False" - EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "llvm-ranlib", "llvm-ranlib\llvm-ranlib.vcproj", "{BB16C7EE-B4ED-4714-B5ED-B775C62A6612}" ProjectSection(ProjectDependencies) = postProject @@ -217,10 +145,6 @@ {19514E48-456C-4B9D-8637-F2285476461E} = {19514E48-456C-4B9D-8637-F2285476461E} {28AA9146-3482-4F41-9CC6-407B1D258508} = {28AA9146-3482-4F41-9CC6-407B1D258508} EndProjectSection - ProjectSection(WebsiteProperties) = preProject - Debug.AspNetCompiler.Debug = "True" - Release.AspNetCompiler.Debug = "False" - EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "llvm-link", "llvm-link\llvm-link.vcproj", "{5E249789-49E1-4600-B12B-8AD2BB6439B2}" ProjectSection(ProjectDependencies) = postProject @@ -231,10 +155,6 @@ {19514E48-456C-4B9D-8637-F2285476461E} = {19514E48-456C-4B9D-8637-F2285476461E} {28AA9146-3482-4F41-9CC6-407B1D258508} = {28AA9146-3482-4F41-9CC6-407B1D258508} EndProjectSection - ProjectSection(WebsiteProperties) = preProject - Debug.AspNetCompiler.Debug = "True" - Release.AspNetCompiler.Debug = "False" - EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Linker", "Linker\Linker.vcproj", "{342CF48F-760A-4040-A9A1-7D75AA2471CE}" ProjectSection(ProjectDependencies) = postProject @@ -242,20 +162,12 @@ {19514E48-456C-4B9D-8637-F2285476461E} = {19514E48-456C-4B9D-8637-F2285476461E} {28AA9146-3482-4F41-9CC6-407B1D258508} = {28AA9146-3482-4F41-9CC6-407B1D258508} EndProjectSection - ProjectSection(WebsiteProperties) = preProject - Debug.AspNetCompiler.Debug = "True" - Release.AspNetCompiler.Debug = "False" - EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CBackend", "CBackend\CBackend.vcproj", "{057777CD-DED5-46DF-BF9A-6B76DE212549}" ProjectSection(ProjectDependencies) = postProject {45CD78D7-C5D9-47FE-AD12-F3251EEDAFFB} = {45CD78D7-C5D9-47FE-AD12-F3251EEDAFFB} {19514E48-456C-4B9D-8637-F2285476461E} = {19514E48-456C-4B9D-8637-F2285476461E} EndProjectSection - ProjectSection(WebsiteProperties) = preProject - Debug.AspNetCompiler.Debug = "True" - Release.AspNetCompiler.Debug = "False" - EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "opt", "opt\opt.vcproj", "{006D8B41-C3C7-4448-85E1-AF8907E591E5}" ProjectSection(ProjectDependencies) = postProject @@ -268,10 +180,6 @@ {28AA9146-3482-4F41-9CC6-407B1D258508} = {28AA9146-3482-4F41-9CC6-407B1D258508} {0622E827-8464-489D-8B1C-B0B496F35C08} = {0622E827-8464-489D-8B1C-B0B496F35C08} EndProjectSection - ProjectSection(WebsiteProperties) = preProject - Debug.AspNetCompiler.Debug = "True" - Release.AspNetCompiler.Debug = "False" - EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "llvm-bcanalyzer", "llvm-bcanalyzer\llvm-bcanalyzer.vcproj", "{E0B1E329-BE3E-456D-B372-5F397BE42C84}" ProjectSection(ProjectDependencies) = postProject @@ -280,10 +188,6 @@ {19514E48-456C-4B9D-8637-F2285476461E} = {19514E48-456C-4B9D-8637-F2285476461E} {28AA9146-3482-4F41-9CC6-407B1D258508} = {28AA9146-3482-4F41-9CC6-407B1D258508} EndProjectSection - ProjectSection(WebsiteProperties) = preProject - Debug.AspNetCompiler.Debug = "True" - Release.AspNetCompiler.Debug = "False" - EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "llvm-ld", "llvm-ld\llvm-ld.vcproj", "{64D8AA46-88DB-41F4-B837-053AE02406B8}" ProjectSection(ProjectDependencies) = postProject @@ -298,10 +202,6 @@ {28AA9146-3482-4F41-9CC6-407B1D258508} = {28AA9146-3482-4F41-9CC6-407B1D258508} {0622E827-8464-489D-8B1C-B0B496F35C08} = {0622E827-8464-489D-8B1C-B0B496F35C08} EndProjectSection - ProjectSection(WebsiteProperties) = preProject - Debug.AspNetCompiler.Debug = "True" - Release.AspNetCompiler.Debug = "False" - EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "llvm-nm", "llvm-nm\llvm-nm.vcproj", "{5FF862CE-80A0-4B48-A80B-68AE325A0432}" ProjectSection(ProjectDependencies) = postProject @@ -312,10 +212,6 @@ {19514E48-456C-4B9D-8637-F2285476461E} = {19514E48-456C-4B9D-8637-F2285476461E} {28AA9146-3482-4F41-9CC6-407B1D258508} = {28AA9146-3482-4F41-9CC6-407B1D258508} EndProjectSection - ProjectSection(WebsiteProperties) = preProject - Debug.AspNetCompiler.Debug = "True" - Release.AspNetCompiler.Debug = "False" - EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "llvm-prof", "llvm-prof\llvm-prof.vcproj", "{ACBE81D9-64B1-4133-823A-807A4E60B454}" ProjectSection(ProjectDependencies) = postProject @@ -326,10 +222,6 @@ {28AA9146-3482-4F41-9CC6-407B1D258508} = {28AA9146-3482-4F41-9CC6-407B1D258508} {0622E827-8464-489D-8B1C-B0B496F35C08} = {0622E827-8464-489D-8B1C-B0B496F35C08} EndProjectSection - ProjectSection(WebsiteProperties) = preProject - Debug.AspNetCompiler.Debug = "True" - Release.AspNetCompiler.Debug = "False" - EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "bugpoint", "bugpoint\bugpoint.vcproj", "{57249192-8E29-4D85-8B7A-FEFF1760B1DA}" ProjectSection(ProjectDependencies) = postProject @@ -344,79 +236,40 @@ {28AA9146-3482-4F41-9CC6-407B1D258508} = {28AA9146-3482-4F41-9CC6-407B1D258508} {0622E827-8464-489D-8B1C-B0B496F35C08} = {0622E827-8464-489D-8B1C-B0B496F35C08} EndProjectSection - ProjectSection(WebsiteProperties) = preProject - Debug.AspNetCompiler.Debug = "True" - Release.AspNetCompiler.Debug = "False" - EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Bitcode", "Bitcode\Bitcode.vcproj", "{F1EFF064-8869-4DFF-8E1A-CD8F4A5F8D62}" ProjectSection(ProjectDependencies) = postProject {28AA9146-3482-4F41-9CC6-407B1D258508} = {28AA9146-3482-4F41-9CC6-407B1D258508} EndProjectSection - ProjectSection(WebsiteProperties) = preProject - Debug.AspNetCompiler.Debug = "True" - Release.AspNetCompiler.Debug = "False" - EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Archive", "Archive\Archive.vcproj", "{F1EFF064-8869-4DFF-8E1A-CD8F4A5F8D61}" ProjectSection(ProjectDependencies) = postProject {45CD78D7-C5D9-47FE-AD12-F3251EEDAFFB} = {45CD78D7-C5D9-47FE-AD12-F3251EEDAFFB} {19514E48-456C-4B9D-8637-F2285476461E} = {19514E48-456C-4B9D-8637-F2285476461E} EndProjectSection - ProjectSection(WebsiteProperties) = preProject - Debug.AspNetCompiler.Debug = "True" - Release.AspNetCompiler.Debug = "False" - EndProjectSection EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "LLVM", "LLVM", "{455BCF47-13B6-451E-8321-8ED9C4866BAA}" - ProjectSection(WebsiteProperties) = preProject - Debug.AspNetCompiler.Debug = "True" - Release.AspNetCompiler.Debug = "False" - EndProjectSection EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Clang", "Clang", "{DAC2AB11-F09C-454B-86FD-9BDBBA25827F}" - ProjectSection(WebsiteProperties) = preProject - Debug.AspNetCompiler.Debug = "True" - Release.AspNetCompiler.Debug = "False" - EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "clangLex", "..\tools\clang\win32\clangLex\clangLex.vcproj", "{030F6909-B2FA-4E53-BEA7-9A559CFC2F73}" - ProjectSection(WebsiteProperties) = preProject - Debug.AspNetCompiler.Debug = "True" - Release.AspNetCompiler.Debug = "False" - EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "clangParse", "..\tools\clang\win32\clangParse\clangParse.vcproj", "{05DF3074-11AF-491A-B078-83BD2EDC31F6}" - ProjectSection(WebsiteProperties) = preProject - Debug.AspNetCompiler.Debug = "True" - Release.AspNetCompiler.Debug = "False" - EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "clangAST", "..\tools\clang\win32\clangAST\clangAST.vcproj", "{5125C3DB-FBD6-4BF8-8D8B-CE51D6E93BCD}" - ProjectSection(WebsiteProperties) = preProject - Debug.AspNetCompiler.Debug = "True" - Release.AspNetCompiler.Debug = "False" - EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "clangSema", "..\tools\clang\win32\clangSema\clangSema.vcproj", "{4727E8B7-AA99-41C9-AB09-A8A862595DB7}" - ProjectSection(WebsiteProperties) = preProject - Debug.AspNetCompiler.Debug = "True" - Release.AspNetCompiler.Debug = "False" - EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "clangCodeGen", "..\tools\clang\win32\clangCodeGen\clangCodeGen.vcproj", "{4CEC5897-D957-47E7-A6AE-2021D4F44A8F}" - ProjectSection(WebsiteProperties) = preProject - Debug.AspNetCompiler.Debug = "True" - Release.AspNetCompiler.Debug = "False" - EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "clangDriver", "..\tools\clang\win32\clangDriver\clangDriver.vcproj", "{7E7DA455-C276-4B93-8D02-8F7E2F629BAF}" ProjectSection(ProjectDependencies) = postProject {030F6909-B2FA-4E53-BEA7-9A559CFC2F73} = {030F6909-B2FA-4E53-BEA7-9A559CFC2F73} - {08CEB1BB-C2A4-4587-B9A9-AEDB8FB44897} = {08CEB1BB-C2A4-4587-B9A9-AEDB8FB44897} + {0622E827-8464-489D-8B1C-B0B496F35C08} = {0622E827-8464-489D-8B1C-B0B496F35C08} {0F8407F3-FA23-4CF1-83A9-DCBE0B361489} = {0F8407F3-FA23-4CF1-83A9-DCBE0B361489} {5125C3DB-FBD6-4BF8-8D8B-CE51D6E93BCD} = {5125C3DB-FBD6-4BF8-8D8B-CE51D6E93BCD} {45CD78D7-C5D9-47FE-AD12-F3251EEDAFFB} = {45CD78D7-C5D9-47FE-AD12-F3251EEDAFFB} + {08CEB1BB-C2A4-4587-B9A9-AEDB8FB44897} = {08CEB1BB-C2A4-4587-B9A9-AEDB8FB44897} {059FBAB8-C76D-48A0-AA75-3C57BD3EAFE4} = {059FBAB8-C76D-48A0-AA75-3C57BD3EAFE4} {4727E8B7-AA99-41C9-AB09-A8A862595DB7} = {4727E8B7-AA99-41C9-AB09-A8A862595DB7} {F9FBDDA2-9EE1-473C-A456-BE20B7B2439D} = {F9FBDDA2-9EE1-473C-A456-BE20B7B2439D} @@ -427,28 +280,12 @@ {28AA9146-3482-4F41-9CC6-407B1D258508} = {28AA9146-3482-4F41-9CC6-407B1D258508} {6C98551A-4C36-4E74-8419-4D3EEEC9D8E0} = {6C98551A-4C36-4E74-8419-4D3EEEC9D8E0} EndProjectSection - ProjectSection(WebsiteProperties) = preProject - Debug.AspNetCompiler.Debug = "True" - Release.AspNetCompiler.Debug = "False" - EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "clangBasic", "..\tools\clang\win32\clangBasic\clangBasic.vcproj", "{298B4876-6EF1-4E80-85D7-72F80693BBEB}" - ProjectSection(WebsiteProperties) = preProject - Debug.AspNetCompiler.Debug = "True" - Release.AspNetCompiler.Debug = "False" - EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "clangAnalysis", "..\tools\clang\win32\clangAnalysis\clangAnalysis.vcproj", "{6C98551A-4C36-4E74-8419-4D3EEEC9D8E0}" - ProjectSection(WebsiteProperties) = preProject - Debug.AspNetCompiler.Debug = "True" - Release.AspNetCompiler.Debug = "False" - EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "clangRewrite", "..\tools\clang\win32\clangRewrite\clangRewrite.vcproj", "{F9FBDDA2-9EE1-473C-A456-BE20B7B2439D}" - ProjectSection(WebsiteProperties) = preProject - Debug.AspNetCompiler.Debug = "True" - Release.AspNetCompiler.Debug = "False" - EndProjectSection EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution From isanbard at gmail.com Thu Jun 26 13:11:46 2008 From: isanbard at gmail.com (Bill Wendling) Date: Thu, 26 Jun 2008 18:11:46 -0000 Subject: [llvm-commits] [llvm] r52791 - in /llvm/trunk/include/llvm: ADT/StringMap.h CodeGen/SelectionDAGNodes.h Support/Allocator.h Message-ID: <200806261811.m5QIBk0A011675@zion.cs.uiuc.edu> Author: void Date: Thu Jun 26 13:11:45 2008 New Revision: 52791 URL: http://llvm.org/viewvc/llvm-project?rev=52791&view=rev Log: Remove warnings about shadowed and unused variables. Modified: llvm/trunk/include/llvm/ADT/StringMap.h llvm/trunk/include/llvm/CodeGen/SelectionDAGNodes.h llvm/trunk/include/llvm/Support/Allocator.h Modified: llvm/trunk/include/llvm/ADT/StringMap.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/StringMap.h?rev=52791&r1=52790&r2=52791&view=diff ============================================================================== --- llvm/trunk/include/llvm/ADT/StringMap.h (original) +++ llvm/trunk/include/llvm/ADT/StringMap.h Thu Jun 26 13:11:45 2008 @@ -130,10 +130,10 @@ public: ValueTy second; - explicit StringMapEntry(unsigned StrLen) - : StringMapEntryBase(StrLen), second() {} - StringMapEntry(unsigned StrLen, const ValueTy &V) - : StringMapEntryBase(StrLen), second(V) {} + explicit StringMapEntry(unsigned strLen) + : StringMapEntryBase(strLen), second() {} + StringMapEntry(unsigned strLen, const ValueTy &V) + : StringMapEntryBase(strLen), second(V) {} const ValueTy &getValue() const { return second; } ValueTy &getValue() { return second; } Modified: llvm/trunk/include/llvm/CodeGen/SelectionDAGNodes.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/SelectionDAGNodes.h?rev=52791&r1=52790&r2=52791&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/SelectionDAGNodes.h (original) +++ llvm/trunk/include/llvm/CodeGen/SelectionDAGNodes.h Thu Jun 26 13:11:45 2008 @@ -1449,9 +1449,9 @@ unsigned Alignment; public: - MemSDNode(unsigned Opc, SDVTList VTs, const Value *SrcValue, - unsigned Alignment) - : SDNode(Opc, VTs), SrcValue(SrcValue), Alignment(Alignment) {} + MemSDNode(unsigned Opc, SDVTList VTs, const Value *srcValue, + unsigned alignment) + : SDNode(Opc, VTs), SrcValue(srcValue), Alignment(alignment) {} virtual ~MemSDNode() {} Modified: llvm/trunk/include/llvm/Support/Allocator.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/Allocator.h?rev=52791&r1=52790&r2=52791&view=diff ============================================================================== --- llvm/trunk/include/llvm/Support/Allocator.h (original) +++ llvm/trunk/include/llvm/Support/Allocator.h Thu Jun 26 13:11:45 2008 @@ -26,7 +26,7 @@ void Reset() {} - void *Allocate(size_t Size, size_t Alignment) { return malloc(Size); } + void *Allocate(size_t Size, size_t /*Alignment*/) { return malloc(Size); } template T *Allocate() { return static_cast(malloc(sizeof(T))); } @@ -55,7 +55,7 @@ return static_cast(Allocate(sizeof(T),AlignOf::Alignment)); } - void Deallocate(void *Ptr) {} + void Deallocate(void */*Ptr*/) {} void PrintStats() const; }; From criswell at uiuc.edu Thu Jun 26 13:46:50 2008 From: criswell at uiuc.edu (John Criswell) Date: Thu, 26 Jun 2008 18:46:50 -0000 Subject: [llvm-commits] [poolalloc] r52793 - /poolalloc/trunk/lib/PoolAllocate/PASimple.cpp Message-ID: <200806261846.m5QIkoWe012779@zion.cs.uiuc.edu> Author: criswell Date: Thu Jun 26 13:46:50 2008 New Revision: 52793 URL: http://llvm.org/viewvc/llvm-project?rev=52793&view=rev Log: Only merge DSNodes that alias with heap objects. Simple pool allocation does not cause aliasing for nodes that only have the stack and/or global flags. Modified: poolalloc/trunk/lib/PoolAllocate/PASimple.cpp Modified: poolalloc/trunk/lib/PoolAllocate/PASimple.cpp URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/PoolAllocate/PASimple.cpp?rev=52793&r1=52792&r2=52793&view=diff ============================================================================== --- poolalloc/trunk/lib/PoolAllocate/PASimple.cpp (original) +++ poolalloc/trunk/lib/PoolAllocate/PASimple.cpp Thu Jun 26 13:46:50 2008 @@ -81,11 +81,23 @@ static void MergeNodesInDSGraph (DSGraph & Graph) { - while ((Graph.node_begin() != Graph.node_end()) && - ((++(Graph.node_begin())) != Graph.node_end())) { - DSNodeHandle Node (Graph.node_begin()); - DSNodeHandle Target(++(Graph.node_begin())); + std::vector HeapNodes; + + DSGraph::node_iterator i; + DSGraph::node_iterator e = Graph.node_end(); + for (i = Graph.node_begin(); i != e; ++i) { + DSNode * Node = i; + if (Node->isHeapNode()) + HeapNodes.push_back (Node); + } + + while (HeapNodes.size() > 1) { + DSNodeHandle Node (*HeapNodes.rbegin()); + DSNodeHandle Target(*(--(HeapNodes.rbegin()))); Node.mergeWith (Target); + HeapNodes.pop_back(); + HeapNodes.pop_back(); + HeapNodes.push_back (Node.getNode()); } return; } From criswell at uiuc.edu Thu Jun 26 14:16:12 2008 From: criswell at uiuc.edu (John Criswell) Date: Thu, 26 Jun 2008 19:16:12 -0000 Subject: [llvm-commits] [poolalloc] r52794 - /poolalloc/trunk/lib/PoolAllocate/PASimple.cpp Message-ID: <200806261916.m5QJGCt7013734@zion.cs.uiuc.edu> Author: criswell Date: Thu Jun 26 14:16:12 2008 New Revision: 52794 URL: http://llvm.org/viewvc/llvm-project?rev=52794&view=rev Log: Fix a run-time error on Mac OS X by just looping through the vector. Modified: poolalloc/trunk/lib/PoolAllocate/PASimple.cpp Modified: poolalloc/trunk/lib/PoolAllocate/PASimple.cpp URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/PoolAllocate/PASimple.cpp?rev=52794&r1=52793&r2=52794&view=diff ============================================================================== --- poolalloc/trunk/lib/PoolAllocate/PASimple.cpp (original) +++ poolalloc/trunk/lib/PoolAllocate/PASimple.cpp Thu Jun 26 14:16:12 2008 @@ -81,24 +81,19 @@ static void MergeNodesInDSGraph (DSGraph & Graph) { - std::vector HeapNodes; + std::vector HeapNodes; DSGraph::node_iterator i; DSGraph::node_iterator e = Graph.node_end(); for (i = Graph.node_begin(); i != e; ++i) { DSNode * Node = i; if (Node->isHeapNode()) - HeapNodes.push_back (Node); + HeapNodes.push_back (DSNodeHandle(Node)); } - while (HeapNodes.size() > 1) { - DSNodeHandle Node (*HeapNodes.rbegin()); - DSNodeHandle Target(*(--(HeapNodes.rbegin()))); - Node.mergeWith (Target); - HeapNodes.pop_back(); - HeapNodes.pop_back(); - HeapNodes.push_back (Node.getNode()); - } + for (unsigned i = 0; i < HeapNodes.size(); ++i) + for (unsigned j = i+1; j < HeapNodes.size(); ++j) + HeapNodes[i].mergeWith (HeapNodes[j]); return; } From evan.cheng at apple.com Thu Jun 26 17:09:30 2008 From: evan.cheng at apple.com (Evan Cheng) Date: Thu, 26 Jun 2008 22:09:30 -0000 Subject: [llvm-commits] [llvm] r52795 - /llvm/trunk/test/Transforms/DeadArgElim/multdeadretval.ll Message-ID: <200806262209.m5QM9UuR019373@zion.cs.uiuc.edu> Author: evancheng Date: Thu Jun 26 17:09:29 2008 New Revision: 52795 URL: http://llvm.org/viewvc/llvm-project?rev=52795&view=rev Log: XFAIL for now. Modified: llvm/trunk/test/Transforms/DeadArgElim/multdeadretval.ll Modified: llvm/trunk/test/Transforms/DeadArgElim/multdeadretval.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/DeadArgElim/multdeadretval.ll?rev=52795&r1=52794&r2=52795&view=diff ============================================================================== --- llvm/trunk/test/Transforms/DeadArgElim/multdeadretval.ll (original) +++ llvm/trunk/test/Transforms/DeadArgElim/multdeadretval.ll Thu Jun 26 17:09:29 2008 @@ -3,6 +3,7 @@ ; run instcombine to fold insert/extractvalue chains and we run dce to clean up ; any remaining dead stuff. ; RUN: llvm-as < %s | opt -deadargelim -instcombine -dce | llvm-dis | not grep i16 +; XFAIL: * define internal {i16, i32} @test(i16 %DEADARG) { %A = insertvalue {i16,i32} undef, i16 1, 0 From sabre at nondot.org Thu Jun 26 17:26:46 2008 From: sabre at nondot.org (Chris Lattner) Date: Thu, 26 Jun 2008 22:26:46 -0000 Subject: [llvm-commits] [llvm] r52796 - /llvm/trunk/include/llvm/PassManager.h Message-ID: <200806262226.m5QMQk0F019930@zion.cs.uiuc.edu> Author: lattner Date: Thu Jun 26 17:26:45 2008 New Revision: 52796 URL: http://llvm.org/viewvc/llvm-project?rev=52796&view=rev Log: allow updating the MPM, so that you can use one FunctionPAssManager with multiple ModuleProviders, e.g. with the JIT. Modified: llvm/trunk/include/llvm/PassManager.h Modified: llvm/trunk/include/llvm/PassManager.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/PassManager.h?rev=52796&r1=52795&r2=52796&view=diff ============================================================================== --- llvm/trunk/include/llvm/PassManager.h (original) +++ llvm/trunk/include/llvm/PassManager.h Thu Jun 26 17:26:45 2008 @@ -95,6 +95,12 @@ /// doFinalization - Run all of the finalizers for the function passes. /// bool doFinalization(); + + /// getModuleProvider - Return the module provider that this passmanager is + /// currently using. This is the module provider that it uses when a function + /// is optimized that is non-resident in the module. + ModuleProvider *getModuleProvider() const { return MP; } + void setModuleProvider(ModuleProvider *NewMP) { MP = NewMP; } private: FunctionPassManagerImpl *FPM; From gordonhenriksen at mac.com Thu Jun 26 17:58:37 2008 From: gordonhenriksen at mac.com (Gordon Henriksen) Date: Thu, 26 Jun 2008 22:58:37 -0000 Subject: [llvm-commits] [llvm] r52797 - /llvm/trunk/docs/DeveloperPolicy.html Message-ID: <200806262258.m5QMwbB3020814@zion.cs.uiuc.edu> Author: gordon Date: Thu Jun 26 17:58:37 2008 New Revision: 52797 URL: http://llvm.org/viewvc/llvm-project?rev=52797&view=rev Log: Add a note for Thunderbird users to the Developer Policy. Modified: llvm/trunk/docs/DeveloperPolicy.html Modified: llvm/trunk/docs/DeveloperPolicy.html URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/DeveloperPolicy.html?rev=52797&r1=52796&r2=52797&view=diff ============================================================================== --- llvm/trunk/docs/DeveloperPolicy.html (original) +++ llvm/trunk/docs/DeveloperPolicy.html Thu Jun 26 17:58:37 2008 @@ -116,6 +116,15 @@ attachment to the message, not embedded into the text of the message. This ensures that your mailer will not mangle the patch when it sends it (e.g. by making whitespace changes or by wrapping lines).

    + +

    For Thunderbird users: Before submitting a patch, please open + Preferences → Advanced → General → Config Editor, + find the key mail.content_disposition_type, and set its value to + 1. Without this setting, Thunderbird sends your attachment using + Content-Disposition: inline rather than Content-Disposition: + attachment. Apple Mail gamely displays such a file inline, making it + difficult to work with for reviewers using that program.

    +

    From evan.cheng at apple.com Thu Jun 26 18:28:04 2008 From: evan.cheng at apple.com (Evan Cheng) Date: Thu, 26 Jun 2008 23:28:04 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r52798 - /llvm-gcc-4.2/trunk/gcc/llvm-debug.cpp Message-ID: <200806262328.m5QNS46n021950@zion.cs.uiuc.edu> Author: evancheng Date: Thu Jun 26 18:28:04 2008 New Revision: 52798 URL: http://llvm.org/viewvc/llvm-project?rev=52798&view=rev Log: Avoid generating debug info for type variants. 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=52798&r1=52797&r2=52798&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/llvm-debug.cpp (original) +++ llvm-gcc-4.2/trunk/gcc/llvm-debug.cpp Thu Jun 26 18:28:04 2008 @@ -439,11 +439,14 @@ /// getOrCreateType - Get the type from the cache or create a new type if /// necessary. /// FIXME - I hate jumbo methods - split up. -TypeDesc *DebugInfo::getOrCreateType(tree_node *type, CompileUnitDesc *Unit) { +TypeDesc *DebugInfo::getOrCreateType(tree type, CompileUnitDesc *Unit) { DEBUGASSERT(type != NULL_TREE && type != error_mark_node && "Not a type."); if (type == NULL_TREE || type == error_mark_node) return NULL; - + + // Ignore about variants such as const, volatile, or restrict. + type = TYPE_MAIN_VARIANT(type); + // Should only be void if a pointer/reference/return type. Returning NULL // allows the caller to produce a non-derived type. if (TREE_CODE(type) == VOID_TYPE) return NULL; From isanbard at gmail.com Thu Jun 26 19:09:40 2008 From: isanbard at gmail.com (Bill Wendling) Date: Fri, 27 Jun 2008 00:09:40 -0000 Subject: [llvm-commits] [llvm] r52800 - in /llvm/trunk: include/llvm/CodeGen/MachineDebugInfoDesc.h include/llvm/CodeGen/MachineModuleInfo.h lib/CodeGen/DwarfWriter.cpp lib/CodeGen/MachineDebugInfoDesc.cpp lib/CodeGen/MachineModuleInfo.cpp lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp lib/VMCore/IntrinsicInst.cpp Message-ID: <200806270009.m5R09erk023373@zion.cs.uiuc.edu> Author: void Date: Thu Jun 26 19:09:40 2008 New Revision: 52800 URL: http://llvm.org/viewvc/llvm-project?rev=52800&view=rev Log: Refactor the DebugInfoDesc stuff out of the MachineModuleInfo file. Clean up some uses of std::vector, where it's return std::vector by value. Yuck! Added: llvm/trunk/include/llvm/CodeGen/MachineDebugInfoDesc.h llvm/trunk/lib/CodeGen/MachineDebugInfoDesc.cpp Modified: llvm/trunk/include/llvm/CodeGen/MachineModuleInfo.h llvm/trunk/lib/CodeGen/DwarfWriter.cpp llvm/trunk/lib/CodeGen/MachineModuleInfo.cpp llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp llvm/trunk/lib/VMCore/IntrinsicInst.cpp Added: llvm/trunk/include/llvm/CodeGen/MachineDebugInfoDesc.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/MachineDebugInfoDesc.h?rev=52800&view=auto ============================================================================== --- llvm/trunk/include/llvm/CodeGen/MachineDebugInfoDesc.h (added) +++ llvm/trunk/include/llvm/CodeGen/MachineDebugInfoDesc.h Thu Jun 26 19:09:40 2008 @@ -0,0 +1,706 @@ +//===-- llvm/CodeGen/MachineDebugInfoDesc.h ---------------------*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// +// +//===----------------------------------------------------------------------===// + +#ifndef LLVM_CODEGEN_MACHINEDEBUGINFODESC_H +#define LLVM_CODEGEN_MACHINEDEBUGINFODESC_H + +#include "llvm/GlobalValue.h" +#include "llvm/Support/DataTypes.h" +#include + +namespace llvm { + +//===----------------------------------------------------------------------===// +// Forward declarations. +class DIVisitor; +class GlobalVariable; + +//===----------------------------------------------------------------------===// +// Debug info description constants. + +enum { + LLVMDebugVersion = (6 << 16), // Current version of debug information. + LLVMDebugVersion5 = (5 << 16), // Constant for version 5. + LLVMDebugVersion4 = (4 << 16), // Constant for version 4. + LLVMDebugVersionMask = 0xffff0000 // Mask for version number. +}; + +//===----------------------------------------------------------------------===// +/// DebugInfoDesc - This class is the base class for debug info descriptors. + +class DebugInfoDesc { + // Content indicator. Dwarf values are used but that does not limit use to + // Dwarf writers. + unsigned Tag; +protected: + explicit DebugInfoDesc(unsigned T) : Tag(T | LLVMDebugVersion) {} +public: + virtual ~DebugInfoDesc(); + + // Accessors + unsigned getTag() const { return Tag & ~LLVMDebugVersionMask; } + unsigned getVersion() const { return Tag & LLVMDebugVersionMask; } + void setTag(unsigned T) { Tag = T | LLVMDebugVersion; } + + /// TagFromGlobal - Returns the tag number from a debug info descriptor + /// GlobalVariable. Return DIIValid if operand is not an unsigned int. + static unsigned TagFromGlobal(GlobalVariable *GV); + + /// VersionFromGlobal - Returns the version number from a debug info + /// descriptor GlobalVariable. Return DIIValid if operand is not an unsigned + /// int. + static unsigned VersionFromGlobal(GlobalVariable *GV); + + /// DescFactory - Create an instance of debug info descriptor based on Tag. + /// Return NULL if not a recognized Tag. + static DebugInfoDesc *DescFactory(unsigned Tag); + + /// getLinkage - get linkage appropriate for this type of descriptor. + /// + virtual GlobalValue::LinkageTypes getLinkage() const; + + //===--------------------------------------------------------------------===// + // Subclasses should supply the following virtual methods. + + /// ApplyToFields - Target the vistor to the fields of the descriptor. + /// + virtual void ApplyToFields(DIVisitor *Visitor); + + /// getDescString - Return a string used to compose global names and labels. + /// + virtual const char *getDescString() const = 0; + + /// getTypeString - Return a string used to label this descriptor's type. + /// + virtual const char *getTypeString() const = 0; + +#ifndef NDEBUG + virtual void dump() = 0; +#endif + + //===--------------------------------------------------------------------===// + // Subclasses should supply the following static methods. + + // Implement isa/cast/dyncast. + static bool classof(const DebugInfoDesc *) { return true; } +}; + +//===----------------------------------------------------------------------===// +/// AnchorDesc - Descriptors of this class act as markers for identifying +/// descriptors of certain groups. +class AnchoredDesc; +class AnchorDesc : public DebugInfoDesc { + // Tag number of descriptors anchored by this object. + unsigned AnchorTag; +public: + AnchorDesc(); + explicit AnchorDesc(AnchoredDesc *D); + + // Accessors + unsigned getAnchorTag() const { return AnchorTag; } + + /// getLinkage - get linkage appropriate for this type of descriptor. + /// + virtual GlobalValue::LinkageTypes getLinkage() const; + + /// ApplyToFields - Target the visitor to the fields of the AnchorDesc. + /// + virtual void ApplyToFields(DIVisitor *Visitor); + + /// getDescString - Return a string used to compose global names and labels. + /// + virtual const char *getDescString() const; + + /// getTypeString - Return a string used to label this descriptor's type. + /// + virtual const char *getTypeString() const { + return "llvm.dbg.anchor.type"; + } + +#ifndef NDEBUG + virtual void dump(); +#endif + + // Implement isa/cast/dyncast. + static bool classof(const AnchorDesc *) { return true; } + static bool classof(const DebugInfoDesc *D); +}; + +//===----------------------------------------------------------------------===// +/// AnchoredDesc - This class manages anchors for a variety of top level +/// descriptors. +class AnchoredDesc : public DebugInfoDesc { + // Anchor for all descriptors of the same type. + DebugInfoDesc *Anchor; +protected: + explicit AnchoredDesc(unsigned T); +public: + // Accessors. + AnchorDesc *getAnchor() const { return static_cast(Anchor); } + void setAnchor(AnchorDesc *A) { Anchor = static_cast(A); } + + //===--------------------------------------------------------------------===// + // Subclasses should supply the following virtual methods. + + /// getAnchorString - Return a string used to label descriptor's anchor. + /// + virtual const char *getAnchorString() const = 0; + + /// ApplyToFields - Target the visitor to the fields of the AnchoredDesc. + /// + virtual void ApplyToFields(DIVisitor *Visitor); +}; + +//===----------------------------------------------------------------------===// +/// CompileUnitDesc - This class packages debug information associated with a +/// source/header file. +class CompileUnitDesc : public AnchoredDesc { + unsigned Language; // Language number (ex. DW_LANG_C89.) + std::string FileName; // Source file name. + std::string Directory; // Source file directory. + std::string Producer; // Compiler string. +public: + CompileUnitDesc(); + + // Accessors + unsigned getLanguage() const { return Language; } + const std::string &getFileName() const { return FileName; } + const std::string &getDirectory() const { return Directory; } + const std::string &getProducer() const { return Producer; } + void setLanguage(unsigned L) { Language = L; } + void setFileName(const std::string &FN) { FileName = FN; } + void setDirectory(const std::string &D) { Directory = D; } + void setProducer(const std::string &P) { Producer = P; } + + // FIXME - Need translation unit getter/setter. + + /// ApplyToFields - Target the visitor to the fields of the CompileUnitDesc. + /// + virtual void ApplyToFields(DIVisitor *Visitor); + + /// getDescString - Return a string used to compose global names and labels. + /// + virtual const char *getDescString() const { + return "llvm.dbg.compile_unit"; + } + + /// getTypeString - Return a string used to label this descriptor's type. + /// + virtual const char *getTypeString() const { + return "llvm.dbg.compile_unit.type"; + } + + /// getAnchorString - Return a string used to label this descriptor's anchor. + /// + const char *getAnchorString() const { + return "llvm.dbg.compile_units"; + } + +#ifndef NDEBUG + virtual void dump(); +#endif + + // Implement isa/cast/dyncast. + static bool classof(const CompileUnitDesc *) { return true; } + static bool classof(const DebugInfoDesc *D); +}; + +//===----------------------------------------------------------------------===// +/// TypeDesc - This class packages debug information associated with a type. +/// +class TypeDesc : public DebugInfoDesc { + enum { + FlagPrivate = 1 << 0, + FlagProtected = 1 << 1 + }; + DebugInfoDesc *Context; // Context debug descriptor. + std::string Name; // Type name (may be empty.) + DebugInfoDesc *File; // Defined compile unit (may be NULL.) + unsigned Line; // Defined line# (may be zero.) + uint64_t Size; // Type bit size (may be zero.) + uint64_t Align; // Type bit alignment (may be zero.) + uint64_t Offset; // Type bit offset (may be zero.) + unsigned Flags; // Miscellaneous flags. +public: + explicit TypeDesc(unsigned T); + + // Accessors + DebugInfoDesc *getContext() const { return Context; } + const std::string &getName() const { return Name; } + CompileUnitDesc *getFile() const { + return static_cast(File); + } + unsigned getLine() const { return Line; } + uint64_t getSize() const { return Size; } + uint64_t getAlign() const { return Align; } + uint64_t getOffset() const { return Offset; } + bool isPrivate() const { + return (Flags & FlagPrivate) != 0; + } + bool isProtected() const { + return (Flags & FlagProtected) != 0; + } + void setContext(DebugInfoDesc *C) { Context = C; } + void setName(const std::string &N) { Name = N; } + void setFile(CompileUnitDesc *U) { + File = static_cast(U); + } + void setLine(unsigned L) { Line = L; } + void setSize(uint64_t S) { Size = S; } + void setAlign(uint64_t A) { Align = A; } + void setOffset(uint64_t O) { Offset = O; } + void setIsPrivate() { Flags |= FlagPrivate; } + void setIsProtected() { Flags |= FlagProtected; } + + /// ApplyToFields - Target the visitor to the fields of the TypeDesc. + /// + virtual void ApplyToFields(DIVisitor *Visitor); + + /// getDescString - Return a string used to compose global names and labels. + /// + virtual const char *getDescString() const { + return "llvm.dbg.type"; + } + + /// getTypeString - Return a string used to label this descriptor's type. + /// + virtual const char *getTypeString() const { + return "llvm.dbg.type.type"; + } + +#ifndef NDEBUG + virtual void dump(); +#endif +}; + +//===----------------------------------------------------------------------===// +/// BasicTypeDesc - This class packages debug information associated with a +/// basic type (eg. int, bool, double.) +class BasicTypeDesc : public TypeDesc { + unsigned Encoding; // Type encoding. +public: + BasicTypeDesc(); + + // Accessors + unsigned getEncoding() const { return Encoding; } + void setEncoding(unsigned E) { Encoding = E; } + + /// ApplyToFields - Target the visitor to the fields of the BasicTypeDesc. + /// + virtual void ApplyToFields(DIVisitor *Visitor); + + /// getDescString - Return a string used to compose global names and labels. + /// + virtual const char *getDescString() const { + return "llvm.dbg.basictype"; + } + + /// getTypeString - Return a string used to label this descriptor's type. + /// + virtual const char *getTypeString() const { + return "llvm.dbg.basictype.type"; + } + +#ifndef NDEBUG + virtual void dump(); +#endif + + // Implement isa/cast/dyncast. + static bool classof(const BasicTypeDesc *) { return true; } + static bool classof(const DebugInfoDesc *D); +}; + +//===----------------------------------------------------------------------===// +/// DerivedTypeDesc - This class packages debug information associated with a +/// derived types (eg., typedef, pointer, reference.) +class DerivedTypeDesc : public TypeDesc { + DebugInfoDesc *FromType; // Type derived from. +public: + explicit DerivedTypeDesc(unsigned T); + + // Accessors + TypeDesc *getFromType() const { + return static_cast(FromType); + } + void setFromType(TypeDesc *F) { + FromType = static_cast(F); + } + + /// ApplyToFields - Target the visitor to the fields of the DerivedTypeDesc. + /// + virtual void ApplyToFields(DIVisitor *Visitor); + + /// getDescString - Return a string used to compose global names and labels. + /// + virtual const char *getDescString() const { + return "llvm.dbg.derivedtype"; + } + + /// getTypeString - Return a string used to label this descriptor's type. + /// + virtual const char *getTypeString() const { + return "llvm.dbg.derivedtype.type"; + } + +#ifndef NDEBUG + virtual void dump(); +#endif + + // Implement isa/cast/dyncast. + static bool classof(const DerivedTypeDesc *) { return true; } + static bool classof(const DebugInfoDesc *D); +}; + +//===----------------------------------------------------------------------===// +/// CompositeTypeDesc - This class packages debug information associated with a +/// array/struct types (eg., arrays, struct, union, enums.) +class CompositeTypeDesc : public DerivedTypeDesc { + std::vector Elements; // Information used to compose type. +public: + explicit CompositeTypeDesc(unsigned T); + + // Accessors + std::vector &getElements() { return Elements; } + + /// ApplyToFields - Target the visitor to the fields of the CompositeTypeDesc. + /// + virtual void ApplyToFields(DIVisitor *Visitor); + + /// getDescString - Return a string used to compose global names and labels. + /// + virtual const char *getDescString() const { + return "llvm.dbg.compositetype"; + } + + /// getTypeString - Return a string used to label this descriptor's type. + /// + virtual const char *getTypeString() const { + return "llvm.dbg.compositetype.type"; + } + +#ifndef NDEBUG + virtual void dump(); +#endif + + // Implement isa/cast/dyncast. + static bool classof(const CompositeTypeDesc *) { return true; } + static bool classof(const DebugInfoDesc *D); +}; + +//===----------------------------------------------------------------------===// +/// SubrangeDesc - This class packages debug information associated with integer +/// value ranges. +class SubrangeDesc : public DebugInfoDesc { + int64_t Lo; // Low value of range. + int64_t Hi; // High value of range. +public: + SubrangeDesc(); + + // Accessors + int64_t getLo() const { return Lo; } + int64_t getHi() const { return Hi; } + void setLo(int64_t L) { Lo = L; } + void setHi(int64_t H) { Hi = H; } + + /// ApplyToFields - Target the visitor to the fields of the SubrangeDesc. + /// + virtual void ApplyToFields(DIVisitor *Visitor); + + /// getDescString - Return a string used to compose global names and labels. + /// + virtual const char *getDescString() const { + return "llvm.dbg.subrange"; + } + + /// getTypeString - Return a string used to label this descriptor's type. + /// + virtual const char *getTypeString() const { + return "llvm.dbg.subrange.type"; + } + +#ifndef NDEBUG + virtual void dump(); +#endif + + // Implement isa/cast/dyncast. + static bool classof(const SubrangeDesc *) { return true; } + static bool classof(const DebugInfoDesc *D); +}; + +//===----------------------------------------------------------------------===// +/// EnumeratorDesc - This class packages debug information associated with +/// named integer constants. +class EnumeratorDesc : public DebugInfoDesc { + std::string Name; // Enumerator name. + int64_t Value; // Enumerator value. +public: + EnumeratorDesc(); + + // Accessors + const std::string &getName() const { return Name; } + int64_t getValue() const { return Value; } + void setName(const std::string &N) { Name = N; } + void setValue(int64_t V) { Value = V; } + + /// ApplyToFields - Target the visitor to the fields of the EnumeratorDesc. + /// + virtual void ApplyToFields(DIVisitor *Visitor); + + /// getDescString - Return a string used to compose global names and labels. + /// + virtual const char *getDescString() const { + return "llvm.dbg.enumerator"; + } + + /// getTypeString - Return a string used to label this descriptor's type. + /// + virtual const char *getTypeString() const { + return "llvm.dbg.enumerator.type"; + } + +#ifndef NDEBUG + virtual void dump(); +#endif + + // Implement isa/cast/dyncast. + static bool classof(const EnumeratorDesc *) { return true; } + static bool classof(const DebugInfoDesc *D); +}; + +//===----------------------------------------------------------------------===// +/// VariableDesc - This class packages debug information associated with a +/// subprogram variable. +/// +class VariableDesc : public DebugInfoDesc { + DebugInfoDesc *Context; // Context debug descriptor. + std::string Name; // Type name (may be empty.) + DebugInfoDesc *File; // Defined compile unit (may be NULL.) + unsigned Line; // Defined line# (may be zero.) + DebugInfoDesc *TyDesc; // Type of variable. +public: + explicit VariableDesc(unsigned T); + + // Accessors + DebugInfoDesc *getContext() const { return Context; } + const std::string &getName() const { return Name; } + CompileUnitDesc *getFile() const { + return static_cast(File); + } + unsigned getLine() const { return Line; } + TypeDesc *getType() const { + return static_cast(TyDesc); + } + void setContext(DebugInfoDesc *C) { Context = C; } + void setName(const std::string &N) { Name = N; } + void setFile(CompileUnitDesc *U) { + File = static_cast(U); + } + void setLine(unsigned L) { Line = L; } + void setType(TypeDesc *T) { + TyDesc = static_cast(T); + } + + /// ApplyToFields - Target the visitor to the fields of the VariableDesc. + /// + virtual void ApplyToFields(DIVisitor *Visitor); + + /// getDescString - Return a string used to compose global names and labels. + /// + virtual const char *getDescString() const { + return "llvm.dbg.variable"; + } + + /// getTypeString - Return a string used to label this descriptor's type. + /// + virtual const char *getTypeString() const { + return "llvm.dbg.variable.type"; + } + +#ifndef NDEBUG + virtual void dump(); +#endif + + // Implement isa/cast/dyncast. + static bool classof(const VariableDesc *) { return true; } + static bool classof(const DebugInfoDesc *D); +}; + +//===----------------------------------------------------------------------===// +/// GlobalDesc - This class is the base descriptor for global functions and +/// variables. +class GlobalDesc : public AnchoredDesc { + DebugInfoDesc *Context; // Context debug descriptor. + std::string Name; // Global name. + std::string FullName; // Fully qualified name. + std::string LinkageName; // Name for binding to MIPS linkage. + DebugInfoDesc *File; // Defined compile unit (may be NULL.) + unsigned Line; // Defined line# (may be zero.) + DebugInfoDesc *TyDesc; // Type debug descriptor. + bool IsStatic; // Is the global a static. + bool IsDefinition; // Is the global defined in context. +protected: + explicit GlobalDesc(unsigned T); +public: + // Accessors + DebugInfoDesc *getContext() const { return Context; } + const std::string &getName() const { return Name; } + const std::string &getFullName() const { return FullName; } + const std::string &getLinkageName() const { return LinkageName; } + CompileUnitDesc *getFile() const { + return static_cast(File); + } + unsigned getLine() const { return Line; } + TypeDesc *getType() const { + return static_cast(TyDesc); + } + bool isStatic() const { return IsStatic; } + bool isDefinition() const { return IsDefinition; } + void setContext(DebugInfoDesc *C) { Context = C; } + void setName(const std::string &N) { Name = N; } + void setFullName(const std::string &N) { FullName = N; } + void setLinkageName(const std::string &N) { LinkageName = N; } + void setFile(CompileUnitDesc *U) { + File = static_cast(U); + } + void setLine(unsigned L) { Line = L; } + void setType(TypeDesc *T) { + TyDesc = static_cast(T); + } + void setIsStatic(bool IS) { IsStatic = IS; } + void setIsDefinition(bool ID) { IsDefinition = ID; } + + /// ApplyToFields - Target the visitor to the fields of the GlobalDesc. + /// + virtual void ApplyToFields(DIVisitor *Visitor); +}; + +//===----------------------------------------------------------------------===// +/// GlobalVariableDesc - This class packages debug information associated with a +/// GlobalVariable. +class GlobalVariableDesc : public GlobalDesc { + GlobalVariable *Global; // llvm global. +public: + GlobalVariableDesc(); + + // Accessors. + GlobalVariable *getGlobalVariable() const { return Global; } + void setGlobalVariable(GlobalVariable *GV) { Global = GV; } + + /// ApplyToFields - Target the visitor to the fields of the + /// GlobalVariableDesc. + virtual void ApplyToFields(DIVisitor *Visitor); + + /// getDescString - Return a string used to compose global names and labels. + /// + virtual const char *getDescString() const { + return "llvm.dbg.global_variable"; + } + + /// getTypeString - Return a string used to label this descriptor's type. + /// + virtual const char *getTypeString() const { + return "llvm.dbg.global_variable.type"; + } + + /// getAnchorString - Return a string used to label this descriptor's anchor. + /// + const char *getAnchorString() const { + return "llvm.dbg.global_variables"; + } + +#ifndef NDEBUG + virtual void dump(); +#endif + + // Implement isa/cast/dyncast. + static bool classof(const GlobalVariableDesc *) { return true; } + static bool classof(const DebugInfoDesc *D); +}; + +//===----------------------------------------------------------------------===// +/// SubprogramDesc - This class packages debug information associated with a +/// subprogram/function. +struct SubprogramDesc : public GlobalDesc { + SubprogramDesc(); + + /// ApplyToFields - Target the visitor to the fields of the SubprogramDesc. + /// + virtual void ApplyToFields(DIVisitor *Visitor); + + /// getDescString - Return a string used to compose global names and labels. + /// + virtual const char *getDescString() const { + return "llvm.dbg.subprogram"; + } + + /// getTypeString - Return a string used to label this descriptor's type. + /// + virtual const char *getTypeString() const { + return "llvm.dbg.subprogram.type"; + } + + /// getAnchorString - Return a string used to label this descriptor's anchor. + /// + const char *getAnchorString() const { + return "llvm.dbg.subprograms"; + } + +#ifndef NDEBUG + virtual void dump(); +#endif + + // Implement isa/cast/dyncast. + static bool classof(const SubprogramDesc *) { return true; } + static bool classof(const DebugInfoDesc *D); +}; + +//===----------------------------------------------------------------------===// +/// BlockDesc - This descriptor groups variables and blocks nested in a block. +/// +class BlockDesc : public DebugInfoDesc { + DebugInfoDesc *Context; // Context debug descriptor. +public: + BlockDesc(); + + // Accessors + DebugInfoDesc *getContext() const { return Context; } + void setContext(DebugInfoDesc *C) { Context = C; } + + /// ApplyToFields - Target the visitor to the fields of the BlockDesc. + /// + virtual void ApplyToFields(DIVisitor *Visitor); + + /// getDescString - Return a string used to compose global names and labels. + /// + virtual const char *getDescString() const { + return "llvm.dbg.block"; + } + + /// getTypeString - Return a string used to label this descriptor's type. + /// + virtual const char *getTypeString() const { + return "llvm.dbg.block.type"; + } + +#ifndef NDEBUG + virtual void dump(); +#endif + + // Implement isa/cast/dyncast. + static bool classof(const BlockDesc *) { return true; } + static bool classof(const DebugInfoDesc *D); +}; + +} // End llvm namespace + +#endif Modified: llvm/trunk/include/llvm/CodeGen/MachineModuleInfo.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/MachineModuleInfo.h?rev=52800&r1=52799&r2=52800&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/MachineModuleInfo.h (original) +++ llvm/trunk/include/llvm/CodeGen/MachineModuleInfo.h Thu Jun 26 19:09:40 2008 @@ -31,18 +31,20 @@ #ifndef LLVM_CODEGEN_MACHINEMODULEINFO_H #define LLVM_CODEGEN_MACHINEMODULEINFO_H -#include "llvm/Support/Dwarf.h" -#include "llvm/Support/DataTypes.h" -#include "llvm/ADT/SmallVector.h" -#include "llvm/ADT/UniqueVector.h" -#include "llvm/ADT/SmallPtrSet.h" #include "llvm/GlobalValue.h" #include "llvm/Pass.h" +#include "llvm/ADT/SmallPtrSet.h" +#include "llvm/ADT/SmallVector.h" +#include "llvm/ADT/UniqueVector.h" +#include "llvm/Support/DataTypes.h" +#include "llvm/Support/Dwarf.h" namespace llvm { //===----------------------------------------------------------------------===// // Forward declarations. +class AnchoredDesc; +class CompileUnitDesc; class Constant; class DebugInfoDesc; class GlobalVariable; @@ -52,16 +54,7 @@ class Module; class PointerType; class StructType; - -//===----------------------------------------------------------------------===// -// Debug info constants. - -enum { - LLVMDebugVersion = (6 << 16), // Current version of debug information. - LLVMDebugVersion5 = (5 << 16), // Constant for version 5. - LLVMDebugVersion4 = (4 << 16), // Constant for version 4. - LLVMDebugVersionMask = 0xffff0000 // Mask for version number. -}; +class VariableDesc; //===----------------------------------------------------------------------===// /// DIVisitor - Subclasses of this class apply steps to each of the fields in @@ -89,662 +82,6 @@ }; //===----------------------------------------------------------------------===// -/// DebugInfoDesc - This class is the base class for debug info descriptors. -/// -class DebugInfoDesc { -private: - unsigned Tag; // Content indicator. Dwarf values are - // used but that does not limit use to - // Dwarf writers. - -protected: - explicit DebugInfoDesc(unsigned T) : Tag(T | LLVMDebugVersion) {} - -public: - virtual ~DebugInfoDesc() {} - - // Accessors - unsigned getTag() const { return Tag & ~LLVMDebugVersionMask; } - unsigned getVersion() const { return Tag & LLVMDebugVersionMask; } - void setTag(unsigned T) { Tag = T | LLVMDebugVersion; } - - /// TagFromGlobal - Returns the tag number from a debug info descriptor - /// GlobalVariable. Return DIIValid if operand is not an unsigned int. - static unsigned TagFromGlobal(GlobalVariable *GV); - - /// VersionFromGlobal - Returns the version number from a debug info - /// descriptor GlobalVariable. Return DIIValid if operand is not an unsigned - /// int. - static unsigned VersionFromGlobal(GlobalVariable *GV); - - /// DescFactory - Create an instance of debug info descriptor based on Tag. - /// Return NULL if not a recognized Tag. - static DebugInfoDesc *DescFactory(unsigned Tag); - - /// getLinkage - get linkage appropriate for this type of descriptor. - /// - virtual GlobalValue::LinkageTypes getLinkage() const; - - //===--------------------------------------------------------------------===// - // Subclasses should supply the following static methods. - - // Implement isa/cast/dyncast. - static bool classof(const DebugInfoDesc *) { return true; } - - //===--------------------------------------------------------------------===// - // Subclasses should supply the following virtual methods. - - /// ApplyToFields - Target the vistor to the fields of the descriptor. - /// - virtual void ApplyToFields(DIVisitor *Visitor); - - /// getDescString - Return a string used to compose global names and labels. - /// - virtual const char *getDescString() const = 0; - - /// getTypeString - Return a string used to label this descriptor's type. - /// - virtual const char *getTypeString() const = 0; - -#ifndef NDEBUG - virtual void dump() = 0; -#endif -}; - -//===----------------------------------------------------------------------===// -/// AnchorDesc - Descriptors of this class act as markers for identifying -/// descriptors of certain groups. -class AnchoredDesc; -class AnchorDesc : public DebugInfoDesc { -private: - unsigned AnchorTag; // Tag number of descriptors anchored - // by this object. - -public: - AnchorDesc(); - explicit AnchorDesc(AnchoredDesc *D); - - // Accessors - unsigned getAnchorTag() const { return AnchorTag; } - - // Implement isa/cast/dyncast. - static bool classof(const AnchorDesc *) { return true; } - static bool classof(const DebugInfoDesc *D); - - /// getLinkage - get linkage appropriate for this type of descriptor. - /// - virtual GlobalValue::LinkageTypes getLinkage() const; - - /// ApplyToFields - Target the visitor to the fields of the AnchorDesc. - /// - virtual void ApplyToFields(DIVisitor *Visitor); - - /// getDescString - Return a string used to compose global names and labels. - /// - virtual const char *getDescString() const; - - /// getTypeString - Return a string used to label this descriptor's type. - /// - virtual const char *getTypeString() const; - -#ifndef NDEBUG - virtual void dump(); -#endif -}; - -//===----------------------------------------------------------------------===// -/// AnchoredDesc - This class manages anchors for a variety of top level -/// descriptors. -class AnchoredDesc : public DebugInfoDesc { -private: - DebugInfoDesc *Anchor; // Anchor for all descriptors of the - // same type. - -protected: - - explicit AnchoredDesc(unsigned T); - -public: - // Accessors. - AnchorDesc *getAnchor() const { return static_cast(Anchor); } - void setAnchor(AnchorDesc *A) { Anchor = static_cast(A); } - - //===--------------------------------------------------------------------===// - // Subclasses should supply the following virtual methods. - - /// getAnchorString - Return a string used to label descriptor's anchor. - /// - virtual const char *getAnchorString() const = 0; - - /// ApplyToFields - Target the visitor to the fields of the AnchoredDesc. - /// - virtual void ApplyToFields(DIVisitor *Visitor); -}; - -//===----------------------------------------------------------------------===// -/// CompileUnitDesc - This class packages debug information associated with a -/// source/header file. -class CompileUnitDesc : public AnchoredDesc { -private: - unsigned Language; // Language number (ex. DW_LANG_C89.) - std::string FileName; // Source file name. - std::string Directory; // Source file directory. - std::string Producer; // Compiler string. - -public: - CompileUnitDesc(); - - - // Accessors - unsigned getLanguage() const { return Language; } - const std::string &getFileName() const { return FileName; } - const std::string &getDirectory() const { return Directory; } - const std::string &getProducer() const { return Producer; } - void setLanguage(unsigned L) { Language = L; } - void setFileName(const std::string &FN) { FileName = FN; } - void setDirectory(const std::string &D) { Directory = D; } - void setProducer(const std::string &P) { Producer = P; } - - // FIXME - Need translation unit getter/setter. - - // Implement isa/cast/dyncast. - static bool classof(const CompileUnitDesc *) { return true; } - static bool classof(const DebugInfoDesc *D); - - /// ApplyToFields - Target the visitor to the fields of the CompileUnitDesc. - /// - virtual void ApplyToFields(DIVisitor *Visitor); - - /// getDescString - Return a string used to compose global names and labels. - /// - virtual const char *getDescString() const; - - /// getTypeString - Return a string used to label this descriptor's type. - /// - virtual const char *getTypeString() const; - - /// getAnchorString - Return a string used to label this descriptor's anchor. - /// - static const char *const AnchorString; - virtual const char *getAnchorString() const; - -#ifndef NDEBUG - virtual void dump(); -#endif -}; - -//===----------------------------------------------------------------------===// -/// TypeDesc - This class packages debug information associated with a type. -/// -class TypeDesc : public DebugInfoDesc { -private: - enum { - FlagPrivate = 1 << 0, - FlagProtected = 1 << 1 - }; - DebugInfoDesc *Context; // Context debug descriptor. - std::string Name; // Type name (may be empty.) - DebugInfoDesc *File; // Defined compile unit (may be NULL.) - unsigned Line; // Defined line# (may be zero.) - uint64_t Size; // Type bit size (may be zero.) - uint64_t Align; // Type bit alignment (may be zero.) - uint64_t Offset; // Type bit offset (may be zero.) - unsigned Flags; // Miscellaneous flags. - -public: - explicit TypeDesc(unsigned T); - - // Accessors - DebugInfoDesc *getContext() const { return Context; } - const std::string &getName() const { return Name; } - CompileUnitDesc *getFile() const { - return static_cast(File); - } - unsigned getLine() const { return Line; } - uint64_t getSize() const { return Size; } - uint64_t getAlign() const { return Align; } - uint64_t getOffset() const { return Offset; } - bool isPrivate() const { - return (Flags & FlagPrivate) != 0; - } - bool isProtected() const { - return (Flags & FlagProtected) != 0; - } - void setContext(DebugInfoDesc *C) { Context = C; } - void setName(const std::string &N) { Name = N; } - void setFile(CompileUnitDesc *U) { - File = static_cast(U); - } - void setLine(unsigned L) { Line = L; } - void setSize(uint64_t S) { Size = S; } - void setAlign(uint64_t A) { Align = A; } - void setOffset(uint64_t O) { Offset = O; } - void setIsPrivate() { Flags |= FlagPrivate; } - void setIsProtected() { Flags |= FlagProtected; } - - /// ApplyToFields - Target the visitor to the fields of the TypeDesc. - /// - virtual void ApplyToFields(DIVisitor *Visitor); - - /// getDescString - Return a string used to compose global names and labels. - /// - virtual const char *getDescString() const; - - /// getTypeString - Return a string used to label this descriptor's type. - /// - virtual const char *getTypeString() const; - -#ifndef NDEBUG - virtual void dump(); -#endif -}; - -//===----------------------------------------------------------------------===// -/// BasicTypeDesc - This class packages debug information associated with a -/// basic type (eg. int, bool, double.) -class BasicTypeDesc : public TypeDesc { -private: - unsigned Encoding; // Type encoding. - -public: - BasicTypeDesc(); - - // Accessors - unsigned getEncoding() const { return Encoding; } - void setEncoding(unsigned E) { Encoding = E; } - - // Implement isa/cast/dyncast. - static bool classof(const BasicTypeDesc *) { return true; } - static bool classof(const DebugInfoDesc *D); - - /// ApplyToFields - Target the visitor to the fields of the BasicTypeDesc. - /// - virtual void ApplyToFields(DIVisitor *Visitor); - - /// getDescString - Return a string used to compose global names and labels. - /// - virtual const char *getDescString() const; - - /// getTypeString - Return a string used to label this descriptor's type. - /// - virtual const char *getTypeString() const; - -#ifndef NDEBUG - virtual void dump(); -#endif -}; - - -//===----------------------------------------------------------------------===// -/// DerivedTypeDesc - This class packages debug information associated with a -/// derived types (eg., typedef, pointer, reference.) -class DerivedTypeDesc : public TypeDesc { -private: - DebugInfoDesc *FromType; // Type derived from. - -public: - explicit DerivedTypeDesc(unsigned T); - - // Accessors - TypeDesc *getFromType() const { - return static_cast(FromType); - } - void setFromType(TypeDesc *F) { - FromType = static_cast(F); - } - - // Implement isa/cast/dyncast. - static bool classof(const DerivedTypeDesc *) { return true; } - static bool classof(const DebugInfoDesc *D); - - /// ApplyToFields - Target the visitor to the fields of the DerivedTypeDesc. - /// - virtual void ApplyToFields(DIVisitor *Visitor); - - /// getDescString - Return a string used to compose global names and labels. - /// - virtual const char *getDescString() const; - - /// getTypeString - Return a string used to label this descriptor's type. - /// - virtual const char *getTypeString() const; - -#ifndef NDEBUG - virtual void dump(); -#endif -}; - -//===----------------------------------------------------------------------===// -/// CompositeTypeDesc - This class packages debug information associated with a -/// array/struct types (eg., arrays, struct, union, enums.) -class CompositeTypeDesc : public DerivedTypeDesc { -private: - std::vector Elements;// Information used to compose type. - -public: - explicit CompositeTypeDesc(unsigned T); - - // Accessors - std::vector &getElements() { return Elements; } - - // Implement isa/cast/dyncast. - static bool classof(const CompositeTypeDesc *) { return true; } - static bool classof(const DebugInfoDesc *D); - - /// ApplyToFields - Target the visitor to the fields of the CompositeTypeDesc. - /// - virtual void ApplyToFields(DIVisitor *Visitor); - - /// getDescString - Return a string used to compose global names and labels. - /// - virtual const char *getDescString() const; - - /// getTypeString - Return a string used to label this descriptor's type. - /// - virtual const char *getTypeString() const; - -#ifndef NDEBUG - virtual void dump(); -#endif -}; - -//===----------------------------------------------------------------------===// -/// SubrangeDesc - This class packages debug information associated with integer -/// value ranges. -class SubrangeDesc : public DebugInfoDesc { -private: - int64_t Lo; // Low value of range. - int64_t Hi; // High value of range. - -public: - SubrangeDesc(); - - // Accessors - int64_t getLo() const { return Lo; } - int64_t getHi() const { return Hi; } - void setLo(int64_t L) { Lo = L; } - void setHi(int64_t H) { Hi = H; } - - // Implement isa/cast/dyncast. - static bool classof(const SubrangeDesc *) { return true; } - static bool classof(const DebugInfoDesc *D); - - /// ApplyToFields - Target the visitor to the fields of the SubrangeDesc. - /// - virtual void ApplyToFields(DIVisitor *Visitor); - - /// getDescString - Return a string used to compose global names and labels. - /// - virtual const char *getDescString() const; - - /// getTypeString - Return a string used to label this descriptor's type. - /// - virtual const char *getTypeString() const; - -#ifndef NDEBUG - virtual void dump(); -#endif -}; - -//===----------------------------------------------------------------------===// -/// EnumeratorDesc - This class packages debug information associated with -/// named integer constants. -class EnumeratorDesc : public DebugInfoDesc { -private: - std::string Name; // Enumerator name. - int64_t Value; // Enumerator value. - -public: - EnumeratorDesc(); - - // Accessors - const std::string &getName() const { return Name; } - int64_t getValue() const { return Value; } - void setName(const std::string &N) { Name = N; } - void setValue(int64_t V) { Value = V; } - - // Implement isa/cast/dyncast. - static bool classof(const EnumeratorDesc *) { return true; } - static bool classof(const DebugInfoDesc *D); - - /// ApplyToFields - Target the visitor to the fields of the EnumeratorDesc. - /// - virtual void ApplyToFields(DIVisitor *Visitor); - - /// getDescString - Return a string used to compose global names and labels. - /// - virtual const char *getDescString() const; - - /// getTypeString - Return a string used to label this descriptor's type. - /// - virtual const char *getTypeString() const; - -#ifndef NDEBUG - virtual void dump(); -#endif -}; - -//===----------------------------------------------------------------------===// -/// VariableDesc - This class packages debug information associated with a -/// subprogram variable. -/// -class VariableDesc : public DebugInfoDesc { -private: - DebugInfoDesc *Context; // Context debug descriptor. - std::string Name; // Type name (may be empty.) - DebugInfoDesc *File; // Defined compile unit (may be NULL.) - unsigned Line; // Defined line# (may be zero.) - DebugInfoDesc *TyDesc; // Type of variable. - -public: - explicit VariableDesc(unsigned T); - - // Accessors - DebugInfoDesc *getContext() const { return Context; } - const std::string &getName() const { return Name; } - CompileUnitDesc *getFile() const { - return static_cast(File); - } - unsigned getLine() const { return Line; } - TypeDesc *getType() const { - return static_cast(TyDesc); - } - void setContext(DebugInfoDesc *C) { Context = C; } - void setName(const std::string &N) { Name = N; } - void setFile(CompileUnitDesc *U) { - File = static_cast(U); - } - void setLine(unsigned L) { Line = L; } - void setType(TypeDesc *T) { - TyDesc = static_cast(T); - } - - // Implement isa/cast/dyncast. - static bool classof(const VariableDesc *) { return true; } - static bool classof(const DebugInfoDesc *D); - - /// ApplyToFields - Target the visitor to the fields of the VariableDesc. - /// - virtual void ApplyToFields(DIVisitor *Visitor); - - /// getDescString - Return a string used to compose global names and labels. - /// - virtual const char *getDescString() const; - - /// getTypeString - Return a string used to label this descriptor's type. - /// - virtual const char *getTypeString() const; - -#ifndef NDEBUG - virtual void dump(); -#endif -}; - -//===----------------------------------------------------------------------===// -/// GlobalDesc - This class is the base descriptor for global functions and -/// variables. -class GlobalDesc : public AnchoredDesc { -private: - DebugInfoDesc *Context; // Context debug descriptor. - std::string Name; // Global name. - std::string FullName; // Fully qualified name. - std::string LinkageName; // Name for binding to MIPS linkage. - DebugInfoDesc *File; // Defined compile unit (may be NULL.) - unsigned Line; // Defined line# (may be zero.) - DebugInfoDesc *TyDesc; // Type debug descriptor. - bool IsStatic; // Is the global a static. - bool IsDefinition; // Is the global defined in context. - -protected: - explicit GlobalDesc(unsigned T); - -public: - // Accessors - DebugInfoDesc *getContext() const { return Context; } - const std::string &getName() const { return Name; } - const std::string &getFullName() const { return FullName; } - const std::string &getLinkageName() const { return LinkageName; } - CompileUnitDesc *getFile() const { - return static_cast(File); - } - unsigned getLine() const { return Line; } - TypeDesc *getType() const { - return static_cast(TyDesc); - } - bool isStatic() const { return IsStatic; } - bool isDefinition() const { return IsDefinition; } - void setContext(DebugInfoDesc *C) { Context = C; } - void setName(const std::string &N) { Name = N; } - void setFullName(const std::string &N) { FullName = N; } - void setLinkageName(const std::string &N) { LinkageName = N; } - void setFile(CompileUnitDesc *U) { - File = static_cast(U); - } - void setLine(unsigned L) { Line = L; } - void setType(TypeDesc *T) { - TyDesc = static_cast(T); - } - void setIsStatic(bool IS) { IsStatic = IS; } - void setIsDefinition(bool ID) { IsDefinition = ID; } - - /// ApplyToFields - Target the visitor to the fields of the GlobalDesc. - /// - virtual void ApplyToFields(DIVisitor *Visitor); -}; - -//===----------------------------------------------------------------------===// -/// GlobalVariableDesc - This class packages debug information associated with a -/// GlobalVariable. -class GlobalVariableDesc : public GlobalDesc { -private: - GlobalVariable *Global; // llvm global. - -public: - GlobalVariableDesc(); - - // Accessors. - GlobalVariable *getGlobalVariable() const { return Global; } - void setGlobalVariable(GlobalVariable *GV) { Global = GV; } - - // Implement isa/cast/dyncast. - static bool classof(const GlobalVariableDesc *) { return true; } - static bool classof(const DebugInfoDesc *D); - - /// ApplyToFields - Target the visitor to the fields of the - /// GlobalVariableDesc. - virtual void ApplyToFields(DIVisitor *Visitor); - - /// getDescString - Return a string used to compose global names and labels. - /// - virtual const char *getDescString() const; - - /// getTypeString - Return a string used to label this descriptor's type. - /// - virtual const char *getTypeString() const; - - /// getAnchorString - Return a string used to label this descriptor's anchor. - /// - static const char *const AnchorString; - virtual const char *getAnchorString() const; - -#ifndef NDEBUG - virtual void dump(); -#endif -}; - -//===----------------------------------------------------------------------===// -/// SubprogramDesc - This class packages debug information associated with a -/// subprogram/function. -class SubprogramDesc : public GlobalDesc { -private: - -public: - SubprogramDesc(); - - // Accessors - - // Implement isa/cast/dyncast. - static bool classof(const SubprogramDesc *) { return true; } - static bool classof(const DebugInfoDesc *D); - - /// ApplyToFields - Target the visitor to the fields of the SubprogramDesc. - /// - virtual void ApplyToFields(DIVisitor *Visitor); - - /// getDescString - Return a string used to compose global names and labels. - /// - virtual const char *getDescString() const; - - /// getTypeString - Return a string used to label this descriptor's type. - /// - virtual const char *getTypeString() const; - - /// getAnchorString - Return a string used to label this descriptor's anchor. - /// - static const char *const AnchorString; - virtual const char *getAnchorString() const; - -#ifndef NDEBUG - virtual void dump(); -#endif -}; - -//===----------------------------------------------------------------------===// -/// BlockDesc - This descriptor groups variables and blocks nested in a block. -/// -class BlockDesc : public DebugInfoDesc { -private: - DebugInfoDesc *Context; // Context debug descriptor. - -public: - BlockDesc(); - - // Accessors - DebugInfoDesc *getContext() const { return Context; } - void setContext(DebugInfoDesc *C) { Context = C; } - - // Implement isa/cast/dyncast. - static bool classof(const BlockDesc *) { return true; } - static bool classof(const DebugInfoDesc *D); - - /// ApplyToFields - Target the visitor to the fields of the BlockDesc. - /// - virtual void ApplyToFields(DIVisitor *Visitor); - - /// getDescString - Return a string used to compose global names and labels. - /// - virtual const char *getDescString() const; - - /// getTypeString - Return a string used to label this descriptor's type. - /// - virtual const char *getTypeString() const; - -#ifndef NDEBUG - virtual void dump(); -#endif -}; - -//===----------------------------------------------------------------------===// /// DIDeserializer - This class is responsible for casting GlobalVariables /// into DebugInfoDesc objects. class DIDeserializer { @@ -1168,28 +505,13 @@ /// getGlobalVariablesUsing - Return all of the GlobalVariables that use the /// named GlobalVariable. - std::vector - getGlobalVariablesUsing(Module &M, const std::string &RootName); + void getGlobalVariablesUsing(Module &M, const std::string &RootName, + std::vector &Result); /// getAnchoredDescriptors - Return a vector of anchored debug descriptors. /// - template std::vector getAnchoredDescriptors(Module &M) { - T Desc; - std::vector Globals = - getGlobalVariablesUsing(M, Desc.getAnchorString()); - std::vector AnchoredDescs; - for (unsigned i = 0, N = Globals.size(); i < N; ++i) { - GlobalVariable *GV = Globals[i]; - - // FIXME - In the short term, changes are too drastic to continue. - if (DebugInfoDesc::TagFromGlobal(GV) == Desc.getTag() && - DebugInfoDesc::VersionFromGlobal(GV) == LLVMDebugVersion) { - AnchoredDescs.push_back(cast(DR.Deserialize(GV))); - } - } - - return AnchoredDescs; - } + void getAnchoredDescriptors(Module &M, const AnchoredDesc *Desc, + std::vector &AnchoredDescs); /// RecordRegionStart - Indicate the start of a region. /// Modified: llvm/trunk/lib/CodeGen/DwarfWriter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/DwarfWriter.cpp?rev=52800&r1=52799&r2=52800&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/DwarfWriter.cpp (original) +++ llvm/trunk/lib/CodeGen/DwarfWriter.cpp Thu Jun 26 19:09:40 2008 @@ -20,6 +20,7 @@ #include "llvm/Module.h" #include "llvm/Type.h" #include "llvm/CodeGen/AsmPrinter.h" +#include "llvm/CodeGen/MachineDebugInfoDesc.h" #include "llvm/CodeGen/MachineModuleInfo.h" #include "llvm/CodeGen/MachineFrameInfo.h" #include "llvm/CodeGen/MachineLocation.h" @@ -2621,25 +2622,23 @@ /// ConstructGlobalDIEs - Create DIEs for each of the externally visible /// global variables. void ConstructGlobalDIEs() { - std::vector GlobalVariables = - MMI->getAnchoredDescriptors(*M); + std::vector GlobalVariables; + GlobalVariableDesc GVD; + MMI->getAnchoredDescriptors(*M, &GVD, GlobalVariables); - for (unsigned i = 0, N = GlobalVariables.size(); i < N; ++i) { - GlobalVariableDesc *GVD = GlobalVariables[i]; - NewGlobalVariable(GVD); - } + for (unsigned i = 0, N = GlobalVariables.size(); i < N; ++i) + NewGlobalVariable((GlobalVariableDesc *)GlobalVariables[i]); } /// ConstructSubprogramDIEs - Create DIEs for each of the externally visible /// subprograms. void ConstructSubprogramDIEs() { - std::vector Subprograms = - MMI->getAnchoredDescriptors(*M); + std::vector Subprograms; + SubprogramDesc SPD; + MMI->getAnchoredDescriptors(*M, &SPD, Subprograms); - for (unsigned i = 0, N = Subprograms.size(); i < N; ++i) { - SubprogramDesc *SPD = Subprograms[i]; - NewSubprogram(SPD); - } + for (unsigned i = 0, N = Subprograms.size(); i < N; ++i) + NewSubprogram((SubprogramDesc*)Subprograms[i]); } public: Added: llvm/trunk/lib/CodeGen/MachineDebugInfoDesc.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachineDebugInfoDesc.cpp?rev=52800&view=auto ============================================================================== --- llvm/trunk/lib/CodeGen/MachineDebugInfoDesc.cpp (added) +++ llvm/trunk/lib/CodeGen/MachineDebugInfoDesc.cpp Thu Jun 26 19:09:40 2008 @@ -0,0 +1,588 @@ +//===-- llvm/CodeGen/MachineDebugInfoDesc.cpp -------------------*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#include "llvm/CodeGen/MachineDebugInfoDesc.h" +#include "llvm/CodeGen/MachineModuleInfo.h" +#include "llvm/Constants.h" +#include "llvm/GlobalVariable.h" +#include "llvm/Support/Dwarf.h" +#include "llvm/Support/Streams.h" + +using namespace llvm; +using namespace llvm::dwarf; + +/// getUIntOperand - Return ith operand if it is an unsigned integer. +/// +static ConstantInt *getUIntOperand(const GlobalVariable *GV, unsigned i) { + // Make sure the GlobalVariable has an initializer. + if (!GV->hasInitializer()) return NULL; + + // Get the initializer constant. + ConstantStruct *CI = dyn_cast(GV->getInitializer()); + if (!CI) return NULL; + + // Check if there is at least i + 1 operands. + unsigned N = CI->getNumOperands(); + if (i >= N) return NULL; + + // Check constant. + return dyn_cast(CI->getOperand(i)); +} + +//===----------------------------------------------------------------------===// + +/// Supply a home for the DebugInfoDesc's v-table. +DebugInfoDesc::~DebugInfoDesc() {} + +/// TagFromGlobal - Returns the tag number from a debug info descriptor +/// GlobalVariable. Return DIIValid if operand is not an unsigned int. +unsigned DebugInfoDesc::TagFromGlobal(GlobalVariable *GV) { + ConstantInt *C = getUIntOperand(GV, 0); + return C ? ((unsigned)C->getZExtValue() & ~LLVMDebugVersionMask) : + (unsigned)DW_TAG_invalid; +} + +/// VersionFromGlobal - Returns the version number from a debug info +/// descriptor GlobalVariable. Return DIIValid if operand is not an unsigned +/// int. +unsigned DebugInfoDesc::VersionFromGlobal(GlobalVariable *GV) { + ConstantInt *C = getUIntOperand(GV, 0); + return C ? ((unsigned)C->getZExtValue() & LLVMDebugVersionMask) : + (unsigned)DW_TAG_invalid; +} + +/// DescFactory - Create an instance of debug info descriptor based on Tag. +/// Return NULL if not a recognized Tag. +DebugInfoDesc *DebugInfoDesc::DescFactory(unsigned Tag) { + switch (Tag) { + case DW_TAG_anchor: return new AnchorDesc(); + case DW_TAG_compile_unit: return new CompileUnitDesc(); + case DW_TAG_variable: return new GlobalVariableDesc(); + case DW_TAG_subprogram: return new SubprogramDesc(); + case DW_TAG_lexical_block: return new BlockDesc(); + case DW_TAG_base_type: return new BasicTypeDesc(); + case DW_TAG_typedef: + case DW_TAG_pointer_type: + case DW_TAG_reference_type: + case DW_TAG_const_type: + case DW_TAG_volatile_type: + case DW_TAG_restrict_type: + case DW_TAG_member: + case DW_TAG_inheritance: return new DerivedTypeDesc(Tag); + case DW_TAG_array_type: + case DW_TAG_structure_type: + case DW_TAG_union_type: + case DW_TAG_enumeration_type: + case DW_TAG_vector_type: + case DW_TAG_subroutine_type: return new CompositeTypeDesc(Tag); + case DW_TAG_subrange_type: return new SubrangeDesc(); + case DW_TAG_enumerator: return new EnumeratorDesc(); + case DW_TAG_return_variable: + case DW_TAG_arg_variable: + case DW_TAG_auto_variable: return new VariableDesc(Tag); + default: break; + } + return NULL; +} + +/// getLinkage - get linkage appropriate for this type of descriptor. +GlobalValue::LinkageTypes DebugInfoDesc::getLinkage() const { + return GlobalValue::InternalLinkage; +} + +/// ApplyToFields - Target the vistor to the fields of the descriptor. +void DebugInfoDesc::ApplyToFields(DIVisitor *Visitor) { + Visitor->Apply(Tag); +} + +//===----------------------------------------------------------------------===// + +AnchorDesc::AnchorDesc() + : DebugInfoDesc(DW_TAG_anchor), AnchorTag(0){ +} +AnchorDesc::AnchorDesc(AnchoredDesc *D) + : DebugInfoDesc(DW_TAG_anchor), AnchorTag(D->getTag()) { +} + +// Implement isa/cast/dyncast. +bool AnchorDesc::classof(const DebugInfoDesc *D) { + return D->getTag() == DW_TAG_anchor; +} + +/// getLinkage - get linkage appropriate for this type of descriptor. +GlobalValue::LinkageTypes AnchorDesc::getLinkage() const { + return GlobalValue::LinkOnceLinkage; +} + +/// ApplyToFields - Target the visitor to the fields of the TransUnitDesc. +void AnchorDesc::ApplyToFields(DIVisitor *Visitor) { + DebugInfoDesc::ApplyToFields(Visitor); + Visitor->Apply(AnchorTag); +} + +/// getDescString - Return a string used to compose global names and labels. A +/// global variable name needs to be defined for each debug descriptor that is +/// anchored. NOTE: that each global variable named here also needs to be added +/// to the list of names left external in the internalizer. +/// +/// ExternalNames.insert("llvm.dbg.compile_units"); +/// ExternalNames.insert("llvm.dbg.global_variables"); +/// ExternalNames.insert("llvm.dbg.subprograms"); +const char *AnchorDesc::getDescString() const { + switch (AnchorTag) { + case DW_TAG_compile_unit: { + CompileUnitDesc CUD; + return CUD.getAnchorString(); + } + case DW_TAG_variable: { + GlobalVariableDesc GVD; + return GVD.getAnchorString(); + } + case DW_TAG_subprogram: { + SubprogramDesc SPD; + return SPD.getAnchorString(); + } + default: break; + } + + assert(0 && "Tag does not have a case for anchor string"); + return ""; +} + +#ifndef NDEBUG +void AnchorDesc::dump() { + cerr << getDescString() << " " + << "Version(" << getVersion() << "), " + << "Tag(" << getTag() << "), " + << "AnchorTag(" << AnchorTag << ")\n"; +} +#endif + +//===----------------------------------------------------------------------===// + +AnchoredDesc::AnchoredDesc(unsigned T) + : DebugInfoDesc(T), Anchor(NULL) { +} + +/// ApplyToFields - Target the visitor to the fields of the AnchoredDesc. +void AnchoredDesc::ApplyToFields(DIVisitor *Visitor) { + DebugInfoDesc::ApplyToFields(Visitor); + Visitor->Apply(Anchor); +} + +//===----------------------------------------------------------------------===// + +CompileUnitDesc::CompileUnitDesc() + : AnchoredDesc(DW_TAG_compile_unit), Language(0), FileName(""), + Directory(""), Producer("") { +} + +// Implement isa/cast/dyncast. +bool CompileUnitDesc::classof(const DebugInfoDesc *D) { + return D->getTag() == DW_TAG_compile_unit; +} + +/// ApplyToFields - Target the visitor to the fields of the CompileUnitDesc. +/// +void CompileUnitDesc::ApplyToFields(DIVisitor *Visitor) { + AnchoredDesc::ApplyToFields(Visitor); + + // Handle cases out of sync with compiler. + if (getVersion() == 0) { + unsigned DebugVersion; + Visitor->Apply(DebugVersion); + } + + Visitor->Apply(Language); + Visitor->Apply(FileName); + Visitor->Apply(Directory); + Visitor->Apply(Producer); +} + +#ifndef NDEBUG +void CompileUnitDesc::dump() { + cerr << getDescString() << " " + << "Version(" << getVersion() << "), " + << "Tag(" << getTag() << "), " + << "Anchor(" << getAnchor() << "), " + << "Language(" << Language << "), " + << "FileName(\"" << FileName << "\"), " + << "Directory(\"" << Directory << "\"), " + << "Producer(\"" << Producer << "\")\n"; +} +#endif + +//===----------------------------------------------------------------------===// + +TypeDesc::TypeDesc(unsigned T) + : DebugInfoDesc(T), Context(NULL), Name(""), File(NULL), Line(0), Size(0), + Align(0), Offset(0), Flags(0) { +} + +/// ApplyToFields - Target the visitor to the fields of the TypeDesc. +/// +void TypeDesc::ApplyToFields(DIVisitor *Visitor) { + DebugInfoDesc::ApplyToFields(Visitor); + Visitor->Apply(Context); + Visitor->Apply(Name); + Visitor->Apply(File); + Visitor->Apply(Line); + Visitor->Apply(Size); + Visitor->Apply(Align); + Visitor->Apply(Offset); + if (getVersion() > LLVMDebugVersion4) Visitor->Apply(Flags); +} + +#ifndef NDEBUG +void TypeDesc::dump() { + cerr << getDescString() << " " + << "Version(" << getVersion() << "), " + << "Tag(" << getTag() << "), " + << "Context(" << Context << "), " + << "Name(\"" << Name << "\"), " + << "File(" << File << "), " + << "Line(" << Line << "), " + << "Size(" << Size << "), " + << "Align(" << Align << "), " + << "Offset(" << Offset << "), " + << "Flags(" << Flags << ")\n"; +} +#endif + +//===----------------------------------------------------------------------===// + +BasicTypeDesc::BasicTypeDesc() + : TypeDesc(DW_TAG_base_type), Encoding(0) { +} + +// Implement isa/cast/dyncast. +bool BasicTypeDesc::classof(const DebugInfoDesc *D) { + return D->getTag() == DW_TAG_base_type; +} + +/// ApplyToFields - Target the visitor to the fields of the BasicTypeDesc. +void BasicTypeDesc::ApplyToFields(DIVisitor *Visitor) { + TypeDesc::ApplyToFields(Visitor); + Visitor->Apply(Encoding); +} + +#ifndef NDEBUG +void BasicTypeDesc::dump() { + cerr << getDescString() << " " + << "Version(" << getVersion() << "), " + << "Tag(" << getTag() << "), " + << "Context(" << getContext() << "), " + << "Name(\"" << getName() << "\"), " + << "Size(" << getSize() << "), " + << "Encoding(" << Encoding << ")\n"; +} +#endif + +//===----------------------------------------------------------------------===// + +DerivedTypeDesc::DerivedTypeDesc(unsigned T) + : TypeDesc(T), FromType(NULL) { +} + +// Implement isa/cast/dyncast. +bool DerivedTypeDesc::classof(const DebugInfoDesc *D) { + unsigned T = D->getTag(); + switch (T) { + case DW_TAG_typedef: + case DW_TAG_pointer_type: + case DW_TAG_reference_type: + case DW_TAG_const_type: + case DW_TAG_volatile_type: + case DW_TAG_restrict_type: + case DW_TAG_member: + case DW_TAG_inheritance: + return true; + default: break; + } + return false; +} + +/// ApplyToFields - Target the visitor to the fields of the DerivedTypeDesc. +void DerivedTypeDesc::ApplyToFields(DIVisitor *Visitor) { + TypeDesc::ApplyToFields(Visitor); + Visitor->Apply(FromType); +} + +#ifndef NDEBUG +void DerivedTypeDesc::dump() { + cerr << getDescString() << " " + << "Version(" << getVersion() << "), " + << "Tag(" << getTag() << "), " + << "Context(" << getContext() << "), " + << "Name(\"" << getName() << "\"), " + << "Size(" << getSize() << "), " + << "File(" << getFile() << "), " + << "Line(" << getLine() << "), " + << "FromType(" << FromType << ")\n"; +} +#endif + +//===----------------------------------------------------------------------===// + +CompositeTypeDesc::CompositeTypeDesc(unsigned T) + : DerivedTypeDesc(T), Elements() { +} + +// Implement isa/cast/dyncast. +bool CompositeTypeDesc::classof(const DebugInfoDesc *D) { + unsigned T = D->getTag(); + switch (T) { + case DW_TAG_array_type: + case DW_TAG_structure_type: + case DW_TAG_union_type: + case DW_TAG_enumeration_type: + case DW_TAG_vector_type: + case DW_TAG_subroutine_type: + return true; + default: break; + } + return false; +} + +/// ApplyToFields - Target the visitor to the fields of the CompositeTypeDesc. +/// +void CompositeTypeDesc::ApplyToFields(DIVisitor *Visitor) { + DerivedTypeDesc::ApplyToFields(Visitor); + Visitor->Apply(Elements); +} + +#ifndef NDEBUG +void CompositeTypeDesc::dump() { + cerr << getDescString() << " " + << "Version(" << getVersion() << "), " + << "Tag(" << getTag() << "), " + << "Context(" << getContext() << "), " + << "Name(\"" << getName() << "\"), " + << "Size(" << getSize() << "), " + << "File(" << getFile() << "), " + << "Line(" << getLine() << "), " + << "FromType(" << getFromType() << "), " + << "Elements.size(" << Elements.size() << ")\n"; +} +#endif + +//===----------------------------------------------------------------------===// + +SubrangeDesc::SubrangeDesc() + : DebugInfoDesc(DW_TAG_subrange_type), Lo(0), Hi(0) { +} + +// Implement isa/cast/dyncast. +bool SubrangeDesc::classof(const DebugInfoDesc *D) { + return D->getTag() == DW_TAG_subrange_type; +} + +/// ApplyToFields - Target the visitor to the fields of the SubrangeDesc. +void SubrangeDesc::ApplyToFields(DIVisitor *Visitor) { + DebugInfoDesc::ApplyToFields(Visitor); + Visitor->Apply(Lo); + Visitor->Apply(Hi); +} + +#ifndef NDEBUG +void SubrangeDesc::dump() { + cerr << getDescString() << " " + << "Version(" << getVersion() << "), " + << "Tag(" << getTag() << "), " + << "Lo(" << Lo << "), " + << "Hi(" << Hi << ")\n"; +} +#endif + +//===----------------------------------------------------------------------===// + +EnumeratorDesc::EnumeratorDesc() + : DebugInfoDesc(DW_TAG_enumerator), Name(""), Value(0) { +} + +// Implement isa/cast/dyncast. +bool EnumeratorDesc::classof(const DebugInfoDesc *D) { + return D->getTag() == DW_TAG_enumerator; +} + +/// ApplyToFields - Target the visitor to the fields of the EnumeratorDesc. +void EnumeratorDesc::ApplyToFields(DIVisitor *Visitor) { + DebugInfoDesc::ApplyToFields(Visitor); + Visitor->Apply(Name); + Visitor->Apply(Value); +} + +#ifndef NDEBUG +void EnumeratorDesc::dump() { + cerr << getDescString() << " " + << "Version(" << getVersion() << "), " + << "Tag(" << getTag() << "), " + << "Name(" << Name << "), " + << "Value(" << Value << ")\n"; +} +#endif + +//===----------------------------------------------------------------------===// + +VariableDesc::VariableDesc(unsigned T) + : DebugInfoDesc(T), Context(NULL), Name(""), File(NULL), Line(0), TyDesc(0) { +} + +// Implement isa/cast/dyncast. +bool VariableDesc::classof(const DebugInfoDesc *D) { + unsigned T = D->getTag(); + switch (T) { + case DW_TAG_auto_variable: + case DW_TAG_arg_variable: + case DW_TAG_return_variable: + return true; + default: break; + } + return false; +} + +/// ApplyToFields - Target the visitor to the fields of the VariableDesc. +void VariableDesc::ApplyToFields(DIVisitor *Visitor) { + DebugInfoDesc::ApplyToFields(Visitor); + Visitor->Apply(Context); + Visitor->Apply(Name); + Visitor->Apply(File); + Visitor->Apply(Line); + Visitor->Apply(TyDesc); +} + +#ifndef NDEBUG +void VariableDesc::dump() { + cerr << getDescString() << " " + << "Version(" << getVersion() << "), " + << "Tag(" << getTag() << "), " + << "Context(" << Context << "), " + << "Name(\"" << Name << "\"), " + << "File(" << File << "), " + << "Line(" << Line << "), " + << "TyDesc(" << TyDesc << ")\n"; +} +#endif + +//===----------------------------------------------------------------------===// + +GlobalDesc::GlobalDesc(unsigned T) + : AnchoredDesc(T), Context(0), Name(""), FullName(""), LinkageName(""), + File(NULL), Line(0), TyDesc(NULL), IsStatic(false), IsDefinition(false) { +} + +/// ApplyToFields - Target the visitor to the fields of the global. +/// +void GlobalDesc::ApplyToFields(DIVisitor *Visitor) { + AnchoredDesc::ApplyToFields(Visitor); + Visitor->Apply(Context); + Visitor->Apply(Name); + Visitor->Apply(FullName); + Visitor->Apply(LinkageName); + Visitor->Apply(File); + Visitor->Apply(Line); + Visitor->Apply(TyDesc); + Visitor->Apply(IsStatic); + Visitor->Apply(IsDefinition); +} + +//===----------------------------------------------------------------------===// + +GlobalVariableDesc::GlobalVariableDesc() + : GlobalDesc(DW_TAG_variable), Global(NULL) { +} + +// Implement isa/cast/dyncast. +bool GlobalVariableDesc::classof(const DebugInfoDesc *D) { + return D->getTag() == DW_TAG_variable; +} + +/// ApplyToFields - Target the visitor to the fields of the GlobalVariableDesc. +void GlobalVariableDesc::ApplyToFields(DIVisitor *Visitor) { + GlobalDesc::ApplyToFields(Visitor); + Visitor->Apply(Global); +} + +#ifndef NDEBUG +void GlobalVariableDesc::dump() { + cerr << getDescString() << " " + << "Version(" << getVersion() << "), " + << "Tag(" << getTag() << "), " + << "Anchor(" << getAnchor() << "), " + << "Name(\"" << getName() << "\"), " + << "FullName(\"" << getFullName() << "\"), " + << "LinkageName(\"" << getLinkageName() << "\"), " + << "File(" << getFile() << ")," + << "Line(" << getLine() << ")," + << "Type(" << getType() << "), " + << "IsStatic(" << (isStatic() ? "true" : "false") << "), " + << "IsDefinition(" << (isDefinition() ? "true" : "false") << "), " + << "Global(" << Global << ")\n"; +} +#endif + +//===----------------------------------------------------------------------===// + +SubprogramDesc::SubprogramDesc() + : GlobalDesc(DW_TAG_subprogram) { +} + +// Implement isa/cast/dyncast. +bool SubprogramDesc::classof(const DebugInfoDesc *D) { + return D->getTag() == DW_TAG_subprogram; +} + +/// ApplyToFields - Target the visitor to the fields of the SubprogramDesc. +void SubprogramDesc::ApplyToFields(DIVisitor *Visitor) { + GlobalDesc::ApplyToFields(Visitor); +} + +#ifndef NDEBUG +void SubprogramDesc::dump() { + cerr << getDescString() << " " + << "Version(" << getVersion() << "), " + << "Tag(" << getTag() << "), " + << "Anchor(" << getAnchor() << "), " + << "Name(\"" << getName() << "\"), " + << "FullName(\"" << getFullName() << "\"), " + << "LinkageName(\"" << getLinkageName() << "\"), " + << "File(" << getFile() << ")," + << "Line(" << getLine() << ")," + << "Type(" << getType() << "), " + << "IsStatic(" << (isStatic() ? "true" : "false") << "), " + << "IsDefinition(" << (isDefinition() ? "true" : "false") << ")\n"; +} +#endif + +//===----------------------------------------------------------------------===// + +BlockDesc::BlockDesc() + : DebugInfoDesc(DW_TAG_lexical_block), Context(NULL) { +} + +// Implement isa/cast/dyncast. +bool BlockDesc::classof(const DebugInfoDesc *D) { + return D->getTag() == DW_TAG_lexical_block; +} + +/// ApplyToFields - Target the visitor to the fields of the BlockDesc. +void BlockDesc::ApplyToFields(DIVisitor *Visitor) { + DebugInfoDesc::ApplyToFields(Visitor); + + Visitor->Apply(Context); +} + +#ifndef NDEBUG +void BlockDesc::dump() { + cerr << getDescString() << " " + << "Version(" << getVersion() << "), " + << "Tag(" << getTag() << ")," + << "Context(" << Context << ")\n"; +} +#endif Modified: llvm/trunk/lib/CodeGen/MachineModuleInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachineModuleInfo.cpp?rev=52800&r1=52799&r2=52800&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/MachineModuleInfo.cpp (original) +++ llvm/trunk/lib/CodeGen/MachineModuleInfo.cpp Thu Jun 26 19:09:40 2008 @@ -14,6 +14,7 @@ #include "llvm/CodeGen/MachineFunctionPass.h" #include "llvm/CodeGen/MachineFunction.h" #include "llvm/CodeGen/MachineLocation.h" +#include "llvm/CodeGen/MachineDebugInfoDesc.h" #include "llvm/Target/TargetInstrInfo.h" #include "llvm/Target/TargetMachine.h" #include "llvm/Target/TargetOptions.h" @@ -52,10 +53,9 @@ /// getGlobalVariablesUsing - Return all of the GlobalVariables that use the /// named GlobalVariable. -static std::vector -getGlobalVariablesUsing(Module &M, const std::string &RootName) { - std::vector Result; // GlobalVariables matching criteria. - +static void +getGlobalVariablesUsing(Module &M, const std::string &RootName, + std::vector &Result) { std::vector FieldTypes; FieldTypes.push_back(Type::Int32Ty); FieldTypes.push_back(Type::Int32Ty); @@ -65,11 +65,8 @@ StructType::get(FieldTypes)); // If present and linkonce then scan for users. - if (UseRoot && UseRoot->hasLinkOnceLinkage()) { + if (UseRoot && UseRoot->hasLinkOnceLinkage()) getGlobalVariablesUsing(UseRoot, Result); - } - - return Result; } /// isStringValue - Return true if the given value can be coerced to a string. @@ -134,24 +131,6 @@ return false; } -/// getUIntOperand - Return ith operand if it is an unsigned integer. -/// -static ConstantInt *getUIntOperand(GlobalVariable *GV, unsigned i) { - // Make sure the GlobalVariable has an initializer. - if (!GV->hasInitializer()) return NULL; - - // Get the initializer constant. - ConstantStruct *CI = dyn_cast(GV->getInitializer()); - if (!CI) return NULL; - - // Check if there is at least i + 1 operands. - unsigned N = CI->getNumOperands(); - if (i >= N) return NULL; - - // Check constant. - return dyn_cast(CI->getOperand(i)); -} - //===----------------------------------------------------------------------===// /// ApplyToFields - Target the visitor to each field of the debug information @@ -487,763 +466,6 @@ //===----------------------------------------------------------------------===// -/// TagFromGlobal - Returns the tag number from a debug info descriptor -/// GlobalVariable. Return DIIValid if operand is not an unsigned int. -unsigned DebugInfoDesc::TagFromGlobal(GlobalVariable *GV) { - ConstantInt *C = getUIntOperand(GV, 0); - return C ? ((unsigned)C->getZExtValue() & ~LLVMDebugVersionMask) : - (unsigned)DW_TAG_invalid; -} - -/// VersionFromGlobal - Returns the version number from a debug info -/// descriptor GlobalVariable. Return DIIValid if operand is not an unsigned -/// int. -unsigned DebugInfoDesc::VersionFromGlobal(GlobalVariable *GV) { - ConstantInt *C = getUIntOperand(GV, 0); - return C ? ((unsigned)C->getZExtValue() & LLVMDebugVersionMask) : - (unsigned)DW_TAG_invalid; -} - -/// DescFactory - Create an instance of debug info descriptor based on Tag. -/// Return NULL if not a recognized Tag. -DebugInfoDesc *DebugInfoDesc::DescFactory(unsigned Tag) { - switch (Tag) { - case DW_TAG_anchor: return new AnchorDesc(); - case DW_TAG_compile_unit: return new CompileUnitDesc(); - case DW_TAG_variable: return new GlobalVariableDesc(); - case DW_TAG_subprogram: return new SubprogramDesc(); - case DW_TAG_lexical_block: return new BlockDesc(); - case DW_TAG_base_type: return new BasicTypeDesc(); - case DW_TAG_typedef: - case DW_TAG_pointer_type: - case DW_TAG_reference_type: - case DW_TAG_const_type: - case DW_TAG_volatile_type: - case DW_TAG_restrict_type: - case DW_TAG_member: - case DW_TAG_inheritance: return new DerivedTypeDesc(Tag); - case DW_TAG_array_type: - case DW_TAG_structure_type: - case DW_TAG_union_type: - case DW_TAG_enumeration_type: - case DW_TAG_vector_type: - case DW_TAG_subroutine_type: return new CompositeTypeDesc(Tag); - case DW_TAG_subrange_type: return new SubrangeDesc(); - case DW_TAG_enumerator: return new EnumeratorDesc(); - case DW_TAG_return_variable: - case DW_TAG_arg_variable: - case DW_TAG_auto_variable: return new VariableDesc(Tag); - default: break; - } - return NULL; -} - -/// getLinkage - get linkage appropriate for this type of descriptor. -/// -GlobalValue::LinkageTypes DebugInfoDesc::getLinkage() const { - return GlobalValue::InternalLinkage; -} - -/// ApplyToFields - Target the vistor to the fields of the descriptor. -/// -void DebugInfoDesc::ApplyToFields(DIVisitor *Visitor) { - Visitor->Apply(Tag); -} - -//===----------------------------------------------------------------------===// - -AnchorDesc::AnchorDesc() -: DebugInfoDesc(DW_TAG_anchor) -, AnchorTag(0) -{} -AnchorDesc::AnchorDesc(AnchoredDesc *D) -: DebugInfoDesc(DW_TAG_anchor) -, AnchorTag(D->getTag()) -{} - -// Implement isa/cast/dyncast. -bool AnchorDesc::classof(const DebugInfoDesc *D) { - return D->getTag() == DW_TAG_anchor; -} - -/// getLinkage - get linkage appropriate for this type of descriptor. -/// -GlobalValue::LinkageTypes AnchorDesc::getLinkage() const { - return GlobalValue::LinkOnceLinkage; -} - -/// ApplyToFields - Target the visitor to the fields of the TransUnitDesc. -/// -void AnchorDesc::ApplyToFields(DIVisitor *Visitor) { - DebugInfoDesc::ApplyToFields(Visitor); - - Visitor->Apply(AnchorTag); -} - -/// getDescString - Return a string used to compose global names and labels. A -/// A global variable name needs to be defined for each debug descriptor that is -/// anchored. NOTE: that each global variable named here also needs to be added -/// to the list of names left external in the internalizer. -/// ExternalNames.insert("llvm.dbg.compile_units"); -/// ExternalNames.insert("llvm.dbg.global_variables"); -/// ExternalNames.insert("llvm.dbg.subprograms"); -const char *AnchorDesc::getDescString() const { - switch (AnchorTag) { - case DW_TAG_compile_unit: return CompileUnitDesc::AnchorString; - case DW_TAG_variable: return GlobalVariableDesc::AnchorString; - case DW_TAG_subprogram: return SubprogramDesc::AnchorString; - default: break; - } - - assert(0 && "Tag does not have a case for anchor string"); - return ""; -} - -/// getTypeString - Return a string used to label this descriptors type. -/// -const char *AnchorDesc::getTypeString() const { - return "llvm.dbg.anchor.type"; -} - -#ifndef NDEBUG -void AnchorDesc::dump() { - cerr << getDescString() << " " - << "Version(" << getVersion() << "), " - << "Tag(" << getTag() << "), " - << "AnchorTag(" << AnchorTag << ")\n"; -} -#endif - -//===----------------------------------------------------------------------===// - -AnchoredDesc::AnchoredDesc(unsigned T) -: DebugInfoDesc(T) -, Anchor(NULL) -{} - -/// ApplyToFields - Target the visitor to the fields of the AnchoredDesc. -/// -void AnchoredDesc::ApplyToFields(DIVisitor *Visitor) { - DebugInfoDesc::ApplyToFields(Visitor); - - Visitor->Apply(Anchor); -} - -//===----------------------------------------------------------------------===// - -CompileUnitDesc::CompileUnitDesc() -: AnchoredDesc(DW_TAG_compile_unit) -, Language(0) -, FileName("") -, Directory("") -, Producer("") -{} - -// Implement isa/cast/dyncast. -bool CompileUnitDesc::classof(const DebugInfoDesc *D) { - return D->getTag() == DW_TAG_compile_unit; -} - -/// ApplyToFields - Target the visitor to the fields of the CompileUnitDesc. -/// -void CompileUnitDesc::ApplyToFields(DIVisitor *Visitor) { - AnchoredDesc::ApplyToFields(Visitor); - - // Handle cases out of sync with compiler. - if (getVersion() == 0) { - unsigned DebugVersion; - Visitor->Apply(DebugVersion); - } - - Visitor->Apply(Language); - Visitor->Apply(FileName); - Visitor->Apply(Directory); - Visitor->Apply(Producer); -} - -/// getDescString - Return a string used to compose global names and labels. -/// -const char *CompileUnitDesc::getDescString() const { - return "llvm.dbg.compile_unit"; -} - -/// getTypeString - Return a string used to label this descriptors type. -/// -const char *CompileUnitDesc::getTypeString() const { - return "llvm.dbg.compile_unit.type"; -} - -/// getAnchorString - Return a string used to label this descriptor's anchor. -/// -const char *const CompileUnitDesc::AnchorString = "llvm.dbg.compile_units"; -const char *CompileUnitDesc::getAnchorString() const { - return AnchorString; -} - -#ifndef NDEBUG -void CompileUnitDesc::dump() { - cerr << getDescString() << " " - << "Version(" << getVersion() << "), " - << "Tag(" << getTag() << "), " - << "Anchor(" << getAnchor() << "), " - << "Language(" << Language << "), " - << "FileName(\"" << FileName << "\"), " - << "Directory(\"" << Directory << "\"), " - << "Producer(\"" << Producer << "\")\n"; -} -#endif - -//===----------------------------------------------------------------------===// - -TypeDesc::TypeDesc(unsigned T) -: DebugInfoDesc(T) -, Context(NULL) -, Name("") -, File(NULL) -, Line(0) -, Size(0) -, Align(0) -, Offset(0) -, Flags(0) -{} - -/// ApplyToFields - Target the visitor to the fields of the TypeDesc. -/// -void TypeDesc::ApplyToFields(DIVisitor *Visitor) { - DebugInfoDesc::ApplyToFields(Visitor); - - Visitor->Apply(Context); - Visitor->Apply(Name); - Visitor->Apply(File); - Visitor->Apply(Line); - Visitor->Apply(Size); - Visitor->Apply(Align); - Visitor->Apply(Offset); - if (getVersion() > LLVMDebugVersion4) Visitor->Apply(Flags); -} - -/// getDescString - Return a string used to compose global names and labels. -/// -const char *TypeDesc::getDescString() const { - return "llvm.dbg.type"; -} - -/// getTypeString - Return a string used to label this descriptor's type. -/// -const char *TypeDesc::getTypeString() const { - return "llvm.dbg.type.type"; -} - -#ifndef NDEBUG -void TypeDesc::dump() { - cerr << getDescString() << " " - << "Version(" << getVersion() << "), " - << "Tag(" << getTag() << "), " - << "Context(" << Context << "), " - << "Name(\"" << Name << "\"), " - << "File(" << File << "), " - << "Line(" << Line << "), " - << "Size(" << Size << "), " - << "Align(" << Align << "), " - << "Offset(" << Offset << "), " - << "Flags(" << Flags << ")\n"; -} -#endif - -//===----------------------------------------------------------------------===// - -BasicTypeDesc::BasicTypeDesc() -: TypeDesc(DW_TAG_base_type) -, Encoding(0) -{} - -// Implement isa/cast/dyncast. -bool BasicTypeDesc::classof(const DebugInfoDesc *D) { - return D->getTag() == DW_TAG_base_type; -} - -/// ApplyToFields - Target the visitor to the fields of the BasicTypeDesc. -/// -void BasicTypeDesc::ApplyToFields(DIVisitor *Visitor) { - TypeDesc::ApplyToFields(Visitor); - - Visitor->Apply(Encoding); -} - -/// getDescString - Return a string used to compose global names and labels. -/// -const char *BasicTypeDesc::getDescString() const { - return "llvm.dbg.basictype"; -} - -/// getTypeString - Return a string used to label this descriptor's type. -/// -const char *BasicTypeDesc::getTypeString() const { - return "llvm.dbg.basictype.type"; -} - -#ifndef NDEBUG -void BasicTypeDesc::dump() { - cerr << getDescString() << " " - << "Version(" << getVersion() << "), " - << "Tag(" << getTag() << "), " - << "Context(" << getContext() << "), " - << "Name(\"" << getName() << "\"), " - << "Size(" << getSize() << "), " - << "Encoding(" << Encoding << ")\n"; -} -#endif - -//===----------------------------------------------------------------------===// - -DerivedTypeDesc::DerivedTypeDesc(unsigned T) -: TypeDesc(T) -, FromType(NULL) -{} - -// Implement isa/cast/dyncast. -bool DerivedTypeDesc::classof(const DebugInfoDesc *D) { - unsigned T = D->getTag(); - switch (T) { - case DW_TAG_typedef: - case DW_TAG_pointer_type: - case DW_TAG_reference_type: - case DW_TAG_const_type: - case DW_TAG_volatile_type: - case DW_TAG_restrict_type: - case DW_TAG_member: - case DW_TAG_inheritance: - return true; - default: break; - } - return false; -} - -/// ApplyToFields - Target the visitor to the fields of the DerivedTypeDesc. -/// -void DerivedTypeDesc::ApplyToFields(DIVisitor *Visitor) { - TypeDesc::ApplyToFields(Visitor); - - Visitor->Apply(FromType); -} - -/// getDescString - Return a string used to compose global names and labels. -/// -const char *DerivedTypeDesc::getDescString() const { - return "llvm.dbg.derivedtype"; -} - -/// getTypeString - Return a string used to label this descriptor's type. -/// -const char *DerivedTypeDesc::getTypeString() const { - return "llvm.dbg.derivedtype.type"; -} - -#ifndef NDEBUG -void DerivedTypeDesc::dump() { - cerr << getDescString() << " " - << "Version(" << getVersion() << "), " - << "Tag(" << getTag() << "), " - << "Context(" << getContext() << "), " - << "Name(\"" << getName() << "\"), " - << "Size(" << getSize() << "), " - << "File(" << getFile() << "), " - << "Line(" << getLine() << "), " - << "FromType(" << FromType << ")\n"; -} -#endif - -//===----------------------------------------------------------------------===// - -CompositeTypeDesc::CompositeTypeDesc(unsigned T) -: DerivedTypeDesc(T) -, Elements() -{} - -// Implement isa/cast/dyncast. -bool CompositeTypeDesc::classof(const DebugInfoDesc *D) { - unsigned T = D->getTag(); - switch (T) { - case DW_TAG_array_type: - case DW_TAG_structure_type: - case DW_TAG_union_type: - case DW_TAG_enumeration_type: - case DW_TAG_vector_type: - case DW_TAG_subroutine_type: - return true; - default: break; - } - return false; -} - -/// ApplyToFields - Target the visitor to the fields of the CompositeTypeDesc. -/// -void CompositeTypeDesc::ApplyToFields(DIVisitor *Visitor) { - DerivedTypeDesc::ApplyToFields(Visitor); - - Visitor->Apply(Elements); -} - -/// getDescString - Return a string used to compose global names and labels. -/// -const char *CompositeTypeDesc::getDescString() const { - return "llvm.dbg.compositetype"; -} - -/// getTypeString - Return a string used to label this descriptor's type. -/// -const char *CompositeTypeDesc::getTypeString() const { - return "llvm.dbg.compositetype.type"; -} - -#ifndef NDEBUG -void CompositeTypeDesc::dump() { - cerr << getDescString() << " " - << "Version(" << getVersion() << "), " - << "Tag(" << getTag() << "), " - << "Context(" << getContext() << "), " - << "Name(\"" << getName() << "\"), " - << "Size(" << getSize() << "), " - << "File(" << getFile() << "), " - << "Line(" << getLine() << "), " - << "FromType(" << getFromType() << "), " - << "Elements.size(" << Elements.size() << ")\n"; -} -#endif - -//===----------------------------------------------------------------------===// - -SubrangeDesc::SubrangeDesc() -: DebugInfoDesc(DW_TAG_subrange_type) -, Lo(0) -, Hi(0) -{} - -// Implement isa/cast/dyncast. -bool SubrangeDesc::classof(const DebugInfoDesc *D) { - return D->getTag() == DW_TAG_subrange_type; -} - -/// ApplyToFields - Target the visitor to the fields of the SubrangeDesc. -/// -void SubrangeDesc::ApplyToFields(DIVisitor *Visitor) { - DebugInfoDesc::ApplyToFields(Visitor); - - Visitor->Apply(Lo); - Visitor->Apply(Hi); -} - -/// getDescString - Return a string used to compose global names and labels. -/// -const char *SubrangeDesc::getDescString() const { - return "llvm.dbg.subrange"; -} - -/// getTypeString - Return a string used to label this descriptor's type. -/// -const char *SubrangeDesc::getTypeString() const { - return "llvm.dbg.subrange.type"; -} - -#ifndef NDEBUG -void SubrangeDesc::dump() { - cerr << getDescString() << " " - << "Version(" << getVersion() << "), " - << "Tag(" << getTag() << "), " - << "Lo(" << Lo << "), " - << "Hi(" << Hi << ")\n"; -} -#endif - -//===----------------------------------------------------------------------===// - -EnumeratorDesc::EnumeratorDesc() -: DebugInfoDesc(DW_TAG_enumerator) -, Name("") -, Value(0) -{} - -// Implement isa/cast/dyncast. -bool EnumeratorDesc::classof(const DebugInfoDesc *D) { - return D->getTag() == DW_TAG_enumerator; -} - -/// ApplyToFields - Target the visitor to the fields of the EnumeratorDesc. -/// -void EnumeratorDesc::ApplyToFields(DIVisitor *Visitor) { - DebugInfoDesc::ApplyToFields(Visitor); - - Visitor->Apply(Name); - Visitor->Apply(Value); -} - -/// getDescString - Return a string used to compose global names and labels. -/// -const char *EnumeratorDesc::getDescString() const { - return "llvm.dbg.enumerator"; -} - -/// getTypeString - Return a string used to label this descriptor's type. -/// -const char *EnumeratorDesc::getTypeString() const { - return "llvm.dbg.enumerator.type"; -} - -#ifndef NDEBUG -void EnumeratorDesc::dump() { - cerr << getDescString() << " " - << "Version(" << getVersion() << "), " - << "Tag(" << getTag() << "), " - << "Name(" << Name << "), " - << "Value(" << Value << ")\n"; -} -#endif - -//===----------------------------------------------------------------------===// - -VariableDesc::VariableDesc(unsigned T) -: DebugInfoDesc(T) -, Context(NULL) -, Name("") -, File(NULL) -, Line(0) -, TyDesc(0) -{} - -// Implement isa/cast/dyncast. -bool VariableDesc::classof(const DebugInfoDesc *D) { - unsigned T = D->getTag(); - switch (T) { - case DW_TAG_auto_variable: - case DW_TAG_arg_variable: - case DW_TAG_return_variable: - return true; - default: break; - } - return false; -} - -/// ApplyToFields - Target the visitor to the fields of the VariableDesc. -/// -void VariableDesc::ApplyToFields(DIVisitor *Visitor) { - DebugInfoDesc::ApplyToFields(Visitor); - - Visitor->Apply(Context); - Visitor->Apply(Name); - Visitor->Apply(File); - Visitor->Apply(Line); - Visitor->Apply(TyDesc); -} - -/// getDescString - Return a string used to compose global names and labels. -/// -const char *VariableDesc::getDescString() const { - return "llvm.dbg.variable"; -} - -/// getTypeString - Return a string used to label this descriptor's type. -/// -const char *VariableDesc::getTypeString() const { - return "llvm.dbg.variable.type"; -} - -#ifndef NDEBUG -void VariableDesc::dump() { - cerr << getDescString() << " " - << "Version(" << getVersion() << "), " - << "Tag(" << getTag() << "), " - << "Context(" << Context << "), " - << "Name(\"" << Name << "\"), " - << "File(" << File << "), " - << "Line(" << Line << "), " - << "TyDesc(" << TyDesc << ")\n"; -} -#endif - -//===----------------------------------------------------------------------===// - -GlobalDesc::GlobalDesc(unsigned T) -: AnchoredDesc(T) -, Context(0) -, Name("") -, FullName("") -, LinkageName("") -, File(NULL) -, Line(0) -, TyDesc(NULL) -, IsStatic(false) -, IsDefinition(false) -{} - -/// ApplyToFields - Target the visitor to the fields of the global. -/// -void GlobalDesc::ApplyToFields(DIVisitor *Visitor) { - AnchoredDesc::ApplyToFields(Visitor); - - Visitor->Apply(Context); - Visitor->Apply(Name); - Visitor->Apply(FullName); - Visitor->Apply(LinkageName); - Visitor->Apply(File); - Visitor->Apply(Line); - Visitor->Apply(TyDesc); - Visitor->Apply(IsStatic); - Visitor->Apply(IsDefinition); -} - -//===----------------------------------------------------------------------===// - -GlobalVariableDesc::GlobalVariableDesc() -: GlobalDesc(DW_TAG_variable) -, Global(NULL) -{} - -// Implement isa/cast/dyncast. -bool GlobalVariableDesc::classof(const DebugInfoDesc *D) { - return D->getTag() == DW_TAG_variable; -} - -/// ApplyToFields - Target the visitor to the fields of the GlobalVariableDesc. -/// -void GlobalVariableDesc::ApplyToFields(DIVisitor *Visitor) { - GlobalDesc::ApplyToFields(Visitor); - - Visitor->Apply(Global); -} - -/// getDescString - Return a string used to compose global names and labels. -/// -const char *GlobalVariableDesc::getDescString() const { - return "llvm.dbg.global_variable"; -} - -/// getTypeString - Return a string used to label this descriptors type. -/// -const char *GlobalVariableDesc::getTypeString() const { - return "llvm.dbg.global_variable.type"; -} - -/// getAnchorString - Return a string used to label this descriptor's anchor. -/// -const char *const GlobalVariableDesc::AnchorString = "llvm.dbg.global_variables"; -const char *GlobalVariableDesc::getAnchorString() const { - return AnchorString; -} - -#ifndef NDEBUG -void GlobalVariableDesc::dump() { - cerr << getDescString() << " " - << "Version(" << getVersion() << "), " - << "Tag(" << getTag() << "), " - << "Anchor(" << getAnchor() << "), " - << "Name(\"" << getName() << "\"), " - << "FullName(\"" << getFullName() << "\"), " - << "LinkageName(\"" << getLinkageName() << "\"), " - << "File(" << getFile() << ")," - << "Line(" << getLine() << ")," - << "Type(" << getType() << "), " - << "IsStatic(" << (isStatic() ? "true" : "false") << "), " - << "IsDefinition(" << (isDefinition() ? "true" : "false") << "), " - << "Global(" << Global << ")\n"; -} -#endif - -//===----------------------------------------------------------------------===// - -SubprogramDesc::SubprogramDesc() -: GlobalDesc(DW_TAG_subprogram) -{} - -// Implement isa/cast/dyncast. -bool SubprogramDesc::classof(const DebugInfoDesc *D) { - return D->getTag() == DW_TAG_subprogram; -} - -/// ApplyToFields - Target the visitor to the fields of the -/// SubprogramDesc. -void SubprogramDesc::ApplyToFields(DIVisitor *Visitor) { - GlobalDesc::ApplyToFields(Visitor); -} - -/// getDescString - Return a string used to compose global names and labels. -/// -const char *SubprogramDesc::getDescString() const { - return "llvm.dbg.subprogram"; -} - -/// getTypeString - Return a string used to label this descriptors type. -/// -const char *SubprogramDesc::getTypeString() const { - return "llvm.dbg.subprogram.type"; -} - -/// getAnchorString - Return a string used to label this descriptor's anchor. -/// -const char *const SubprogramDesc::AnchorString = "llvm.dbg.subprograms"; -const char *SubprogramDesc::getAnchorString() const { - return AnchorString; -} - -#ifndef NDEBUG -void SubprogramDesc::dump() { - cerr << getDescString() << " " - << "Version(" << getVersion() << "), " - << "Tag(" << getTag() << "), " - << "Anchor(" << getAnchor() << "), " - << "Name(\"" << getName() << "\"), " - << "FullName(\"" << getFullName() << "\"), " - << "LinkageName(\"" << getLinkageName() << "\"), " - << "File(" << getFile() << ")," - << "Line(" << getLine() << ")," - << "Type(" << getType() << "), " - << "IsStatic(" << (isStatic() ? "true" : "false") << "), " - << "IsDefinition(" << (isDefinition() ? "true" : "false") << ")\n"; -} -#endif - -//===----------------------------------------------------------------------===// - -BlockDesc::BlockDesc() -: DebugInfoDesc(DW_TAG_lexical_block) -, Context(NULL) -{} - -// Implement isa/cast/dyncast. -bool BlockDesc::classof(const DebugInfoDesc *D) { - return D->getTag() == DW_TAG_lexical_block; -} - -/// ApplyToFields - Target the visitor to the fields of the BlockDesc. -/// -void BlockDesc::ApplyToFields(DIVisitor *Visitor) { - DebugInfoDesc::ApplyToFields(Visitor); - - Visitor->Apply(Context); -} - -/// getDescString - Return a string used to compose global names and labels. -/// -const char *BlockDesc::getDescString() const { - return "llvm.dbg.block"; -} - -/// getTypeString - Return a string used to label this descriptors type. -/// -const char *BlockDesc::getTypeString() const { - return "llvm.dbg.block.type"; -} - -#ifndef NDEBUG -void BlockDesc::dump() { - cerr << getDescString() << " " - << "Version(" << getVersion() << "), " - << "Tag(" << getTag() << ")," - << "Context(" << Context << ")\n"; -} -#endif - -//===----------------------------------------------------------------------===// - DebugInfoDesc *DIDeserializer::Deserialize(Value *V) { return Deserialize(getGlobalVariable(V)); } @@ -1591,11 +813,12 @@ /// SetupCompileUnits - Set up the unique vector of compile units. /// void MachineModuleInfo::SetupCompileUnits(Module &M) { - std::vectorCU = getAnchoredDescriptors(M); + std::vector CUList; + CompileUnitDesc CUD; + getAnchoredDescriptors(M, &CUD, CUList); - for (unsigned i = 0, N = CU.size(); i < N; i++) { - CompileUnits.insert(CU[i]); - } + for (unsigned i = 0, N = CUList.size(); i < N; i++) + CompileUnits.insert((CompileUnitDesc*)CUList[i]); } /// getCompileUnits - Return a vector of debug compile units. @@ -1604,12 +827,31 @@ return CompileUnits; } +/// getAnchoredDescriptors - Return a vector of anchored debug descriptors. +/// +void +MachineModuleInfo::getAnchoredDescriptors(Module &M, const AnchoredDesc *Desc, + std::vector &AnchoredDescs) { + std::vector Globals; + getGlobalVariablesUsing(M, Desc->getAnchorString(), Globals); + + for (unsigned i = 0, N = Globals.size(); i < N; ++i) { + GlobalVariable *GV = Globals[i]; + + // FIXME - In the short term, changes are too drastic to continue. + if (DebugInfoDesc::TagFromGlobal(GV) == Desc->getTag() && + DebugInfoDesc::VersionFromGlobal(GV) == LLVMDebugVersion) + AnchoredDescs.push_back(DR.Deserialize(GV)); + } +} + /// getGlobalVariablesUsing - Return all of the GlobalVariables that use the /// named GlobalVariable. -std::vector +void MachineModuleInfo::getGlobalVariablesUsing(Module &M, - const std::string &RootName) { - return ::getGlobalVariablesUsing(M, RootName); + const std::string &RootName, + std::vector &Globals) { + return ::getGlobalVariablesUsing(M, RootName, Globals); } /// RecordSourceLine - Records location information and associates it with a @@ -1947,4 +1189,3 @@ FunctionPass *createDebugLabelFoldingPass() { return new DebugLabelFolder(); } } - Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp?rev=52800&r1=52799&r2=52800&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Thu Jun 26 19:09:40 2008 @@ -27,6 +27,7 @@ #include "llvm/IntrinsicInst.h" #include "llvm/ParameterAttributes.h" #include "llvm/CodeGen/Collector.h" +#include "llvm/CodeGen/MachineDebugInfoDesc.h" #include "llvm/CodeGen/MachineFunction.h" #include "llvm/CodeGen/MachineFrameInfo.h" #include "llvm/CodeGen/MachineInstrBuilder.h" Modified: llvm/trunk/lib/VMCore/IntrinsicInst.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/IntrinsicInst.cpp?rev=52800&r1=52799&r2=52800&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/IntrinsicInst.cpp (original) +++ llvm/trunk/lib/VMCore/IntrinsicInst.cpp Thu Jun 26 19:09:40 2008 @@ -29,6 +29,7 @@ #include "llvm/Constants.h" #include "llvm/GlobalVariable.h" #include "llvm/Analysis/ValueTracking.h" +#include "llvm/CodeGen/MachineDebugInfoDesc.h" #include "llvm/CodeGen/MachineModuleInfo.h" using namespace llvm; From isanbard at gmail.com Thu Jun 26 19:14:49 2008 From: isanbard at gmail.com (Bill Wendling) Date: Fri, 27 Jun 2008 00:14:49 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r52801 - /llvm-gcc-4.2/trunk/gcc/llvm-debug.cpp Message-ID: <200806270014.m5R0En34023514@zion.cs.uiuc.edu> Author: void Date: Thu Jun 26 19:14:49 2008 New Revision: 52801 URL: http://llvm.org/viewvc/llvm-project?rev=52801&view=rev Log: Goes with r52800. I split DebugInfoDesc out of MachineModuleInfo. 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=52801&r1=52800&r2=52801&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/llvm-debug.cpp (original) +++ llvm-gcc-4.2/trunk/gcc/llvm-debug.cpp Thu Jun 26 19:14:49 2008 @@ -880,23 +880,26 @@ MachineModuleInfo MMI; MMI.AnalyzeModule(*TheModule); - std::vector Subprograms = - MMI.getAnchoredDescriptors(*TheModule); + std::vector Subprograms; + SubprogramDesc SPD; + MMI.getAnchoredDescriptors(*TheModule, &SPD, Subprograms); if (!Subprograms.empty()) - SubprogramAnchor = Subprograms[0]->getAnchor(); + SubprogramAnchor = ((SubprogramDesc*)Subprograms[0])->getAnchor(); - std::vector CUs = - MMI.getAnchoredDescriptors(*TheModule); + std::vector CUs; + CompileUnitDesc CUD; + MMI.getAnchoredDescriptors(*TheModule, &CUD, CUs); if (!CUs.empty()) - CompileUnitAnchor = CUs[0]->getAnchor(); + CompileUnitAnchor = ((CompileUnitDesc*)CUs[0])->getAnchor(); - std::vector GVs = - MMI.getAnchoredDescriptors(*TheModule); + std::vector GVs; + GlobalVariableDesc GVD; + MMI.getAnchoredDescriptors(*TheModule, &GVD, GVs); if (!GVs.empty()) - GlobalVariableAnchor = GVs[0]->getAnchor(); + GlobalVariableAnchor = ((GlobalVariableDesc*)GVs[0])->getAnchor(); const std::map &GlobalDescs = MMI.getDIDeserializer()->getGlobalDescs(); From isanbard at gmail.com Thu Jun 26 19:52:16 2008 From: isanbard at gmail.com (Bill Wendling) Date: Fri, 27 Jun 2008 00:52:16 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r52802 - /llvm-gcc-4.2/trunk/gcc/llvm-debug.h Message-ID: <200806270052.m5R0qGdH024657@zion.cs.uiuc.edu> Author: void Date: Thu Jun 26 19:52:16 2008 New Revision: 52802 URL: http://llvm.org/viewvc/llvm-project?rev=52802&view=rev Log: Forgot to include this file in my last commit. Modified: llvm-gcc-4.2/trunk/gcc/llvm-debug.h 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=52802&r1=52801&r2=52802&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/llvm-debug.h (original) +++ llvm-gcc-4.2/trunk/gcc/llvm-debug.h Thu Jun 26 19:52:16 2008 @@ -28,6 +28,7 @@ #ifndef LLVM_DEBUG_H #define LLVM_DEBUG_H +#include "llvm/CodeGen/MachineDebugInfoDesc.h" #include "llvm/CodeGen/MachineModuleInfo.h" extern "C" { From isanbard at gmail.com Thu Jun 26 19:56:36 2008 From: isanbard at gmail.com (Bill Wendling) Date: Fri, 27 Jun 2008 00:56:36 -0000 Subject: [llvm-commits] [llvm] r52803 - in /llvm/trunk: include/llvm/CodeGen/MachineDebugInfoDesc.h include/llvm/CodeGen/MachineModuleInfo.h lib/CodeGen/MachineModuleInfo.cpp Message-ID: <200806270056.m5R0ubD2024828@zion.cs.uiuc.edu> Author: void Date: Thu Jun 26 19:56:36 2008 New Revision: 52803 URL: http://llvm.org/viewvc/llvm-project?rev=52803&view=rev Log: - Remove a use of std::vector. - Make sure that we're not recalculating the size of a vector that never changes. Modified: llvm/trunk/include/llvm/CodeGen/MachineDebugInfoDesc.h llvm/trunk/include/llvm/CodeGen/MachineModuleInfo.h llvm/trunk/lib/CodeGen/MachineModuleInfo.cpp Modified: llvm/trunk/include/llvm/CodeGen/MachineDebugInfoDesc.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/MachineDebugInfoDesc.h?rev=52803&r1=52802&r2=52803&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/MachineDebugInfoDesc.h (original) +++ llvm/trunk/include/llvm/CodeGen/MachineDebugInfoDesc.h Thu Jun 26 19:56:36 2008 @@ -407,10 +407,10 @@ SubrangeDesc(); // Accessors - int64_t getLo() const { return Lo; } - int64_t getHi() const { return Hi; } - void setLo(int64_t L) { Lo = L; } - void setHi(int64_t H) { Hi = H; } + int64_t getLo() const { return Lo; } + int64_t getHi() const { return Hi; } + void setLo(int64_t L) { Lo = L; } + void setHi(int64_t H) { Hi = H; } /// ApplyToFields - Target the visitor to the fields of the SubrangeDesc. /// @@ -552,32 +552,34 @@ explicit GlobalDesc(unsigned T); public: // Accessors - DebugInfoDesc *getContext() const { return Context; } - const std::string &getName() const { return Name; } - const std::string &getFullName() const { return FullName; } - const std::string &getLinkageName() const { return LinkageName; } + DebugInfoDesc *getContext() const { return Context; } + const std::string &getName() const { return Name; } + const std::string &getFullName() const { return FullName; } + const std::string &getLinkageName() const { return LinkageName; } CompileUnitDesc *getFile() const { return static_cast(File); } - unsigned getLine() const { return Line; } + unsigned getLine() const { return Line; } TypeDesc *getType() const { return static_cast(TyDesc); } - bool isStatic() const { return IsStatic; } - bool isDefinition() const { return IsDefinition; } - void setContext(DebugInfoDesc *C) { Context = C; } - void setName(const std::string &N) { Name = N; } - void setFullName(const std::string &N) { FullName = N; } - void setLinkageName(const std::string &N) { LinkageName = N; } + + bool isStatic() const { return IsStatic; } + bool isDefinition() const { return IsDefinition; } + + void setContext(DebugInfoDesc *C) { Context = C; } + void setName(const std::string &N) { Name = N; } + void setFullName(const std::string &N) { FullName = N; } + void setLinkageName(const std::string &N) { LinkageName = N; } void setFile(CompileUnitDesc *U) { File = static_cast(U); } - void setLine(unsigned L) { Line = L; } + void setLine(unsigned L) { Line = L; } void setType(TypeDesc *T) { TyDesc = static_cast(T); } - void setIsStatic(bool IS) { IsStatic = IS; } - void setIsDefinition(bool ID) { IsDefinition = ID; } + void setIsStatic(bool IS) { IsStatic = IS; } + void setIsDefinition(bool ID) { IsDefinition = ID; } /// ApplyToFields - Target the visitor to the fields of the GlobalDesc. /// @@ -593,8 +595,8 @@ GlobalVariableDesc(); // Accessors. - GlobalVariable *getGlobalVariable() const { return Global; } - void setGlobalVariable(GlobalVariable *GV) { Global = GV; } + GlobalVariable *getGlobalVariable() const { return Global; } + void setGlobalVariable(GlobalVariable *GV) { Global = GV; } /// ApplyToFields - Target the visitor to the fields of the /// GlobalVariableDesc. @@ -673,8 +675,8 @@ BlockDesc(); // Accessors - DebugInfoDesc *getContext() const { return Context; } - void setContext(DebugInfoDesc *C) { Context = C; } + DebugInfoDesc *getContext() const { return Context; } + void setContext(DebugInfoDesc *C) { Context = C; } /// ApplyToFields - Target the visitor to the fields of the BlockDesc. /// Modified: llvm/trunk/include/llvm/CodeGen/MachineModuleInfo.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/MachineModuleInfo.h?rev=52803&r1=52802&r2=52803&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/MachineModuleInfo.h (original) +++ llvm/trunk/include/llvm/CodeGen/MachineModuleInfo.h Thu Jun 26 19:56:36 2008 @@ -591,7 +591,7 @@ /// getFilterIDFor - Return the id of the filter encoded by TyIds. This is /// function wide. - int getFilterIDFor(std::vector &TyIds); + int getFilterIDFor(SmallVectorImpl &TyIds); /// TidyLandingPads - Remap landing pad labels and remove any deleted landing /// pads. Modified: llvm/trunk/lib/CodeGen/MachineModuleInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachineModuleInfo.cpp?rev=52803&r1=52802&r2=52803&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/MachineModuleInfo.cpp (original) +++ llvm/trunk/lib/CodeGen/MachineModuleInfo.cpp Thu Jun 26 19:56:36 2008 @@ -513,8 +513,8 @@ // If not already defined. if (!EmptyStructPtrTy) { // Construct the empty structure type. - const StructType *EmptyStructTy = - StructType::get(std::vector()); + const StructType *EmptyStructTy = StructType::get(NULL, NULL); + // Construct the pointer to empty structure type. EmptyStructPtrTy = PointerType::getUnqual(EmptyStructTy); } @@ -532,6 +532,7 @@ if (!Ty) { // Set up fields vector. std::vector Fields; + // Get types of fields. DIGetTypesVisitor GTAM(*this, Fields); GTAM.ApplyToFields(DD); @@ -551,22 +552,27 @@ Constant *DISerializer::getString(const std::string &String) { // Check string cache for previous edition. Constant *&Slot = StringCache[String]; + // Return Constant if previously defined. if (Slot) return Slot; + // If empty string then use a sbyte* null instead. if (String.empty()) { Slot = ConstantPointerNull::get(getStrPtrType()); } else { // Construct string as an llvm constant. Constant *ConstStr = ConstantArray::get(String); + // Otherwise create and return a new string global. GlobalVariable *StrGV = new GlobalVariable(ConstStr->getType(), true, GlobalVariable::InternalLinkage, ConstStr, ".str", M); StrGV->setSection("llvm.metadata"); + // Convert to generic string pointer. Slot = ConstantExpr::getBitCast(StrGV, getStrPtrType()); } + return Slot; } @@ -593,6 +599,7 @@ // Set up elements vector std::vector Elements; + // Add fields. DISerializeVisitor SRAM(*this, Elements); SRAM.ApplyToFields(DD); @@ -996,9 +1003,11 @@ void MachineModuleInfo::addFilterTypeInfo(MachineBasicBlock *LandingPad, std::vector &TyInfo) { LandingPadInfo &LP = getOrCreateLandingPadInfo(LandingPad); - std::vector IdsInFilter (TyInfo.size()); + SmallVector IdsInFilter(TyInfo.size()); + for (unsigned I = 0, E = TyInfo.size(); I != E; ++I) IdsInFilter[I] = getTypeIDFor(TyInfo[I]); + LP.TypeIds.push_back(getFilterIDFor(IdsInFilter)); } @@ -1066,13 +1075,14 @@ /// getFilterIDFor - Return the filter id for the specified typeinfos. This is /// function wide. -int MachineModuleInfo::getFilterIDFor(std::vector &TyIds) { +int MachineModuleInfo::getFilterIDFor(SmallVectorImpl &TyIds) { // If the new filter coincides with the tail of an existing filter, then // re-use the existing filter. Folding filters more than this requires // re-ordering filters and/or their elements - probably not worth it. + unsigned TyIDSize = TyIds.size(); for (std::vector::iterator I = FilterEnds.begin(), E = FilterEnds.end(); I != E; ++I) { - unsigned i = *I, j = TyIds.size(); + unsigned i = *I, j = TyIDSize; while (i && j) if (FilterIds[--i] != TyIds[--j]) @@ -1081,16 +1091,18 @@ if (!j) // The new filter coincides with range [i, end) of the existing filter. return -(1 + i); - try_next:; } // Add the new filter. - int FilterID = -(1 + FilterIds.size()); - FilterIds.reserve(FilterIds.size() + TyIds.size() + 1); - for (unsigned I = 0, N = TyIds.size(); I != N; ++I) + unsigned FilterIDSize = FilterIds.size(); + int FilterID = -(1 + FilterIDSize); + FilterIds.reserve(FilterIDSize + TyIDSize + 1); + + for (unsigned I = 0, N = TyIDSize; I != N; ++I) FilterIds.push_back(TyIds[I]); - FilterEnds.push_back(FilterIds.size()); + + FilterEnds.push_back(FilterIDSize); FilterIds.push_back(0); // terminator return FilterID; } @@ -1108,13 +1120,13 @@ const Function* Personality = NULL; // Scan landing pads. If there is at least one non-NULL personality - use it. - for (unsigned i = 0; i != LandingPads.size(); ++i) + for (unsigned i = 0, e = LandingPads.size(); i != e; ++i) if (LandingPads[i].Personality) { Personality = LandingPads[i].Personality; break; } - for (unsigned i = 0; i < Personalities.size(); ++i) { + for (unsigned i = 0, e = Personalities.size(); i < e; ++i) { if (Personalities[i] == Personality) return i; } From resistor at mac.com Thu Jun 26 20:22:50 2008 From: resistor at mac.com (Owen Anderson) Date: Fri, 27 Jun 2008 01:22:50 -0000 Subject: [llvm-commits] [llvm] r52804 - /llvm/trunk/lib/CodeGen/MachineInstr.cpp Message-ID: <200806270122.m5R1Moth025817@zion.cs.uiuc.edu> Author: resistor Date: Thu Jun 26 20:22:50 2008 New Revision: 52804 URL: http://llvm.org/viewvc/llvm-project?rev=52804&view=rev Log: Don't perform expensive queries checking for super and sub registers when we know that there aren't any. This speed up LiveVariables on instcombine at -O0 -g from 0.3855s to 0.3503s. Look for more improvements in this area soon! Modified: llvm/trunk/lib/CodeGen/MachineInstr.cpp Modified: llvm/trunk/lib/CodeGen/MachineInstr.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachineInstr.cpp?rev=52804&r1=52803&r2=52804&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/MachineInstr.cpp (original) +++ llvm/trunk/lib/CodeGen/MachineInstr.cpp Thu Jun 26 20:22:50 2008 @@ -780,6 +780,7 @@ const TargetRegisterInfo *RegInfo, bool AddIfNotFound) { bool isPhysReg = TargetRegisterInfo::isPhysicalRegister(IncomingReg); + bool hasAliases = isPhysReg && RegInfo->getAliasSet(IncomingReg) == 0; bool Found = false; SmallVector DeadOps; for (unsigned i = 0, e = getNumOperands(); i != e; ++i) { @@ -790,7 +791,7 @@ if (Reg == IncomingReg) { MO.setIsDead(); Found = true; - } else if (isPhysReg && MO.isDead() && + } else if (hasAliases && MO.isDead() && TargetRegisterInfo::isPhysicalRegister(Reg)) { // There exists a super-register that's marked dead. if (RegInfo->isSuperRegister(IncomingReg, Reg)) From isanbard at gmail.com Thu Jun 26 20:24:36 2008 From: isanbard at gmail.com (Bill Wendling) Date: Fri, 27 Jun 2008 01:24:36 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r52805 - /llvm-gcc-4.2/trunk/gcc/llvm-debug.cpp Message-ID: <200806270124.m5R1Oa4D025885@zion.cs.uiuc.edu> Author: void Date: Thu Jun 26 20:24:36 2008 New Revision: 52805 URL: http://llvm.org/viewvc/llvm-project?rev=52805&view=rev Log: Use DenseMap instead of std::map 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=52805&r1=52804&r2=52805&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/llvm-debug.cpp (original) +++ llvm-gcc-4.2/trunk/gcc/llvm-debug.cpp Thu Jun 26 20:24:36 2008 @@ -901,9 +901,9 @@ if (!GVs.empty()) GlobalVariableAnchor = ((GlobalVariableDesc*)GVs[0])->getAnchor(); - const std::map &GlobalDescs + const DenseMap &GlobalDescs = MMI.getDIDeserializer()->getGlobalDescs(); - for (std::map::const_iterator + for (DenseMap::const_iterator I = GlobalDescs.begin(), E = GlobalDescs.end(); I != E; ++I) SR.addDescriptor(I->second, I->first); } From isanbard at gmail.com Thu Jun 26 20:27:57 2008 From: isanbard at gmail.com (Bill Wendling) Date: Fri, 27 Jun 2008 01:27:57 -0000 Subject: [llvm-commits] [llvm] r52806 - in /llvm/trunk: include/llvm/CodeGen/MachineDebugInfoDesc.h include/llvm/CodeGen/MachineModuleInfo.h lib/CodeGen/MachineModuleInfo.cpp Message-ID: <200806270127.m5R1RvrZ026042@zion.cs.uiuc.edu> Author: void Date: Thu Jun 26 20:27:56 2008 New Revision: 52806 URL: http://llvm.org/viewvc/llvm-project?rev=52806&view=rev Log: Reverting broken patch r52803. Modified: llvm/trunk/include/llvm/CodeGen/MachineDebugInfoDesc.h llvm/trunk/include/llvm/CodeGen/MachineModuleInfo.h llvm/trunk/lib/CodeGen/MachineModuleInfo.cpp Modified: llvm/trunk/include/llvm/CodeGen/MachineDebugInfoDesc.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/MachineDebugInfoDesc.h?rev=52806&r1=52805&r2=52806&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/MachineDebugInfoDesc.h (original) +++ llvm/trunk/include/llvm/CodeGen/MachineDebugInfoDesc.h Thu Jun 26 20:27:56 2008 @@ -407,10 +407,10 @@ SubrangeDesc(); // Accessors - int64_t getLo() const { return Lo; } - int64_t getHi() const { return Hi; } - void setLo(int64_t L) { Lo = L; } - void setHi(int64_t H) { Hi = H; } + int64_t getLo() const { return Lo; } + int64_t getHi() const { return Hi; } + void setLo(int64_t L) { Lo = L; } + void setHi(int64_t H) { Hi = H; } /// ApplyToFields - Target the visitor to the fields of the SubrangeDesc. /// @@ -552,34 +552,32 @@ explicit GlobalDesc(unsigned T); public: // Accessors - DebugInfoDesc *getContext() const { return Context; } - const std::string &getName() const { return Name; } - const std::string &getFullName() const { return FullName; } - const std::string &getLinkageName() const { return LinkageName; } + DebugInfoDesc *getContext() const { return Context; } + const std::string &getName() const { return Name; } + const std::string &getFullName() const { return FullName; } + const std::string &getLinkageName() const { return LinkageName; } CompileUnitDesc *getFile() const { return static_cast(File); } - unsigned getLine() const { return Line; } + unsigned getLine() const { return Line; } TypeDesc *getType() const { return static_cast(TyDesc); } - - bool isStatic() const { return IsStatic; } - bool isDefinition() const { return IsDefinition; } - - void setContext(DebugInfoDesc *C) { Context = C; } - void setName(const std::string &N) { Name = N; } - void setFullName(const std::string &N) { FullName = N; } - void setLinkageName(const std::string &N) { LinkageName = N; } + bool isStatic() const { return IsStatic; } + bool isDefinition() const { return IsDefinition; } + void setContext(DebugInfoDesc *C) { Context = C; } + void setName(const std::string &N) { Name = N; } + void setFullName(const std::string &N) { FullName = N; } + void setLinkageName(const std::string &N) { LinkageName = N; } void setFile(CompileUnitDesc *U) { File = static_cast(U); } - void setLine(unsigned L) { Line = L; } + void setLine(unsigned L) { Line = L; } void setType(TypeDesc *T) { TyDesc = static_cast(T); } - void setIsStatic(bool IS) { IsStatic = IS; } - void setIsDefinition(bool ID) { IsDefinition = ID; } + void setIsStatic(bool IS) { IsStatic = IS; } + void setIsDefinition(bool ID) { IsDefinition = ID; } /// ApplyToFields - Target the visitor to the fields of the GlobalDesc. /// @@ -595,8 +593,8 @@ GlobalVariableDesc(); // Accessors. - GlobalVariable *getGlobalVariable() const { return Global; } - void setGlobalVariable(GlobalVariable *GV) { Global = GV; } + GlobalVariable *getGlobalVariable() const { return Global; } + void setGlobalVariable(GlobalVariable *GV) { Global = GV; } /// ApplyToFields - Target the visitor to the fields of the /// GlobalVariableDesc. @@ -675,8 +673,8 @@ BlockDesc(); // Accessors - DebugInfoDesc *getContext() const { return Context; } - void setContext(DebugInfoDesc *C) { Context = C; } + DebugInfoDesc *getContext() const { return Context; } + void setContext(DebugInfoDesc *C) { Context = C; } /// ApplyToFields - Target the visitor to the fields of the BlockDesc. /// Modified: llvm/trunk/include/llvm/CodeGen/MachineModuleInfo.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/MachineModuleInfo.h?rev=52806&r1=52805&r2=52806&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/MachineModuleInfo.h (original) +++ llvm/trunk/include/llvm/CodeGen/MachineModuleInfo.h Thu Jun 26 20:27:56 2008 @@ -33,6 +33,7 @@ #include "llvm/GlobalValue.h" #include "llvm/Pass.h" +#include "llvm/ADT/DenseMap.h" #include "llvm/ADT/SmallPtrSet.h" #include "llvm/ADT/SmallVector.h" #include "llvm/ADT/UniqueVector.h" @@ -85,15 +86,10 @@ /// DIDeserializer - This class is responsible for casting GlobalVariables /// into DebugInfoDesc objects. class DIDeserializer { -private: - std::map GlobalDescs; - // Previously defined gloabls. - + // Previously defined gloabls. + DenseMap GlobalDescs; public: - DIDeserializer() {} - ~DIDeserializer() {} - - const std::map &getGlobalDescs() const { + const DenseMap &getGlobalDescs() const { return GlobalDescs; } @@ -107,27 +103,23 @@ /// DISerializer - This class is responsible for casting DebugInfoDesc objects /// into GlobalVariables. class DISerializer { -private: Module *M; // Definition space module. PointerType *StrPtrTy; // A "i8*" type. Created lazily. PointerType *EmptyStructPtrTy; // A "{ }*" type. Created lazily. + + // Types per Tag. Created lazily. std::map TagTypes; - // Types per Tag. Created lazily. - std::map DescGlobals; - // Previously defined descriptors. - std::map StringCache; - // Previously defined strings. - + + // Previously defined descriptors. + DenseMap DescGlobals; + + // Previously defined strings. + DenseMap StringCache; public: DISerializer() - : M(NULL) - , StrPtrTy(NULL) - , EmptyStructPtrTy(NULL) - , TagTypes() - , DescGlobals() - , StringCache() + : M(NULL), StrPtrTy(NULL), EmptyStructPtrTy(NULL), TagTypes(), + DescGlobals(), StringCache() {} - ~DISerializer() {} // Accessors Module *getModule() const { return M; }; @@ -161,21 +153,17 @@ /// DIVerifier - This class is responsible for verifying the given network of /// GlobalVariables are valid as DebugInfoDesc objects. class DIVerifier { -private: enum { Unknown = 0, Invalid, Valid }; - std::map Validity;// Tracks prior results. - std::map Counts; // Count of fields per Tag type. - + DenseMap Validity; // Tracks prior results. + std::map Counts; // Count of fields per Tag type. public: DIVerifier() - : Validity() - , Counts() + : Validity(), Counts() {} - ~DIVerifier() {} /// Verify - Return true if the GlobalVariable appears to be a valid /// serialization of a DebugInfoDesc. @@ -191,12 +179,10 @@ /// SourceLineInfo - This class is used to record source line correspondence. /// class SourceLineInfo { -private: unsigned Line; // Source line number. unsigned Column; // Source column. unsigned SourceID; // Source ID number. unsigned LabelID; // Label in code ID number. - public: SourceLineInfo(unsigned L, unsigned C, unsigned S, unsigned I) : Line(L), Column(C), SourceID(S), LabelID(I) {} @@ -212,10 +198,8 @@ /// SourceFileInfo - This class is used to track source information. /// class SourceFileInfo { -private: unsigned DirectoryID; // Directory ID number. std::string Name; // File name (not including directory.) - public: SourceFileInfo(unsigned D, const std::string &N) : DirectoryID(D), Name(N) {} @@ -591,7 +575,7 @@ /// getFilterIDFor - Return the id of the filter encoded by TyIds. This is /// function wide. - int getFilterIDFor(SmallVectorImpl &TyIds); + int getFilterIDFor(std::vector &TyIds); /// TidyLandingPads - Remap landing pad labels and remove any deleted landing /// pads. Modified: llvm/trunk/lib/CodeGen/MachineModuleInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachineModuleInfo.cpp?rev=52806&r1=52805&r2=52806&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/MachineModuleInfo.cpp (original) +++ llvm/trunk/lib/CodeGen/MachineModuleInfo.cpp Thu Jun 26 20:27:56 2008 @@ -38,7 +38,7 @@ /// getGlobalVariablesUsing - Return all of the GlobalVariables which have the /// specified value in their initializer somewhere. static void -getGlobalVariablesUsing(Value *V, std::vector &Result) { +getGlobalVariablesUsing(Value *V, SmallVectorImpl &Result) { // Scan though value users. for (Value::use_iterator I = V->use_begin(), E = V->use_end(); I != E; ++I) { if (GlobalVariable *GV = dyn_cast(*I)) { @@ -55,7 +55,7 @@ /// named GlobalVariable. static void getGlobalVariablesUsing(Module &M, const std::string &RootName, - std::vector &Result) { + SmallVectorImpl &Result) { std::vector FieldTypes; FieldTypes.push_back(Type::Int32Ty); FieldTypes.push_back(Type::Int32Ty); @@ -180,10 +180,7 @@ public: DIDeserializeVisitor(DIDeserializer &D, GlobalVariable *GV) - : DIVisitor() - , DR(D) - , I(0) - , CI(cast(GV->getInitializer())) + : DIVisitor(), DR(D), I(0), CI(cast(GV->getInitializer())) {} /// Apply - Set the value of each of the fields. @@ -276,7 +273,7 @@ Elements.push_back(ConstantInt::get(Type::Int1Ty, Field)); } virtual void Apply(std::string &Field) { - Elements.push_back(SR.getString(Field)); + Elements.push_back(SR.getString(Field)); } virtual void Apply(DebugInfoDesc *&Field) { GlobalVariable *GV = NULL; @@ -511,14 +508,11 @@ /// const PointerType *DISerializer::getEmptyStructPtrType() { // If not already defined. - if (!EmptyStructPtrTy) { - // Construct the empty structure type. - const StructType *EmptyStructTy = StructType::get(NULL, NULL); + if (EmptyStructPtrTy) return EmptyStructPtrTy; - // Construct the pointer to empty structure type. - EmptyStructPtrTy = PointerType::getUnqual(EmptyStructTy); - } - + // Construct the pointer to empty structure type. + const StructType *EmptyStructTy = + StructType::get(std::vector()); return EmptyStructPtrTy; } @@ -532,7 +526,6 @@ if (!Ty) { // Set up fields vector. std::vector Fields; - // Get types of fields. DIGetTypesVisitor GTAM(*this, Fields); GTAM.ApplyToFields(DD); @@ -551,7 +544,7 @@ /// Constant *DISerializer::getString(const std::string &String) { // Check string cache for previous edition. - Constant *&Slot = StringCache[String]; + Constant *&Slot = StringCache[String.c_str()]; // Return Constant if previously defined. if (Slot) return Slot; @@ -599,7 +592,6 @@ // Set up elements vector std::vector Elements; - // Add fields. DISerializeVisitor SRAM(*this, Elements); SRAM.ApplyToFields(DD); @@ -839,7 +831,7 @@ void MachineModuleInfo::getAnchoredDescriptors(Module &M, const AnchoredDesc *Desc, std::vector &AnchoredDescs) { - std::vector Globals; + SmallVector Globals; getGlobalVariablesUsing(M, Desc->getAnchorString(), Globals); for (unsigned i = 0, N = Globals.size(); i < N; ++i) { @@ -1003,11 +995,9 @@ void MachineModuleInfo::addFilterTypeInfo(MachineBasicBlock *LandingPad, std::vector &TyInfo) { LandingPadInfo &LP = getOrCreateLandingPadInfo(LandingPad); - SmallVector IdsInFilter(TyInfo.size()); - + std::vector IdsInFilter (TyInfo.size()); for (unsigned I = 0, E = TyInfo.size(); I != E; ++I) IdsInFilter[I] = getTypeIDFor(TyInfo[I]); - LP.TypeIds.push_back(getFilterIDFor(IdsInFilter)); } @@ -1075,14 +1065,13 @@ /// getFilterIDFor - Return the filter id for the specified typeinfos. This is /// function wide. -int MachineModuleInfo::getFilterIDFor(SmallVectorImpl &TyIds) { +int MachineModuleInfo::getFilterIDFor(std::vector &TyIds) { // If the new filter coincides with the tail of an existing filter, then // re-use the existing filter. Folding filters more than this requires // re-ordering filters and/or their elements - probably not worth it. - unsigned TyIDSize = TyIds.size(); for (std::vector::iterator I = FilterEnds.begin(), E = FilterEnds.end(); I != E; ++I) { - unsigned i = *I, j = TyIDSize; + unsigned i = *I, j = TyIds.size(); while (i && j) if (FilterIds[--i] != TyIds[--j]) @@ -1091,18 +1080,16 @@ if (!j) // The new filter coincides with range [i, end) of the existing filter. return -(1 + i); + try_next:; } // Add the new filter. - unsigned FilterIDSize = FilterIds.size(); - int FilterID = -(1 + FilterIDSize); - FilterIds.reserve(FilterIDSize + TyIDSize + 1); - - for (unsigned I = 0, N = TyIDSize; I != N; ++I) + int FilterID = -(1 + FilterIds.size()); + FilterIds.reserve(FilterIds.size() + TyIds.size() + 1); + for (unsigned I = 0, N = TyIds.size(); I != N; ++I) FilterIds.push_back(TyIds[I]); - - FilterEnds.push_back(FilterIDSize); + FilterEnds.push_back(FilterIds.size()); FilterIds.push_back(0); // terminator return FilterID; } @@ -1120,13 +1107,13 @@ const Function* Personality = NULL; // Scan landing pads. If there is at least one non-NULL personality - use it. - for (unsigned i = 0, e = LandingPads.size(); i != e; ++i) + for (unsigned i = 0; i != LandingPads.size(); ++i) if (LandingPads[i].Personality) { Personality = LandingPads[i].Personality; break; } - for (unsigned i = 0, e = Personalities.size(); i < e; ++i) { + for (unsigned i = 0; i < Personalities.size(); ++i) { if (Personalities[i] == Personality) return i; } From isanbard at gmail.com Thu Jun 26 20:28:06 2008 From: isanbard at gmail.com (Bill Wendling) Date: Fri, 27 Jun 2008 01:28:06 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r52807 - /llvm-gcc-4.2/trunk/gcc/llvm-debug.cpp Message-ID: <200806270128.m5R1S694026058@zion.cs.uiuc.edu> Author: void Date: Thu Jun 26 20:28:05 2008 New Revision: 52807 URL: http://llvm.org/viewvc/llvm-project?rev=52807&view=rev Log: Reverting broken patch r52805. 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=52807&r1=52806&r2=52807&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/llvm-debug.cpp (original) +++ llvm-gcc-4.2/trunk/gcc/llvm-debug.cpp Thu Jun 26 20:28:05 2008 @@ -901,9 +901,9 @@ if (!GVs.empty()) GlobalVariableAnchor = ((GlobalVariableDesc*)GVs[0])->getAnchor(); - const DenseMap &GlobalDescs + const std::map &GlobalDescs = MMI.getDIDeserializer()->getGlobalDescs(); - for (DenseMap::const_iterator + for (std::map::const_iterator I = GlobalDescs.begin(), E = GlobalDescs.end(); I != E; ++I) SR.addDescriptor(I->second, I->first); } From isanbard at gmail.com Thu Jun 26 20:32:08 2008 From: isanbard at gmail.com (Bill Wendling) Date: Fri, 27 Jun 2008 01:32:08 -0000 Subject: [llvm-commits] [llvm] r52808 - /llvm/trunk/lib/CodeGen/MachineModuleInfo.cpp Message-ID: <200806270132.m5R1W8Im026167@zion.cs.uiuc.edu> Author: void Date: Thu Jun 26 20:32:08 2008 New Revision: 52808 URL: http://llvm.org/viewvc/llvm-project?rev=52808&view=rev Log: Cruft left from patch revert...sorry. :-( Modified: llvm/trunk/lib/CodeGen/MachineModuleInfo.cpp Modified: llvm/trunk/lib/CodeGen/MachineModuleInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachineModuleInfo.cpp?rev=52808&r1=52807&r2=52808&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/MachineModuleInfo.cpp (original) +++ llvm/trunk/lib/CodeGen/MachineModuleInfo.cpp Thu Jun 26 20:32:08 2008 @@ -38,7 +38,7 @@ /// getGlobalVariablesUsing - Return all of the GlobalVariables which have the /// specified value in their initializer somewhere. static void -getGlobalVariablesUsing(Value *V, SmallVectorImpl &Result) { +getGlobalVariablesUsing(Value *V, std::vector &Result) { // Scan though value users. for (Value::use_iterator I = V->use_begin(), E = V->use_end(); I != E; ++I) { if (GlobalVariable *GV = dyn_cast(*I)) { @@ -55,7 +55,7 @@ /// named GlobalVariable. static void getGlobalVariablesUsing(Module &M, const std::string &RootName, - SmallVectorImpl &Result) { + std::vector &Result) { std::vector FieldTypes; FieldTypes.push_back(Type::Int32Ty); FieldTypes.push_back(Type::Int32Ty); @@ -513,6 +513,9 @@ // Construct the pointer to empty structure type. const StructType *EmptyStructTy = StructType::get(std::vector()); + + // Construct the pointer to empty structure type. + EmptyStructPtrTy = PointerType::getUnqual(EmptyStructTy); return EmptyStructPtrTy; } @@ -831,7 +834,7 @@ void MachineModuleInfo::getAnchoredDescriptors(Module &M, const AnchoredDesc *Desc, std::vector &AnchoredDescs) { - SmallVector Globals; + std::vector Globals; getGlobalVariablesUsing(M, Desc->getAnchorString(), Globals); for (unsigned i = 0, N = Globals.size(); i < N; ++i) { From isanbard at gmail.com Thu Jun 26 20:37:37 2008 From: isanbard at gmail.com (Bill Wendling) Date: Fri, 27 Jun 2008 01:37:37 -0000 Subject: [llvm-commits] [llvm] r52809 - /llvm/trunk/include/llvm/CodeGen/MachineModuleInfo.h Message-ID: <200806270137.m5R1bbDS026310@zion.cs.uiuc.edu> Author: void Date: Thu Jun 26 20:37:37 2008 New Revision: 52809 URL: http://llvm.org/viewvc/llvm-project?rev=52809&view=rev Log: More cruft from revert... Modified: llvm/trunk/include/llvm/CodeGen/MachineModuleInfo.h Modified: llvm/trunk/include/llvm/CodeGen/MachineModuleInfo.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/MachineModuleInfo.h?rev=52809&r1=52808&r2=52809&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/MachineModuleInfo.h (original) +++ llvm/trunk/include/llvm/CodeGen/MachineModuleInfo.h Thu Jun 26 20:37:37 2008 @@ -87,9 +87,9 @@ /// into DebugInfoDesc objects. class DIDeserializer { // Previously defined gloabls. - DenseMap GlobalDescs; + std::map GlobalDescs; public: - const DenseMap &getGlobalDescs() const { + const std::map &getGlobalDescs() const { return GlobalDescs; } From sabre at nondot.org Thu Jun 26 22:10:27 2008 From: sabre at nondot.org (Chris Lattner) Date: Fri, 27 Jun 2008 03:10:27 -0000 Subject: [llvm-commits] [llvm] r52810 - in /llvm/trunk: lib/Linker/LinkModules.cpp test/Linker/2008-06-26-AddressSpace.ll Message-ID: <200806270310.m5R3ASWu029378@zion.cs.uiuc.edu> Author: lattner Date: Thu Jun 26 22:10:24 2008 New Revision: 52810 URL: http://llvm.org/viewvc/llvm-project?rev=52810&view=rev Log: when linking globals, make sure to preserve the address space of the global. Added: llvm/trunk/test/Linker/2008-06-26-AddressSpace.ll Modified: llvm/trunk/lib/Linker/LinkModules.cpp Modified: llvm/trunk/lib/Linker/LinkModules.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Linker/LinkModules.cpp?rev=52810&r1=52809&r2=52810&view=diff ============================================================================== --- llvm/trunk/lib/Linker/LinkModules.cpp (original) +++ llvm/trunk/lib/Linker/LinkModules.cpp Thu Jun 26 22:10:24 2008 @@ -575,7 +575,8 @@ GlobalVariable *NewDGV = new GlobalVariable(SGV->getType()->getElementType(), SGV->isConstant(), SGV->getLinkage(), /*init*/0, - SGV->getName(), Dest); + SGV->getName(), Dest, false, + SGV->getType()->getAddressSpace()); // Propagate alignment, visibility and section info. CopyGVAttributes(NewDGV, SGV); @@ -599,7 +600,8 @@ GlobalVariable *NewDGV = new GlobalVariable(SGV->getType()->getElementType(), SGV->isConstant(), SGV->getLinkage(), /*init*/0, - "", Dest); + "", Dest, false, + SGV->getType()->getAddressSpace()); // Set alignment allowing CopyGVAttributes merge it with alignment of SGV. NewDGV->setAlignment(DGV->getAlignment()); @@ -634,7 +636,8 @@ GlobalVariable *NewDGV = new GlobalVariable(SGV->getType()->getElementType(), DGVar->isConstant(), DGVar->getLinkage(), - /*init*/0, DGVar->getName(), Dest); + /*init*/0, DGVar->getName(), Dest, false, + SGV->getType()->getAddressSpace()); CopyGVAttributes(NewDGV, DGVar); DGV->replaceAllUsesWith(ConstantExpr::getBitCast(NewDGV, DGVar->getType())); @@ -1166,7 +1169,8 @@ // Create the new global variable... GlobalVariable *NG = new GlobalVariable(NewType, G1->isConstant(), G1->getLinkage(), - /*init*/0, First->first, M, G1->isThreadLocal()); + /*init*/0, First->first, M, G1->isThreadLocal(), + G1->getType()->getAddressSpace()); // Propagate alignment, visibility and section info. CopyGVAttributes(NG, G1); Added: llvm/trunk/test/Linker/2008-06-26-AddressSpace.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Linker/2008-06-26-AddressSpace.ll?rev=52810&view=auto ============================================================================== --- llvm/trunk/test/Linker/2008-06-26-AddressSpace.ll (added) +++ llvm/trunk/test/Linker/2008-06-26-AddressSpace.ll Thu Jun 26 22:10:24 2008 @@ -0,0 +1,9 @@ +; Test linking two functions with different prototypes and two globals +; in different modules. +; RUN: llvm-as %s -o %t.foo1.bc -f +; RUN: echo | llvm-as -o %t.foo2.bc -f +; RUN: llvm-link %t.foo2.bc %t.foo1.bc | llvm-dis | grep {addrspace(2)} +; RUN: llvm-link %t.foo1.bc %t.foo2.bc | llvm-dis | grep {addrspace(2)} +; rdar://6038021 + + at G = global i32 256 addrspace(2) From sabre at nondot.org Thu Jun 26 22:14:20 2008 From: sabre at nondot.org (Chris Lattner) Date: Fri, 27 Jun 2008 03:14:20 -0000 Subject: [llvm-commits] [llvm] r52811 - /llvm/trunk/test/CodeGen/X86/2006-11-28-Memcpy.ll Message-ID: <200806270314.m5R3ELVK029484@zion.cs.uiuc.edu> Author: lattner Date: Thu Jun 26 22:14:20 2008 New Revision: 52811 URL: http://llvm.org/viewvc/llvm-project?rev=52811&view=rev Log: test doesn't need eh info Modified: llvm/trunk/test/CodeGen/X86/2006-11-28-Memcpy.ll Modified: llvm/trunk/test/CodeGen/X86/2006-11-28-Memcpy.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/2006-11-28-Memcpy.ll?rev=52811&r1=52810&r2=52811&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/X86/2006-11-28-Memcpy.ll (original) +++ llvm/trunk/test/CodeGen/X86/2006-11-28-Memcpy.ll Thu Jun 26 22:14:20 2008 @@ -8,7 +8,7 @@ @bytes = constant [4 x i8] c"\AA\BB\CC\DD" ; <[4 x i8]*> [#uses=1] @bytes2 = global [4 x i8] c"\AA\BB\CC\DD" ; <[4 x i8]*> [#uses=1] -define i32 @test1() { +define i32 @test1() nounwind { %y = alloca i32 ; [#uses=2] %c = bitcast i32* %y to i8* ; [#uses=1] %z = getelementptr [4 x i8]* @bytes, i32 0, i32 0 ; [#uses=1] @@ -19,7 +19,7 @@ ret i32 0 } -define void @test2() { +define void @test2() nounwind { %y = alloca i32 ; [#uses=2] %c = bitcast i32* %y to i8* ; [#uses=1] %z = getelementptr [4 x i8]* @bytes2, i32 0, i32 0 ; [#uses=1] From sabre at nondot.org Thu Jun 26 22:18:41 2008 From: sabre at nondot.org (Chris Lattner) Date: Fri, 27 Jun 2008 03:18:41 -0000 Subject: [llvm-commits] [llvm] r52812 - /llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Message-ID: <200806270318.m5R3IfNA029606@zion.cs.uiuc.edu> Author: lattner Date: Thu Jun 26 22:18:41 2008 New Revision: 52812 URL: http://llvm.org/viewvc/llvm-project?rev=52812&view=rev Log: simplify this check, GetConstantStringInfo validates that a global is constant already. No functionality change. Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp?rev=52812&r1=52811&r2=52812&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Thu Jun 26 22:18:41 2008 @@ -2594,11 +2594,9 @@ return false; GlobalVariable *GV = dyn_cast(G->getGlobal()); - if (GV && GV->isConstant()) { - if (GetConstantStringInfo(GV, Str)) { - SrcOff += SrcDelta; - return true; - } + if (GV && GetConstantStringInfo(GV, Str)) { + SrcOff += SrcDelta; + return true; } return false; From clattner at apple.com Thu Jun 26 22:19:38 2008 From: clattner at apple.com (Chris Lattner) Date: Thu, 26 Jun 2008 20:19:38 -0700 Subject: [llvm-commits] [llvm] r52748 - in /llvm/trunk: include/llvm/Analysis/ValueTracking.h include/llvm/Constant.h include/llvm/IntrinsicInst.h lib/Analysis/ValueTracking.cpp lib/CodeGen/MachineModuleInfo.cpp lib/CodeGen/SelectionDAG/SelectionDAG.cpp lib/Debugger/ProgramInfo.cpp lib/Transforms/Scalar/InstructionCombining.cpp lib/VMCore/Constants.cpp lib/VMCore/IntrinsicInst.cpp In-Reply-To: <200806260031.m5Q0VDU5032390@zion.cs.uiuc.edu> References: <200806260031.m5Q0VDU5032390@zion.cs.uiuc.edu> Message-ID: <0653B2E1-0E8F-4256-938E-1192C3A2B1D4@apple.com> On Jun 25, 2008, at 5:31 PM, Eric Christopher wrote: > Author: echristo > Date: Wed Jun 25 19:31:12 2008 > New Revision: 52748 > > URL: http://llvm.org/viewvc/llvm-project?rev=52748&view=rev > Log: > Move GetConstantStringInfo to lib/Analysis. Remove > string output routine from Constant. Update all > callers. Change debug intrinsic api slightly to > accomodate move of routine, these now return values > instead of strings. Eric, this test caused serious regressions in the llvm dejagnu suite. Please make sure you test patches before you apply them. I will track down and fix the regressions this time. -Chris From sabre at nondot.org Thu Jun 26 22:36:51 2008 From: sabre at nondot.org (Chris Lattner) Date: Fri, 27 Jun 2008 03:36:51 -0000 Subject: [llvm-commits] [llvm] r52813 - in /llvm/trunk: include/llvm/Analysis/ValueTracking.h lib/Analysis/ValueTracking.cpp Message-ID: <200806270336.m5R3apYV030203@zion.cs.uiuc.edu> Author: lattner Date: Thu Jun 26 22:36:51 2008 New Revision: 52813 URL: http://llvm.org/viewvc/llvm-project?rev=52813&view=rev Log: fix the regressions from Eric's patch by making GetConstantStringInfo tolerate a non-nul-terminated string, and handling a direct global reference. Modified: llvm/trunk/include/llvm/Analysis/ValueTracking.h llvm/trunk/lib/Analysis/ValueTracking.cpp Modified: llvm/trunk/include/llvm/Analysis/ValueTracking.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/ValueTracking.h?rev=52813&r1=52812&r2=52813&view=diff ============================================================================== --- llvm/trunk/include/llvm/Analysis/ValueTracking.h (original) +++ llvm/trunk/include/llvm/Analysis/ValueTracking.h Thu Jun 26 22:36:51 2008 @@ -76,7 +76,7 @@ /// GetConstantStringInfo - This function computes the length of a /// null-terminated C string pointed to by V. If successful, it returns true /// and returns the string in Str. If unsuccessful, it returns false. - bool GetConstantStringInfo(Value *V, std::string &Str); + bool GetConstantStringInfo(Value *V, std::string &Str, uint64_t Offset = 0); } // end namespace llvm #endif Modified: llvm/trunk/lib/Analysis/ValueTracking.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/ValueTracking.cpp?rev=52813&r1=52812&r2=52813&view=diff ============================================================================== --- llvm/trunk/lib/Analysis/ValueTracking.cpp (original) +++ llvm/trunk/lib/Analysis/ValueTracking.cpp Thu Jun 26 22:36:51 2008 @@ -935,13 +935,13 @@ /// GetConstantStringInfo - This function computes the length of a /// null-terminated C string pointed to by V. If successful, it returns true /// and returns the string in Str. If unsuccessful, it returns false. -bool llvm::GetConstantStringInfo(Value *V, std::string &Str) { +bool llvm::GetConstantStringInfo(Value *V, std::string &Str, uint64_t Offset) { // If V is NULL then return false; if (V == NULL) return false; // Look through bitcast instructions. if (BitCastInst *BCI = dyn_cast(V)) - return GetConstantStringInfo(BCI->getOperand(0), Str); + return GetConstantStringInfo(BCI->getOperand(0), Str, Offset); // If the value is not a GEP instruction nor a constant expression with a // GEP instruction, then return false because ConstantArray can't occur @@ -953,35 +953,36 @@ if (CE->getOpcode() != Instruction::GetElementPtr) return false; GEP = CE; - } else { - return false; } - // Make sure the GEP has exactly three arguments. - if (GEP->getNumOperands() != 3) - return false; - - // Check to make sure that the first operand of the GEP is an integer and - // has value 0 so that we are sure we're indexing into the initializer. - if (ConstantInt *Idx = dyn_cast(GEP->getOperand(1))) { - if (!Idx->isZero()) + if (GEP) { + // Make sure the GEP has exactly three arguments. + if (GEP->getNumOperands() != 3) return false; - } else - return false; - - // If the second index isn't a ConstantInt, then this is a variable index - // into the array. If this occurs, we can't say anything meaningful about - // the string. - uint64_t StartIdx = 0; - if (ConstantInt *CI = dyn_cast(GEP->getOperand(2))) - StartIdx = CI->getZExtValue(); - else - return false; + + // Check to make sure that the first operand of the GEP is an integer and + // has value 0 so that we are sure we're indexing into the initializer. + if (ConstantInt *Idx = dyn_cast(GEP->getOperand(1))) { + if (!Idx->isZero()) + return false; + } else + return false; + + // If the second index isn't a ConstantInt, then this is a variable index + // into the array. If this occurs, we can't say anything meaningful about + // the string. + uint64_t StartIdx = 0; + if (ConstantInt *CI = dyn_cast(GEP->getOperand(2))) + StartIdx = CI->getZExtValue(); + else + return false; + return GetConstantStringInfo(GEP->getOperand(0), Str, StartIdx+Offset); + } // 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. - GlobalVariable* GV = dyn_cast(GEP->getOperand(0)); + GlobalVariable* GV = dyn_cast(V); if (!GV || !GV->isConstant() || !GV->hasInitializer()) return false; Constant *GlobalInit = GV->getInitializer(); @@ -1002,10 +1003,13 @@ // Get the number of elements in the array uint64_t NumElts = Array->getType()->getNumElements(); - // Traverse the constant array from StartIdx (derived above) which is - // the place the GEP refers to in the array. - Str.reserve(NumElts); - for (unsigned i = StartIdx; i < NumElts; ++i) { + if (Offset > NumElts) + return false; + + // Traverse the constant array from 'Offset' which is the place the GEP refers + // to in the array. + Str.reserve(NumElts-Offset); + for (unsigned i = Offset; i != NumElts; ++i) { Constant *Elt = Array->getOperand(i); ConstantInt *CI = dyn_cast(Elt); if (!CI) // This array isn't suitable, non-int initializer. @@ -1015,5 +1019,6 @@ Str += (char)CI->getZExtValue(); } - return false; // The array isn't null terminated. + // The array isn't null terminated, but maybe this is a memcpy, not a strcpy. + return true; } From echristo at apple.com Thu Jun 26 22:49:52 2008 From: echristo at apple.com (Eric Christopher) Date: Thu, 26 Jun 2008 20:49:52 -0700 Subject: [llvm-commits] [llvm] r52748 - in /llvm/trunk: include/llvm/Analysis/ValueTracking.h include/llvm/Constant.h include/llvm/IntrinsicInst.h lib/Analysis/ValueTracking.cpp lib/CodeGen/MachineModuleInfo.cpp lib/CodeGen/SelectionDAG/SelectionDAG.cpp lib/Debugger/ProgramInfo.cpp lib/Transforms/Scalar/InstructionCombining.cpp lib/VMCore/Constants.cpp lib/VMCore/IntrinsicInst.cpp In-Reply-To: <0653B2E1-0E8F-4256-938E-1192C3A2B1D4@apple.com> References: <200806260031.m5Q0VDU5032390@zion.cs.uiuc.edu> <0653B2E1-0E8F-4256-938E-1192C3A2B1D4@apple.com> Message-ID: <2E852838-0F1D-4D69-A06D-BA27CEB80097@apple.com> On Jun 26, 2008, at 8:19 PM, Chris Lattner wrote: > Eric, this test caused serious regressions in the llvm dejagnu > suite. Please make sure you test patches before you apply them. I > will track down and fix the regressions this time. Hunh, my apologies. It seemed noisy before and after so I didn't see it. I'll double check the regressions against what's posted next time. Again, sorry :( -eric From baldrick at free.fr Thu Jun 26 23:15:09 2008 From: baldrick at free.fr (Duncan Sands) Date: Fri, 27 Jun 2008 04:15:09 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r52814 - /llvm-gcc-4.2/trunk/gcc/llvm-debug.cpp Message-ID: <200806270415.m5R4F9ox031234@zion.cs.uiuc.edu> Author: baldrick Date: Thu Jun 26 23:15:09 2008 New Revision: 52814 URL: http://llvm.org/viewvc/llvm-project?rev=52814&view=rev Log: Tweak grammar. 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=52814&r1=52813&r2=52814&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/llvm-debug.cpp (original) +++ llvm-gcc-4.2/trunk/gcc/llvm-debug.cpp Thu Jun 26 23:15:09 2008 @@ -444,7 +444,7 @@ "Not a type."); if (type == NULL_TREE || type == error_mark_node) return NULL; - // Ignore about variants such as const, volatile, or restrict. + // Ignore variants such as const, volatile, or restrict. type = TYPE_MAIN_VARIANT(type); // Should only be void if a pointer/reference/return type. Returning NULL From sabre at nondot.org Thu Jun 26 23:29:49 2008 From: sabre at nondot.org (Chris Lattner) Date: Thu, 26 Jun 2008 21:29:49 -0700 Subject: [llvm-commits] VMKit commits Message-ID: <82F3FC23-5D69-4198-A272-C908E5F49FCF@nondot.org> Hi All, I'm setting up a new vmkit-commits list. If you'd like to receive commit messages for vmkit, please sign up here: http://lists.cs.uiuc.edu/mailman/listinfo/vmkit-commits -Chris From resistor at mac.com Fri Jun 27 01:56:04 2008 From: resistor at mac.com (Owen Anderson) Date: Fri, 27 Jun 2008 06:56:04 -0000 Subject: [llvm-commits] [llvm] r52818 - in /llvm/trunk: include/llvm/Target/TargetRegisterInfo.h lib/Target/TargetRegisterInfo.cpp Message-ID: <200806270656.m5R6u4jM004062@zion.cs.uiuc.edu> Author: resistor Date: Fri Jun 27 01:56:04 2008 New Revision: 52818 URL: http://llvm.org/viewvc/llvm-project?rev=52818&view=rev Log: Cache subregister relationships in a set in TargetRegisterInfo to allow faster lookups. This speeds up LiveVariables from 0.6279s to 0.6165s on kimwitu++. Modified: llvm/trunk/include/llvm/Target/TargetRegisterInfo.h llvm/trunk/lib/Target/TargetRegisterInfo.cpp Modified: llvm/trunk/include/llvm/Target/TargetRegisterInfo.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetRegisterInfo.h?rev=52818&r1=52817&r2=52818&view=diff ============================================================================== --- llvm/trunk/include/llvm/Target/TargetRegisterInfo.h (original) +++ llvm/trunk/include/llvm/Target/TargetRegisterInfo.h Fri Jun 27 01:56:04 2008 @@ -21,6 +21,7 @@ #include "llvm/CodeGen/ValueTypes.h" #include #include +#include namespace llvm { @@ -285,6 +286,7 @@ regclass_iterator RegClassBegin, RegClassEnd; // List of regclasses int CallFrameSetupOpcode, CallFrameDestroyOpcode; + std::set > Subregs; protected: TargetRegisterInfo(const TargetRegisterDesc *D, unsigned NR, regclass_iterator RegClassBegin, @@ -419,9 +421,7 @@ /// isSubRegister - Returns true if regB is a sub-register of regA. /// bool isSubRegister(unsigned regA, unsigned regB) const { - for (const unsigned *SR = getSubRegisters(regA); *SR; ++SR) - if (*SR == regB) return true; - return false; + return Subregs.count(std::make_pair(regA, regB)); } /// isSuperRegister - Returns true if regB is a super-register of regA. Modified: llvm/trunk/lib/Target/TargetRegisterInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/TargetRegisterInfo.cpp?rev=52818&r1=52817&r2=52818&view=diff ============================================================================== --- llvm/trunk/lib/Target/TargetRegisterInfo.cpp (original) +++ llvm/trunk/lib/Target/TargetRegisterInfo.cpp Fri Jun 27 01:56:04 2008 @@ -29,6 +29,16 @@ CallFrameSetupOpcode = CFSO; CallFrameDestroyOpcode = CFDO; + + for (unsigned i = 0; i < NumRegs; ++i) { + const TargetRegisterDesc* CurrReg = Desc + i; + + // Initialize the Subregs set, which stores pairs (a, b) where + // b is a subreg of a. + if (CurrReg->SubRegs) + for (const unsigned* CurrSR = CurrReg->SubRegs; *CurrSR; ++CurrSR) + Subregs.insert(std::make_pair(i, *CurrSR)); + } } TargetRegisterInfo::~TargetRegisterInfo() {} From resistor at mac.com Fri Jun 27 02:05:59 2008 From: resistor at mac.com (Owen Anderson) Date: Fri, 27 Jun 2008 07:05:59 -0000 Subject: [llvm-commits] [llvm] r52819 - /llvm/trunk/lib/CodeGen/LiveVariables.cpp Message-ID: <200806270705.m5R75xu5004366@zion.cs.uiuc.edu> Author: resistor Date: Fri Jun 27 02:05:59 2008 New Revision: 52819 URL: http://llvm.org/viewvc/llvm-project?rev=52819&view=rev Log: Use a SmallSet when we can to reduce memory allocations. This speeds up a particular testcase from 0.0302s to 0.0222s in LiveVariables. Modified: llvm/trunk/lib/CodeGen/LiveVariables.cpp Modified: llvm/trunk/lib/CodeGen/LiveVariables.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/LiveVariables.cpp?rev=52819&r1=52818&r2=52819&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/LiveVariables.cpp (original) +++ llvm/trunk/lib/CodeGen/LiveVariables.cpp Fri Jun 27 02:05:59 2008 @@ -34,6 +34,7 @@ #include "llvm/Target/TargetMachine.h" #include "llvm/ADT/DepthFirstIterator.h" #include "llvm/ADT/SmallPtrSet.h" +#include "llvm/ADT/SmallSet.h" #include "llvm/ADT/STLExtras.h" #include "llvm/Config/alloca.h" #include @@ -387,7 +388,7 @@ void LiveVariables::HandlePhysRegDef(unsigned Reg, MachineInstr *MI) { // What parts of the register are previously defined? - std::set Live; + SmallSet Live; if (PhysRegDef[Reg] || PhysRegUse[Reg]) { Live.insert(Reg); for (const unsigned *SS = TRI->getSubRegisters(Reg); *SS; ++SS) From isanbard at gmail.com Fri Jun 27 02:13:44 2008 From: isanbard at gmail.com (Bill Wendling) Date: Fri, 27 Jun 2008 07:13:44 -0000 Subject: [llvm-commits] [llvm] r52820 - /llvm/trunk/lib/CodeGen/MachineModuleInfo.cpp Message-ID: <200806270713.m5R7DiCw004586@zion.cs.uiuc.edu> Author: void Date: Fri Jun 27 02:13:44 2008 New Revision: 52820 URL: http://llvm.org/viewvc/llvm-project?rev=52820&view=rev Log: Reduce number of times .size() is called on a vector. Rename some variables to match normal naming scheme. Modified: llvm/trunk/lib/CodeGen/MachineModuleInfo.cpp Modified: llvm/trunk/lib/CodeGen/MachineModuleInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachineModuleInfo.cpp?rev=52820&r1=52819&r2=52820&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/MachineModuleInfo.cpp (original) +++ llvm/trunk/lib/CodeGen/MachineModuleInfo.cpp Fri Jun 27 02:13:44 2008 @@ -306,7 +306,7 @@ ArrayType *AT = ArrayType::get(EmptyTy, N); std::vector ArrayElements; - for (unsigned i = 0, N = Field.size(); i < N; ++i) { + for (unsigned i = 0; i < N; ++i) { if (DebugInfoDesc *Element = Field[i]) { GlobalVariable *GVE = SR.Serialize(Element); Constant *CE = ConstantExpr::getBitCast(GVE, EmptyTy); @@ -711,8 +711,8 @@ //===----------------------------------------------------------------------===// DebugScope::~DebugScope() { - for (unsigned i = 0, N = Scopes.size(); i < N; ++i) delete Scopes[i]; - for (unsigned j = 0, M = Variables.size(); j < M; ++j) delete Variables[j]; + for (unsigned i = 0, e = Scopes.size(); i < e; ++i) delete Scopes[i]; + for (unsigned i = 0, e = Variables.size(); i < e; ++i) delete Variables[i]; } //===----------------------------------------------------------------------===// @@ -819,7 +819,7 @@ CompileUnitDesc CUD; getAnchoredDescriptors(M, &CUD, CUList); - for (unsigned i = 0, N = CUList.size(); i < N; i++) + for (unsigned i = 0, e = CUList.size(); i < e; i++) CompileUnits.insert((CompileUnitDesc*)CUList[i]); } @@ -837,7 +837,7 @@ std::vector Globals; getGlobalVariablesUsing(M, Desc->getAnchorString(), Globals); - for (unsigned i = 0, N = Globals.size(); i < N; ++i) { + for (unsigned i = 0, e = Globals.size(); i < e; ++i) { GlobalVariable *GV = Globals[i]; // FIXME - In the short term, changes are too drastic to continue. @@ -939,9 +939,10 @@ /// getOrCreateLandingPadInfo - Find or create an LandingPadInfo for the /// specified MachineBasicBlock. -LandingPadInfo &MachineModuleInfo::getOrCreateLandingPadInfo - (MachineBasicBlock *LandingPad) { +LandingPadInfo & +MachineModuleInfo::getOrCreateLandingPadInfo(MachineBasicBlock *LandingPad) { unsigned N = LandingPads.size(); + for (unsigned i = 0; i < N; ++i) { LandingPadInfo &LP = LandingPads[i]; if (LP.LandingPadBlock == LandingPad) @@ -977,7 +978,7 @@ LandingPadInfo &LP = getOrCreateLandingPadInfo(LandingPad); LP.Personality = Personality; - for (unsigned i = 0; i < Personalities.size(); ++i) + for (unsigned i = 0, e = Personalities.size(); i < e; ++i) if (Personalities[i] == Personality) return; @@ -998,9 +999,12 @@ void MachineModuleInfo::addFilterTypeInfo(MachineBasicBlock *LandingPad, std::vector &TyInfo) { LandingPadInfo &LP = getOrCreateLandingPadInfo(LandingPad); - std::vector IdsInFilter (TyInfo.size()); - for (unsigned I = 0, E = TyInfo.size(); I != E; ++I) + unsigned TyInfoSize = TyInfo.size(); + std::vector IdsInFilter(TyInfoSize); + + for (unsigned I = 0; I != TyInfoSize; ++I) IdsInFilter[I] = getTypeIDFor(TyInfo[I]); + LP.TypeIds.push_back(getFilterIDFor(IdsInFilter)); } @@ -1025,7 +1029,7 @@ continue; } - for (unsigned j=0; j != LandingPads[i].BeginLabels.size(); ) { + for (unsigned j = 0; j != LandingPads[i].BeginLabels.size(); ) { unsigned BeginLabel = MappedLabel(LandingPad.BeginLabels[j]); unsigned EndLabel = MappedLabel(LandingPad.EndLabels[j]); @@ -1059,8 +1063,9 @@ /// getTypeIDFor - Return the type id for the specified typeinfo. This is /// function wide. unsigned MachineModuleInfo::getTypeIDFor(GlobalVariable *TI) { - for (unsigned i = 0, N = TypeInfos.size(); i != N; ++i) - if (TypeInfos[i] == TI) return i + 1; + for (unsigned i = 0, e = TypeInfos.size(); i != e; ++i) + if (TypeInfos[i] == TI) + return i + 1; TypeInfos.push_back(TI); return TypeInfos.size(); @@ -1090,8 +1095,10 @@ // Add the new filter. int FilterID = -(1 + FilterIds.size()); FilterIds.reserve(FilterIds.size() + TyIds.size() + 1); + for (unsigned I = 0, N = TyIds.size(); I != N; ++I) FilterIds.push_back(TyIds[I]); + FilterEnds.push_back(FilterIds.size()); FilterIds.push_back(0); // terminator return FilterID; @@ -1110,16 +1117,15 @@ const Function* Personality = NULL; // Scan landing pads. If there is at least one non-NULL personality - use it. - for (unsigned i = 0; i != LandingPads.size(); ++i) + for (unsigned i = 0, e = LandingPads.size(); i != e; ++i) if (LandingPads[i].Personality) { Personality = LandingPads[i].Personality; break; } - for (unsigned i = 0; i < Personalities.size(); ++i) { + for (unsigned i = 0, e = Personalities.size(); i < e; ++i) if (Personalities[i] == Personality) return i; - } // This should never happen assert(0 && "Personality function should be set!"); From evan.cheng at apple.com Fri Jun 27 02:19:26 2008 From: evan.cheng at apple.com (Evan Cheng) Date: Fri, 27 Jun 2008 00:19:26 -0700 Subject: [llvm-commits] [llvm] r52818 - in /llvm/trunk: include/llvm/Target/TargetRegisterInfo.h lib/Target/TargetRegisterInfo.cpp In-Reply-To: <200806270656.m5R6u4jM004062@zion.cs.uiuc.edu> References: <200806270656.m5R6u4jM004062@zion.cs.uiuc.edu> Message-ID: Is this really the right approach? I thought we want tblgen at build time to create these matrices to speed up queries. Suppose we are compiling a bunch of small programs. We'd be recomputing the set everytime. Evan On Jun 26, 2008, at 11:56 PM, Owen Anderson wrote: > Author: resistor > Date: Fri Jun 27 01:56:04 2008 > New Revision: 52818 > > URL: http://llvm.org/viewvc/llvm-project?rev=52818&view=rev > Log: > Cache subregister relationships in a set in TargetRegisterInfo to > allow faster lookups. > This speeds up LiveVariables from 0.6279s to 0.6165s on kimwitu++. > > Modified: > llvm/trunk/include/llvm/Target/TargetRegisterInfo.h > llvm/trunk/lib/Target/TargetRegisterInfo.cpp > > Modified: llvm/trunk/include/llvm/Target/TargetRegisterInfo.h > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetRegisterInfo.h?rev=52818&r1=52817&r2=52818&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/include/llvm/Target/TargetRegisterInfo.h (original) > +++ llvm/trunk/include/llvm/Target/TargetRegisterInfo.h Fri Jun 27 > 01:56:04 2008 > @@ -21,6 +21,7 @@ > #include "llvm/CodeGen/ValueTypes.h" > #include > #include > +#include > > namespace llvm { > > @@ -285,6 +286,7 @@ > regclass_iterator RegClassBegin, RegClassEnd; // List of > regclasses > > int CallFrameSetupOpcode, CallFrameDestroyOpcode; > + std::set > Subregs; > protected: > TargetRegisterInfo(const TargetRegisterDesc *D, unsigned NR, > regclass_iterator RegClassBegin, > @@ -419,9 +421,7 @@ > /// isSubRegister - Returns true if regB is a sub-register of regA. > /// > bool isSubRegister(unsigned regA, unsigned regB) const { > - for (const unsigned *SR = getSubRegisters(regA); *SR; ++SR) > - if (*SR == regB) return true; > - return false; > + return Subregs.count(std::make_pair(regA, regB)); > } > > /// isSuperRegister - Returns true if regB is a super-register of > regA. > > Modified: llvm/trunk/lib/Target/TargetRegisterInfo.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/TargetRegisterInfo.cpp?rev=52818&r1=52817&r2=52818&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/lib/Target/TargetRegisterInfo.cpp (original) > +++ llvm/trunk/lib/Target/TargetRegisterInfo.cpp Fri Jun 27 01:56:04 > 2008 > @@ -29,6 +29,16 @@ > > CallFrameSetupOpcode = CFSO; > CallFrameDestroyOpcode = CFDO; > + > + for (unsigned i = 0; i < NumRegs; ++i) { > + const TargetRegisterDesc* CurrReg = Desc + i; > + > + // Initialize the Subregs set, which stores pairs (a, b) where > + // b is a subreg of a. > + if (CurrReg->SubRegs) > + for (const unsigned* CurrSR = CurrReg->SubRegs; *CurrSR; + > +CurrSR) > + Subregs.insert(std::make_pair(i, *CurrSR)); > + } > } > > TargetRegisterInfo::~TargetRegisterInfo() {} > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From evan.cheng at apple.com Fri Jun 27 02:22:55 2008 From: evan.cheng at apple.com (Evan Cheng) Date: Fri, 27 Jun 2008 00:22:55 -0700 Subject: [llvm-commits] [llvm] r52819 - /llvm/trunk/lib/CodeGen/LiveVariables.cpp In-Reply-To: <200806270705.m5R75xu5004366@zion.cs.uiuc.edu> References: <200806270705.m5R75xu5004366@zion.cs.uiuc.edu> Message-ID: <19154965-3AB2-460F-9363-12D1075D582E@apple.com> 32 is a fairly nice sized set. Is this always a win? Perhaps we can make the set an instance variable and share it among several functions? Evan On Jun 27, 2008, at 12:05 AM, Owen Anderson wrote: > Author: resistor > Date: Fri Jun 27 02:05:59 2008 > New Revision: 52819 > > URL: http://llvm.org/viewvc/llvm-project?rev=52819&view=rev > Log: > Use a SmallSet when we can to reduce memory allocations. > This speeds up a particular testcase from 0.0302s to 0.0222s in > LiveVariables. > > Modified: > llvm/trunk/lib/CodeGen/LiveVariables.cpp > > Modified: llvm/trunk/lib/CodeGen/LiveVariables.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/LiveVariables.cpp?rev=52819&r1=52818&r2=52819&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/lib/CodeGen/LiveVariables.cpp (original) > +++ llvm/trunk/lib/CodeGen/LiveVariables.cpp Fri Jun 27 02:05:59 2008 > @@ -34,6 +34,7 @@ > #include "llvm/Target/TargetMachine.h" > #include "llvm/ADT/DepthFirstIterator.h" > #include "llvm/ADT/SmallPtrSet.h" > +#include "llvm/ADT/SmallSet.h" > #include "llvm/ADT/STLExtras.h" > #include "llvm/Config/alloca.h" > #include > @@ -387,7 +388,7 @@ > > void LiveVariables::HandlePhysRegDef(unsigned Reg, MachineInstr *MI) { > // What parts of the register are previously defined? > - std::set Live; > + SmallSet Live; > if (PhysRegDef[Reg] || PhysRegUse[Reg]) { > Live.insert(Reg); > for (const unsigned *SS = TRI->getSubRegisters(Reg); *SS; ++SS) > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From resistor at mac.com Fri Jun 27 02:27:43 2008 From: resistor at mac.com (Owen Anderson) Date: Fri, 27 Jun 2008 00:27:43 -0700 Subject: [llvm-commits] [llvm] r52818 - in /llvm/trunk: include/llvm/Target/TargetRegisterInfo.h lib/Target/TargetRegisterInfo.cpp In-Reply-To: References: <200806270656.m5R6u4jM004062@zion.cs.uiuc.edu> Message-ID: I thought this was the approach we'd agreed on at the end of today? I don't know how to have tblgen create this information without attaching it to each TargetRegisterDesc, which will be very costly in terms of memory footprint. --Owen On Jun 27, 2008, at 12:19 AM, Evan Cheng wrote: > Is this really the right approach? I thought we want tblgen at build > time to create these matrices to speed up queries. Suppose we are > compiling a bunch of small programs. We'd be recomputing the set > everytime. > > Evan > > On Jun 26, 2008, at 11:56 PM, Owen Anderson wrote: > >> Author: resistor >> Date: Fri Jun 27 01:56:04 2008 >> New Revision: 52818 >> >> URL: http://llvm.org/viewvc/llvm-project?rev=52818&view=rev >> Log: >> Cache subregister relationships in a set in TargetRegisterInfo to >> allow faster lookups. >> This speeds up LiveVariables from 0.6279s to 0.6165s on kimwitu++. >> >> Modified: >> llvm/trunk/include/llvm/Target/TargetRegisterInfo.h >> llvm/trunk/lib/Target/TargetRegisterInfo.cpp >> >> Modified: llvm/trunk/include/llvm/Target/TargetRegisterInfo.h >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetRegisterInfo.h?rev=52818&r1=52817&r2=52818&view=diff >> >> = >> = >> = >> = >> = >> = >> = >> = >> = >> ===================================================================== >> --- llvm/trunk/include/llvm/Target/TargetRegisterInfo.h (original) >> +++ llvm/trunk/include/llvm/Target/TargetRegisterInfo.h Fri Jun 27 >> 01:56:04 2008 >> @@ -21,6 +21,7 @@ >> #include "llvm/CodeGen/ValueTypes.h" >> #include >> #include >> +#include >> >> namespace llvm { >> >> @@ -285,6 +286,7 @@ >> regclass_iterator RegClassBegin, RegClassEnd; // List of >> regclasses >> >> int CallFrameSetupOpcode, CallFrameDestroyOpcode; >> + std::set > Subregs; >> protected: >> TargetRegisterInfo(const TargetRegisterDesc *D, unsigned NR, >> regclass_iterator RegClassBegin, >> @@ -419,9 +421,7 @@ >> /// isSubRegister - Returns true if regB is a sub-register of regA. >> /// >> bool isSubRegister(unsigned regA, unsigned regB) const { >> - for (const unsigned *SR = getSubRegisters(regA); *SR; ++SR) >> - if (*SR == regB) return true; >> - return false; >> + return Subregs.count(std::make_pair(regA, regB)); >> } >> >> /// isSuperRegister - Returns true if regB is a super-register of >> regA. >> >> Modified: llvm/trunk/lib/Target/TargetRegisterInfo.cpp >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/TargetRegisterInfo.cpp?rev=52818&r1=52817&r2=52818&view=diff >> >> = >> = >> = >> = >> = >> = >> = >> = >> = >> ===================================================================== >> --- llvm/trunk/lib/Target/TargetRegisterInfo.cpp (original) >> +++ llvm/trunk/lib/Target/TargetRegisterInfo.cpp Fri Jun 27 01:56:04 >> 2008 >> @@ -29,6 +29,16 @@ >> >> CallFrameSetupOpcode = CFSO; >> CallFrameDestroyOpcode = CFDO; >> + >> + for (unsigned i = 0; i < NumRegs; ++i) { >> + const TargetRegisterDesc* CurrReg = Desc + i; >> + >> + // Initialize the Subregs set, which stores pairs (a, b) where >> + // b is a subreg of a. >> + if (CurrReg->SubRegs) >> + for (const unsigned* CurrSR = CurrReg->SubRegs; *CurrSR; + >> +CurrSR) >> + Subregs.insert(std::make_pair(i, *CurrSR)); >> + } >> } >> >> TargetRegisterInfo::~TargetRegisterInfo() {} >> >> >> _______________________________________________ >> llvm-commits mailing list >> llvm-commits at cs.uiuc.edu >> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/pkcs7-signature Size: 4260 bytes Desc: not available Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20080627/40d7be14/attachment.bin From resistor at mac.com Fri Jun 27 02:29:15 2008 From: resistor at mac.com (Owen Anderson) Date: Fri, 27 Jun 2008 00:29:15 -0700 Subject: [llvm-commits] [llvm] r52819 - /llvm/trunk/lib/CodeGen/LiveVariables.cpp In-Reply-To: <19154965-3AB2-460F-9363-12D1075D582E@apple.com> References: <200806270705.m5R75xu5004366@zion.cs.uiuc.edu> <19154965-3AB2-460F-9363-12D1075D582E@apple.com> Message-ID: Having replaced the std::set with the SmallSet, I no longer see anything related to the set in profiling, so I doubt there's much benefit to be had from reusing it. 32 just seemed like a reasonable number. Feel free to tune it if you'd like. --Owen On Jun 27, 2008, at 12:22 AM, Evan Cheng wrote: > 32 is a fairly nice sized set. Is this always a win? Perhaps we can > make the set an instance variable and share it among several > functions? > > Evan > > On Jun 27, 2008, at 12:05 AM, Owen Anderson wrote: > >> Author: resistor >> Date: Fri Jun 27 02:05:59 2008 >> New Revision: 52819 >> >> URL: http://llvm.org/viewvc/llvm-project?rev=52819&view=rev >> Log: >> Use a SmallSet when we can to reduce memory allocations. >> This speeds up a particular testcase from 0.0302s to 0.0222s in >> LiveVariables. >> >> Modified: >> llvm/trunk/lib/CodeGen/LiveVariables.cpp >> >> Modified: llvm/trunk/lib/CodeGen/LiveVariables.cpp >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/LiveVariables.cpp?rev=52819&r1=52818&r2=52819&view=diff >> >> = >> = >> = >> = >> = >> = >> = >> = >> = >> ===================================================================== >> --- llvm/trunk/lib/CodeGen/LiveVariables.cpp (original) >> +++ llvm/trunk/lib/CodeGen/LiveVariables.cpp Fri Jun 27 02:05:59 2008 >> @@ -34,6 +34,7 @@ >> #include "llvm/Target/TargetMachine.h" >> #include "llvm/ADT/DepthFirstIterator.h" >> #include "llvm/ADT/SmallPtrSet.h" >> +#include "llvm/ADT/SmallSet.h" >> #include "llvm/ADT/STLExtras.h" >> #include "llvm/Config/alloca.h" >> #include >> @@ -387,7 +388,7 @@ >> >> void LiveVariables::HandlePhysRegDef(unsigned Reg, MachineInstr >> *MI) { >> // What parts of the register are previously defined? >> - std::set Live; >> + SmallSet Live; >> if (PhysRegDef[Reg] || PhysRegUse[Reg]) { >> Live.insert(Reg); >> for (const unsigned *SS = TRI->getSubRegisters(Reg); *SS; ++SS) >> >> >> _______________________________________________ >> llvm-commits mailing list >> llvm-commits at cs.uiuc.edu >> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/pkcs7-signature Size: 4260 bytes Desc: not available Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20080627/36d8b3fd/attachment.bin From kremenek at apple.com Fri Jun 27 02:52:16 2008 From: kremenek at apple.com (Ted Kremenek) Date: Fri, 27 Jun 2008 07:52:16 -0000 Subject: [llvm-commits] [llvm] r52821 - /llvm/tags/checker/checker-46/ Message-ID: <200806270752.m5R7qG0R014027@zion.cs.uiuc.edu> Author: kremenek Date: Fri Jun 27 02:52:16 2008 New Revision: 52821 URL: http://llvm.org/viewvc/llvm-project?rev=52821&view=rev Log: Tagging checker-46. Added: llvm/tags/checker/checker-46/ - copied from r52820, llvm/trunk/ From baldrick at free.fr Fri Jun 27 05:52:15 2008 From: baldrick at free.fr (Duncan Sands) Date: Fri, 27 Jun 2008 10:52:15 -0000 Subject: [llvm-commits] [llvm] r52824 - /llvm/trunk/test/Linker/link-archive.ll Message-ID: <200806271052.m5RAqF9F021917@zion.cs.uiuc.edu> Author: baldrick Date: Fri Jun 27 05:52:12 2008 New Revision: 52824 URL: http://llvm.org/viewvc/llvm-project?rev=52824&view=rev Log: Use the c modifier to tell llvm-ar not to issue a warning when creating the archive (the warning causes the test to fail). Modified: llvm/trunk/test/Linker/link-archive.ll Modified: llvm/trunk/test/Linker/link-archive.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Linker/link-archive.ll?rev=52824&r1=52823&r2=52824&view=diff ============================================================================== --- llvm/trunk/test/Linker/link-archive.ll (original) +++ llvm/trunk/test/Linker/link-archive.ll Fri Jun 27 05:52:12 2008 @@ -3,8 +3,8 @@ ; RUN: llvm-as %s -o %t.bar.bc -f ; RUN: echo {define i32* @foo(i32 %x) \{ ret i32* @baz \} \ ; RUN: @baz = external global i32 } | llvm-as -o %t.foo.bc -f -; RUN: llvm-ar rf %t.foo.a %t.foo.bc -; RUN: llvm-ar rf %t.bar.a %t.bar.bc +; RUN: llvm-ar rcf %t.foo.a %t.foo.bc +; RUN: llvm-ar rcf %t.bar.a %t.bar.bc ; RUN: llvm-ld -disable-opt %t.bar.bc %t.foo.a -o %t.bc ; RUN: llvm-ld -disable-opt %t.foo.bc %t.bar.a -o %t.bc declare i32* @foo(...) From baldrick at free.fr Fri Jun 27 08:55:38 2008 From: baldrick at free.fr (Duncan Sands) Date: Fri, 27 Jun 2008 13:55:38 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r52825 - /llvm-gcc-4.2/trunk/gcc/fortran/trans-decl.c Message-ID: <200806271355.m5RDtc04027843@zion.cs.uiuc.edu> Author: baldrick Date: Fri Jun 27 08:55:37 2008 New Revision: 52825 URL: http://llvm.org/viewvc/llvm-project?rev=52825&view=rev Log: The cpow functions take two arguments not one. Fixes PR2443. Modified: llvm-gcc-4.2/trunk/gcc/fortran/trans-decl.c Modified: llvm-gcc-4.2/trunk/gcc/fortran/trans-decl.c URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/fortran/trans-decl.c?rev=52825&r1=52824&r2=52825&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/fortran/trans-decl.c (original) +++ llvm-gcc-4.2/trunk/gcc/fortran/trans-decl.c Fri Jun 27 08:55:37 2008 @@ -2145,24 +2145,30 @@ #undef NRKINDS } + /* LLVM local begin - correct cpow prototypes */ gfor_fndecl_math_cpowf = gfc_build_library_function_decl (get_identifier ("cpowf"), - gfc_complex4_type_node, - 1, gfc_complex4_type_node); + gfc_complex4_type_node, 2, + gfc_complex4_type_node, + gfc_complex4_type_node); gfor_fndecl_math_cpow = gfc_build_library_function_decl (get_identifier ("cpow"), - gfc_complex8_type_node, - 1, gfc_complex8_type_node); + gfc_complex8_type_node, 2, + gfc_complex8_type_node, + gfc_complex8_type_node); if (gfc_complex10_type_node) gfor_fndecl_math_cpowl10 = gfc_build_library_function_decl (get_identifier ("cpowl"), - gfc_complex10_type_node, 1, - gfc_complex10_type_node); + gfc_complex10_type_node, 2, + gfc_complex10_type_node, + gfc_complex10_type_node); if (gfc_complex16_type_node) gfor_fndecl_math_cpowl16 = gfc_build_library_function_decl (get_identifier ("cpowl"), - gfc_complex16_type_node, 1, - gfc_complex16_type_node); + gfc_complex16_type_node, 2, + gfc_complex16_type_node, + gfc_complex16_type_node); + /* LLVM local end - correct cpow prototypes */ gfor_fndecl_math_ishftc4 = gfc_build_library_function_decl (get_identifier (PREFIX("ishftc4")), From baldrick at free.fr Fri Jun 27 09:22:20 2008 From: baldrick at free.fr (Duncan Sands) Date: Fri, 27 Jun 2008 14:22:20 -0000 Subject: [llvm-commits] [llvm] r52826 - in /llvm/trunk/test: FrontendFortran/ FrontendFortran/cpow.f90 FrontendFortran/dg.exp lib/llvm.exp Message-ID: <200806271422.m5REMKYh028621@zion.cs.uiuc.edu> Author: baldrick Date: Fri Jun 27 09:22:20 2008 New Revision: 52826 URL: http://llvm.org/viewvc/llvm-project?rev=52826&view=rev Log: Regression test for PR2443. Added: llvm/trunk/test/FrontendFortran/ llvm/trunk/test/FrontendFortran/cpow.f90 llvm/trunk/test/FrontendFortran/dg.exp Modified: llvm/trunk/test/lib/llvm.exp Added: llvm/trunk/test/FrontendFortran/cpow.f90 URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/FrontendFortran/cpow.f90?rev=52826&view=auto ============================================================================== --- llvm/trunk/test/FrontendFortran/cpow.f90 (added) +++ llvm/trunk/test/FrontendFortran/cpow.f90 Fri Jun 27 09:22:20 2008 @@ -0,0 +1,18 @@ +! RUN: %llvmgcc -c %s +! PR2443 + +! Program to test the power (**) operator +program testpow + implicit none + real(kind=4) r, s, two + real(kind=8) :: q + complex(kind=4) :: c, z + real, parameter :: del = 0.0001 + integer i, j + + two = 2.0 + + c = (2.0, 3.0) + c = c ** two + if (abs(c - (-5.0, 12.0)) .gt. del) call abort +end program Added: llvm/trunk/test/FrontendFortran/dg.exp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/FrontendFortran/dg.exp?rev=52826&view=auto ============================================================================== --- llvm/trunk/test/FrontendFortran/dg.exp (added) +++ llvm/trunk/test/FrontendFortran/dg.exp Fri Jun 27 09:22:20 2008 @@ -0,0 +1,6 @@ +load_lib llvm.exp + +if [ llvm_gcc_supports fortran ] then { + RunLLVMTests [lsort [glob -nocomplain $srcdir/$subdir/*.{f,f90}]] +} + Modified: llvm/trunk/test/lib/llvm.exp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/lib/llvm.exp?rev=52826&r1=52825&r2=52826&view=diff ============================================================================== --- llvm/trunk/test/lib/llvm.exp (original) +++ llvm/trunk/test/lib/llvm.exp Fri Jun 27 09:22:20 2008 @@ -238,7 +238,7 @@ c++ { set file cc1plus } objc { set file cc1 } objc++ { set file cc1 } - fortran { set file fcc1 } + fortran { set file f951 } default { return 0 } } foreach supported_lang [split "$llvmgcc_langs" ,] { From akyrtzi at gmail.com Fri Jun 27 10:09:01 2008 From: akyrtzi at gmail.com (Argiris Kirtzidis) Date: Fri, 27 Jun 2008 15:09:01 -0000 Subject: [llvm-commits] [llvm] r52827 - /llvm/trunk/tools/llvm-ld/llvm-ld.cpp Message-ID: <200806271509.m5RF914g030002@zion.cs.uiuc.edu> Author: akirtzidis Date: Fri Jun 27 10:08:59 2008 New Revision: 52827 URL: http://llvm.org/viewvc/llvm-project?rev=52827&view=rev Log: Since we are using GCC to assemble the program, make sure the assembly syntax is AT&T. Modified: llvm/trunk/tools/llvm-ld/llvm-ld.cpp Modified: llvm/trunk/tools/llvm-ld/llvm-ld.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-ld/llvm-ld.cpp?rev=52827&r1=52826&r2=52827&view=diff ============================================================================== --- llvm/trunk/tools/llvm-ld/llvm-ld.cpp (original) +++ llvm/trunk/tools/llvm-ld/llvm-ld.cpp Fri Jun 27 10:08:59 2008 @@ -251,6 +251,9 @@ // Run LLC to convert the bitcode file into assembly code. std::vector args; args.push_back(llc.c_str()); + // We will use GCC to assemble the program so set the assembly syntax to AT&T, + // regardless of what the target in the bitcode file is. + args.push_back("-x86-asm-syntax=att"); args.push_back("-f"); args.push_back("-o"); args.push_back(OutputFilename.c_str()); From evan.cheng at apple.com Fri Jun 27 10:18:09 2008 From: evan.cheng at apple.com (Evan Cheng) Date: Fri, 27 Jun 2008 08:18:09 -0700 Subject: [llvm-commits] [llvm] r52818 - in /llvm/trunk: include/llvm/Target/TargetRegisterInfo.h lib/Target/TargetRegisterInfo.cpp In-Reply-To: References: <200806270656.m5R6u4jM004062@zion.cs.uiuc.edu> Message-ID: <84E40B9C-CDA0-4AD2-B3E2-963EC3CAC0FA@apple.com> How about having tblgen create a two-dimensional array that represents the aliasing relationship? You can use a bitvector representation, it wouldn't be expensive at all if there is one for the whole target.The map should be owned by each TargetRegisterInfo. Take a look at the code in X86GenRegisterInfo.inc to get a flavor what it would look like. Evan On Jun 27, 2008, at 12:27 AM, Owen Anderson wrote: > I thought this was the approach we'd agreed on at the end of today? > I don't know how to have tblgen create this information without > attaching it to each TargetRegisterDesc, which will be very costly > in terms of memory footprint. > > --Owen > > On Jun 27, 2008, at 12:19 AM, Evan Cheng wrote: > >> Is this really the right approach? I thought we want tblgen at build >> time to create these matrices to speed up queries. Suppose we are >> compiling a bunch of small programs. We'd be recomputing the set >> everytime. >> >> Evan >> >> On Jun 26, 2008, at 11:56 PM, Owen Anderson wrote: >> >>> Author: resistor >>> Date: Fri Jun 27 01:56:04 2008 >>> New Revision: 52818 >>> >>> URL: http://llvm.org/viewvc/llvm-project?rev=52818&view=rev >>> Log: >>> Cache subregister relationships in a set in TargetRegisterInfo to >>> allow faster lookups. >>> This speeds up LiveVariables from 0.6279s to 0.6165s on kimwitu++. >>> >>> Modified: >>> llvm/trunk/include/llvm/Target/TargetRegisterInfo.h >>> llvm/trunk/lib/Target/TargetRegisterInfo.cpp >>> >>> Modified: llvm/trunk/include/llvm/Target/TargetRegisterInfo.h >>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetRegisterInfo.h?rev=52818&r1=52817&r2=52818&view=diff >>> >>> = >>> = >>> = >>> = >>> = >>> = >>> = >>> = >>> = >>> = >>> ==================================================================== >>> --- llvm/trunk/include/llvm/Target/TargetRegisterInfo.h (original) >>> +++ llvm/trunk/include/llvm/Target/TargetRegisterInfo.h Fri Jun 27 >>> 01:56:04 2008 >>> @@ -21,6 +21,7 @@ >>> #include "llvm/CodeGen/ValueTypes.h" >>> #include >>> #include >>> +#include >>> >>> namespace llvm { >>> >>> @@ -285,6 +286,7 @@ >>> regclass_iterator RegClassBegin, RegClassEnd; // List of >>> regclasses >>> >>> int CallFrameSetupOpcode, CallFrameDestroyOpcode; >>> + std::set > Subregs; >>> protected: >>> TargetRegisterInfo(const TargetRegisterDesc *D, unsigned NR, >>> regclass_iterator RegClassBegin, >>> @@ -419,9 +421,7 @@ >>> /// isSubRegister - Returns true if regB is a sub-register of regA. >>> /// >>> bool isSubRegister(unsigned regA, unsigned regB) const { >>> - for (const unsigned *SR = getSubRegisters(regA); *SR; ++SR) >>> - if (*SR == regB) return true; >>> - return false; >>> + return Subregs.count(std::make_pair(regA, regB)); >>> } >>> >>> /// isSuperRegister - Returns true if regB is a super-register of >>> regA. >>> >>> Modified: llvm/trunk/lib/Target/TargetRegisterInfo.cpp >>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/TargetRegisterInfo.cpp?rev=52818&r1=52817&r2=52818&view=diff >>> >>> = >>> = >>> = >>> = >>> = >>> = >>> = >>> = >>> = >>> = >>> ==================================================================== >>> --- llvm/trunk/lib/Target/TargetRegisterInfo.cpp (original) >>> +++ llvm/trunk/lib/Target/TargetRegisterInfo.cpp Fri Jun 27 01:56:04 >>> 2008 >>> @@ -29,6 +29,16 @@ >>> >>> CallFrameSetupOpcode = CFSO; >>> CallFrameDestroyOpcode = CFDO; >>> + >>> + for (unsigned i = 0; i < NumRegs; ++i) { >>> + const TargetRegisterDesc* CurrReg = Desc + i; >>> + >>> + // Initialize the Subregs set, which stores pairs (a, b) where >>> + // b is a subreg of a. >>> + if (CurrReg->SubRegs) >>> + for (const unsigned* CurrSR = CurrReg->SubRegs; *CurrSR; + >>> +CurrSR) >>> + Subregs.insert(std::make_pair(i, *CurrSR)); >>> + } >>> } >>> >>> TargetRegisterInfo::~TargetRegisterInfo() {} >>> >>> >>> _______________________________________________ >>> 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 asl at math.spbu.ru Fri Jun 27 11:10:21 2008 From: asl at math.spbu.ru (Anton Korobeynikov) Date: Fri, 27 Jun 2008 16:10:21 -0000 Subject: [llvm-commits] [llvm] r52828 - /llvm/trunk/lib/Target/PowerPC/PPCInstrInfo.td Message-ID: <200806271610.m5RGALWo032006@zion.cs.uiuc.edu> Author: asl Date: Fri Jun 27 11:10:20 2008 New Revision: 52828 URL: http://llvm.org/viewvc/llvm-project?rev=52828&view=rev Log: Provide correct encoding for PPC LWARX instructions. Patch by Gary Benson! Modified: llvm/trunk/lib/Target/PowerPC/PPCInstrInfo.td Modified: llvm/trunk/lib/Target/PowerPC/PPCInstrInfo.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/PPCInstrInfo.td?rev=52828&r1=52827&r2=52828&view=diff ============================================================================== --- llvm/trunk/lib/Target/PowerPC/PPCInstrInfo.td (original) +++ llvm/trunk/lib/Target/PowerPC/PPCInstrInfo.td Fri Jun 27 11:10:20 2008 @@ -531,8 +531,8 @@ PPC970_DGroup_Single; // Atomic operations. -def LWARX : Pseudo<(outs GPRC:$rD), (ins memrr:$ptr, i32imm:$label), - "\nLa${label}_entry:\n\tlwarx $rD, $ptr", +def LWARX : XForm_1<31, 20, (outs GPRC:$rD), (ins memrr:$ptr, i32imm:$label), + "\nLa${label}_entry:\n\tlwarx $rD, $ptr", LdStLWARX, [(set GPRC:$rD, (PPClarx xoaddr:$ptr, imm:$label))]>; let Defs = [CR0] in { From dpatel at apple.com Fri Jun 27 11:43:22 2008 From: dpatel at apple.com (Devang Patel) Date: Fri, 27 Jun 2008 16:43:22 -0000 Subject: [llvm-commits] [llvm] r52829 - /llvm/trunk/lib/VMCore/Dominators.cpp Message-ID: <200806271643.m5RGhMi9000773@zion.cs.uiuc.edu> Author: dpatel Date: Fri Jun 27 11:43:21 2008 New Revision: 52829 URL: http://llvm.org/viewvc/llvm-project?rev=52829&view=rev Log: Add dominator info printer pass. Modified: llvm/trunk/lib/VMCore/Dominators.cpp Modified: llvm/trunk/lib/VMCore/Dominators.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Dominators.cpp?rev=52829&r1=52828&r2=52829&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/Dominators.cpp (original) +++ llvm/trunk/lib/VMCore/Dominators.cpp Fri Jun 27 11:43:21 2008 @@ -286,3 +286,34 @@ void DominanceFrontierBase::dump() { print (llvm::cerr); } + +//===----------------------------------------------------------------------===// +// DomInfoPrinter Pass +//===----------------------------------------------------------------------===// + +namespace { + class VISIBILITY_HIDDEN DomInfoPrinter : public FunctionPass { + public: + static char ID; // Pass identification, replacement for typeid + DomInfoPrinter() : FunctionPass((intptr_t)&ID) {} + + virtual void getAnalysisUsage(AnalysisUsage &AU) const { + AU.setPreservesAll(); + AU.addRequired(); + AU.addRequired(); + + } + + virtual bool runOnFunction(Function &F) { + DominatorTree &DT = getAnalysis(); + DT.dump(); + DominanceFrontier &DF = getAnalysis(); + DF.dump(); + return false; + } + }; +} + +char DomInfoPrinter::ID = 0; +static RegisterPass +DIP("print-dom-info", "Dominator Info Printer", true, true); From resistor at mac.com Fri Jun 27 13:16:00 2008 From: resistor at mac.com (Owen Anderson) Date: Fri, 27 Jun 2008 11:16:00 -0700 Subject: [llvm-commits] [llvm] r52818 - in /llvm/trunk: include/llvm/Target/TargetRegisterInfo.h lib/Target/TargetRegisterInfo.cpp In-Reply-To: <84E40B9C-CDA0-4AD2-B3E2-963EC3CAC0FA@apple.com> References: <200806270656.m5R6u4jM004062@zion.cs.uiuc.edu> <84E40B9C-CDA0-4AD2-B3E2-963EC3CAC0FA@apple.com> Message-ID: <0FF826DC-80DC-4350-BC7C-8D5E7FE542F9@mac.com> That won't be any smaller than just attaching a bitvector to each TargetRegDesc, which you didn't like because it wasted space. The advantage of the std::set approach is that it's sparse, so we don't waste a large amount of space representing non-interferences. --Owen On Jun 27, 2008, at 8:18 AM, Evan Cheng wrote: > How about having tblgen create a two-dimensional array that represents > the aliasing relationship? You can use a bitvector representation, it > wouldn't be expensive at all if there is one for the whole target.The > map should be owned by each TargetRegisterInfo. Take a look at the > code in X86GenRegisterInfo.inc to get a flavor what it would look > like. > > Evan > > On Jun 27, 2008, at 12:27 AM, Owen Anderson wrote: > >> I thought this was the approach we'd agreed on at the end of today? >> I don't know how to have tblgen create this information without >> attaching it to each TargetRegisterDesc, which will be very costly >> in terms of memory footprint. >> >> --Owen >> >> On Jun 27, 2008, at 12:19 AM, Evan Cheng wrote: >> >>> Is this really the right approach? I thought we want tblgen at build >>> time to create these matrices to speed up queries. Suppose we are >>> compiling a bunch of small programs. We'd be recomputing the set >>> everytime. >>> >>> Evan >>> >>> On Jun 26, 2008, at 11:56 PM, Owen Anderson wrote: >>> >>>> Author: resistor >>>> Date: Fri Jun 27 01:56:04 2008 >>>> New Revision: 52818 >>>> >>>> URL: http://llvm.org/viewvc/llvm-project?rev=52818&view=rev >>>> Log: >>>> Cache subregister relationships in a set in TargetRegisterInfo to >>>> allow faster lookups. >>>> This speeds up LiveVariables from 0.6279s to 0.6165s on kimwitu++. >>>> >>>> Modified: >>>> llvm/trunk/include/llvm/Target/TargetRegisterInfo.h >>>> llvm/trunk/lib/Target/TargetRegisterInfo.cpp >>>> >>>> Modified: llvm/trunk/include/llvm/Target/TargetRegisterInfo.h >>>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetRegisterInfo.h?rev=52818&r1=52817&r2=52818&view=diff >>>> >>>> = >>>> = >>>> = >>>> = >>>> = >>>> = >>>> = >>>> = >>>> = >>>> = >>>> = >>>> =================================================================== >>>> --- llvm/trunk/include/llvm/Target/TargetRegisterInfo.h (original) >>>> +++ llvm/trunk/include/llvm/Target/TargetRegisterInfo.h Fri Jun 27 >>>> 01:56:04 2008 >>>> @@ -21,6 +21,7 @@ >>>> #include "llvm/CodeGen/ValueTypes.h" >>>> #include >>>> #include >>>> +#include >>>> >>>> namespace llvm { >>>> >>>> @@ -285,6 +286,7 @@ >>>> regclass_iterator RegClassBegin, RegClassEnd; // List of >>>> regclasses >>>> >>>> int CallFrameSetupOpcode, CallFrameDestroyOpcode; >>>> + std::set > Subregs; >>>> protected: >>>> TargetRegisterInfo(const TargetRegisterDesc *D, unsigned NR, >>>> regclass_iterator RegClassBegin, >>>> @@ -419,9 +421,7 @@ >>>> /// isSubRegister - Returns true if regB is a sub-register of regA. >>>> /// >>>> bool isSubRegister(unsigned regA, unsigned regB) const { >>>> - for (const unsigned *SR = getSubRegisters(regA); *SR; ++SR) >>>> - if (*SR == regB) return true; >>>> - return false; >>>> + return Subregs.count(std::make_pair(regA, regB)); >>>> } >>>> >>>> /// isSuperRegister - Returns true if regB is a super-register of >>>> regA. >>>> >>>> Modified: llvm/trunk/lib/Target/TargetRegisterInfo.cpp >>>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/TargetRegisterInfo.cpp?rev=52818&r1=52817&r2=52818&view=diff >>>> >>>> = >>>> = >>>> = >>>> = >>>> = >>>> = >>>> = >>>> = >>>> = >>>> = >>>> = >>>> =================================================================== >>>> --- llvm/trunk/lib/Target/TargetRegisterInfo.cpp (original) >>>> +++ llvm/trunk/lib/Target/TargetRegisterInfo.cpp Fri Jun 27 >>>> 01:56:04 >>>> 2008 >>>> @@ -29,6 +29,16 @@ >>>> >>>> CallFrameSetupOpcode = CFSO; >>>> CallFrameDestroyOpcode = CFDO; >>>> + >>>> + for (unsigned i = 0; i < NumRegs; ++i) { >>>> + const TargetRegisterDesc* CurrReg = Desc + i; >>>> + >>>> + // Initialize the Subregs set, which stores pairs (a, b) where >>>> + // b is a subreg of a. >>>> + if (CurrReg->SubRegs) >>>> + for (const unsigned* CurrSR = CurrReg->SubRegs; *CurrSR; + >>>> +CurrSR) >>>> + Subregs.insert(std::make_pair(i, *CurrSR)); >>>> + } >>>> } >>>> >>>> TargetRegisterInfo::~TargetRegisterInfo() {} >>>> >>>> >>>> _______________________________________________ >>>> 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 > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From clattner at apple.com Fri Jun 27 13:20:58 2008 From: clattner at apple.com (Chris Lattner) Date: Fri, 27 Jun 2008 11:20:58 -0700 Subject: [llvm-commits] [llvm] r52818 - in /llvm/trunk: include/llvm/Target/TargetRegisterInfo.h lib/Target/TargetRegisterInfo.cpp In-Reply-To: <0FF826DC-80DC-4350-BC7C-8D5E7FE542F9@mac.com> References: <200806270656.m5R6u4jM004062@zion.cs.uiuc.edu> <84E40B9C-CDA0-4AD2-B3E2-963EC3CAC0FA@apple.com> <0FF826DC-80DC-4350-BC7C-8D5E7FE542F9@mac.com> Message-ID: On Jun 27, 2008, at 11:16 AM, Owen Anderson wrote: > That won't be any smaller than just attaching a bitvector to each > TargetRegDesc, which you didn't like because it wasted space. The > advantage of the std::set approach is that it's sparse, so we don't > waste a large amount of space representing non-interferences. Why not have tblgen emit a function that does a simple hash on the two register values into a probed hash table that it generates? The size of the hash table would be proportional to the number of entries. -Chris From clattner at apple.com Fri Jun 27 13:23:21 2008 From: clattner at apple.com (Chris Lattner) Date: Fri, 27 Jun 2008 11:23:21 -0700 Subject: [llvm-commits] [llvm] r52829 - /llvm/trunk/lib/VMCore/Dominators.cpp In-Reply-To: <200806271643.m5RGhMi9000773@zion.cs.uiuc.edu> References: <200806271643.m5RGhMi9000773@zion.cs.uiuc.edu> Message-ID: <81AEF76D-FD84-4E29-92EF-62A9825DE528@apple.com> On Jun 27, 2008, at 9:43 AM, Devang Patel wrote: > URL: http://llvm.org/viewvc/llvm-project?rev=52829&view=rev > Log: > Add dominator info printer pass. Please put this into tools/opt/GraphPrinters.cpp so that it doesn't grow vmcore. Thanks Devang, -Chris > > > Modified: > llvm/trunk/lib/VMCore/Dominators.cpp > > Modified: llvm/trunk/lib/VMCore/Dominators.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Dominators.cpp?rev=52829&r1=52828&r2=52829&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/lib/VMCore/Dominators.cpp (original) > +++ llvm/trunk/lib/VMCore/Dominators.cpp Fri Jun 27 11:43:21 2008 > @@ -286,3 +286,34 @@ > void DominanceFrontierBase::dump() { > print (llvm::cerr); > } > + > +// > = > = > = > ----------------------------------------------------------------------= > ==// > +// DomInfoPrinter Pass > +// > = > = > = > ----------------------------------------------------------------------= > ==// > + > +namespace { > + class VISIBILITY_HIDDEN DomInfoPrinter : public FunctionPass { > + public: > + static char ID; // Pass identification, replacement for typeid > + DomInfoPrinter() : FunctionPass((intptr_t)&ID) {} > + > + virtual void getAnalysisUsage(AnalysisUsage &AU) const { > + AU.setPreservesAll(); > + AU.addRequired(); > + AU.addRequired(); > + > + } > + > + virtual bool runOnFunction(Function &F) { > + DominatorTree &DT = getAnalysis(); > + DT.dump(); > + DominanceFrontier &DF = getAnalysis(); > + DF.dump(); > + return false; > + } > + }; > +} > + > +char DomInfoPrinter::ID = 0; > +static RegisterPass > +DIP("print-dom-info", "Dominator Info Printer", true, true); > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From sabre at nondot.org Fri Jun 27 13:49:21 2008 From: sabre at nondot.org (Chris Lattner) Date: Fri, 27 Jun 2008 18:49:21 -0000 Subject: [llvm-commits] [llvm] r52832 - /llvm/trunk/include/llvm/Support/IRBuilder.h Message-ID: <200806271849.m5RInLG2004684@zion.cs.uiuc.edu> Author: lattner Date: Fri Jun 27 13:49:21 2008 New Revision: 52832 URL: http://llvm.org/viewvc/llvm-project?rev=52832&view=rev Log: Tweak IRBuilder to explicitly call the setName(const char*) method on Value instead of passing the name into the instruction ctors. Since most instruction ctors take their name as an std::string, this avoids copying the string to the heap and a malloc and free. Patch by Pratik Solanki! Modified: llvm/trunk/include/llvm/Support/IRBuilder.h Modified: llvm/trunk/include/llvm/Support/IRBuilder.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/IRBuilder.h?rev=52832&r1=52831&r2=52832&view=diff ============================================================================== --- llvm/trunk/include/llvm/Support/IRBuilder.h (original) +++ llvm/trunk/include/llvm/Support/IRBuilder.h Fri Jun 27 13:49:21 2008 @@ -69,16 +69,18 @@ /// Insert - Insert and return the specified instruction. template - InstTy *Insert(InstTy *I) const { - InsertHelper(I); + InstTy *Insert(InstTy *I, const char *Name = "") const { + InsertHelper(I, Name); return I; } /// InsertHelper - Insert the specified instruction at the specified insertion /// point. This is split out of Insert so that it isn't duplicated for every /// template instantiation. - void InsertHelper(Instruction *I) const { + void InsertHelper(Instruction *I, const char *Name) const { if (BB) BB->getInstList().insert(InsertPt, I); + if (Name[0]) + I->setName(Name); } //===--------------------------------------------------------------------===// @@ -98,12 +100,12 @@ } ReturnInst *CreateRet(Value * const* retVals, unsigned N) { - return Insert(ReturnInst::Create(retVals, N)); + return Insert(ReturnInst::Create(retVals, N)); } GetResultInst *CreateGetResult(Value *V, unsigned Index, const char *Name = "") { - return Insert(new GetResultInst(V, Index, Name)); + return Insert(new GetResultInst(V, Index), Name); } /// CreateBr - Create an unconditional 'br label X' instruction. @@ -130,7 +132,7 @@ BasicBlock *UnwindDest, InputIterator ArgBegin, InputIterator ArgEnd, const char *Name = "") { return Insert(InvokeInst::Create(Callee, NormalDest, UnwindDest, - ArgBegin, ArgEnd, Name)); + ArgBegin, ArgEnd), Name); } UnwindInst *CreateUnwind() { @@ -149,103 +151,103 @@ if (Constant *LC = dyn_cast(LHS)) if (Constant *RC = dyn_cast(RHS)) return ConstantExpr::getAdd(LC, RC); - return Insert(BinaryOperator::CreateAdd(LHS, RHS, Name)); + return Insert(BinaryOperator::CreateAdd(LHS, RHS), Name); } Value *CreateSub(Value *LHS, Value *RHS, const char *Name = "") { if (Constant *LC = dyn_cast(LHS)) if (Constant *RC = dyn_cast(RHS)) return ConstantExpr::getSub(LC, RC); - return Insert(BinaryOperator::CreateSub(LHS, RHS, Name)); + return Insert(BinaryOperator::CreateSub(LHS, RHS), Name); } Value *CreateMul(Value *LHS, Value *RHS, const char *Name = "") { if (Constant *LC = dyn_cast(LHS)) if (Constant *RC = dyn_cast(RHS)) return ConstantExpr::getMul(LC, RC); - return Insert(BinaryOperator::CreateMul(LHS, RHS, Name)); + return Insert(BinaryOperator::CreateMul(LHS, RHS), Name); } Value *CreateUDiv(Value *LHS, Value *RHS, const char *Name = "") { if (Constant *LC = dyn_cast(LHS)) if (Constant *RC = dyn_cast(RHS)) return ConstantExpr::getUDiv(LC, RC); - return Insert(BinaryOperator::CreateUDiv(LHS, RHS, Name)); + return Insert(BinaryOperator::CreateUDiv(LHS, RHS), Name); } Value *CreateSDiv(Value *LHS, Value *RHS, const char *Name = "") { if (Constant *LC = dyn_cast(LHS)) if (Constant *RC = dyn_cast(RHS)) return ConstantExpr::getSDiv(LC, RC); - return Insert(BinaryOperator::CreateSDiv(LHS, RHS, Name)); + return Insert(BinaryOperator::CreateSDiv(LHS, RHS), Name); } Value *CreateFDiv(Value *LHS, Value *RHS, const char *Name = "") { if (Constant *LC = dyn_cast(LHS)) if (Constant *RC = dyn_cast(RHS)) return ConstantExpr::getFDiv(LC, RC); - return Insert(BinaryOperator::CreateFDiv(LHS, RHS, Name)); + return Insert(BinaryOperator::CreateFDiv(LHS, RHS), Name); } Value *CreateURem(Value *LHS, Value *RHS, const char *Name = "") { if (Constant *LC = dyn_cast(LHS)) if (Constant *RC = dyn_cast(RHS)) return ConstantExpr::getURem(LC, RC); - return Insert(BinaryOperator::CreateURem(LHS, RHS, Name)); + return Insert(BinaryOperator::CreateURem(LHS, RHS), Name); } Value *CreateSRem(Value *LHS, Value *RHS, const char *Name = "") { if (Constant *LC = dyn_cast(LHS)) if (Constant *RC = dyn_cast(RHS)) return ConstantExpr::getSRem(LC, RC); - return Insert(BinaryOperator::CreateSRem(LHS, RHS, Name)); + return Insert(BinaryOperator::CreateSRem(LHS, RHS), Name); } Value *CreateFRem(Value *LHS, Value *RHS, const char *Name = "") { if (Constant *LC = dyn_cast(LHS)) if (Constant *RC = dyn_cast(RHS)) return ConstantExpr::getFRem(LC, RC); - return Insert(BinaryOperator::CreateFRem(LHS, RHS, Name)); + return Insert(BinaryOperator::CreateFRem(LHS, RHS), Name); } Value *CreateShl(Value *LHS, Value *RHS, const char *Name = "") { if (Constant *LC = dyn_cast(LHS)) if (Constant *RC = dyn_cast(RHS)) return ConstantExpr::getShl(LC, RC); - return Insert(BinaryOperator::CreateShl(LHS, RHS, Name)); + return Insert(BinaryOperator::CreateShl(LHS, RHS), Name); } Value *CreateLShr(Value *LHS, Value *RHS, const char *Name = "") { if (Constant *LC = dyn_cast(LHS)) if (Constant *RC = dyn_cast(RHS)) return ConstantExpr::getLShr(LC, RC); - return Insert(BinaryOperator::CreateLShr(LHS, RHS, Name)); + return Insert(BinaryOperator::CreateLShr(LHS, RHS), Name); } Value *CreateAShr(Value *LHS, Value *RHS, const char *Name = "") { if (Constant *LC = dyn_cast(LHS)) if (Constant *RC = dyn_cast(RHS)) return ConstantExpr::getAShr(LC, RC); - return Insert(BinaryOperator::CreateAShr(LHS, RHS, Name)); + return Insert(BinaryOperator::CreateAShr(LHS, RHS), Name); } Value *CreateAnd(Value *LHS, Value *RHS, const char *Name = "") { if (Constant *LC = dyn_cast(LHS)) if (Constant *RC = dyn_cast(RHS)) return ConstantExpr::getAnd(LC, RC); - return Insert(BinaryOperator::CreateAnd(LHS, RHS, Name)); + return Insert(BinaryOperator::CreateAnd(LHS, RHS), Name); } Value *CreateOr(Value *LHS, Value *RHS, const char *Name = "") { if (Constant *LC = dyn_cast(LHS)) if (Constant *RC = dyn_cast(RHS)) return ConstantExpr::getOr(LC, RC); - return Insert(BinaryOperator::CreateOr(LHS, RHS, Name)); + return Insert(BinaryOperator::CreateOr(LHS, RHS), Name); } Value *CreateXor(Value *LHS, Value *RHS, const char *Name = "") { if (Constant *LC = dyn_cast(LHS)) if (Constant *RC = dyn_cast(RHS)) return ConstantExpr::getXor(LC, RC); - return Insert(BinaryOperator::CreateXor(LHS, RHS, Name)); + return Insert(BinaryOperator::CreateXor(LHS, RHS), Name); } BinaryOperator *CreateBinOp(Instruction::BinaryOps Opc, Value *LHS, Value *RHS, const char *Name = "") { - return Insert(BinaryOperator::Create(Opc, LHS, RHS, Name)); + return Insert(BinaryOperator::Create(Opc, LHS, RHS), Name); } BinaryOperator *CreateNeg(Value *V, const char *Name = "") { - return Insert(BinaryOperator::CreateNeg(V, Name)); + return Insert(BinaryOperator::CreateNeg(V), Name); } BinaryOperator *CreateNot(Value *V, const char *Name = "") { - return Insert(BinaryOperator::CreateNot(V, Name)); + return Insert(BinaryOperator::CreateNot(V), Name); } //===--------------------------------------------------------------------===// @@ -254,11 +256,11 @@ MallocInst *CreateMalloc(const Type *Ty, Value *ArraySize = 0, const char *Name = "") { - return Insert(new MallocInst(Ty, ArraySize, Name)); + return Insert(new MallocInst(Ty, ArraySize), Name); } AllocaInst *CreateAlloca(const Type *Ty, Value *ArraySize = 0, const char *Name = "") { - return Insert(new AllocaInst(Ty, ArraySize, Name)); + return Insert(new AllocaInst(Ty, ArraySize), Name); } FreeInst *CreateFree(Value *Ptr) { return Insert(new FreeInst(Ptr)); @@ -284,15 +286,16 @@ break; } if (i == IdxEnd) - return ConstantExpr::getGetElementPtr(PC, &IdxBegin[0], IdxEnd - IdxBegin); + return ConstantExpr::getGetElementPtr(PC, &IdxBegin[0], + IdxEnd - IdxBegin); } - return(Insert(GetElementPtrInst::Create(Ptr, IdxBegin, IdxEnd, Name))); + return(Insert(GetElementPtrInst::Create(Ptr, IdxBegin, IdxEnd), Name)); } Value *CreateGEP(Value *Ptr, Value *Idx, const char *Name = "") { if (Constant *PC = dyn_cast(Ptr)) if (Constant *IC = dyn_cast(Idx)) return ConstantExpr::getGetElementPtr(PC, &IC, 1); - return Insert(GetElementPtrInst::Create(Ptr, Idx, Name)); + return Insert(GetElementPtrInst::Create(Ptr, Idx), Name); } Value *CreateStructGEP(Value *Ptr, unsigned Idx, const char *Name = "") { llvm::Value *Idxs[] = { @@ -303,7 +306,7 @@ if (Constant *PC = dyn_cast(Ptr)) return ConstantExpr::getGetElementPtr(PC, Idxs, 2); - return Insert(GetElementPtrInst::Create(Ptr, Idxs, Idxs+2, Name)); + return Insert(GetElementPtrInst::Create(Ptr, Idxs, Idxs+2), Name); } //===--------------------------------------------------------------------===// @@ -357,7 +360,7 @@ return V; if (Constant *VC = dyn_cast(V)) return ConstantExpr::getCast(Op, VC, DestTy); - return Insert(CastInst::Create(Op, V, DestTy, Name)); + return Insert(CastInst::Create(Op, V, DestTy), Name); } Value *CreateIntCast(Value *V, const Type *DestTy, bool isSigned, const char *Name = "") { @@ -365,7 +368,7 @@ return V; if (Constant *VC = dyn_cast(V)) return ConstantExpr::getIntegerCast(VC, DestTy, isSigned); - return Insert(CastInst::CreateIntegerCast(V, DestTy, isSigned, Name)); + return Insert(CastInst::CreateIntegerCast(V, DestTy, isSigned), Name); } //===--------------------------------------------------------------------===// @@ -451,14 +454,14 @@ if (Constant *LC = dyn_cast(LHS)) if (Constant *RC = dyn_cast(RHS)) return ConstantExpr::getCompare(P, LC, RC); - return Insert(new ICmpInst(P, LHS, RHS, Name)); + return Insert(new ICmpInst(P, LHS, RHS), Name); } Value *CreateFCmp(CmpInst::Predicate P, Value *LHS, Value *RHS, const char *Name = "") { if (Constant *LC = dyn_cast(LHS)) if (Constant *RC = dyn_cast(RHS)) return ConstantExpr::getCompare(P, LC, RC); - return Insert(new FCmpInst(P, LHS, RHS, Name)); + return Insert(new FCmpInst(P, LHS, RHS), Name); } Value *CreateVICmp(CmpInst::Predicate P, Value *LHS, Value *RHS, @@ -466,14 +469,14 @@ if (Constant *LC = dyn_cast(LHS)) if (Constant *RC = dyn_cast(RHS)) return ConstantExpr::getCompare(P, LC, RC); - return Insert(new VICmpInst(P, LHS, RHS, Name)); + return Insert(new VICmpInst(P, LHS, RHS), Name); } Value *CreateVFCmp(CmpInst::Predicate P, Value *LHS, Value *RHS, const char *Name = "") { if (Constant *LC = dyn_cast(LHS)) if (Constant *RC = dyn_cast(RHS)) return ConstantExpr::getCompare(P, LC, RC); - return Insert(new VFCmpInst(P, LHS, RHS, Name)); + return Insert(new VFCmpInst(P, LHS, RHS), Name); } //===--------------------------------------------------------------------===// @@ -481,35 +484,35 @@ //===--------------------------------------------------------------------===// PHINode *CreatePHI(const Type *Ty, const char *Name = "") { - return Insert(PHINode::Create(Ty, Name)); + return Insert(PHINode::Create(Ty), Name); } CallInst *CreateCall(Value *Callee, const char *Name = "") { - return Insert(CallInst::Create(Callee, Name)); + return Insert(CallInst::Create(Callee), Name); } CallInst *CreateCall(Value *Callee, Value *Arg, const char *Name = "") { - return Insert(CallInst::Create(Callee, Arg, Name)); + return Insert(CallInst::Create(Callee, Arg), Name); } CallInst *CreateCall2(Value *Callee, Value *Arg1, Value *Arg2, const char *Name = "") { Value *Args[] = { Arg1, Arg2 }; - return Insert(CallInst::Create(Callee, Args, Args+2, Name)); + return Insert(CallInst::Create(Callee, Args, Args+2), Name); } CallInst *CreateCall3(Value *Callee, Value *Arg1, Value *Arg2, Value *Arg3, const char *Name = "") { Value *Args[] = { Arg1, Arg2, Arg3 }; - return Insert(CallInst::Create(Callee, Args, Args+3, Name)); + return Insert(CallInst::Create(Callee, Args, Args+3), Name); } CallInst *CreateCall4(Value *Callee, Value *Arg1, Value *Arg2, Value *Arg3, Value *Arg4, const char *Name = "") { Value *Args[] = { Arg1, Arg2, Arg3, Arg4 }; - return Insert(CallInst::Create(Callee, Args, Args+4, Name)); + return Insert(CallInst::Create(Callee, Args, Args+4), Name); } template CallInst *CreateCall(Value *Callee, InputIterator ArgBegin, InputIterator ArgEnd, const char *Name = "") { - return Insert(CallInst::Create(Callee, ArgBegin, ArgEnd, Name)); + return Insert(CallInst::Create(Callee, ArgBegin, ArgEnd), Name); } Value *CreateSelect(Value *C, Value *True, Value *False, @@ -518,11 +521,11 @@ if (Constant *TC = dyn_cast(True)) if (Constant *FC = dyn_cast(False)) return ConstantExpr::getSelect(CC, TC, FC); - return Insert(SelectInst::Create(C, True, False, Name)); + return Insert(SelectInst::Create(C, True, False), Name); } VAArgInst *CreateVAArg(Value *List, const Type *Ty, const char *Name = "") { - return Insert(new VAArgInst(List, Ty, Name)); + return Insert(new VAArgInst(List, Ty), Name); } Value *CreateExtractElement(Value *Vec, Value *Idx, @@ -530,7 +533,7 @@ if (Constant *VC = dyn_cast(Vec)) if (Constant *IC = dyn_cast(Idx)) return ConstantExpr::getExtractElement(VC, IC); - return Insert(new ExtractElementInst(Vec, Idx, Name)); + return Insert(new ExtractElementInst(Vec, Idx), Name); } Value *CreateInsertElement(Value *Vec, Value *NewElt, Value *Idx, @@ -539,7 +542,7 @@ if (Constant *NC = dyn_cast(NewElt)) if (Constant *IC = dyn_cast(Idx)) return ConstantExpr::getInsertElement(VC, NC, IC); - return Insert(InsertElementInst::Create(Vec, NewElt, Idx, Name)); + return Insert(InsertElementInst::Create(Vec, NewElt, Idx), Name); } Value *CreateShuffleVector(Value *V1, Value *V2, Value *Mask, @@ -548,7 +551,7 @@ if (Constant *V2C = dyn_cast(V2)) if (Constant *MC = dyn_cast(Mask)) return ConstantExpr::getShuffleVector(V1C, V2C, MC); - return Insert(new ShuffleVectorInst(V1, V2, Mask, Name)); + return Insert(new ShuffleVectorInst(V1, V2, Mask), Name); } }; From bruno.cardoso at gmail.com Fri Jun 27 14:05:49 2008 From: bruno.cardoso at gmail.com (Bruno Cardoso Lopes) Date: Fri, 27 Jun 2008 16:05:49 -0300 Subject: [llvm-commits] [llvm-gcc] [PATCH] psp allegrex support Message-ID: <275e64e40806271205g5a3bef98n4418589f3b97a415@mail.gmail.com> Enable cross compiling for allegrex. This patched is based on the pspdev gcc 4.2 port. -- Bruno Cardoso Lopes http://www.brunocardoso.cc "When faced with untenable alternatives, you should consider your imperative." From bruno.cardoso at gmail.com Fri Jun 27 14:06:27 2008 From: bruno.cardoso at gmail.com (Bruno Cardoso Lopes) Date: Fri, 27 Jun 2008 16:06:27 -0300 Subject: [llvm-commits] [llvm-gcc] [PATCH] psp allegrex support In-Reply-To: <275e64e40806271205g5a3bef98n4418589f3b97a415@mail.gmail.com> References: <275e64e40806271205g5a3bef98n4418589f3b97a415@mail.gmail.com> Message-ID: <275e64e40806271206u48935983y817593a594437c9e@mail.gmail.com> the patch... On Fri, Jun 27, 2008 at 4:05 PM, Bruno Cardoso Lopes wrote: > Enable cross compiling for allegrex. > This patched is based on the pspdev gcc 4.2 port. > > -- > Bruno Cardoso Lopes > http://www.brunocardoso.cc > "When faced with untenable alternatives, you > should consider your imperative." > -- Bruno Cardoso Lopes http://www.brunocardoso.cc "When faced with untenable alternatives, you should consider your imperative." -------------- next part -------------- A non-text attachment was scrubbed... Name: allegrex.patch Type: application/octet-stream Size: 4568 bytes Desc: not available Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20080627/16dede6c/attachment.obj From clattner at apple.com Fri Jun 27 14:30:50 2008 From: clattner at apple.com (Chris Lattner) Date: Fri, 27 Jun 2008 12:30:50 -0700 Subject: [llvm-commits] [llvm-gcc] [PATCH] psp allegrex support In-Reply-To: <275e64e40806271206u48935983y817593a594437c9e@mail.gmail.com> References: <275e64e40806271205g5a3bef98n4418589f3b97a415@mail.gmail.com> <275e64e40806271206u48935983y817593a594437c9e@mail.gmail.com> Message-ID: <6D59F959-FA2B-4033-BE1E-ED421E833D7D@apple.com> On Jun 27, 2008, at 12:06 PM, Bruno Cardoso Lopes wrote: > the patch... Hi Bruno, Is this patch GPLv2? If not, is there an older version of the patch that you can get? -Chris > > > On Fri, Jun 27, 2008 at 4:05 PM, Bruno Cardoso Lopes > wrote: >> Enable cross compiling for allegrex. >> This patched is based on the pspdev gcc 4.2 port. >> >> -- >> Bruno Cardoso Lopes >> http://www.brunocardoso.cc >> "When faced with untenable alternatives, you >> should consider your imperative." >> > > > > -- > Bruno Cardoso Lopes > http://www.brunocardoso.cc > "When faced with untenable alternatives, you > should consider your imperative." > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From sabre at nondot.org Fri Jun 27 15:58:30 2008 From: sabre at nondot.org (Chris Lattner) Date: Fri, 27 Jun 2008 15:58:30 -0500 Subject: [llvm-commits] CVS: llvm-www/pubs/2008-09-LadyVM.html 2008-09-LadyVM.pdf index.html Message-ID: <200806272058.m5RKwUka009256@zion.cs.uiuc.edu> Changes in directory llvm-www/pubs: 2008-09-LadyVM.html added (r1.1) 2008-09-LadyVM.pdf added (r1.1) index.html updated: 1.76 -> 1.77 --- Log message: Add a new paper. --- Diffs of the changes: (+57 -0) 2008-09-LadyVM.html | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++ 2008-09-LadyVM.pdf | 0 index.html | 6 ++++++ 3 files changed, 57 insertions(+) Index: llvm-www/pubs/2008-09-LadyVM.html diff -c /dev/null llvm-www/pubs/2008-09-LadyVM.html:1.1 *** /dev/null Fri Jun 27 15:57:37 2008 --- llvm-www/pubs/2008-09-LadyVM.html Fri Jun 27 15:57:26 2008 *************** *** 0 **** --- 1,51 ---- + + + + + + A Lazy Developer Approach: Building a JVM with Third Party Software + + + +
    + A Lazy Developer Approach: Building a JVM with Third Party Software +
    +
    + Nicolas Geoffray, Gael Thomas, Charles Clement and Bertil Folliot +
    + +

    Abstract:

    +
    + The development of a complete Java Virtual Machine (JVM) + implementation is a tedious process which involves knowledge in different + areas: garbage collection, just in time compilation, interpretation, file + parsing, data structures, etc. The result is that developing its own virtual + machine requires a considerable amount of man/year. In this paper we show that + one can implement a JVM with third party software and with performance + comparable to industrial and top open-source JVMs. Our proof-of-concept + implementation uses existing versions of a garbage collector, a just in + time compiler, and the base library, and is robust enough to + execute complex Java applications such as the OSGi Felix + implementation and the Tomcat servlet container. + +
    + +

    Bibtex:

    +
    + @inproceedings{geoffray08ladyvm,
    +         author = {N. Geoffray  and G. Thomas and C. Cl\'ement and B. Folliot},
    +         title = { A Lazy Developer Approach: Building a JVM with Third Party Software }, 
    +         booktitle = {{International Conference on Principles and Practice of Programming In Java (PPPJ 2008)  }}, 
    +         year = {2008},
    +         address = {Modena, Italy},
    +         month = {September},
    + }
    + 
    + +

    Download:

    + + + + Index: llvm-www/pubs/2008-09-LadyVM.pdf Index: llvm-www/pubs/index.html diff -u llvm-www/pubs/index.html:1.76 llvm-www/pubs/index.html:1.77 --- llvm-www/pubs/index.html:1.76 Tue May 20 01:47:22 2008 +++ llvm-www/pubs/index.html Fri Jun 27 15:57:27 2008 @@ -3,6 +3,12 @@
      +
    1. "A Lazy Developer Approach: +Building a JVM with Third Party Software"
      +Nicolas Geoffray, Gael Thomas, Charles Clement and Bertil Folliot
      +Proc. International Conference on Principles and Practice of Programming +In Java (PPPJ 2008), September 2008
    2. +
    3. "Automatic Data Partitioning in Software Transactional Memories"
      Torvald Riegel, Christof Fetzer, and Pascal Felber
      From sabre at nondot.org Fri Jun 27 15:59:52 2008 From: sabre at nondot.org (Chris Lattner) Date: Fri, 27 Jun 2008 15:59:52 -0500 Subject: [llvm-commits] CVS: llvm-www/pubs/2008-09-LadyVM.html Message-ID: <200806272059.m5RKxq33009326@zion.cs.uiuc.edu> Changes in directory llvm-www/pubs: 2008-09-LadyVM.html updated: 1.1 -> 1.2 --- Log message: fix link --- Diffs of the changes: (+1 -1) 2008-09-LadyVM.html | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm-www/pubs/2008-09-LadyVM.html diff -u llvm-www/pubs/2008-09-LadyVM.html:1.1 llvm-www/pubs/2008-09-LadyVM.html:1.2 --- llvm-www/pubs/2008-09-LadyVM.html:1.1 Fri Jun 27 15:57:26 2008 +++ llvm-www/pubs/2008-09-LadyVM.html Fri Jun 27 15:59:34 2008 @@ -44,7 +44,7 @@

      Download:

      From bruno.cardoso at gmail.com Fri Jun 27 16:05:34 2008 From: bruno.cardoso at gmail.com (Bruno Cardoso Lopes) Date: Fri, 27 Jun 2008 18:05:34 -0300 Subject: [llvm-commits] [llvm-gcc] [PATCH] psp allegrex support In-Reply-To: <6D59F959-FA2B-4033-BE1E-ED421E833D7D@apple.com> References: <275e64e40806271205g5a3bef98n4418589f3b97a415@mail.gmail.com> <275e64e40806271206u48935983y817593a594437c9e@mail.gmail.com> <6D59F959-FA2B-4033-BE1E-ED421E833D7D@apple.com> Message-ID: <275e64e40806271405n15bc821bk41d6fe7f438442ee@mail.gmail.com> Hi Chris, > Is this patch GPLv2? If not, is there an older version of the patch > that you can get? Since the original version is applied to gcc-4.1.0 and that version is GPLv2 I believe the patch is GPLv2 too. Also, the only file from the patch (psp.h) that explicitly contains a license, is licensed under GPLv2. Btw, the files were retrieved from the homebrew devel group (pspdev), not from Sony, and the patches they applied, they did it directly to a gcc source from fsf. What do you think, it is ok to commit? Or we need some kind of more strictly assurance ? -- Bruno Cardoso Lopes http://www.brunocardoso.cc "When faced with untenable alternatives, you should consider your imperative." From sabre at nondot.org Fri Jun 27 16:09:11 2008 From: sabre at nondot.org (Chris Lattner) Date: Fri, 27 Jun 2008 21:09:11 -0000 Subject: [llvm-commits] [llvm] r52834 - in /llvm/trunk: include/llvm/Module.h include/llvm/ValueSymbolTable.h lib/VMCore/Module.cpp lib/VMCore/ValueSymbolTable.cpp Message-ID: <200806272109.m5RL9Bq8009730@zion.cs.uiuc.edu> Author: lattner Date: Fri Jun 27 16:09:10 2008 New Revision: 52834 URL: http://llvm.org/viewvc/llvm-project?rev=52834&view=rev Log: Add a new version of Module::getFunction that takes a const char* instead of a std::string. This avoids copying the string to the heap in common cases. Patch by Pratik Solanki! Modified: llvm/trunk/include/llvm/Module.h llvm/trunk/include/llvm/ValueSymbolTable.h llvm/trunk/lib/VMCore/Module.cpp llvm/trunk/lib/VMCore/ValueSymbolTable.cpp Modified: llvm/trunk/include/llvm/Module.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Module.h?rev=52834&r1=52833&r2=52834&view=diff ============================================================================== --- llvm/trunk/include/llvm/Module.h (original) +++ llvm/trunk/include/llvm/Module.h Fri Jun 27 16:09:10 2008 @@ -209,6 +209,7 @@ /// getFunction - Look up the specified function in the module symbol table. /// If it does not exist, return null. Function *getFunction(const std::string &Name) const; + Function *getFunction(const char *Name) const; /// @} /// @name Global Variable Accessors Modified: llvm/trunk/include/llvm/ValueSymbolTable.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ValueSymbolTable.h?rev=52834&r1=52833&r2=52834&view=diff ============================================================================== --- llvm/trunk/include/llvm/ValueSymbolTable.h (original) +++ llvm/trunk/include/llvm/ValueSymbolTable.h Fri Jun 27 16:09:10 2008 @@ -67,6 +67,7 @@ /// @returns the value associated with the \p name /// @brief Lookup a named Value. Value *lookup(const std::string &name) const; + Value *lookup(const char *NameBegin, const char *NameEnd) const; /// @returns true iff the symbol table is empty /// @brief Determine if the symbol table is empty Modified: llvm/trunk/lib/VMCore/Module.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Module.cpp?rev=52834&r1=52833&r2=52834&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/Module.cpp (original) +++ llvm/trunk/lib/VMCore/Module.cpp Fri Jun 27 16:09:10 2008 @@ -201,6 +201,11 @@ return dyn_cast_or_null(SymTab.lookup(Name)); } +Function *Module::getFunction(const char *Name) const { + const ValueSymbolTable &SymTab = getValueSymbolTable(); + return dyn_cast_or_null(SymTab.lookup(Name, Name+strlen(Name))); +} + //===----------------------------------------------------------------------===// // Methods for easy access to the global variables in the module. // Modified: llvm/trunk/lib/VMCore/ValueSymbolTable.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/ValueSymbolTable.cpp?rev=52834&r1=52833&r2=52834&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/ValueSymbolTable.cpp (original) +++ llvm/trunk/lib/VMCore/ValueSymbolTable.cpp Fri Jun 27 16:09:10 2008 @@ -54,6 +54,14 @@ return 0; } +Value *ValueSymbolTable::lookup(const char *NameBegin, + const char *NameEnd) const { + const_iterator VI = vmap.find(NameBegin, NameEnd); + if (VI != vmap.end()) // We found the symbol + return VI->getValue(); + return 0; +} + // Insert a value into the symbol table with the specified name... // void ValueSymbolTable::reinsertValue(Value* V) { From sabre at nondot.org Fri Jun 27 16:15:25 2008 From: sabre at nondot.org (Chris Lattner) Date: Fri, 27 Jun 2008 21:15:25 -0000 Subject: [llvm-commits] [llvm] r52835 - /llvm/trunk/include/llvm/Value.h Message-ID: <200806272115.m5RLFPTi009971@zion.cs.uiuc.edu> Author: lattner Date: Fri Jun 27 16:15:25 2008 New Revision: 52835 URL: http://llvm.org/viewvc/llvm-project?rev=52835&view=rev Log: add a helper. Modified: llvm/trunk/include/llvm/Value.h Modified: llvm/trunk/include/llvm/Value.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Value.h?rev=52835&r1=52834&r2=52835&view=diff ============================================================================== --- llvm/trunk/include/llvm/Value.h (original) +++ llvm/trunk/include/llvm/Value.h Fri Jun 27 16:15:25 2008 @@ -93,6 +93,8 @@ /// Note that names can have null characters within the string as well as at /// their end. This always returns a non-null pointer. const char *getNameStart() const; + /// getNameEnd - Return a pointer to the end of the name. + const char *getNameEnd() const { return getNameStart() + getNameLen(); } /// isName - Return true if this value has the name specified by the provided /// nul terminated string. From asl at math.spbu.ru Fri Jun 27 16:22:50 2008 From: asl at math.spbu.ru (Anton Korobeynikov) Date: Fri, 27 Jun 2008 21:22:50 -0000 Subject: [llvm-commits] [llvm] r52836 - in /llvm/trunk/lib/Target/X86: X86AsmPrinter.cpp X86AsmPrinter.h X86IntelAsmPrinter.cpp Message-ID: <200806272122.m5RLMoNx010206@zion.cs.uiuc.edu> Author: asl Date: Fri Jun 27 16:22:49 2008 New Revision: 52836 URL: http://llvm.org/viewvc/llvm-project?rev=52836&view=rev Log: Use StringSet instead of std::set Modified: llvm/trunk/lib/Target/X86/X86AsmPrinter.cpp llvm/trunk/lib/Target/X86/X86AsmPrinter.h llvm/trunk/lib/Target/X86/X86IntelAsmPrinter.cpp Modified: llvm/trunk/lib/Target/X86/X86AsmPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86AsmPrinter.cpp?rev=52836&r1=52835&r2=52836&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86AsmPrinter.cpp (original) +++ llvm/trunk/lib/Target/X86/X86AsmPrinter.cpp Fri Jun 27 16:22:49 2008 @@ -368,32 +368,32 @@ SwitchToDataSection(".section .drectve"); } - for (std::set::iterator i = DLLExportedGVs.begin(), + for (StringSet<>::iterator i = DLLExportedGVs.begin(), e = DLLExportedGVs.end(); i != e; ++i) { - O << "\t.ascii \" -export:" << *i << ",data\"\n"; - } + O << "\t.ascii \" -export:" << i->getKeyData() << ",data\"\n"; + } if (!DLLExportedFns.empty()) { SwitchToDataSection(".section .drectve"); } - for (std::set::iterator i = DLLExportedFns.begin(), + for (StringSet<>::iterator i = DLLExportedFns.begin(), e = DLLExportedFns.end(); i != e; ++i) { - O << "\t.ascii \" -export:" << *i << "\"\n"; - } + O << "\t.ascii \" -export:" << i->getKeyData() << "\"\n"; + } if (Subtarget->isTargetDarwin()) { SwitchToDataSection(""); // Output stubs for dynamically-linked functions unsigned j = 1; - for (std::set::iterator i = FnStubs.begin(), e = FnStubs.end(); + for (StringSet<>::iterator i = FnStubs.begin(), e = FnStubs.end(); i != e; ++i, ++j) { SwitchToDataSection("\t.section __IMPORT,__jump_table,symbol_stubs," "self_modifying_code+pure_instructions,5", 0); - std::string p = *i; + std::string p = i->getKeyData(); printSuffixedName(p, "$stub"); O << ":\n"; O << "\t.indirect_symbol " << p << "\n"; @@ -416,9 +416,9 @@ if (!GVStubs.empty()) SwitchToDataSection( "\t.section __IMPORT,__pointers,non_lazy_symbol_pointers"); - for (std::set::iterator i = GVStubs.begin(), e = GVStubs.end(); + for (StringSet<>::iterator i = GVStubs.begin(), e = GVStubs.end(); i != e; ++i) { - std::string p = *i; + std::string p = i->getKeyData(); printSuffixedName(p, "$non_lazy_ptr"); O << ":\n"; O << "\t.indirect_symbol " << p << "\n"; @@ -436,16 +436,16 @@ O << "\t.subsections_via_symbols\n"; } else if (Subtarget->isTargetCygMing()) { // Emit type information for external functions - for (std::set::iterator i = FnStubs.begin(), e = FnStubs.end(); + for (StringSet<>::iterator i = FnStubs.begin(), e = FnStubs.end(); i != e; ++i) { - O << "\t.def\t " << *i + O << "\t.def\t " << i->getKeyData() << ";\t.scl\t" << COFF::C_EXT << ";\t.type\t" << (COFF::DT_FCN << COFF::N_BTSHFT) << ";\t.endef\n"; } - + // Emit final debug information. - DW.EndModule(); + DW.EndModule(); } else if (Subtarget->isTargetELF()) { // Emit final debug information. DW.EndModule(); Modified: llvm/trunk/lib/Target/X86/X86AsmPrinter.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86AsmPrinter.h?rev=52836&r1=52835&r2=52836&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86AsmPrinter.h (original) +++ llvm/trunk/lib/Target/X86/X86AsmPrinter.h Fri Jun 27 16:22:49 2008 @@ -19,12 +19,11 @@ #include "X86.h" #include "X86MachineFunctionInfo.h" #include "X86TargetMachine.h" +#include "llvm/ADT/StringSet.h" #include "llvm/CodeGen/AsmPrinter.h" #include "llvm/CodeGen/DwarfWriter.h" #include "llvm/CodeGen/MachineModuleInfo.h" #include "llvm/Support/Compiler.h" -#include - namespace llvm { @@ -70,10 +69,10 @@ const X86Subtarget *Subtarget; // Necessary for Darwin to print out the apprioriate types of linker stubs - std::set FnStubs, GVStubs, LinkOnceStubs; + StringSet<> FnStubs, GVStubs, LinkOnceStubs; // Necessary for dllexport support - std::set DLLExportedFns, DLLExportedGVs; + StringSet<> DLLExportedFns, DLLExportedGVs; inline static bool isScale(const MachineOperand &MO) { return MO.isImmediate() && Modified: llvm/trunk/lib/Target/X86/X86IntelAsmPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86IntelAsmPrinter.cpp?rev=52836&r1=52835&r2=52836&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86IntelAsmPrinter.cpp (original) +++ llvm/trunk/lib/Target/X86/X86IntelAsmPrinter.cpp Fri Jun 27 16:22:49 2008 @@ -425,23 +425,23 @@ O << "_drectve\t segment info alias('.drectve')\n"; } - for (std::set::iterator i = DLLExportedGVs.begin(), + for (StringSet<>::iterator i = DLLExportedGVs.begin(), e = DLLExportedGVs.end(); i != e; ++i) { - O << "\t db ' /EXPORT:" << *i << ",data'\n"; - } + O << "\t db ' /EXPORT:" << i->getKeyData() << ",data'\n"; + } - for (std::set::iterator i = DLLExportedFns.begin(), + for (StringSet<>::iterator i = DLLExportedFns.begin(), e = DLLExportedFns.end(); i != e; ++i) { - O << "\t db ' /EXPORT:" << *i << "'\n"; - } + O << "\t db ' /EXPORT:" << i->getKeyData() << "'\n"; + } if (!DLLExportedGVs.empty() || !DLLExportedFns.empty()) { - O << "_drectve\t ends\n"; + O << "_drectve\t ends\n"; } - + // Bypass X86SharedAsmPrinter::doFinalization(). bool Result = AsmPrinter::doFinalization(M); SwitchToDataSection(""); From sabre at nondot.org Fri Jun 27 16:25:24 2008 From: sabre at nondot.org (Chris Lattner) Date: Fri, 27 Jun 2008 21:25:24 -0000 Subject: [llvm-commits] [llvm] r52837 - /llvm/trunk/lib/VMCore/Module.cpp Message-ID: <200806272125.m5RLPOrx010295@zion.cs.uiuc.edu> Author: lattner Date: Fri Jun 27 16:25:24 2008 New Revision: 52837 URL: http://llvm.org/viewvc/llvm-project?rev=52837&view=rev Log: simplify some code to avoid string thrashing. Modified: llvm/trunk/lib/VMCore/Module.cpp Modified: llvm/trunk/lib/VMCore/Module.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Module.cpp?rev=52837&r1=52836&r2=52837&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/Module.cpp (original) +++ llvm/trunk/lib/VMCore/Module.cpp Fri Jun 27 16:25:24 2008 @@ -156,10 +156,12 @@ // Okay, the function exists. Does it have externally visible linkage? if (F->hasInternalLinkage()) { - // Rename the function. - F->setName(SymTab.getUniqueName(F->getName())); + // Clear the function's name. + F->setName(""); // Retry, now there won't be a conflict. - return getOrInsertFunction(Name, Ty); + Constant *NewF = getOrInsertFunction(Name, Ty); + F->setName(&Name[0], Name.size()); + return NewF; } // If the function exists but has the wrong type, return a bitcast to the From sabre at nondot.org Fri Jun 27 16:26:26 2008 From: sabre at nondot.org (Chris Lattner) Date: Fri, 27 Jun 2008 21:26:26 -0000 Subject: [llvm-commits] [llvm] r52838 - in /llvm/trunk: include/llvm/ValueSymbolTable.h lib/VMCore/ValueSymbolTable.cpp Message-ID: <200806272126.m5RLQQ4B010330@zion.cs.uiuc.edu> Author: lattner Date: Fri Jun 27 16:26:26 2008 New Revision: 52838 URL: http://llvm.org/viewvc/llvm-project?rev=52838&view=rev Log: implement some fixme's by making "autorenaming" in the value symbol table not thrash the heap with string stuff (e.g. utostr). Modified: llvm/trunk/include/llvm/ValueSymbolTable.h llvm/trunk/lib/VMCore/ValueSymbolTable.cpp Modified: llvm/trunk/include/llvm/ValueSymbolTable.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ValueSymbolTable.h?rev=52838&r1=52837&r2=52838&view=diff ============================================================================== --- llvm/trunk/include/llvm/ValueSymbolTable.h (original) +++ llvm/trunk/include/llvm/ValueSymbolTable.h Fri Jun 27 16:26:26 2008 @@ -76,12 +76,6 @@ /// @brief The number of name/type pairs is returned. inline unsigned size() const { return unsigned(vmap.size()); } - /// Given a base name, return a string that is either equal to it or - /// derived from it that does not already occur in the symbol table - /// for the specified type. - /// @brief Get a name unique to this symbol table - std::string getUniqueName(const std::string &BaseName) const; - /// This function can be used from the debugger to display the /// content of the symbol table while debugging. /// @brief Print out symbol table on stderr Modified: llvm/trunk/lib/VMCore/ValueSymbolTable.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/ValueSymbolTable.cpp?rev=52838&r1=52837&r2=52838&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/ValueSymbolTable.cpp (original) +++ llvm/trunk/lib/VMCore/ValueSymbolTable.cpp Fri Jun 27 16:26:26 2008 @@ -15,7 +15,7 @@ #include "llvm/GlobalValue.h" #include "llvm/Type.h" #include "llvm/ValueSymbolTable.h" -#include "llvm/ADT/StringExtras.h" +#include "llvm/ADT/SmallString.h" #include "llvm/Support/Debug.h" using namespace llvm; @@ -30,21 +30,6 @@ #endif } -// getUniqueName - Given a base name, return a string that is either equal to -// it (or derived from it) that does not already occur in the symbol table for -// the specified type. -// -std::string ValueSymbolTable::getUniqueName(const std::string &BaseName) const { - std::string TryName = BaseName; - - // See if the name exists - while (vmap.find(&TryName[0], &TryName[TryName.size()]) != vmap.end()) - // Loop until we find a free name in the symbol table. - TryName = BaseName + utostr(++LastUnique); - return TryName; -} - - // lookup a value - Returns null on failure... // Value *ValueSymbolTable::lookup(const std::string &Name) const { @@ -73,18 +58,17 @@ return; } - // FIXME: this could be much more efficient. - // Otherwise, there is a naming conflict. Rename this value. - std::string UniqueName = V->getName(); - + SmallString<128> UniqueName(V->getNameStart(), V->getNameEnd()); + + // The name is too already used, just free it so we can allocate a new name. V->Name->Destroy(); unsigned BaseSize = UniqueName.size(); while (1) { // Trim any suffix off. UniqueName.resize(BaseSize); - UniqueName += utostr(++LastUnique); + UniqueName.append_uint_32(++LastUnique); // Try insert the vmap entry with this suffix. ValueName &NewName = vmap.GetOrCreateValue(&UniqueName[0], &UniqueName[UniqueName.size()]); @@ -100,7 +84,7 @@ void ValueSymbolTable::removeValueName(ValueName *V) { //DEBUG(DOUT << " Removing Value: " << V->getKeyData() << "\n"); - // Remove the value from the plane. + // Remove the value from the symbol table. vmap.remove(V); } @@ -109,6 +93,7 @@ /// auto-renames the name and returns that instead. ValueName *ValueSymbolTable::createValueName(const char *NameStart, unsigned NameLen, Value *V) { + // In the common case, the name is not already in the symbol table. ValueName &Entry = vmap.GetOrCreateValue(NameStart, NameStart+NameLen); if (Entry.getValue() == 0) { Entry.setValue(V); @@ -117,14 +102,14 @@ return &Entry; } - // FIXME: this could be much more efficient. - // Otherwise, there is a naming conflict. Rename this value. - std::string UniqueName(NameStart, NameStart+NameLen); + SmallString<128> UniqueName(NameStart, NameStart+NameLen); + while (1) { // Trim any suffix off. UniqueName.resize(NameLen); - UniqueName += utostr(++LastUnique); + UniqueName.append_uint_32(++LastUnique); + // Try insert the vmap entry with this suffix. ValueName &NewName = vmap.GetOrCreateValue(&UniqueName[0], &UniqueName[UniqueName.size()]); From resistor at mac.com Fri Jun 27 16:48:21 2008 From: resistor at mac.com (Owen Anderson) Date: Fri, 27 Jun 2008 21:48:21 -0000 Subject: [llvm-commits] [llvm] r52839 - /llvm/trunk/include/llvm/Support/MathExtras.h Message-ID: <200806272148.m5RLmLuh010925@zion.cs.uiuc.edu> Author: resistor Date: Fri Jun 27 16:48:21 2008 New Revision: 52839 URL: http://llvm.org/viewvc/llvm-project?rev=52839&view=rev Log: Add a NextPowerOf2 function to calculate the next power of two greater than a given integer. Modified: llvm/trunk/include/llvm/Support/MathExtras.h Modified: llvm/trunk/include/llvm/Support/MathExtras.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/MathExtras.h?rev=52839&r1=52838&r2=52839&view=diff ============================================================================== --- llvm/trunk/include/llvm/Support/MathExtras.h (original) +++ llvm/trunk/include/llvm/Support/MathExtras.h Fri Jun 27 16:48:21 2008 @@ -396,6 +396,18 @@ // The largest power of 2 that divides both A and B. return (A | B) & -(A | B); } + +/// NextPowerOf2 - Returns the next power of two (in 64-bits) +/// that is strictly greater than A. Returns zero on overflow. +static inline uint64_t NextPowerOf2(uint64_t A) { + A |= (A >> 1); + A |= (A >> 2); + A |= (A >> 4); + A |= (A >> 8); + A |= (A >> 16); + A |= (A >> 32); + return A + 1; +} } // End llvm namespace From echristo at apple.com Fri Jun 27 17:05:51 2008 From: echristo at apple.com (Eric Christopher) Date: Fri, 27 Jun 2008 15:05:51 -0700 Subject: [llvm-commits] [llvm-gcc] [PATCH] psp allegrex support In-Reply-To: <275e64e40806271206u48935983y817593a594437c9e@mail.gmail.com> References: <275e64e40806271205g5a3bef98n4418589f3b97a415@mail.gmail.com> <275e64e40806271206u48935983y817593a594437c9e@mail.gmail.com> Message-ID: On Jun 27, 2008, at 12:06 PM, Bruno Cardoso Lopes wrote: > +mipsallegrex-*-elf* | mipsallegrexel-*-elf*) Why not just mipsallegrex*? + tm_defines="MIPS_ISA_DEFAULT=2 MIPS_CPU_STRING_DEFAULT=\\\"allegrex\\ \" MIPS_ABI_DEFAULT=ABI_EABI" you want: tm_defines="${tm_defines} ...." - mips-*-*) echo mips;; \ - mipsel-*-*) echo mipsel;; \ + mips*el-*-*) echo mipsel;; \ + mips*-*-*) echo mips;; \ If this change is needed then something is wrong. +++ gcc/config/mips/t-allegrex (revision 0) You could just require --disable-multilibs and use t-elf, but that's not a big deal. +#undef SUBTARGET_CPP_SPEC +#define SUBTARGET_CPP_SPEC "-DPSP=1 -D__psp__=1 -D_PSP=1" This needs to go into TARGET_CPU_CPP_BUILTINS(). You also need to define a PROCESSOR_TYPE and mask for the processor. That will make any other defines you need in the backend much easier to deal with (and enable you to do the above bits). -eric From evan.cheng at apple.com Fri Jun 27 17:11:49 2008 From: evan.cheng at apple.com (Evan Cheng) Date: Fri, 27 Jun 2008 22:11:49 -0000 Subject: [llvm-commits] [llvm] r52841 - /llvm/trunk/lib/CodeGen/MachineInstr.cpp Message-ID: <200806272211.m5RMBnpj011876@zion.cs.uiuc.edu> Author: evancheng Date: Fri Jun 27 17:11:49 2008 New Revision: 52841 URL: http://llvm.org/viewvc/llvm-project?rev=52841&view=rev Log: Looks like this condition is inverted. Modified: llvm/trunk/lib/CodeGen/MachineInstr.cpp Modified: llvm/trunk/lib/CodeGen/MachineInstr.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachineInstr.cpp?rev=52841&r1=52840&r2=52841&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/MachineInstr.cpp (original) +++ llvm/trunk/lib/CodeGen/MachineInstr.cpp Fri Jun 27 17:11:49 2008 @@ -780,7 +780,7 @@ const TargetRegisterInfo *RegInfo, bool AddIfNotFound) { bool isPhysReg = TargetRegisterInfo::isPhysicalRegister(IncomingReg); - bool hasAliases = isPhysReg && RegInfo->getAliasSet(IncomingReg) == 0; + bool hasAliases = isPhysReg && RegInfo->getAliasSet(IncomingReg); bool Found = false; SmallVector DeadOps; for (unsigned i = 0, e = getNumOperands(); i != e; ++i) { @@ -792,7 +792,7 @@ MO.setIsDead(); Found = true; } else if (hasAliases && MO.isDead() && - TargetRegisterInfo::isPhysicalRegister(Reg)) { + TargetRegisterInfo::isPhysicalRegister(Reg)) { // There exists a super-register that's marked dead. if (RegInfo->isSuperRegister(IncomingReg, Reg)) Found = true; From kremenek at apple.com Fri Jun 27 17:12:54 2008 From: kremenek at apple.com (Ted Kremenek) Date: Fri, 27 Jun 2008 22:12:54 -0000 Subject: [llvm-commits] [llvm] r52842 - /llvm/tags/checker/checker-47/ Message-ID: <200806272212.m5RMCskB011916@zion.cs.uiuc.edu> Author: kremenek Date: Fri Jun 27 17:12:54 2008 New Revision: 52842 URL: http://llvm.org/viewvc/llvm-project?rev=52842&view=rev Log: Tagging checker-47. Added: llvm/tags/checker/checker-47/ - copied from r52841, llvm/trunk/ From clattner at apple.com Fri Jun 27 17:25:19 2008 From: clattner at apple.com (Chris Lattner) Date: Fri, 27 Jun 2008 15:25:19 -0700 Subject: [llvm-commits] [llvm-gcc] [PATCH] psp allegrex support In-Reply-To: <275e64e40806271405n15bc821bk41d6fe7f438442ee@mail.gmail.com> References: <275e64e40806271205g5a3bef98n4418589f3b97a415@mail.gmail.com> <275e64e40806271206u48935983y817593a594437c9e@mail.gmail.com> <6D59F959-FA2B-4033-BE1E-ED421E833D7D@apple.com> <275e64e40806271405n15bc821bk41d6fe7f438442ee@mail.gmail.com> Message-ID: On Jun 27, 2008, at 2:05 PM, Bruno Cardoso Lopes wrote: > Hi Chris, > >> Is this patch GPLv2? If not, is there an older version of the patch >> that you can get? > > Since the original version is applied to gcc-4.1.0 and that version > is GPLv2 > I believe the patch is GPLv2 too. Not necessarily. Are there differences between the two patches? Please find a version that came from a GPL2 source tree and forward port that if necessary. I'm sorry for being insistent, but this is "important". > Also, the only file from the patch (psp.h) that explicitly contains a > license, is licensed > under GPLv2. > Btw, the files were retrieved from the homebrew devel group > (pspdev), not > from Sony, and the patches they applied, they did it directly to a > gcc source from fsf. > What do you think, it is ok to commit? Or we need some kind of more > strictly > assurance ? Can you give me a pointer to where you got the patches? -Chris From dalej at apple.com Fri Jun 27 17:29:47 2008 From: dalej at apple.com (Dale Johannesen) Date: Fri, 27 Jun 2008 22:29:47 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r52845 - in /llvm-gcc-4.2/trunk/gcc: llvm-types.cpp llvm.h objc/objc-act.c Message-ID: <200806272229.m5RMTlMI012403@zion.cs.uiuc.edu> Author: johannes Date: Fri Jun 27 17:29:47 2008 New Revision: 52845 URL: http://llvm.org/viewvc/llvm-project?rev=52845&view=rev Log: Remove some dead code (fully reverts 50276). Modified: llvm-gcc-4.2/trunk/gcc/llvm-types.cpp llvm-gcc-4.2/trunk/gcc/llvm.h llvm-gcc-4.2/trunk/gcc/objc/objc-act.c Modified: llvm-gcc-4.2/trunk/gcc/llvm-types.cpp URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-types.cpp?rev=52845&r1=52844&r2=52845&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/llvm-types.cpp (original) +++ llvm-gcc-4.2/trunk/gcc/llvm-types.cpp Fri Jun 27 17:29:47 2008 @@ -46,10 +46,6 @@ } #include "llvm-abi.h" -void llvm_compute_type(tree X) { - ConvertType(X); -} - //===----------------------------------------------------------------------===// // Matching LLVM types with GCC trees //===----------------------------------------------------------------------===// Modified: llvm-gcc-4.2/trunk/gcc/llvm.h URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm.h?rev=52845&r1=52844&r2=52845&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/llvm.h (original) +++ llvm-gcc-4.2/trunk/gcc/llvm.h Fri Jun 27 17:29:47 2008 @@ -49,12 +49,6 @@ */ void reset_type_and_initializer_llvm(union tree_node*); -/* llvm_compute_type - Compute the LLVM type for the specified tree type eagerly - * instead of letting it happen lazily. - */ -void llvm_compute_type(union tree_node*); - - /* reset_initializer_llvm - Change the initializer for a global variable. */ void reset_initializer_llvm(union tree_node*); 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=52845&r1=52844&r2=52845&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/objc/objc-act.c (original) +++ llvm-gcc-4.2/trunk/gcc/objc/objc-act.c Fri Jun 27 17:29:47 2008 @@ -8633,22 +8633,6 @@ /* APPLE LOCAL begin ObjC new abi */ if (flag_objc_abi == 2) CLASS_TYPE (class) = record; - - /* APPLE LOCAL llvm begin */ -#if 0 -#ifdef ENABLE_LLVM - /* Synthesized properties will later be added to this RECORD_DECL as they - * are found in @implementations. We don't want the LLVM tree->llvm - * converter to see these newly added properties, so we emulate the RTL - * backend and analyze the type eagerly in this case. It would be better - * for the ObjC front-end to not add these properties to the RECORD_DECL - * but that would be a large/invasive change. rdar://5812818 - */ - if (flag_objc_abi == 2) - llvm_compute_type(record); -#endif -#endif - /* APPLE LOCAL llvm end */ } } /* APPLE LOCAL end ObjC new abi */ From sanxiyn at gmail.com Fri Jun 27 17:55:30 2008 From: sanxiyn at gmail.com (Seo Sanghyeon) Date: Fri, 27 Jun 2008 22:55:30 -0000 Subject: [llvm-commits] [llvm] r52847 - /llvm/trunk/lib/System/Unix/Path.inc Message-ID: <200806272255.m5RMtUev013215@zion.cs.uiuc.edu> Author: sanxiyn Date: Fri Jun 27 17:55:30 2008 New Revision: 52847 URL: http://llvm.org/viewvc/llvm-project?rev=52847&view=rev Log: Fix GetMainExecutable. Patch by Sam Bishop. Modified: llvm/trunk/lib/System/Unix/Path.inc Modified: llvm/trunk/lib/System/Unix/Path.inc URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/System/Unix/Path.inc?rev=52847&r1=52846&r2=52847&view=diff ============================================================================== --- llvm/trunk/lib/System/Unix/Path.inc (original) +++ llvm/trunk/lib/System/Unix/Path.inc Fri Jun 27 17:55:30 2008 @@ -263,11 +263,9 @@ /// GetMainExecutable - Return the path to the main executable, given the /// value of argv[0] from program startup. Path Path::GetMainExecutable(const char *argv0, void *MainAddr) { -#if defined(__CYGWIN__) - char exe_link[64]; - snprintf(exe_link, sizeof(exe_link), "/proc/%d/exe", getpid()); +#if defined(__linux__) || defined(__CYGWIN__) char exe_path[MAXPATHLEN]; - ssize_t len = readlink(exe_link, exe_path, sizeof(exe_path)); + ssize_t len = readlink("/proc/self/exe", exe_path, sizeof(exe_path)); if (len > 0 && len < MAXPATHLEN - 1) { exe_path[len] = '\0'; return Path(std::string(exe_path)); From clattner at apple.com Fri Jun 27 18:16:11 2008 From: clattner at apple.com (Chris Lattner) Date: Fri, 27 Jun 2008 16:16:11 -0700 Subject: [llvm-commits] [llvm] r52800 - in /llvm/trunk: include/llvm/CodeGen/MachineDebugInfoDesc.h include/llvm/CodeGen/MachineModuleInfo.h lib/CodeGen/DwarfWriter.cpp lib/CodeGen/MachineDebugInfoDesc.cpp lib/CodeGen/MachineModuleInfo.cpp lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp lib/VMCore/IntrinsicInst.cpp In-Reply-To: <200806270009.m5R09erk023373@zion.cs.uiuc.edu> References: <200806270009.m5R09erk023373@zion.cs.uiuc.edu> Message-ID: <27FFFA69-E9FA-4110-8B76-621A3F366456@apple.com> On Jun 26, 2008, at 5:09 PM, Bill Wendling wrote: > Log: > Refactor the DebugInfoDesc stuff out of the MachineModuleInfo file. > Clean up > some uses of std::vector, where it's return std::vector by value. > Yuck! Nice, much better. One request: when making a big reorganization change like this, it is vastly preferred to move the code without changing it at all. Because you committed the move with the vector change, it is impossible to review the vector change. Can you see if there are files #including MachineModuleInfo.h that can change to #include MachineDebugInfo.h instead? > @@ -0,0 +1,706 @@ > +//===-- llvm/CodeGen/MachineDebugInfoDesc.h ---------------------*- > C++ -*-===// How about just MachineDebugInfo.h? > +// > = > = > = > ----------------------------------------------------------------------= > ==// > +// > +// > +// > +// > = > = > = > ----------------------------------------------------------------------= > ==// What does this do? > > + > +#ifndef LLVM_CODEGEN_MACHINEDEBUGINFODESC_H > +#define LLVM_CODEGEN_MACHINEDEBUGINFODESC_H > + > +#include "llvm/GlobalValue.h" Is it possible to just extern the classes that are used? > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/include/llvm/CodeGen/MachineModuleInfo.h (original) > +++ llvm/trunk/include/llvm/CodeGen/MachineModuleInfo.h Thu Jun 26 > 19:09:40 2008 > @@ -31,18 +31,20 @@ > #ifndef LLVM_CODEGEN_MACHINEMODULEINFO_H > #define LLVM_CODEGEN_MACHINEMODULEINFO_H > > #include "llvm/GlobalValue.h" > #include "llvm/Pass.h" > +#include "llvm/ADT/SmallPtrSet.h" > +#include "llvm/ADT/SmallVector.h" > +#include "llvm/ADT/UniqueVector.h" > +#include "llvm/Support/DataTypes.h" > +#include "llvm/Support/Dwarf.h" Does this header depend on MachineDebugInfo.h? If so, it should #include it. > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/lib/CodeGen/DwarfWriter.cpp (original) > +++ llvm/trunk/lib/CodeGen/DwarfWriter.cpp Thu Jun 26 19:09:40 2008 > @@ -20,6 +20,7 @@ > #include "llvm/Module.h" > #include "llvm/Type.h" > #include "llvm/CodeGen/AsmPrinter.h" > +#include "llvm/CodeGen/MachineDebugInfoDesc.h" > #include "llvm/CodeGen/MachineModuleInfo.h" Are these headers really independent of each other? Thanks for tackling this Bill! -Chris From isanbard at gmail.com Fri Jun 27 18:41:46 2008 From: isanbard at gmail.com (Bill Wendling) Date: Fri, 27 Jun 2008 16:41:46 -0700 Subject: [llvm-commits] [llvm] r52800 - in /llvm/trunk: include/llvm/CodeGen/MachineDebugInfoDesc.h include/llvm/CodeGen/MachineModuleInfo.h lib/CodeGen/DwarfWriter.cpp lib/CodeGen/MachineDebugInfoDesc.cpp lib/CodeGen/MachineModuleInfo.cpp lib/CodeGen/Sel Message-ID: <16e5fdf90806271641v44eaaf81t114d6c8a68150582@mail.gmail.com> On Fri, Jun 27, 2008 at 4:16 PM, Chris Lattner wrote: > On Jun 26, 2008, at 5:09 PM, Bill Wendling wrote: >> Log: >> Refactor the DebugInfoDesc stuff out of the MachineModuleInfo file. >> Clean up >> some uses of std::vector, where it's return std::vector by value. >> Yuck! > > Nice, much better. One request: when making a big reorganization > change like this, it is vastly preferred to move the code without > changing it at all. Because you committed the move with the vector > change, it is impossible to review the vector change. > Sorry... > Can you see if there are files #including MachineModuleInfo.h that can > change to #include MachineDebugInfo.h instead? > >> @@ -0,0 +1,706 @@ >> +//===-- llvm/CodeGen/MachineDebugInfoDesc.h ---------------------*- >> C++ -*-===// > > How about just MachineDebugInfo.h? > I'm separating out other stuff into that file. >> +// >> = >> = >> = >> ----------------------------------------------------------------------= >> ==// >> +// >> +// >> +// >> +// >> = >> = >> = >> ----------------------------------------------------------------------= >> ==// > > What does this do? > Nothing! ;-) Um, I'll come up with a comment... >> +#ifndef LLVM_CODEGEN_MACHINEDEBUGINFODESC_H >> +#define LLVM_CODEGEN_MACHINEDEBUGINFODESC_H >> + >> +#include "llvm/GlobalValue.h" > > Is it possible to just extern the classes that are used? > It's using the GlobalValue::LinkageTypes enum. I suppose I could make it an unsigned int instead? >> --- llvm/trunk/include/llvm/CodeGen/MachineModuleInfo.h (original) >> +++ llvm/trunk/include/llvm/CodeGen/MachineModuleInfo.h Thu Jun 26 >> 19:09:40 2008 >> @@ -31,18 +31,20 @@ >> #ifndef LLVM_CODEGEN_MACHINEMODULEINFO_H >> #define LLVM_CODEGEN_MACHINEMODULEINFO_H >> >> #include "llvm/GlobalValue.h" >> #include "llvm/Pass.h" >> +#include "llvm/ADT/SmallPtrSet.h" >> +#include "llvm/ADT/SmallVector.h" >> +#include "llvm/ADT/UniqueVector.h" >> +#include "llvm/Support/DataTypes.h" >> +#include "llvm/Support/Dwarf.h" > > Does this header depend on MachineDebugInfo.h? If so, it should > #include it. > No. >> --- llvm/trunk/lib/CodeGen/DwarfWriter.cpp (original) >> +++ llvm/trunk/lib/CodeGen/DwarfWriter.cpp Thu Jun 26 19:09:40 2008 >> @@ -20,6 +20,7 @@ >> #include "llvm/Module.h" >> #include "llvm/Type.h" >> #include "llvm/CodeGen/AsmPrinter.h" >> +#include "llvm/CodeGen/MachineDebugInfoDesc.h" >> #include "llvm/CodeGen/MachineModuleInfo.h" > > Are these headers really independent of each other? > Yes. -bw From clattner at apple.com Fri Jun 27 18:59:28 2008 From: clattner at apple.com (Chris Lattner) Date: Fri, 27 Jun 2008 16:59:28 -0700 Subject: [llvm-commits] [llvm] r52800 - in /llvm/trunk: include/llvm/CodeGen/MachineDebugInfoDesc.h include/llvm/CodeGen/MachineModuleInfo.h lib/CodeGen/DwarfWriter.cpp lib/CodeGen/MachineDebugInfoDesc.cpp lib/CodeGen/MachineModuleInfo.cpp lib/CodeGen/Sel In-Reply-To: <16e5fdf90806271641v44eaaf81t114d6c8a68150582@mail.gmail.com> References: <16e5fdf90806271641v44eaaf81t114d6c8a68150582@mail.gmail.com> Message-ID: <8E7AA8BE-2FB8-41EA-9377-A4905A6510C6@apple.com> >>> >>> @@ -0,0 +1,706 @@ >>> +//===-- llvm/CodeGen/MachineDebugInfoDesc.h ---------------------*- >>> C++ -*-===// >> >> How about just MachineDebugInfo.h? >> > I'm separating out other stuff into that file. Ok >>> +#include "llvm/GlobalValue.h" >> >> Is it possible to just extern the classes that are used? >> > It's using the GlobalValue::LinkageTypes enum. I suppose I could make > it an unsigned int instead? I think unsigned int is best here. >> Are these headers really independent of each other? >> > Yes. ok! -Chris From gohman at apple.com Fri Jun 27 19:45:22 2008 From: gohman at apple.com (Dan Gohman) Date: Sat, 28 Jun 2008 00:45:22 -0000 Subject: [llvm-commits] [llvm] r52849 - /llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Message-ID: <200806280045.m5S0jM20016297@zion.cs.uiuc.edu> Author: djg Date: Fri Jun 27 19:45:22 2008 New Revision: 52849 URL: http://llvm.org/viewvc/llvm-project?rev=52849&view=rev Log: When folding a bitcast into a load or store, preserve the alignment information of the original load or store, which is checked to be at least as good, and possibly better. Modified: llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Modified: llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp?rev=52849&r1=52848&r2=52849&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Fri Jun 27 19:45:22 2008 @@ -3445,7 +3445,7 @@ if (Align <= OrigAlign) { SDOperand Load = DAG.getLoad(VT, LN0->getChain(), LN0->getBasePtr(), LN0->getSrcValue(), LN0->getSrcValueOffset(), - LN0->isVolatile(), Align); + LN0->isVolatile(), OrigAlign); AddToWorkList(N); CombineTo(N0.Val, DAG.getNode(ISD::BIT_CONVERT, N0.getValueType(), Load), Load.getValue(1)); @@ -4547,7 +4547,7 @@ ((!AfterLegalize && !ST->isVolatile()) || TLI.isOperationLegal(ISD::STORE, SVT))) return DAG.getStore(Chain, Value.getOperand(0), Ptr, ST->getSrcValue(), - ST->getSrcValueOffset(), ST->isVolatile(), Align); + ST->getSrcValueOffset(), ST->isVolatile(), OrigAlign); } // Turn 'store float 1.0, Ptr' -> 'store int 0x12345678, Ptr' From sabre at nondot.org Fri Jun 27 23:37:05 2008 From: sabre at nondot.org (Chris Lattner) Date: Sat, 28 Jun 2008 04:37:05 -0000 Subject: [llvm-commits] [llvm] r52850 - /llvm/trunk/lib/Analysis/ValueTracking.cpp Message-ID: <200806280437.m5S4b5et022361@zion.cs.uiuc.edu> Author: lattner Date: Fri Jun 27 23:37:04 2008 New Revision: 52850 URL: http://llvm.org/viewvc/llvm-project?rev=52850&view=rev Log: Tighten up checking. Modified: llvm/trunk/lib/Analysis/ValueTracking.cpp Modified: llvm/trunk/lib/Analysis/ValueTracking.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/ValueTracking.cpp?rev=52850&r1=52849&r2=52850&view=diff ============================================================================== --- llvm/trunk/lib/Analysis/ValueTracking.cpp (original) +++ llvm/trunk/lib/Analysis/ValueTracking.cpp Fri Jun 27 23:37:04 2008 @@ -950,6 +950,8 @@ if (GetElementPtrInst *GEPI = dyn_cast(V)) { GEP = GEPI; } else if (ConstantExpr *CE = dyn_cast(V)) { + if (CE->getOpcode() == Instruction::BitCast) + return GetConstantStringInfo(CE->getOperand(0), Str, Offset); if (CE->getOpcode() != Instruction::GetElementPtr) return false; GEP = CE; @@ -960,12 +962,16 @@ if (GEP->getNumOperands() != 3) return false; + // Make sure the index-ee is a pointer to array of i8. + const PointerType *PT = cast(GEP->getOperand(0)->getType()); + const ArrayType *AT = dyn_cast(PT->getElementType()); + if (AT == 0 || AT->getElementType() != Type::Int8Ty) + return false; + // Check to make sure that the first operand of the GEP is an integer and // has value 0 so that we are sure we're indexing into the initializer. - if (ConstantInt *Idx = dyn_cast(GEP->getOperand(1))) { - if (!Idx->isZero()) - return false; - } else + ConstantInt *FirstIdx = dyn_cast(GEP->getOperand(1)); + if (FirstIdx == 0 || !FirstIdx->isZero()) return false; // If the second index isn't a ConstantInt, then this is a variable index From sabre at nondot.org Sat Jun 28 00:33:32 2008 From: sabre at nondot.org (Chris Lattner) Date: Sat, 28 Jun 2008 05:33:32 -0000 Subject: [llvm-commits] [llvm] r52851 - in /llvm/trunk: include/llvm/Analysis/ValueTracking.h lib/Analysis/ValueTracking.cpp lib/CodeGen/SelectionDAG/SelectionDAG.cpp Message-ID: <200806280533.m5S5XWMJ024036@zion.cs.uiuc.edu> Author: lattner Date: Sat Jun 28 00:33:32 2008 New Revision: 52851 URL: http://llvm.org/viewvc/llvm-project?rev=52851&view=rev Log: Add back the capability to include nul characters in strings with GetConstantStringInfo. This will hopefully restore llvm-gcc to happy bootstrap land. Modified: llvm/trunk/include/llvm/Analysis/ValueTracking.h llvm/trunk/lib/Analysis/ValueTracking.cpp llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Modified: llvm/trunk/include/llvm/Analysis/ValueTracking.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/ValueTracking.h?rev=52851&r1=52850&r2=52851&view=diff ============================================================================== --- llvm/trunk/include/llvm/Analysis/ValueTracking.h (original) +++ llvm/trunk/include/llvm/Analysis/ValueTracking.h Sat Jun 28 00:33:32 2008 @@ -76,8 +76,12 @@ /// GetConstantStringInfo - This function computes the length of a /// null-terminated C string pointed to by V. If successful, it returns true - /// and returns the string in Str. If unsuccessful, it returns false. - bool GetConstantStringInfo(Value *V, std::string &Str, uint64_t Offset = 0); + /// and returns the string in Str. If unsuccessful, it returns false. If + /// StopAtNul is set to true (the default), the returned string is truncated + /// by a nul character in the global. If StopAtNul is false, the nul + /// character is included in the result string. + bool GetConstantStringInfo(Value *V, std::string &Str, uint64_t Offset = 0, + bool StopAtNul = true); } // end namespace llvm #endif Modified: llvm/trunk/lib/Analysis/ValueTracking.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/ValueTracking.cpp?rev=52851&r1=52850&r2=52851&view=diff ============================================================================== --- llvm/trunk/lib/Analysis/ValueTracking.cpp (original) +++ llvm/trunk/lib/Analysis/ValueTracking.cpp Sat Jun 28 00:33:32 2008 @@ -935,13 +935,14 @@ /// GetConstantStringInfo - This function computes the length of a /// null-terminated C string pointed to by V. If successful, it returns true /// and returns the string in Str. If unsuccessful, it returns false. -bool llvm::GetConstantStringInfo(Value *V, std::string &Str, uint64_t Offset) { +bool llvm::GetConstantStringInfo(Value *V, std::string &Str, uint64_t Offset, + bool StopAtNul) { // If V is NULL then return false; if (V == NULL) return false; // Look through bitcast instructions. if (BitCastInst *BCI = dyn_cast(V)) - return GetConstantStringInfo(BCI->getOperand(0), Str, Offset); + return GetConstantStringInfo(BCI->getOperand(0), Str, Offset, StopAtNul); // If the value is not a GEP instruction nor a constant expression with a // GEP instruction, then return false because ConstantArray can't occur @@ -951,7 +952,7 @@ GEP = GEPI; } else if (ConstantExpr *CE = dyn_cast(V)) { if (CE->getOpcode() == Instruction::BitCast) - return GetConstantStringInfo(CE->getOperand(0), Str, Offset); + return GetConstantStringInfo(CE->getOperand(0), Str, Offset, StopAtNul); if (CE->getOpcode() != Instruction::GetElementPtr) return false; GEP = CE; @@ -982,7 +983,8 @@ StartIdx = CI->getZExtValue(); else return false; - return GetConstantStringInfo(GEP->getOperand(0), Str, StartIdx+Offset); + return GetConstantStringInfo(GEP->getOperand(0), Str, StartIdx+Offset, + StopAtNul); } // The GEP instruction, constant or instruction, must reference a global @@ -1020,7 +1022,7 @@ ConstantInt *CI = dyn_cast(Elt); if (!CI) // This array isn't suitable, non-int initializer. return false; - if (CI->isZero()) + if (StopAtNul && CI->isZero()) return true; // we found end of string, success! Str += (char)CI->getZExtValue(); } Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp?rev=52851&r1=52850&r2=52851&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Sat Jun 28 00:33:32 2008 @@ -2594,7 +2594,7 @@ return false; GlobalVariable *GV = dyn_cast(G->getGlobal()); - if (GV && GetConstantStringInfo(GV, Str)) { + if (GV && GetConstantStringInfo(GV, Str, SrcDelta, false)) { SrcOff += SrcDelta; return true; } From sabre at nondot.org Sat Jun 28 01:24:51 2008 From: sabre at nondot.org (Chris Lattner) Date: Sat, 28 Jun 2008 06:24:51 -0000 Subject: [llvm-commits] [llvm] r52854 - /llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Message-ID: <200806280624.m5S6OpPs025870@zion.cs.uiuc.edu> Author: lattner Date: Sat Jun 28 01:24:50 2008 New Revision: 52854 URL: http://llvm.org/viewvc/llvm-project?rev=52854&view=rev Log: Really fix the bootstrap failure. Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp?rev=52854&r1=52853&r2=52854&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Sat Jun 28 01:24:50 2008 @@ -2578,8 +2578,7 @@ /// isMemSrcFromString - Returns true if memcpy source is a string constant. /// -static bool isMemSrcFromString(SDOperand Src, std::string &Str, - uint64_t &SrcOff) { +static bool isMemSrcFromString(SDOperand Src, std::string &Str) { unsigned SrcDelta = 0; GlobalAddressSDNode *G = NULL; if (Src.getOpcode() == ISD::GlobalAddress) @@ -2594,10 +2593,8 @@ return false; GlobalVariable *GV = dyn_cast(G->getGlobal()); - if (GV && GetConstantStringInfo(GV, Str, SrcDelta, false)) { - SrcOff += SrcDelta; + if (GV && GetConstantStringInfo(GV, Str, SrcDelta, false)) return true; - } return false; } @@ -2614,8 +2611,7 @@ bool AllowUnalign = TLI.allowsUnalignedMemoryAccesses(); std::string Str; - uint64_t SrcOff = 0; - bool isSrcStr = isMemSrcFromString(Src, Str, SrcOff); + bool isSrcStr = isMemSrcFromString(Src, Str); bool isSrcConst = isa(Src); MVT VT= TLI.getOptimalMemOpType(Size, Align, isSrcConst, isSrcStr); if (VT != MVT::iAny) { @@ -2710,11 +2706,11 @@ return SDOperand(); std::string Str; - uint64_t SrcOff = 0, DstOff = 0; - bool CopyFromStr = isMemSrcFromString(Src, Str, SrcOff); + bool CopyFromStr = isMemSrcFromString(Src, Str); SmallVector OutChains; unsigned NumMemOps = MemOps.size(); + uint64_t SrcOff = 0, DstOff = 0; for (unsigned i = 0; i < NumMemOps; i++) { MVT VT = MemOps[i]; unsigned VTSize = VT.getSizeInBits() / 8; From bruno.cardoso at gmail.com Sat Jun 28 02:07:56 2008 From: bruno.cardoso at gmail.com (Bruno Cardoso Lopes) Date: Sat, 28 Jun 2008 04:07:56 -0300 Subject: [llvm-commits] [llvm-gcc] [PATCH] psp allegrex support In-Reply-To: References: <275e64e40806271205g5a3bef98n4418589f3b97a415@mail.gmail.com> <275e64e40806271206u48935983y817593a594437c9e@mail.gmail.com> Message-ID: <275e64e40806280007i5ced438cja2e11874883d3763@mail.gmail.com> Hi Eric, Nice to have your point of view. I got everything from the homebrew toolchain, but your way seems cleaner, i'll get it done. :) >> > > +mipsallegrex-*-elf* | mipsallegrexel-*-elf*) > > Why not just mipsallegrex*? > > + tm_defines="MIPS_ISA_DEFAULT=2 MIPS_CPU_STRING_DEFAULT=\\\"allegrex\\ > \" MIPS_ABI_DEFAULT=ABI_EABI" > > you want: > > tm_defines="${tm_defines} ...." > > - mips-*-*) echo mips;; \ > - mipsel-*-*) echo mipsel;; \ > + mips*el-*-*) echo mipsel;; \ > + mips*-*-*) echo mips;; \ > > If this change is needed then something is wrong. > > +++ gcc/config/mips/t-allegrex (revision 0) > > You could just require --disable-multilibs and use t-elf, but that's > not a big deal. > > +#undef SUBTARGET_CPP_SPEC > +#define SUBTARGET_CPP_SPEC "-DPSP=1 -D__psp__=1 -D_PSP=1" > > This needs to go into TARGET_CPU_CPP_BUILTINS(). > > You also need to define a PROCESSOR_TYPE and mask for the processor. > That will make any other defines you need in the backend much easier > to deal with (and enable you to do the above bits). -- Bruno Cardoso Lopes http://www.brunocardoso.cc "When faced with untenable alternatives, you should consider your imperative." From bruno.cardoso at gmail.com Sat Jun 28 02:11:48 2008 From: bruno.cardoso at gmail.com (Bruno Cardoso Lopes) Date: Sat, 28 Jun 2008 04:11:48 -0300 Subject: [llvm-commits] [llvm-gcc] [PATCH] psp allegrex support In-Reply-To: References: <275e64e40806271205g5a3bef98n4418589f3b97a415@mail.gmail.com> <275e64e40806271206u48935983y817593a594437c9e@mail.gmail.com> <6D59F959-FA2B-4033-BE1E-ED421E833D7D@apple.com> <275e64e40806271405n15bc821bk41d6fe7f438442ee@mail.gmail.com> Message-ID: <275e64e40806280011u70341c5cr69865580f98e4e91@mail.gmail.com> On Fri, Jun 27, 2008 at 7:25 PM, Chris Lattner wrote: > > On Jun 27, 2008, at 2:05 PM, Bruno Cardoso Lopes wrote: > >> Hi Chris, >> >>> Is this patch GPLv2? If not, is there an older version of the patch >>> that you can get? >> >> Since the original version is applied to gcc-4.1.0 and that version >> is GPLv2 >> I believe the patch is GPLv2 too. > > Not necessarily. Are there differences between the two patches? > Please find a version that came from a GPL2 source tree and forward > port that if necessary. I'm sorry for being insistent, but this is > "important". Yeah, you're right :) > >> Also, the only file from the patch (psp.h) that explicitly contains a >> license, is licensed >> under GPLv2. >> Btw, the files were retrieved from the homebrew devel group >> (pspdev), not >> from Sony, and the patches they applied, they did it directly to a >> gcc source from fsf. >> What do you think, it is ok to commit? Or we need some kind of more >> strictly >> assurance ? > > Can you give me a pointer to where you got the patches? svn.ps2dev.org/psp/trunk/psptoolchain They basically download the gcc 4.1 from fsf and apply their patches, but there is nothing about their patch license. -- Bruno Cardoso Lopes http://www.brunocardoso.cc "When faced with untenable alternatives, you should consider your imperative." From bruno.cardoso at gmail.com Sat Jun 28 02:21:11 2008 From: bruno.cardoso at gmail.com (Bruno Cardoso Lopes) Date: Sat, 28 Jun 2008 04:21:11 -0300 Subject: [llvm-commits] [llvm-gcc] [PATCH] psp allegrex support In-Reply-To: <275e64e40806280011u70341c5cr69865580f98e4e91@mail.gmail.com> References: <275e64e40806271205g5a3bef98n4418589f3b97a415@mail.gmail.com> <275e64e40806271206u48935983y817593a594437c9e@mail.gmail.com> <6D59F959-FA2B-4033-BE1E-ED421E833D7D@apple.com> <275e64e40806271405n15bc821bk41d6fe7f438442ee@mail.gmail.com> <275e64e40806280011u70341c5cr69865580f98e4e91@mail.gmail.com> Message-ID: <275e64e40806280021h497d4844i6d4545af38e500f0@mail.gmail.com> > svn.ps2dev.org/psp/trunk/psptoolchain > They basically download the gcc 4.1 from fsf and apply their patches, but > there is nothing about their patch license. By the environment, seems GPLv2 to me, what do you think? -- Bruno Cardoso Lopes http://www.brunocardoso.cc "When faced with untenable alternatives, you should consider your imperative." From asl at math.spbu.ru Sat Jun 28 05:55:26 2008 From: asl at math.spbu.ru (Anton Korobeynikov) Date: Sat, 28 Jun 2008 14:55:26 +0400 Subject: [llvm-commits] [llvm] r52854 - /llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp In-Reply-To: <200806280624.m5S6OpPs025870@zion.cs.uiuc.edu> References: <200806280624.m5S6OpPs025870@zion.cs.uiuc.edu> Message-ID: <1214650526.8922.53.camel@localhost> Hi, Chris > Really fix the bootstrap failure. TOT is still broken for me: Comparing stages 2 and 3 warning: ./cc1obj-checksum.o differs warning: ./cc1plus-checksum.o differs warning: ./cc1-checksum.o differs warning: ./cc1objplus-checksum.o differs Bootstrap comparison failure! ./i386.o differs -- With best regards, Anton Korobeynikov. Faculty of Mathematics & Mechanics, Saint Petersburg State University. From asl at math.spbu.ru Sat Jun 28 06:07:19 2008 From: asl at math.spbu.ru (Anton Korobeynikov) Date: Sat, 28 Jun 2008 11:07:19 -0000 Subject: [llvm-commits] [llvm] r52856 - /llvm/trunk/lib/Target/X86/X86IntelAsmPrinter.cpp Message-ID: <200806281107.m5SB7JOO012206@zion.cs.uiuc.edu> Author: asl Date: Sat Jun 28 06:07:18 2008 New Revision: 52856 URL: http://llvm.org/viewvc/llvm-project?rev=52856&view=rev Log: Whitespace cleanup Modified: llvm/trunk/lib/Target/X86/X86IntelAsmPrinter.cpp Modified: llvm/trunk/lib/Target/X86/X86IntelAsmPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86IntelAsmPrinter.cpp?rev=52856&r1=52855&r2=52856&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86IntelAsmPrinter.cpp (original) +++ llvm/trunk/lib/Target/X86/X86IntelAsmPrinter.cpp Sat Jun 28 06:07:18 2008 @@ -62,18 +62,18 @@ default: assert(0 && "Unsupported linkage type!"); case Function::InternalLinkage: EmitAlignment(FnAlign); - break; + break; case Function::DLLExportLinkage: DLLExportedFns.insert(CurrentFnName); //FALLS THROUGH case Function::ExternalLinkage: O << "\tpublic " << CurrentFnName << "\n"; EmitAlignment(FnAlign); - break; + break; } - + O << CurrentFnName << "\tproc near\n"; - + // Print out code for the function. for (MachineFunction::const_iterator I = MF.begin(), E = MF.end(); I != E; ++I) { @@ -113,10 +113,10 @@ } } -void X86IntelAsmPrinter::printOp(const MachineOperand &MO, +void X86IntelAsmPrinter::printOp(const MachineOperand &MO, const char *Modifier) { switch (MO.getType()) { - case MachineOperand::MO_Register: { + case MachineOperand::MO_Register: { if (TargetRegisterInfo::isPhysicalRegister(MO.getReg())) { unsigned Reg = MO.getReg(); if (Modifier && strncmp(Modifier, "subreg", strlen("subreg")) == 0) { @@ -142,7 +142,7 @@ O << TAI->getPrivateGlobalPrefix() << "JTI" << getFunctionNumber() << "_" << MO.getIndex(); return; - } + } case MachineOperand::MO_ConstantPoolIndex: { bool isMemOp = Modifier && !strcmp(Modifier, "mem"); if (!isMemOp) O << "OFFSET "; @@ -159,7 +159,7 @@ case MachineOperand::MO_GlobalAddress: { bool isCallOp = Modifier && !strcmp(Modifier, "call"); bool isMemOp = Modifier && !strcmp(Modifier, "mem"); - GlobalValue *GV = MO.getGlobal(); + GlobalValue *GV = MO.getGlobal(); std::string Name = Mang->getValueName(GV); X86SharedAsmPrinter::decorateName(Name, GV); @@ -168,8 +168,8 @@ if (GV->hasDLLImportLinkage()) { // FIXME: This should be fixed with full support of stdcall & fastcall // CC's - O << "__imp_"; - } + O << "__imp_"; + } O << Name; int Offset = MO.getOffset(); if (Offset > 0) @@ -235,11 +235,11 @@ O << "]"; } -void X86IntelAsmPrinter::printPICJumpTableSetLabel(unsigned uid, +void X86IntelAsmPrinter::printPICJumpTableSetLabel(unsigned uid, const MachineBasicBlock *MBB) const { if (!TAI->getSetDirective()) return; - + O << TAI->getSetDirective() << ' ' << TAI->getPrivateGlobalPrefix() << getFunctionNumber() << '_' << uid << "_set_" << MBB->getNumber() << ','; printBasicBlockLabel(MBB, false, false, false); @@ -277,12 +277,12 @@ /// PrintAsmOperand - Print out an operand for an inline asm expression. /// bool X86IntelAsmPrinter::PrintAsmOperand(const MachineInstr *MI, unsigned OpNo, - unsigned AsmVariant, + unsigned AsmVariant, const char *ExtraCode) { // Does this asm operand have a single letter operand modifier? if (ExtraCode && ExtraCode[0]) { if (ExtraCode[1] != 0) return true; // Unknown modifier. - + switch (ExtraCode[0]) { default: return true; // Unknown modifier. case 'b': // Print QImode register @@ -292,14 +292,14 @@ return printAsmMRegister(MI->getOperand(OpNo), ExtraCode[0]); } } - + printOperand(MI, OpNo); return false; } bool X86IntelAsmPrinter::PrintAsmMemoryOperand(const MachineInstr *MI, unsigned OpNo, - unsigned AsmVariant, + unsigned AsmVariant, const char *ExtraCode) { if (ExtraCode && ExtraCode[0]) return true; // Unknown modifier. @@ -319,7 +319,7 @@ bool X86IntelAsmPrinter::doInitialization(Module &M) { bool Result = X86SharedAsmPrinter::doInitialization(M); - + Mang->markCharUnacceptable('.'); O << "\t.686\n\t.model flat\n\n"; @@ -333,10 +333,10 @@ O << "\textern " ; if (I->hasDLLImportLinkage()) { O << "__imp_"; - } + } O << Name << ":near\n"; } - + // Emit declarations for external globals. Note that VC++ always declares // external globals to have type byte, and if that's good enough for VC++... for (Module::const_global_iterator I = M.global_begin(), E = M.global_end(); @@ -347,7 +347,7 @@ O << "\textern " ; if (I->hasDLLImportLinkage()) { O << "__imp_"; - } + } O << Name << ":byte\n"; } } @@ -362,11 +362,11 @@ for (Module::const_global_iterator I = M.global_begin(), E = M.global_end(); I != E; ++I) { if (I->isDeclaration()) continue; // External global require no code - + // Check to see if this is a special global used by LLVM, if so, emit it. if (EmitSpecialLLVMGlobal(I)) continue; - + std::string name = Mang->getValueName(I); Constant *C = I->getInitializer(); unsigned Align = TD->getPreferredAlignmentLog(I); From asl at math.spbu.ru Sat Jun 28 06:07:35 2008 From: asl at math.spbu.ru (Anton Korobeynikov) Date: Sat, 28 Jun 2008 11:07:35 -0000 Subject: [llvm-commits] [llvm] r52857 - /llvm/trunk/lib/Target/X86/X86IntelAsmPrinter.cpp Message-ID: <200806281107.m5SB7ZUQ012228@zion.cs.uiuc.edu> Author: asl Date: Sat Jun 28 06:07:35 2008 New Revision: 52857 URL: http://llvm.org/viewvc/llvm-project?rev=52857&view=rev Log: Cleanup Modified: llvm/trunk/lib/Target/X86/X86IntelAsmPrinter.cpp Modified: llvm/trunk/lib/Target/X86/X86IntelAsmPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86IntelAsmPrinter.cpp?rev=52857&r1=52856&r2=52857&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86IntelAsmPrinter.cpp (original) +++ llvm/trunk/lib/Target/X86/X86IntelAsmPrinter.cpp Sat Jun 28 06:07:35 2008 @@ -318,7 +318,7 @@ } bool X86IntelAsmPrinter::doInitialization(Module &M) { - bool Result = X86SharedAsmPrinter::doInitialization(M); + bool Result = AsmPrinter::doInitialization(M); Mang->markCharUnacceptable('.'); @@ -415,8 +415,7 @@ } // Output linker support code for dllexported globals - if (!DLLExportedGVs.empty() || - !DLLExportedFns.empty()) { + if (!DLLExportedGVs.empty() || !DLLExportedFns.empty()) { SwitchToDataSection(""); O << "; WARNING: The following code is valid only with MASM v8.x and (possible) higher\n" << "; This version of MASM is usually shipped with Microsoft Visual Studio 2005\n" @@ -427,20 +426,16 @@ for (StringSet<>::iterator i = DLLExportedGVs.begin(), e = DLLExportedGVs.end(); - i != e; ++i) { + i != e; ++i) O << "\t db ' /EXPORT:" << i->getKeyData() << ",data'\n"; - } for (StringSet<>::iterator i = DLLExportedFns.begin(), e = DLLExportedFns.end(); - i != e; ++i) { + i != e; ++i) O << "\t db ' /EXPORT:" << i->getKeyData() << "'\n"; - } - if (!DLLExportedGVs.empty() || - !DLLExportedFns.empty()) { + if (!DLLExportedGVs.empty() || !DLLExportedFns.empty()) O << "_drectve\t ends\n"; - } // Bypass X86SharedAsmPrinter::doFinalization(). bool Result = AsmPrinter::doFinalization(M); From asl at math.spbu.ru Sat Jun 28 06:07:54 2008 From: asl at math.spbu.ru (Anton Korobeynikov) Date: Sat, 28 Jun 2008 11:07:54 -0000 Subject: [llvm-commits] [llvm] r52858 - in /llvm/trunk/lib/Target/X86: X86AsmPrinter.h X86InstrInfo.h X86IntelAsmPrinter.cpp X86IntelAsmPrinter.h Message-ID: <200806281107.m5SB7sRb012253@zion.cs.uiuc.edu> Author: asl Date: Sat Jun 28 06:07:54 2008 New Revision: 52858 URL: http://llvm.org/viewvc/llvm-project?rev=52858&view=rev Log: Make intel asmprinter child of generic asmprinter, not x86 shared asm printer. This leads to some code duplication, which will be resolved later. Modified: llvm/trunk/lib/Target/X86/X86AsmPrinter.h llvm/trunk/lib/Target/X86/X86InstrInfo.h llvm/trunk/lib/Target/X86/X86IntelAsmPrinter.cpp llvm/trunk/lib/Target/X86/X86IntelAsmPrinter.h Modified: llvm/trunk/lib/Target/X86/X86AsmPrinter.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86AsmPrinter.h?rev=52858&r1=52857&r2=52858&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86AsmPrinter.h (original) +++ llvm/trunk/lib/Target/X86/X86AsmPrinter.h Sat Jun 28 06:07:54 2008 @@ -73,23 +73,6 @@ // Necessary for dllexport support StringSet<> DLLExportedFns, DLLExportedGVs; - - inline static bool isScale(const MachineOperand &MO) { - return MO.isImmediate() && - (MO.getImm() == 1 || MO.getImm() == 2 || - MO.getImm() == 4 || MO.getImm() == 8); - } - - inline static bool isMem(const MachineInstr *MI, unsigned Op) { - if (MI->getOperand(Op).isFrameIndex()) return true; - return Op+4 <= MI->getNumOperands() && - MI->getOperand(Op ).isRegister() && isScale(MI->getOperand(Op+1)) && - MI->getOperand(Op+2).isRegister() && - (MI->getOperand(Op+3).isImmediate() || - MI->getOperand(Op+3).isGlobalAddress() || - MI->getOperand(Op+3).isConstantPoolIndex() || - MI->getOperand(Op+3).isJumpTableIndex()); - } }; } // end namespace llvm Modified: llvm/trunk/lib/Target/X86/X86InstrInfo.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86InstrInfo.h?rev=52858&r1=52857&r2=52858&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86InstrInfo.h (original) +++ llvm/trunk/lib/Target/X86/X86InstrInfo.h Sat Jun 28 06:07:54 2008 @@ -227,6 +227,23 @@ }; } +inline static bool isScale(const MachineOperand &MO) { + return MO.isImmediate() && + (MO.getImm() == 1 || MO.getImm() == 2 || + MO.getImm() == 4 || MO.getImm() == 8); +} + +inline static bool isMem(const MachineInstr *MI, unsigned Op) { + if (MI->getOperand(Op).isFrameIndex()) return true; + return Op+4 <= MI->getNumOperands() && + MI->getOperand(Op ).isRegister() && isScale(MI->getOperand(Op+1)) && + MI->getOperand(Op+2).isRegister() && + (MI->getOperand(Op+3).isImmediate() || + MI->getOperand(Op+3).isGlobalAddress() || + MI->getOperand(Op+3).isConstantPoolIndex() || + MI->getOperand(Op+3).isJumpTableIndex()); +} + class X86InstrInfo : public TargetInstrInfoImpl { X86TargetMachine &TM; const X86RegisterInfo RI; Modified: llvm/trunk/lib/Target/X86/X86IntelAsmPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86IntelAsmPrinter.cpp?rev=52858&r1=52857&r2=52858&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86IntelAsmPrinter.cpp (original) +++ llvm/trunk/lib/Target/X86/X86IntelAsmPrinter.cpp Sat Jun 28 06:07:54 2008 @@ -15,20 +15,109 @@ #define DEBUG_TYPE "asm-printer" #include "X86IntelAsmPrinter.h" +#include "X86InstrInfo.h" #include "X86TargetAsmInfo.h" #include "X86.h" #include "llvm/CallingConv.h" #include "llvm/Constants.h" +#include "llvm/DerivedTypes.h" #include "llvm/Module.h" +#include "llvm/ADT/Statistic.h" +#include "llvm/ADT/StringExtras.h" #include "llvm/Assembly/Writer.h" #include "llvm/Support/Mangler.h" #include "llvm/Target/TargetAsmInfo.h" #include "llvm/Target/TargetOptions.h" -#include "llvm/ADT/Statistic.h" using namespace llvm; STATISTIC(EmittedInsts, "Number of machine instrs printed"); +static X86MachineFunctionInfo calculateFunctionInfo(const Function *F, + const TargetData *TD) { + X86MachineFunctionInfo Info; + uint64_t Size = 0; + + switch (F->getCallingConv()) { + case CallingConv::X86_StdCall: + Info.setDecorationStyle(StdCall); + break; + case CallingConv::X86_FastCall: + Info.setDecorationStyle(FastCall); + break; + default: + return Info; + } + + unsigned argNum = 1; + for (Function::const_arg_iterator AI = F->arg_begin(), AE = F->arg_end(); + AI != AE; ++AI, ++argNum) { + const Type* Ty = AI->getType(); + + // 'Dereference' type in case of byval parameter attribute + if (F->paramHasAttr(argNum, ParamAttr::ByVal)) + Ty = cast(Ty)->getElementType(); + + // Size should be aligned to DWORD boundary + Size += ((TD->getABITypeSize(Ty) + 3)/4)*4; + } + + // We're not supporting tooooo huge arguments :) + Info.setBytesToPopOnReturn((unsigned int)Size); + return Info; +} + + +/// decorateName - Query FunctionInfoMap and use this information for various +/// name decoration. +void X86IntelAsmPrinter::decorateName(std::string &Name, + const GlobalValue *GV) { + const Function *F = dyn_cast(GV); + if (!F) return; + + // We don't want to decorate non-stdcall or non-fastcall functions right now + unsigned CC = F->getCallingConv(); + if (CC != CallingConv::X86_StdCall && CC != CallingConv::X86_FastCall) + return; + + FMFInfoMap::const_iterator info_item = FunctionInfoMap.find(F); + + const X86MachineFunctionInfo *Info; + if (info_item == FunctionInfoMap.end()) { + // Calculate apropriate function info and populate map + FunctionInfoMap[F] = calculateFunctionInfo(F, TM.getTargetData()); + Info = &FunctionInfoMap[F]; + } else { + Info = &info_item->second; + } + + const FunctionType *FT = F->getFunctionType(); + switch (Info->getDecorationStyle()) { + case None: + break; + case StdCall: + // "Pure" variadic functions do not receive @0 suffix. + if (!FT->isVarArg() || (FT->getNumParams() == 0) || + (FT->getNumParams() == 1 && F->hasStructRetAttr())) + Name += '@' + utostr_32(Info->getBytesToPopOnReturn()); + break; + case FastCall: + // "Pure" variadic functions do not receive @0 suffix. + if (!FT->isVarArg() || (FT->getNumParams() == 0) || + (FT->getNumParams() == 1 && F->hasStructRetAttr())) + Name += '@' + utostr_32(Info->getBytesToPopOnReturn()); + + if (Name[0] == '_') + Name[0] = '@'; + else + Name = '@' + Name; + + break; + default: + assert(0 && "Unsupported DecorationStyle"); + } +} + + std::string X86IntelAsmPrinter::getSectionForFunction(const Function &F) const { // Intel asm always emits functions to _text. return "_text"; @@ -53,7 +142,7 @@ if (CC == CallingConv::X86_StdCall || CC == CallingConv::X86_FastCall) FunctionInfoMap[F] = *MF.getInfo(); - X86SharedAsmPrinter::decorateName(CurrentFnName, F); + decorateName(CurrentFnName, F); SwitchToTextSection(getSectionForFunction(*F).c_str(), F); @@ -162,7 +251,7 @@ GlobalValue *GV = MO.getGlobal(); std::string Name = Mang->getValueName(GV); - X86SharedAsmPrinter::decorateName(Name, GV); + decorateName(Name, GV); if (!isMemOp && !isCallOp) O << "OFFSET "; if (GV->hasDLLImportLinkage()) { @@ -328,7 +417,7 @@ for (Module::iterator I = M.begin(), E = M.end(); I != E; ++I) if (I->isDeclaration()) { std::string Name = Mang->getValueName(I); - X86SharedAsmPrinter::decorateName(Name, I); + decorateName(Name, I); O << "\textern " ; if (I->hasDLLImportLinkage()) { Modified: llvm/trunk/lib/Target/X86/X86IntelAsmPrinter.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86IntelAsmPrinter.h?rev=52858&r1=52857&r2=52858&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86IntelAsmPrinter.h (original) +++ llvm/trunk/lib/Target/X86/X86IntelAsmPrinter.h Sat Jun 28 06:07:54 2008 @@ -14,16 +14,19 @@ #ifndef X86INTELASMPRINTER_H #define X86INTELASMPRINTER_H -#include "X86AsmPrinter.h" -#include "llvm/CodeGen/ValueTypes.h" -#include "llvm/Target/TargetRegisterInfo.h" +#include "X86.h" +#include "X86MachineFunctionInfo.h" +#include "X86TargetMachine.h" +#include "llvm/CodeGen/AsmPrinter.h" +#include "llvm/ADT/StringSet.h" +#include "llvm/Support/Compiler.h" namespace llvm { -struct VISIBILITY_HIDDEN X86IntelAsmPrinter : public X86SharedAsmPrinter { +struct VISIBILITY_HIDDEN X86IntelAsmPrinter : public AsmPrinter { X86IntelAsmPrinter(std::ostream &O, X86TargetMachine &TM, const TargetAsmInfo *T) - : X86SharedAsmPrinter(O, TM, T) { + : AsmPrinter(O, TM, T) { } virtual const char *getPassName() const { @@ -110,12 +113,31 @@ bool runOnMachineFunction(MachineFunction &F); bool doInitialization(Module &M); bool doFinalization(Module &M); - + + // We have to propagate some information about MachineFunction to + // AsmPrinter. It's ok, when we're printing the function, since we have + // access to MachineFunction and can get the appropriate MachineFunctionInfo. + // Unfortunately, this is not possible when we're printing reference to + // Function (e.g. calling it and so on). Even more, there is no way to get the + // corresponding MachineFunctions: it can even be not created at all. That's + // why we should use additional structure, when we're collecting all necessary + // information. + // + // This structure is using e.g. for name decoration for stdcall & fastcall'ed + // function, since we have to use arguments' size for decoration. + typedef std::map FMFInfoMap; + FMFInfoMap FunctionInfoMap; + + void decorateName(std::string& Name, const GlobalValue* GV); + /// getSectionForFunction - Return the section that we should emit the /// specified function body into. virtual std::string getSectionForFunction(const Function &F) const; virtual void EmitString(const ConstantArray *CVA) const; + + // Necessary for dllexport support + StringSet<> DLLExportedFns, DLLExportedGVs; }; } // end namespace llvm From asl at math.spbu.ru Sat Jun 28 06:08:10 2008 From: asl at math.spbu.ru (Anton Korobeynikov) Date: Sat, 28 Jun 2008 11:08:10 -0000 Subject: [llvm-commits] [llvm] r52859 - in /llvm/trunk/lib/Target/X86: X86ATTAsmPrinter.cpp X86AsmPrinter.cpp Message-ID: <200806281108.m5SB8AhA012273@zion.cs.uiuc.edu> Author: asl Date: Sat Jun 28 06:08:09 2008 New Revision: 52859 URL: http://llvm.org/viewvc/llvm-project?rev=52859&view=rev Log: whitespace cleanup Modified: llvm/trunk/lib/Target/X86/X86ATTAsmPrinter.cpp llvm/trunk/lib/Target/X86/X86AsmPrinter.cpp Modified: llvm/trunk/lib/Target/X86/X86ATTAsmPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ATTAsmPrinter.cpp?rev=52859&r1=52858&r2=52859&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86ATTAsmPrinter.cpp (original) +++ llvm/trunk/lib/Target/X86/X86ATTAsmPrinter.cpp Sat Jun 28 06:08:09 2008 @@ -51,7 +51,7 @@ std::string X86ATTAsmPrinter::getSectionForFunction(const Function &F) const { switch (F.getLinkage()) { default: assert(0 && "Unknown linkage type!"); - case Function::InternalLinkage: + case Function::InternalLinkage: case Function::DLLExportLinkage: case Function::ExternalLinkage: return TAI->getTextSection(); @@ -97,7 +97,7 @@ X86SharedAsmPrinter::decorateName(CurrentFnName, F); SwitchToTextSection(getSectionForFunction(*F).c_str(), F); - + unsigned FnAlign = OptimizeForSize ? 1 : 4; switch (F->getLinkage()) { default: assert(0 && "Unknown linkage type!"); @@ -109,7 +109,7 @@ //FALLS THROUGH case Function::ExternalLinkage: EmitAlignment(FnAlign, F); - O << "\t.globl\t" << CurrentFnName << "\n"; + O << "\t.globl\t" << CurrentFnName << "\n"; break; case Function::LinkOnceLinkage: case Function::WeakLinkage: @@ -192,7 +192,7 @@ // Print out jump tables referenced by the function. EmitJumpTableInfo(MF.getJumpTableInfo(), MF); - + // We didn't modify anything. return false; } @@ -252,7 +252,7 @@ else if (Subtarget->isPICStyleGOT()) O << "@GOTOFF"; } - + if (isMemOp && Subtarget->isPICStyleRIPRel() && !NotRIPRel) O << "(%rip)"; return; @@ -270,7 +270,7 @@ else if (Subtarget->isPICStyleGOT()) O << "@GOTOFF"; } - + int Offset = MO.getOffset(); if (Offset > 0) O << "+" << Offset; @@ -299,7 +299,7 @@ std::string Name = Mang->getValueName(GV); X86SharedAsmPrinter::decorateName(Name, GV); - + if (!isMemOp && !isCallOp) O << '$'; else if (Name[0] == '$') { @@ -326,16 +326,16 @@ } } else { if (GV->hasDLLImportLinkage()) - O << "__imp_"; + O << "__imp_"; O << Name; } - + if (!isCallOp && TM.getRelocationModel() == Reloc::PIC_) O << '-' << getPICLabelString(getFunctionNumber(), TAI, Subtarget); } else { if (GV->hasDLLImportLinkage()) { - O << "__imp_"; - } + O << "__imp_"; + } O << Name; if (isCallOp) { @@ -484,7 +484,7 @@ if (IndexReg.getReg() || BaseReg.getReg()) { unsigned ScaleVal = MI->getOperand(Op+1).getImm(); unsigned BaseRegOperand = 0, IndexRegOperand = 2; - + // There are cases where we can end up with ESP/RSP in the indexreg slot. // If this happens, swap the base/index register to support assemblers that // don't work when the index is *SP. @@ -493,7 +493,7 @@ std::swap(BaseReg, IndexReg); std::swap(BaseRegOperand, IndexRegOperand); } - + O << "("; if (BaseReg.getReg()) printOperand(MI, Op+BaseRegOperand, Modifier); @@ -508,7 +508,7 @@ } } -void X86ATTAsmPrinter::printPICJumpTableSetLabel(unsigned uid, +void X86ATTAsmPrinter::printPICJumpTableSetLabel(unsigned uid, const MachineBasicBlock *MBB) const { if (!TAI->getSetDirective()) return; @@ -516,12 +516,12 @@ // We don't need .set machinery if we have GOT-style relocations if (Subtarget->isPICStyleGOT()) return; - + O << TAI->getSetDirective() << ' ' << TAI->getPrivateGlobalPrefix() << getFunctionNumber() << '_' << uid << "_set_" << MBB->getNumber() << ','; printBasicBlockLabel(MBB, false, false, false); if (Subtarget->isPICStyleRIPRel()) - O << '-' << TAI->getPrivateGlobalPrefix() << "JTI" << getFunctionNumber() + O << '-' << TAI->getPrivateGlobalPrefix() << "JTI" << getFunctionNumber() << '_' << uid << '\n'; else O << '-' << getPICLabelString(getFunctionNumber(), TAI, Subtarget) << '\n'; @@ -535,8 +535,8 @@ void X86ATTAsmPrinter::printPICJumpTableEntry(const MachineJumpTableInfo *MJTI, const MachineBasicBlock *MBB, - unsigned uid) const -{ + unsigned uid) const +{ const char *JTEntryDirective = MJTI->getEntrySize() == 4 ? TAI->getData32bitsDirective() : TAI->getData64bitsDirective(); @@ -586,12 +586,12 @@ /// PrintAsmOperand - Print out an operand for an inline asm expression. /// bool X86ATTAsmPrinter::PrintAsmOperand(const MachineInstr *MI, unsigned OpNo, - unsigned AsmVariant, + unsigned AsmVariant, const char *ExtraCode) { // Does this asm operand have a single letter operand modifier? if (ExtraCode && ExtraCode[0]) { if (ExtraCode[1] != 0) return true; // Unknown modifier. - + switch (ExtraCode[0]) { default: return true; // Unknown modifier. case 'c': // Don't print "$" before a global var name or constant. @@ -606,24 +606,24 @@ return printAsmMRegister(MI->getOperand(OpNo), ExtraCode[0]); printOperand(MI, OpNo); return false; - + case 'P': // Don't print @PLT, but do print as memory. printOperand(MI, OpNo, "mem"); return false; } } - + printOperand(MI, OpNo); return false; } bool X86ATTAsmPrinter::PrintAsmMemoryOperand(const MachineInstr *MI, unsigned OpNo, - unsigned AsmVariant, + unsigned AsmVariant, const char *ExtraCode) { if (ExtraCode && ExtraCode[0]) { if (ExtraCode[1] != 0) return true; // Unknown modifier. - + switch (ExtraCode[0]) { default: return true; // Unknown modifier. case 'b': // Print QImode register Modified: llvm/trunk/lib/Target/X86/X86AsmPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86AsmPrinter.cpp?rev=52859&r1=52858&r2=52859&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86AsmPrinter.cpp (original) +++ llvm/trunk/lib/Target/X86/X86AsmPrinter.cpp Sat Jun 28 06:08:09 2008 @@ -37,7 +37,7 @@ const TargetData *TD) { X86MachineFunctionInfo Info; uint64_t Size = 0; - + switch (F->getCallingConv()) { case CallingConv::X86_StdCall: Info.setDecorationStyle(StdCall); From asl at math.spbu.ru Sat Jun 28 06:08:28 2008 From: asl at math.spbu.ru (Anton Korobeynikov) Date: Sat, 28 Jun 2008 11:08:28 -0000 Subject: [llvm-commits] [llvm] r52860 - in /llvm/trunk/lib/Target/X86: X86ATTAsmPrinter.cpp X86ATTAsmPrinter.h X86AsmPrinter.cpp X86AsmPrinter.h Message-ID: <200806281108.m5SB8SIn012297@zion.cs.uiuc.edu> Author: asl Date: Sat Jun 28 06:08:27 2008 New Revision: 52860 URL: http://llvm.org/viewvc/llvm-project?rev=52860&view=rev Log: Remove X86SharedAsmPrinter Modified: llvm/trunk/lib/Target/X86/X86ATTAsmPrinter.cpp llvm/trunk/lib/Target/X86/X86ATTAsmPrinter.h llvm/trunk/lib/Target/X86/X86AsmPrinter.cpp llvm/trunk/lib/Target/X86/X86AsmPrinter.h Modified: llvm/trunk/lib/Target/X86/X86ATTAsmPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ATTAsmPrinter.cpp?rev=52860&r1=52859&r2=52860&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86ATTAsmPrinter.cpp (original) +++ llvm/trunk/lib/Target/X86/X86ATTAsmPrinter.cpp Sat Jun 28 06:08:27 2008 @@ -20,14 +20,16 @@ #include "X86MachineFunctionInfo.h" #include "X86TargetMachine.h" #include "X86TargetAsmInfo.h" -#include "llvm/ADT/StringExtras.h" #include "llvm/CallingConv.h" -#include "llvm/CodeGen/MachineJumpTableInfo.h" +#include "llvm/DerivedTypes.h" #include "llvm/Module.h" +#include "llvm/Type.h" +#include "llvm/ADT/Statistic.h" +#include "llvm/ADT/StringExtras.h" +#include "llvm/CodeGen/MachineJumpTableInfo.h" #include "llvm/Support/Mangler.h" #include "llvm/Target/TargetAsmInfo.h" #include "llvm/Target/TargetOptions.h" -#include "llvm/ADT/Statistic.h" using namespace llvm; STATISTIC(EmittedInsts, "Number of machine instrs printed"); @@ -46,6 +48,103 @@ return label; } +static X86MachineFunctionInfo calculateFunctionInfo(const Function *F, + const TargetData *TD) { + X86MachineFunctionInfo Info; + uint64_t Size = 0; + + switch (F->getCallingConv()) { + case CallingConv::X86_StdCall: + Info.setDecorationStyle(StdCall); + break; + case CallingConv::X86_FastCall: + Info.setDecorationStyle(FastCall); + break; + default: + return Info; + } + + unsigned argNum = 1; + for (Function::const_arg_iterator AI = F->arg_begin(), AE = F->arg_end(); + AI != AE; ++AI, ++argNum) { + const Type* Ty = AI->getType(); + + // 'Dereference' type in case of byval parameter attribute + if (F->paramHasAttr(argNum, ParamAttr::ByVal)) + Ty = cast(Ty)->getElementType(); + + // Size should be aligned to DWORD boundary + Size += ((TD->getABITypeSize(Ty) + 3)/4)*4; + } + + // We're not supporting tooooo huge arguments :) + Info.setBytesToPopOnReturn((unsigned int)Size); + return Info; +} + +/// PrintUnmangledNameSafely - Print out the printable characters in the name. +/// Don't print things like \n or \0. +static void PrintUnmangledNameSafely(const Value *V, std::ostream &OS) { + for (const char *Name = V->getNameStart(), *E = Name+V->getNameLen(); + Name != E; ++Name) + if (isprint(*Name)) + OS << *Name; +} + +/// decorateName - Query FunctionInfoMap and use this information for various +/// name decoration. +void X86ATTAsmPrinter::decorateName(std::string &Name, + const GlobalValue *GV) { + const Function *F = dyn_cast(GV); + if (!F) return; + + // We don't want to decorate non-stdcall or non-fastcall functions right now + unsigned CC = F->getCallingConv(); + if (CC != CallingConv::X86_StdCall && CC != CallingConv::X86_FastCall) + return; + + // Decorate names only when we're targeting Cygwin/Mingw32 targets + if (!Subtarget->isTargetCygMing()) + return; + + FMFInfoMap::const_iterator info_item = FunctionInfoMap.find(F); + + const X86MachineFunctionInfo *Info; + if (info_item == FunctionInfoMap.end()) { + // Calculate apropriate function info and populate map + FunctionInfoMap[F] = calculateFunctionInfo(F, TM.getTargetData()); + Info = &FunctionInfoMap[F]; + } else { + Info = &info_item->second; + } + + const FunctionType *FT = F->getFunctionType(); + switch (Info->getDecorationStyle()) { + case None: + break; + case StdCall: + // "Pure" variadic functions do not receive @0 suffix. + if (!FT->isVarArg() || (FT->getNumParams() == 0) || + (FT->getNumParams() == 1 && F->hasStructRetAttr())) + Name += '@' + utostr_32(Info->getBytesToPopOnReturn()); + break; + case FastCall: + // "Pure" variadic functions do not receive @0 suffix. + if (!FT->isVarArg() || (FT->getNumParams() == 0) || + (FT->getNumParams() == 1 && F->hasStructRetAttr())) + Name += '@' + utostr_32(Info->getBytesToPopOnReturn()); + + if (Name[0] == '_') { + Name[0] = '@'; + } else { + Name = '@' + Name; + } + break; + default: + assert(0 && "Unsupported DecorationStyle"); + } +} + /// getSectionForFunction - Return the section that we should emit the /// specified function body into. std::string X86ATTAsmPrinter::getSectionForFunction(const Function &F) const { @@ -94,7 +193,7 @@ if (CC == CallingConv::X86_StdCall || CC == CallingConv::X86_FastCall) FunctionInfoMap[F] = *MF.getInfo(); - X86SharedAsmPrinter::decorateName(CurrentFnName, F); + decorateName(CurrentFnName, F); SwitchToTextSection(getSectionForFunction(*F).c_str(), F); @@ -298,7 +397,7 @@ bool isThreadLocal = GVar && GVar->isThreadLocal(); std::string Name = Mang->getValueName(GV); - X86SharedAsmPrinter::decorateName(Name, GV); + decorateName(Name, GV); if (!isMemOp && !isCallOp) O << '$'; @@ -649,5 +748,329 @@ printInstruction(MI); } +/// doInitialization +bool X86ATTAsmPrinter::doInitialization(Module &M) { + if (TAI->doesSupportDebugInformation()) { + // Emit initial debug information. + DW.BeginModule(&M); + } + + bool Result = AsmPrinter::doInitialization(M); + + // Darwin wants symbols to be quoted if they have complex names. + if (Subtarget->isTargetDarwin()) + Mang->setUseQuotes(true); + + return Result; +} + + +bool X86ATTAsmPrinter::doFinalization(Module &M) { + // Note: this code is not shared by the Intel printer as it is too different + // from how MASM does things. When making changes here don't forget to look + // at X86IntelAsmPrinter::doFinalization(). + const TargetData *TD = TM.getTargetData(); + + // Print out module-level global variables here. + for (Module::const_global_iterator I = M.global_begin(), E = M.global_end(); + I != E; ++I) { + if (!I->hasInitializer()) + continue; // External global require no code + + // Check to see if this is a special global used by LLVM, if so, emit it. + if (EmitSpecialLLVMGlobal(I)) { + if (Subtarget->isTargetDarwin() && + TM.getRelocationModel() == Reloc::Static) { + if (I->getName() == "llvm.global_ctors") + O << ".reference .constructors_used\n"; + else if (I->getName() == "llvm.global_dtors") + O << ".reference .destructors_used\n"; + } + continue; + } + + std::string name = Mang->getValueName(I); + Constant *C = I->getInitializer(); + const Type *Type = C->getType(); + unsigned Size = TD->getABITypeSize(Type); + unsigned Align = TD->getPreferredAlignmentLog(I); + + if (I->hasHiddenVisibility()) { + if (const char *Directive = TAI->getHiddenDirective()) + O << Directive << name << "\n"; + } else if (I->hasProtectedVisibility()) { + if (const char *Directive = TAI->getProtectedDirective()) + O << Directive << name << "\n"; + } + + if (Subtarget->isTargetELF()) + O << "\t.type\t" << name << ", at object\n"; + + if (C->isNullValue() && !I->hasSection()) { + if (I->hasExternalLinkage()) { + if (const char *Directive = TAI->getZeroFillDirective()) { + O << "\t.globl " << name << "\n"; + O << Directive << "__DATA, __common, " << name << ", " + << Size << ", " << Align << "\n"; + continue; + } + } + + if (!I->isThreadLocal() && + (I->hasInternalLinkage() || I->hasWeakLinkage() || + I->hasLinkOnceLinkage() || I->hasCommonLinkage())) { + if (Size == 0) Size = 1; // .comm Foo, 0 is undefined, avoid it. + if (!NoZerosInBSS && TAI->getBSSSection()) + SwitchToDataSection(TAI->getBSSSection(), I); + else + SwitchToDataSection(TAI->getDataSection(), I); + if (TAI->getLCOMMDirective() != NULL) { + if (I->hasInternalLinkage()) { + O << TAI->getLCOMMDirective() << name << "," << Size; + if (Subtarget->isTargetDarwin()) + O << "," << Align; + } else if (Subtarget->isTargetDarwin() && !I->hasCommonLinkage()) { + O << "\t.globl " << name << "\n" + << TAI->getWeakDefDirective() << name << "\n"; + SwitchToDataSection("\t.section __DATA,__datacoal_nt,coalesced", I); + EmitAlignment(Align, I); + O << name << ":\t\t\t\t" << TAI->getCommentString() << " "; + PrintUnmangledNameSafely(I, O); + O << "\n"; + EmitGlobalConstant(C); + continue; + } else { + O << TAI->getCOMMDirective() << name << "," << Size; + + // Leopard and above support aligned common symbols. + if (Subtarget->getDarwinVers() >= 9) + O << "," << Align; + } + } else { + if (!Subtarget->isTargetCygMing()) { + if (I->hasInternalLinkage()) + O << "\t.local\t" << name << "\n"; + } + O << TAI->getCOMMDirective() << name << "," << Size; + if (TAI->getCOMMDirectiveTakesAlignment()) + O << "," << (TAI->getAlignmentIsInBytes() ? (1 << Align) : Align); + } + O << "\t\t" << TAI->getCommentString() << " "; + PrintUnmangledNameSafely(I, O); + O << "\n"; + continue; + } + } + + switch (I->getLinkage()) { + case GlobalValue::CommonLinkage: + case GlobalValue::LinkOnceLinkage: + case GlobalValue::WeakLinkage: + if (Subtarget->isTargetDarwin()) { + O << "\t.globl " << name << "\n" + << TAI->getWeakDefDirective() << name << "\n"; + if (!I->isConstant()) + SwitchToDataSection("\t.section __DATA,__datacoal_nt,coalesced", I); + else { + const ArrayType *AT = dyn_cast(Type); + if (AT && AT->getElementType()==Type::Int8Ty) + SwitchToDataSection("\t.section __TEXT,__const_coal,coalesced", I); + else + SwitchToDataSection("\t.section __DATA,__const_coal,coalesced", I); + } + } else if (Subtarget->isTargetCygMing()) { + std::string SectionName(".section\t.data$linkonce." + + name + + ",\"aw\""); + SwitchToDataSection(SectionName.c_str(), I); + O << "\t.globl\t" << name << "\n" + << "\t.linkonce same_size\n"; + } else { + std::string SectionName("\t.section\t.llvm.linkonce.d." + + name + + ",\"aw\", at progbits"); + SwitchToDataSection(SectionName.c_str(), I); + O << "\t.weak\t" << name << "\n"; + } + break; + case GlobalValue::DLLExportLinkage: + DLLExportedGVs.insert(Mang->makeNameProper(I->getName(),"")); + // FALL THROUGH + case GlobalValue::AppendingLinkage: + // FIXME: appending linkage variables should go into a section of + // their name or something. For now, just emit them as external. + case GlobalValue::ExternalLinkage: + // If external or appending, declare as a global symbol + O << "\t.globl " << name << "\n"; + // FALL THROUGH + case GlobalValue::InternalLinkage: { + if (I->isConstant()) { + const ConstantArray *CVA = dyn_cast(C); + if (TAI->getCStringSection() && CVA && CVA->isCString()) { + SwitchToDataSection(TAI->getCStringSection(), I); + break; + } + } + // FIXME: special handling for ".ctors" & ".dtors" sections + if (I->hasSection() && + (I->getSection() == ".ctors" || + I->getSection() == ".dtors")) { + std::string SectionName = ".section " + I->getSection(); + + if (Subtarget->isTargetCygMing()) { + SectionName += ",\"aw\""; + } else { + assert(!Subtarget->isTargetDarwin()); + SectionName += ",\"aw\", at progbits"; + } + SwitchToDataSection(SectionName.c_str()); + } else if (I->hasSection() && Subtarget->isTargetDarwin()) { + // Honor all section names on Darwin; ObjC uses this + std::string SectionName = ".section " + I->getSection(); + SwitchToDataSection(SectionName.c_str()); + } else { + if (C->isNullValue() && !NoZerosInBSS && TAI->getBSSSection()) + SwitchToDataSection(I->isThreadLocal() ? TAI->getTLSBSSSection() : + TAI->getBSSSection(), I); + else if (!I->isConstant()) + SwitchToDataSection(I->isThreadLocal() ? TAI->getTLSDataSection() : + TAI->getDataSection(), I); + else if (I->isThreadLocal()) + SwitchToDataSection(TAI->getTLSDataSection()); + else { + // Read-only data. + bool HasReloc = C->ContainsRelocations(); + if (HasReloc && + Subtarget->isTargetDarwin() && + TM.getRelocationModel() != Reloc::Static) + SwitchToDataSection("\t.const_data\n"); + else if (!HasReloc && Size == 4 && + TAI->getFourByteConstantSection()) + SwitchToDataSection(TAI->getFourByteConstantSection(), I); + else if (!HasReloc && Size == 8 && + TAI->getEightByteConstantSection()) + SwitchToDataSection(TAI->getEightByteConstantSection(), I); + else if (!HasReloc && Size == 16 && + TAI->getSixteenByteConstantSection()) + SwitchToDataSection(TAI->getSixteenByteConstantSection(), I); + else if (TAI->getReadOnlySection()) + SwitchToDataSection(TAI->getReadOnlySection(), I); + else + SwitchToDataSection(TAI->getDataSection(), I); + } + } + + break; + } + default: + assert(0 && "Unknown linkage type!"); + } + + EmitAlignment(Align, I); + O << name << ":\t\t\t\t" << TAI->getCommentString() << " "; + PrintUnmangledNameSafely(I, O); + O << "\n"; + if (TAI->hasDotTypeDotSizeDirective()) + O << "\t.size\t" << name << ", " << Size << "\n"; + // If the initializer is a extern weak symbol, remember to emit the weak + // reference! + if (const GlobalValue *GV = dyn_cast(C)) + if (GV->hasExternalWeakLinkage()) + ExtWeakSymbols.insert(GV); + + EmitGlobalConstant(C); + } + + // Output linker support code for dllexported globals + if (!DLLExportedGVs.empty()) { + SwitchToDataSection(".section .drectve"); + } + + for (StringSet<>::iterator i = DLLExportedGVs.begin(), + e = DLLExportedGVs.end(); + i != e; ++i) { + O << "\t.ascii \" -export:" << i->getKeyData() << ",data\"\n"; + } + + if (!DLLExportedFns.empty()) { + SwitchToDataSection(".section .drectve"); + } + + for (StringSet<>::iterator i = DLLExportedFns.begin(), + e = DLLExportedFns.end(); + i != e; ++i) { + O << "\t.ascii \" -export:" << i->getKeyData() << "\"\n"; + } + + if (Subtarget->isTargetDarwin()) { + SwitchToDataSection(""); + + // Output stubs for dynamically-linked functions + unsigned j = 1; + for (StringSet<>::iterator i = FnStubs.begin(), e = FnStubs.end(); + i != e; ++i, ++j) { + SwitchToDataSection("\t.section __IMPORT,__jump_table,symbol_stubs," + "self_modifying_code+pure_instructions,5", 0); + std::string p = i->getKeyData(); + printSuffixedName(p, "$stub"); + O << ":\n"; + O << "\t.indirect_symbol " << p << "\n"; + O << "\thlt ; hlt ; hlt ; hlt ; hlt\n"; + } + + O << "\n"; + + if (TAI->doesSupportExceptionHandling() && MMI && !Subtarget->is64Bit()) { + // Add the (possibly multiple) personalities to the set of global values. + // Only referenced functions get into the Personalities list. + const std::vector& Personalities = MMI->getPersonalities(); + + for (std::vector::const_iterator I = Personalities.begin(), + E = Personalities.end(); I != E; ++I) + if (*I) GVStubs.insert("_" + (*I)->getName()); + } + + // Output stubs for external and common global variables. + if (!GVStubs.empty()) + SwitchToDataSection( + "\t.section __IMPORT,__pointers,non_lazy_symbol_pointers"); + for (StringSet<>::iterator i = GVStubs.begin(), e = GVStubs.end(); + i != e; ++i) { + std::string p = i->getKeyData(); + printSuffixedName(p, "$non_lazy_ptr"); + O << ":\n"; + O << "\t.indirect_symbol " << p << "\n"; + O << "\t.long\t0\n"; + } + + // Emit final debug information. + DW.EndModule(); + + // Funny Darwin hack: This flag tells the linker that no global symbols + // contain code that falls through to other global symbols (e.g. the obvious + // implementation of multiple entry points). If this doesn't occur, the + // linker can safely perform dead code stripping. Since LLVM never + // generates code that does this, it is always safe to set. + O << "\t.subsections_via_symbols\n"; + } else if (Subtarget->isTargetCygMing()) { + // Emit type information for external functions + for (StringSet<>::iterator i = FnStubs.begin(), e = FnStubs.end(); + i != e; ++i) { + O << "\t.def\t " << i->getKeyData() + << ";\t.scl\t" << COFF::C_EXT + << ";\t.type\t" << (COFF::DT_FCN << COFF::N_BTSHFT) + << ";\t.endef\n"; + } + + // Emit final debug information. + DW.EndModule(); + } else if (Subtarget->isTargetELF()) { + // Emit final debug information. + DW.EndModule(); + } + + return AsmPrinter::doFinalization(M); +} + // Include the auto-generated portion of the assembly writer. #include "X86GenAsmWriter.inc" Modified: llvm/trunk/lib/Target/X86/X86ATTAsmPrinter.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ATTAsmPrinter.h?rev=52860&r1=52859&r2=52860&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86ATTAsmPrinter.h (original) +++ llvm/trunk/lib/Target/X86/X86ATTAsmPrinter.h Sat Jun 28 06:08:27 2008 @@ -14,21 +14,49 @@ #ifndef X86ATTASMPRINTER_H #define X86ATTASMPRINTER_H -#include "X86AsmPrinter.h" +#include "X86.h" +#include "X86MachineFunctionInfo.h" +#include "X86TargetMachine.h" +#include "llvm/ADT/StringSet.h" +#include "llvm/CodeGen/AsmPrinter.h" +#include "llvm/CodeGen/DwarfWriter.h" +#include "llvm/CodeGen/MachineModuleInfo.h" #include "llvm/CodeGen/ValueTypes.h" +#include "llvm/Support/Compiler.h" namespace llvm { struct MachineJumpTableInfo; - -struct VISIBILITY_HIDDEN X86ATTAsmPrinter : public X86SharedAsmPrinter { - X86ATTAsmPrinter(std::ostream &O, X86TargetMachine &TM, const TargetAsmInfo *T) - : X86SharedAsmPrinter(O, TM, T) { } + +struct VISIBILITY_HIDDEN X86ATTAsmPrinter : public AsmPrinter { + DwarfWriter DW; + MachineModuleInfo *MMI; + + const X86Subtarget *Subtarget; + + X86ATTAsmPrinter(std::ostream &O, X86TargetMachine &TM, + const TargetAsmInfo *T) + : AsmPrinter(O, TM, T), DW(O, this, T), MMI(0) { + Subtarget = &TM.getSubtarget(); + } virtual const char *getPassName() const { return "X86 AT&T-Style Assembly Printer"; } + void getAnalysisUsage(AnalysisUsage &AU) const { + AU.setPreservesAll(); + if (Subtarget->isTargetDarwin() || + Subtarget->isTargetELF() || + Subtarget->isTargetCygMing()) { + AU.addRequired(); + } + AsmPrinter::getAnalysisUsage(AU); + } + + bool doInitialization(Module &M); + bool doFinalization(Module &M); + /// printInstruction - This method is automatically generated by tablegen /// from the instruction set description. This method returns true if the /// machine instruction was sufficiently described to print it, otherwise it @@ -68,13 +96,13 @@ void printlea64_32mem(const MachineInstr *MI, unsigned OpNo) { printMemReference(MI, OpNo, "subreg64"); } - + bool printAsmMRegister(const MachineOperand &MO, const char Mode); bool PrintAsmOperand(const MachineInstr *MI, unsigned OpNo, unsigned AsmVariant, const char *ExtraCode); bool PrintAsmMemoryOperand(const MachineInstr *MI, unsigned OpNo, unsigned AsmVariant, const char *ExtraCode); - + void printMachineInstruction(const MachineInstr *MI); void printSSECC(const MachineInstr *MI, unsigned Op); void printMemReference(const MachineInstr *MI, unsigned Op, @@ -88,13 +116,35 @@ void printPICJumpTableEntry(const MachineJumpTableInfo *MJTI, const MachineBasicBlock *MBB, unsigned uid) const; - + void printPICLabel(const MachineInstr *MI, unsigned Op); bool runOnMachineFunction(MachineFunction &F); - + /// getSectionForFunction - Return the section that we should emit the /// specified function body into. virtual std::string getSectionForFunction(const Function &F) const; + + // Necessary for Darwin to print out the apprioriate types of linker stubs + StringSet<> FnStubs, GVStubs, LinkOnceStubs; + + // Necessary for dllexport support + StringSet<> DLLExportedFns, DLLExportedGVs; + + // We have to propagate some information about MachineFunction to + // AsmPrinter. It's ok, when we're printing the function, since we have + // access to MachineFunction and can get the appropriate MachineFunctionInfo. + // Unfortunately, this is not possible when we're printing reference to + // Function (e.g. calling it and so on). Even more, there is no way to get the + // corresponding MachineFunctions: it can even be not created at all. That's + // why we should use additional structure, when we're collecting all necessary + // information. + // + // This structure is using e.g. for name decoration for stdcall & fastcall'ed + // function, since we have to use arguments' size for decoration. + typedef std::map FMFInfoMap; + FMFInfoMap FunctionInfoMap; + + void decorateName(std::string& Name, const GlobalValue* GV); }; } // end namespace llvm Modified: llvm/trunk/lib/Target/X86/X86AsmPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86AsmPrinter.cpp?rev=52860&r1=52859&r2=52860&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86AsmPrinter.cpp (original) +++ llvm/trunk/lib/Target/X86/X86AsmPrinter.cpp Sat Jun 28 06:08:27 2008 @@ -14,446 +14,11 @@ // //===----------------------------------------------------------------------===// -#include "X86AsmPrinter.h" #include "X86ATTAsmPrinter.h" -#include "X86COFF.h" #include "X86IntelAsmPrinter.h" -#include "X86MachineFunctionInfo.h" #include "X86Subtarget.h" -#include "llvm/ADT/StringExtras.h" -#include "llvm/CallingConv.h" -#include "llvm/Constants.h" -#include "llvm/Module.h" -#include "llvm/DerivedTypes.h" -#include "llvm/ParameterAttributes.h" -#include "llvm/Type.h" -#include "llvm/Assembly/Writer.h" -#include "llvm/Support/Mangler.h" -#include "llvm/Target/TargetAsmInfo.h" -#include "llvm/Target/TargetOptions.h" using namespace llvm; -static X86MachineFunctionInfo calculateFunctionInfo(const Function *F, - const TargetData *TD) { - X86MachineFunctionInfo Info; - uint64_t Size = 0; - - switch (F->getCallingConv()) { - case CallingConv::X86_StdCall: - Info.setDecorationStyle(StdCall); - break; - case CallingConv::X86_FastCall: - Info.setDecorationStyle(FastCall); - break; - default: - return Info; - } - - unsigned argNum = 1; - for (Function::const_arg_iterator AI = F->arg_begin(), AE = F->arg_end(); - AI != AE; ++AI, ++argNum) { - const Type* Ty = AI->getType(); - - // 'Dereference' type in case of byval parameter attribute - if (F->paramHasAttr(argNum, ParamAttr::ByVal)) - Ty = cast(Ty)->getElementType(); - - // Size should be aligned to DWORD boundary - Size += ((TD->getABITypeSize(Ty) + 3)/4)*4; - } - - // We're not supporting tooooo huge arguments :) - Info.setBytesToPopOnReturn((unsigned int)Size); - return Info; -} - - -/// decorateName - Query FunctionInfoMap and use this information for various -/// name decoration. -void X86SharedAsmPrinter::decorateName(std::string &Name, - const GlobalValue *GV) { - const Function *F = dyn_cast(GV); - if (!F) return; - - // We don't want to decorate non-stdcall or non-fastcall functions right now - unsigned CC = F->getCallingConv(); - if (CC != CallingConv::X86_StdCall && CC != CallingConv::X86_FastCall) - return; - - // Decorate names only when we're targeting Cygwin/Mingw32 targets - if (!Subtarget->isTargetCygMing()) - return; - - FMFInfoMap::const_iterator info_item = FunctionInfoMap.find(F); - - const X86MachineFunctionInfo *Info; - if (info_item == FunctionInfoMap.end()) { - // Calculate apropriate function info and populate map - FunctionInfoMap[F] = calculateFunctionInfo(F, TM.getTargetData()); - Info = &FunctionInfoMap[F]; - } else { - Info = &info_item->second; - } - - const FunctionType *FT = F->getFunctionType(); - switch (Info->getDecorationStyle()) { - case None: - break; - case StdCall: - // "Pure" variadic functions do not receive @0 suffix. - if (!FT->isVarArg() || (FT->getNumParams() == 0) || - (FT->getNumParams() == 1 && F->hasStructRetAttr())) - Name += '@' + utostr_32(Info->getBytesToPopOnReturn()); - break; - case FastCall: - // "Pure" variadic functions do not receive @0 suffix. - if (!FT->isVarArg() || (FT->getNumParams() == 0) || - (FT->getNumParams() == 1 && F->hasStructRetAttr())) - Name += '@' + utostr_32(Info->getBytesToPopOnReturn()); - - if (Name[0] == '_') { - Name[0] = '@'; - } else { - Name = '@' + Name; - } - break; - default: - assert(0 && "Unsupported DecorationStyle"); - } -} - -/// doInitialization -bool X86SharedAsmPrinter::doInitialization(Module &M) { - if (TAI->doesSupportDebugInformation()) { - // Emit initial debug information. - DW.BeginModule(&M); - } - - bool Result = AsmPrinter::doInitialization(M); - - // Darwin wants symbols to be quoted if they have complex names. - if (Subtarget->isTargetDarwin()) - Mang->setUseQuotes(true); - - return Result; -} - -/// PrintUnmangledNameSafely - Print out the printable characters in the name. -/// Don't print things like \n or \0. -static void PrintUnmangledNameSafely(const Value *V, std::ostream &OS) { - for (const char *Name = V->getNameStart(), *E = Name+V->getNameLen(); - Name != E; ++Name) - if (isprint(*Name)) - OS << *Name; -} - -bool X86SharedAsmPrinter::doFinalization(Module &M) { - // Note: this code is not shared by the Intel printer as it is too different - // from how MASM does things. When making changes here don't forget to look - // at X86IntelAsmPrinter::doFinalization(). - const TargetData *TD = TM.getTargetData(); - - // Print out module-level global variables here. - for (Module::const_global_iterator I = M.global_begin(), E = M.global_end(); - I != E; ++I) { - if (!I->hasInitializer()) - continue; // External global require no code - - // Check to see if this is a special global used by LLVM, if so, emit it. - if (EmitSpecialLLVMGlobal(I)) { - if (Subtarget->isTargetDarwin() && - TM.getRelocationModel() == Reloc::Static) { - if (I->getName() == "llvm.global_ctors") - O << ".reference .constructors_used\n"; - else if (I->getName() == "llvm.global_dtors") - O << ".reference .destructors_used\n"; - } - continue; - } - - std::string name = Mang->getValueName(I); - Constant *C = I->getInitializer(); - const Type *Type = C->getType(); - unsigned Size = TD->getABITypeSize(Type); - unsigned Align = TD->getPreferredAlignmentLog(I); - - if (I->hasHiddenVisibility()) { - if (const char *Directive = TAI->getHiddenDirective()) - O << Directive << name << "\n"; - } else if (I->hasProtectedVisibility()) { - if (const char *Directive = TAI->getProtectedDirective()) - O << Directive << name << "\n"; - } - - if (Subtarget->isTargetELF()) - O << "\t.type\t" << name << ", at object\n"; - - if (C->isNullValue() && !I->hasSection()) { - if (I->hasExternalLinkage()) { - if (const char *Directive = TAI->getZeroFillDirective()) { - O << "\t.globl " << name << "\n"; - O << Directive << "__DATA, __common, " << name << ", " - << Size << ", " << Align << "\n"; - continue; - } - } - - if (!I->isThreadLocal() && - (I->hasInternalLinkage() || I->hasWeakLinkage() || - I->hasLinkOnceLinkage() || I->hasCommonLinkage())) { - if (Size == 0) Size = 1; // .comm Foo, 0 is undefined, avoid it. - if (!NoZerosInBSS && TAI->getBSSSection()) - SwitchToDataSection(TAI->getBSSSection(), I); - else - SwitchToDataSection(TAI->getDataSection(), I); - if (TAI->getLCOMMDirective() != NULL) { - if (I->hasInternalLinkage()) { - O << TAI->getLCOMMDirective() << name << "," << Size; - if (Subtarget->isTargetDarwin()) - O << "," << Align; - } else if (Subtarget->isTargetDarwin() && !I->hasCommonLinkage()) { - O << "\t.globl " << name << "\n" - << TAI->getWeakDefDirective() << name << "\n"; - SwitchToDataSection("\t.section __DATA,__datacoal_nt,coalesced", I); - EmitAlignment(Align, I); - O << name << ":\t\t\t\t" << TAI->getCommentString() << " "; - PrintUnmangledNameSafely(I, O); - O << "\n"; - EmitGlobalConstant(C); - continue; - } else { - O << TAI->getCOMMDirective() << name << "," << Size; - - // Leopard and above support aligned common symbols. - if (Subtarget->getDarwinVers() >= 9) - O << "," << Align; - } - } else { - if (!Subtarget->isTargetCygMing()) { - if (I->hasInternalLinkage()) - O << "\t.local\t" << name << "\n"; - } - O << TAI->getCOMMDirective() << name << "," << Size; - if (TAI->getCOMMDirectiveTakesAlignment()) - O << "," << (TAI->getAlignmentIsInBytes() ? (1 << Align) : Align); - } - O << "\t\t" << TAI->getCommentString() << " "; - PrintUnmangledNameSafely(I, O); - O << "\n"; - continue; - } - } - - switch (I->getLinkage()) { - case GlobalValue::CommonLinkage: - case GlobalValue::LinkOnceLinkage: - case GlobalValue::WeakLinkage: - if (Subtarget->isTargetDarwin()) { - O << "\t.globl " << name << "\n" - << TAI->getWeakDefDirective() << name << "\n"; - if (!I->isConstant()) - SwitchToDataSection("\t.section __DATA,__datacoal_nt,coalesced", I); - else { - const ArrayType *AT = dyn_cast(Type); - if (AT && AT->getElementType()==Type::Int8Ty) - SwitchToDataSection("\t.section __TEXT,__const_coal,coalesced", I); - else - SwitchToDataSection("\t.section __DATA,__const_coal,coalesced", I); - } - } else if (Subtarget->isTargetCygMing()) { - std::string SectionName(".section\t.data$linkonce." + - name + - ",\"aw\""); - SwitchToDataSection(SectionName.c_str(), I); - O << "\t.globl\t" << name << "\n" - << "\t.linkonce same_size\n"; - } else { - std::string SectionName("\t.section\t.llvm.linkonce.d." + - name + - ",\"aw\", at progbits"); - SwitchToDataSection(SectionName.c_str(), I); - O << "\t.weak\t" << name << "\n"; - } - break; - case GlobalValue::DLLExportLinkage: - DLLExportedGVs.insert(Mang->makeNameProper(I->getName(),"")); - // FALL THROUGH - case GlobalValue::AppendingLinkage: - // FIXME: appending linkage variables should go into a section of - // their name or something. For now, just emit them as external. - case GlobalValue::ExternalLinkage: - // If external or appending, declare as a global symbol - O << "\t.globl " << name << "\n"; - // FALL THROUGH - case GlobalValue::InternalLinkage: { - if (I->isConstant()) { - const ConstantArray *CVA = dyn_cast(C); - if (TAI->getCStringSection() && CVA && CVA->isCString()) { - SwitchToDataSection(TAI->getCStringSection(), I); - break; - } - } - // FIXME: special handling for ".ctors" & ".dtors" sections - if (I->hasSection() && - (I->getSection() == ".ctors" || - I->getSection() == ".dtors")) { - std::string SectionName = ".section " + I->getSection(); - - if (Subtarget->isTargetCygMing()) { - SectionName += ",\"aw\""; - } else { - assert(!Subtarget->isTargetDarwin()); - SectionName += ",\"aw\", at progbits"; - } - SwitchToDataSection(SectionName.c_str()); - } else if (I->hasSection() && Subtarget->isTargetDarwin()) { - // Honor all section names on Darwin; ObjC uses this - std::string SectionName = ".section " + I->getSection(); - SwitchToDataSection(SectionName.c_str()); - } else { - if (C->isNullValue() && !NoZerosInBSS && TAI->getBSSSection()) - SwitchToDataSection(I->isThreadLocal() ? TAI->getTLSBSSSection() : - TAI->getBSSSection(), I); - else if (!I->isConstant()) - SwitchToDataSection(I->isThreadLocal() ? TAI->getTLSDataSection() : - TAI->getDataSection(), I); - else if (I->isThreadLocal()) - SwitchToDataSection(TAI->getTLSDataSection()); - else { - // Read-only data. - bool HasReloc = C->ContainsRelocations(); - if (HasReloc && - Subtarget->isTargetDarwin() && - TM.getRelocationModel() != Reloc::Static) - SwitchToDataSection("\t.const_data\n"); - else if (!HasReloc && Size == 4 && - TAI->getFourByteConstantSection()) - SwitchToDataSection(TAI->getFourByteConstantSection(), I); - else if (!HasReloc && Size == 8 && - TAI->getEightByteConstantSection()) - SwitchToDataSection(TAI->getEightByteConstantSection(), I); - else if (!HasReloc && Size == 16 && - TAI->getSixteenByteConstantSection()) - SwitchToDataSection(TAI->getSixteenByteConstantSection(), I); - else if (TAI->getReadOnlySection()) - SwitchToDataSection(TAI->getReadOnlySection(), I); - else - SwitchToDataSection(TAI->getDataSection(), I); - } - } - - break; - } - default: - assert(0 && "Unknown linkage type!"); - } - - EmitAlignment(Align, I); - O << name << ":\t\t\t\t" << TAI->getCommentString() << " "; - PrintUnmangledNameSafely(I, O); - O << "\n"; - if (TAI->hasDotTypeDotSizeDirective()) - O << "\t.size\t" << name << ", " << Size << "\n"; - // If the initializer is a extern weak symbol, remember to emit the weak - // reference! - if (const GlobalValue *GV = dyn_cast(C)) - if (GV->hasExternalWeakLinkage()) - ExtWeakSymbols.insert(GV); - - EmitGlobalConstant(C); - } - - // Output linker support code for dllexported globals - if (!DLLExportedGVs.empty()) { - SwitchToDataSection(".section .drectve"); - } - - for (StringSet<>::iterator i = DLLExportedGVs.begin(), - e = DLLExportedGVs.end(); - i != e; ++i) { - O << "\t.ascii \" -export:" << i->getKeyData() << ",data\"\n"; - } - - if (!DLLExportedFns.empty()) { - SwitchToDataSection(".section .drectve"); - } - - for (StringSet<>::iterator i = DLLExportedFns.begin(), - e = DLLExportedFns.end(); - i != e; ++i) { - O << "\t.ascii \" -export:" << i->getKeyData() << "\"\n"; - } - - if (Subtarget->isTargetDarwin()) { - SwitchToDataSection(""); - - // Output stubs for dynamically-linked functions - unsigned j = 1; - for (StringSet<>::iterator i = FnStubs.begin(), e = FnStubs.end(); - i != e; ++i, ++j) { - SwitchToDataSection("\t.section __IMPORT,__jump_table,symbol_stubs," - "self_modifying_code+pure_instructions,5", 0); - std::string p = i->getKeyData(); - printSuffixedName(p, "$stub"); - O << ":\n"; - O << "\t.indirect_symbol " << p << "\n"; - O << "\thlt ; hlt ; hlt ; hlt ; hlt\n"; - } - - O << "\n"; - - if (TAI->doesSupportExceptionHandling() && MMI && !Subtarget->is64Bit()) { - // Add the (possibly multiple) personalities to the set of global values. - // Only referenced functions get into the Personalities list. - const std::vector& Personalities = MMI->getPersonalities(); - - for (std::vector::const_iterator I = Personalities.begin(), - E = Personalities.end(); I != E; ++I) - if (*I) GVStubs.insert("_" + (*I)->getName()); - } - - // Output stubs for external and common global variables. - if (!GVStubs.empty()) - SwitchToDataSection( - "\t.section __IMPORT,__pointers,non_lazy_symbol_pointers"); - for (StringSet<>::iterator i = GVStubs.begin(), e = GVStubs.end(); - i != e; ++i) { - std::string p = i->getKeyData(); - printSuffixedName(p, "$non_lazy_ptr"); - O << ":\n"; - O << "\t.indirect_symbol " << p << "\n"; - O << "\t.long\t0\n"; - } - - // Emit final debug information. - DW.EndModule(); - - // Funny Darwin hack: This flag tells the linker that no global symbols - // contain code that falls through to other global symbols (e.g. the obvious - // implementation of multiple entry points). If this doesn't occur, the - // linker can safely perform dead code stripping. Since LLVM never - // generates code that does this, it is always safe to set. - O << "\t.subsections_via_symbols\n"; - } else if (Subtarget->isTargetCygMing()) { - // Emit type information for external functions - for (StringSet<>::iterator i = FnStubs.begin(), e = FnStubs.end(); - i != e; ++i) { - O << "\t.def\t " << i->getKeyData() - << ";\t.scl\t" << COFF::C_EXT - << ";\t.type\t" << (COFF::DT_FCN << COFF::N_BTSHFT) - << ";\t.endef\n"; - } - - // Emit final debug information. - DW.EndModule(); - } else if (Subtarget->isTargetELF()) { - // Emit final debug information. - DW.EndModule(); - } - - return AsmPrinter::doFinalization(M); -} - /// createX86CodePrinterPass - Returns a pass that prints the X86 assembly code /// for a MachineFunction to the given output stream, using the given target /// machine description. Modified: llvm/trunk/lib/Target/X86/X86AsmPrinter.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86AsmPrinter.h?rev=52860&r1=52859&r2=52860&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86AsmPrinter.h (original) +++ llvm/trunk/lib/Target/X86/X86AsmPrinter.h Sat Jun 28 06:08:27 2008 @@ -1,80 +0,0 @@ -//===-- X86AsmPrinter.h - Convert X86 LLVM code to Intel assembly ---------===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// -// This file the shared super class printer that converts from our internal -// representation of machine-dependent LLVM code to Intel and AT&T format -// assembly language. This printer is the output mechanism used by `llc'. -// -//===----------------------------------------------------------------------===// - -#ifndef X86ASMPRINTER_H -#define X86ASMPRINTER_H - -#include "X86.h" -#include "X86MachineFunctionInfo.h" -#include "X86TargetMachine.h" -#include "llvm/ADT/StringSet.h" -#include "llvm/CodeGen/AsmPrinter.h" -#include "llvm/CodeGen/DwarfWriter.h" -#include "llvm/CodeGen/MachineModuleInfo.h" -#include "llvm/Support/Compiler.h" - -namespace llvm { - -struct VISIBILITY_HIDDEN X86SharedAsmPrinter : public AsmPrinter { - DwarfWriter DW; - MachineModuleInfo *MMI; - - X86SharedAsmPrinter(std::ostream &O, X86TargetMachine &TM, - const TargetAsmInfo *T) - : AsmPrinter(O, TM, T), DW(O, this, T), MMI(0) { - Subtarget = &TM.getSubtarget(); - } - - // We have to propagate some information about MachineFunction to - // AsmPrinter. It's ok, when we're printing the function, since we have - // access to MachineFunction and can get the appropriate MachineFunctionInfo. - // Unfortunately, this is not possible when we're printing reference to - // Function (e.g. calling it and so on). Even more, there is no way to get the - // corresponding MachineFunctions: it can even be not created at all. That's - // why we should use additional structure, when we're collecting all necessary - // information. - // - // This structure is using e.g. for name decoration for stdcall & fastcall'ed - // function, since we have to use arguments' size for decoration. - typedef std::map FMFInfoMap; - FMFInfoMap FunctionInfoMap; - - void decorateName(std::string& Name, const GlobalValue* GV); - - bool doInitialization(Module &M); - bool doFinalization(Module &M); - - void getAnalysisUsage(AnalysisUsage &AU) const { - AU.setPreservesAll(); - if (Subtarget->isTargetDarwin() || - Subtarget->isTargetELF() || - Subtarget->isTargetCygMing()) { - AU.addRequired(); - } - AsmPrinter::getAnalysisUsage(AU); - } - - const X86Subtarget *Subtarget; - - // Necessary for Darwin to print out the apprioriate types of linker stubs - StringSet<> FnStubs, GVStubs, LinkOnceStubs; - - // Necessary for dllexport support - StringSet<> DLLExportedFns, DLLExportedGVs; -}; - -} // end namespace llvm - -#endif From asl at math.spbu.ru Sat Jun 28 06:08:44 2008 From: asl at math.spbu.ru (Anton Korobeynikov) Date: Sat, 28 Jun 2008 11:08:44 -0000 Subject: [llvm-commits] [llvm] r52861 - /llvm/trunk/lib/Target/X86/X86ATTAsmPrinter.cpp Message-ID: <200806281108.m5SB8jEW012315@zion.cs.uiuc.edu> Author: asl Date: Sat Jun 28 06:08:44 2008 New Revision: 52861 URL: http://llvm.org/viewvc/llvm-project?rev=52861&view=rev Log: Cleanup Modified: llvm/trunk/lib/Target/X86/X86ATTAsmPrinter.cpp Modified: llvm/trunk/lib/Target/X86/X86ATTAsmPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ATTAsmPrinter.cpp?rev=52861&r1=52860&r2=52861&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86ATTAsmPrinter.cpp (original) +++ llvm/trunk/lib/Target/X86/X86ATTAsmPrinter.cpp Sat Jun 28 06:08:44 2008 @@ -982,15 +982,13 @@ } // Output linker support code for dllexported globals - if (!DLLExportedGVs.empty()) { + if (!DLLExportedGVs.empty()) SwitchToDataSection(".section .drectve"); - } for (StringSet<>::iterator i = DLLExportedGVs.begin(), e = DLLExportedGVs.end(); - i != e; ++i) { + i != e; ++i) O << "\t.ascii \" -export:" << i->getKeyData() << ",data\"\n"; - } if (!DLLExportedFns.empty()) { SwitchToDataSection(".section .drectve"); @@ -998,9 +996,8 @@ for (StringSet<>::iterator i = DLLExportedFns.begin(), e = DLLExportedFns.end(); - i != e; ++i) { + i != e; ++i) O << "\t.ascii \" -export:" << i->getKeyData() << "\"\n"; - } if (Subtarget->isTargetDarwin()) { SwitchToDataSection(""); From asl at math.spbu.ru Sat Jun 28 06:09:01 2008 From: asl at math.spbu.ru (Anton Korobeynikov) Date: Sat, 28 Jun 2008 11:09:01 -0000 Subject: [llvm-commits] [llvm] r52862 - in /llvm/trunk/lib/Target/X86: X86ATTAsmPrinter.cpp X86ATTAsmPrinter.h Message-ID: <200806281109.m5SB91Jf012333@zion.cs.uiuc.edu> Author: asl Date: Sat Jun 28 06:09:01 2008 New Revision: 52862 URL: http://llvm.org/viewvc/llvm-project?rev=52862&view=rev Log: Factor out stuff into helper function Modified: llvm/trunk/lib/Target/X86/X86ATTAsmPrinter.cpp llvm/trunk/lib/Target/X86/X86ATTAsmPrinter.h Modified: llvm/trunk/lib/Target/X86/X86ATTAsmPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ATTAsmPrinter.cpp?rev=52862&r1=52861&r2=52862&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86ATTAsmPrinter.cpp (original) +++ llvm/trunk/lib/Target/X86/X86ATTAsmPrinter.cpp Sat Jun 28 06:09:01 2008 @@ -167,31 +167,8 @@ } } -/// runOnMachineFunction - This uses the printMachineInstruction() -/// method to print assembly for each instruction. -/// -bool X86ATTAsmPrinter::runOnMachineFunction(MachineFunction &MF) { - if (TAI->doesSupportDebugInformation()) { - // Let PassManager know we need debug information and relay - // the MachineModuleInfo address on to DwarfWriter. - MMI = &getAnalysis(); - DW.SetModuleInfo(MMI); - } - - SetupMachineFunction(MF); - O << "\n\n"; - - // Print out constants referenced by the function - EmitConstantPool(MF.getConstantPool()); - - // Print out labels for the function. +void X86ATTAsmPrinter::emitFunctionHeader(const MachineFunction &MF) { const Function *F = MF.getFunction(); - unsigned CC = F->getCallingConv(); - - // Populate function information map. Actually, We don't want to populate - // non-stdcall or non-fastcall functions' information right now. - if (CC == CallingConv::X86_StdCall || CC == CallingConv::X86_FastCall) - FunctionInfoMap[F] = *MF.getInfo(); decorateName(CurrentFnName, F); @@ -204,8 +181,6 @@ EmitAlignment(FnAlign, F); break; case Function::DLLExportLinkage: - DLLExportedFns.insert(Mang->makeNameProper(F->getName(), "")); - //FALLS THROUGH case Function::ExternalLinkage: EmitAlignment(FnAlign, F); O << "\t.globl\t" << CurrentFnName << "\n"; @@ -248,13 +223,43 @@ (F->getLinkage() == Function::LinkOnceLinkage || F->getLinkage() == Function::WeakLinkage)) O << "Lllvm$workaround$fake$stub$" << CurrentFnName << ":\n"; +} - if (TAI->doesSupportDebugInformation() || - TAI->doesSupportExceptionHandling()) { - // Emit pre-function debug and/or EH information. - DW.BeginFunction(&MF); +/// runOnMachineFunction - This uses the printMachineInstruction() +/// method to print assembly for each instruction. +/// +bool X86ATTAsmPrinter::runOnMachineFunction(MachineFunction &MF) { + const Function *F = MF.getFunction(); + unsigned CC = F->getCallingConv(); + + if (TAI->doesSupportDebugInformation()) { + // Let PassManager know we need debug information and relay + // the MachineModuleInfo address on to DwarfWriter. + MMI = &getAnalysis(); + DW.SetModuleInfo(MMI); } + SetupMachineFunction(MF); + O << "\n\n"; + + // Populate function information map. Actually, We don't want to populate + // non-stdcall or non-fastcall functions' information right now. + if (CC == CallingConv::X86_StdCall || CC == CallingConv::X86_FastCall) + FunctionInfoMap[F] = *MF.getInfo(); + + // Print out constants referenced by the function + EmitConstantPool(MF.getConstantPool()); + + if (F->hasDLLExportLinkage()) + DLLExportedFns.insert(Mang->makeNameProper(F->getName(), "")); + + // Print the 'header' of function + emitFunctionHeader(MF); + + // Emit pre-function debug and/or EH information. + if (TAI->doesSupportDebugInformation() || TAI->doesSupportExceptionHandling()) + DW.BeginFunction(&MF); + // Print out code for the function. bool hasAnyRealCode = false; for (MachineFunction::const_iterator I = MF.begin(), E = MF.end(); @@ -284,10 +289,9 @@ if (TAI->hasDotTypeDotSizeDirective()) O << "\t.size\t" << CurrentFnName << ", .-" << CurrentFnName << "\n"; - if (TAI->doesSupportDebugInformation()) { - // Emit post-function debug information. + // Emit post-function debug information. + if (TAI->doesSupportDebugInformation()) DW.EndFunction(); - } // Print out jump tables referenced by the function. EmitJumpTableInfo(MF.getJumpTableInfo(), MF); Modified: llvm/trunk/lib/Target/X86/X86ATTAsmPrinter.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ATTAsmPrinter.h?rev=52862&r1=52861&r2=52862&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86ATTAsmPrinter.h (original) +++ llvm/trunk/lib/Target/X86/X86ATTAsmPrinter.h Sat Jun 28 06:09:01 2008 @@ -124,6 +124,8 @@ /// specified function body into. virtual std::string getSectionForFunction(const Function &F) const; + void emitFunctionHeader(const MachineFunction &MF); + // Necessary for Darwin to print out the apprioriate types of linker stubs StringSet<> FnStubs, GVStubs, LinkOnceStubs; From asl at math.spbu.ru Sat Jun 28 06:09:17 2008 From: asl at math.spbu.ru (Anton Korobeynikov) Date: Sat, 28 Jun 2008 11:09:17 -0000 Subject: [llvm-commits] [llvm] r52863 - in /llvm/trunk/lib/Target/X86: X86ATTAsmPrinter.cpp X86ATTAsmPrinter.h Message-ID: <200806281109.m5SB9H3P012352@zion.cs.uiuc.edu> Author: asl Date: Sat Jun 28 06:09:17 2008 New Revision: 52863 URL: http://llvm.org/viewvc/llvm-project?rev=52863&view=rev Log: Use common naming convention Modified: llvm/trunk/lib/Target/X86/X86ATTAsmPrinter.cpp llvm/trunk/lib/Target/X86/X86ATTAsmPrinter.h Modified: llvm/trunk/lib/Target/X86/X86ATTAsmPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ATTAsmPrinter.cpp?rev=52863&r1=52862&r2=52863&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86ATTAsmPrinter.cpp (original) +++ llvm/trunk/lib/Target/X86/X86ATTAsmPrinter.cpp Sat Jun 28 06:09:17 2008 @@ -688,7 +688,7 @@ /// PrintAsmOperand - Print out an operand for an inline asm expression. /// -bool X86ATTAsmPrinter::PrintAsmOperand(const MachineInstr *MI, unsigned OpNo, +bool X86ATTAsmPrinter::printAsmOperand(const MachineInstr *MI, unsigned OpNo, unsigned AsmVariant, const char *ExtraCode) { // Does this asm operand have a single letter operand modifier? @@ -720,7 +720,7 @@ return false; } -bool X86ATTAsmPrinter::PrintAsmMemoryOperand(const MachineInstr *MI, +bool X86ATTAsmPrinter::printAsmMemoryOperand(const MachineInstr *MI, unsigned OpNo, unsigned AsmVariant, const char *ExtraCode) { Modified: llvm/trunk/lib/Target/X86/X86ATTAsmPrinter.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ATTAsmPrinter.h?rev=52863&r1=52862&r2=52863&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86ATTAsmPrinter.h (original) +++ llvm/trunk/lib/Target/X86/X86ATTAsmPrinter.h Sat Jun 28 06:09:17 2008 @@ -98,9 +98,9 @@ } bool printAsmMRegister(const MachineOperand &MO, const char Mode); - bool PrintAsmOperand(const MachineInstr *MI, unsigned OpNo, + bool printAsmOperand(const MachineInstr *MI, unsigned OpNo, unsigned AsmVariant, const char *ExtraCode); - bool PrintAsmMemoryOperand(const MachineInstr *MI, unsigned OpNo, + bool printAsmMemoryOperand(const MachineInstr *MI, unsigned OpNo, unsigned AsmVariant, const char *ExtraCode); void printMachineInstruction(const MachineInstr *MI); From asl at math.spbu.ru Sat Jun 28 06:09:33 2008 From: asl at math.spbu.ru (Anton Korobeynikov) Date: Sat, 28 Jun 2008 11:09:33 -0000 Subject: [llvm-commits] [llvm] r52864 - in /llvm/trunk/lib/Target/X86: X86ATTAsmPrinter.cpp X86ATTAsmPrinter.h Message-ID: <200806281109.m5SB9X2P012372@zion.cs.uiuc.edu> Author: asl Date: Sat Jun 28 06:09:32 2008 New Revision: 52864 URL: http://llvm.org/viewvc/llvm-project?rev=52864&view=rev Log: Move printing of module-level GVs into dedicated helper Modified: llvm/trunk/lib/Target/X86/X86ATTAsmPrinter.cpp llvm/trunk/lib/Target/X86/X86ATTAsmPrinter.h Modified: llvm/trunk/lib/Target/X86/X86ATTAsmPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ATTAsmPrinter.cpp?rev=52864&r1=52863&r2=52864&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86ATTAsmPrinter.cpp (original) +++ llvm/trunk/lib/Target/X86/X86ATTAsmPrinter.cpp Sat Jun 28 06:09:32 2008 @@ -769,221 +769,222 @@ } -bool X86ATTAsmPrinter::doFinalization(Module &M) { - // Note: this code is not shared by the Intel printer as it is too different - // from how MASM does things. When making changes here don't forget to look - // at X86IntelAsmPrinter::doFinalization(). +void X86ATTAsmPrinter::printModuleLevelGV(const GlobalVariable* GVar) { const TargetData *TD = TM.getTargetData(); - // Print out module-level global variables here. - for (Module::const_global_iterator I = M.global_begin(), E = M.global_end(); - I != E; ++I) { - if (!I->hasInitializer()) - continue; // External global require no code - - // Check to see if this is a special global used by LLVM, if so, emit it. - if (EmitSpecialLLVMGlobal(I)) { - if (Subtarget->isTargetDarwin() && - TM.getRelocationModel() == Reloc::Static) { - if (I->getName() == "llvm.global_ctors") - O << ".reference .constructors_used\n"; - else if (I->getName() == "llvm.global_dtors") - O << ".reference .destructors_used\n"; - } - continue; - } + if (!GVar->hasInitializer()) + return; // External global require no code - std::string name = Mang->getValueName(I); - Constant *C = I->getInitializer(); - const Type *Type = C->getType(); - unsigned Size = TD->getABITypeSize(Type); - unsigned Align = TD->getPreferredAlignmentLog(I); - - if (I->hasHiddenVisibility()) { - if (const char *Directive = TAI->getHiddenDirective()) - O << Directive << name << "\n"; - } else if (I->hasProtectedVisibility()) { - if (const char *Directive = TAI->getProtectedDirective()) - O << Directive << name << "\n"; + // Check to see if this is a special global used by LLVM, if so, emit it. + if (EmitSpecialLLVMGlobal(GVar)) { + if (Subtarget->isTargetDarwin() && + TM.getRelocationModel() == Reloc::Static) { + if (GVar->getName() == "llvm.global_ctors") + O << ".reference .constructors_used\n"; + else if (GVar->getName() == "llvm.global_dtors") + O << ".reference .destructors_used\n"; } + return; + } + + std::string name = Mang->getValueName(GVar); + Constant *C = GVar->getInitializer(); + const Type *Type = C->getType(); + unsigned Size = TD->getABITypeSize(Type); + unsigned Align = TD->getPreferredAlignmentLog(GVar); + + if (GVar->hasHiddenVisibility()) { + if (const char *Directive = TAI->getHiddenDirective()) + O << Directive << name << "\n"; + } else if (GVar->hasProtectedVisibility()) { + if (const char *Directive = TAI->getProtectedDirective()) + O << Directive << name << "\n"; + } - if (Subtarget->isTargetELF()) - O << "\t.type\t" << name << ", at object\n"; + if (Subtarget->isTargetELF()) + O << "\t.type\t" << name << ", at object\n"; - if (C->isNullValue() && !I->hasSection()) { - if (I->hasExternalLinkage()) { - if (const char *Directive = TAI->getZeroFillDirective()) { - O << "\t.globl " << name << "\n"; - O << Directive << "__DATA, __common, " << name << ", " - << Size << ", " << Align << "\n"; - continue; - } + if (C->isNullValue() && !GVar->hasSection()) { + if (GVar->hasExternalLinkage()) { + if (const char *Directive = TAI->getZeroFillDirective()) { + O << "\t.globl " << name << "\n"; + O << Directive << "__DATA, __common, " << name << ", " + << Size << ", " << Align << "\n"; + return; } + } - if (!I->isThreadLocal() && - (I->hasInternalLinkage() || I->hasWeakLinkage() || - I->hasLinkOnceLinkage() || I->hasCommonLinkage())) { - if (Size == 0) Size = 1; // .comm Foo, 0 is undefined, avoid it. - if (!NoZerosInBSS && TAI->getBSSSection()) - SwitchToDataSection(TAI->getBSSSection(), I); - else - SwitchToDataSection(TAI->getDataSection(), I); - if (TAI->getLCOMMDirective() != NULL) { - if (I->hasInternalLinkage()) { - O << TAI->getLCOMMDirective() << name << "," << Size; - if (Subtarget->isTargetDarwin()) - O << "," << Align; - } else if (Subtarget->isTargetDarwin() && !I->hasCommonLinkage()) { - O << "\t.globl " << name << "\n" - << TAI->getWeakDefDirective() << name << "\n"; - SwitchToDataSection("\t.section __DATA,__datacoal_nt,coalesced", I); - EmitAlignment(Align, I); - O << name << ":\t\t\t\t" << TAI->getCommentString() << " "; - PrintUnmangledNameSafely(I, O); - O << "\n"; - EmitGlobalConstant(C); - continue; - } else { - O << TAI->getCOMMDirective() << name << "," << Size; - - // Leopard and above support aligned common symbols. - if (Subtarget->getDarwinVers() >= 9) - O << "," << Align; - } + if (!GVar->isThreadLocal() && + (GVar->hasInternalLinkage() || GVar->hasWeakLinkage() || + GVar->hasLinkOnceLinkage() || GVar->hasCommonLinkage())) { + if (Size == 0) Size = 1; // .comm Foo, 0 is undefined, avoid it. + if (!NoZerosInBSS && TAI->getBSSSection()) + SwitchToDataSection(TAI->getBSSSection(), GVar); + else + SwitchToDataSection(TAI->getDataSection(), GVar); + if (TAI->getLCOMMDirective() != NULL) { + if (GVar->hasInternalLinkage()) { + O << TAI->getLCOMMDirective() << name << "," << Size; + if (Subtarget->isTargetDarwin()) + O << "," << Align; + } else if (Subtarget->isTargetDarwin() && !GVar->hasCommonLinkage()) { + O << "\t.globl " << name << "\n" + << TAI->getWeakDefDirective() << name << "\n"; + SwitchToDataSection("\t.section __DATA,__datacoal_nt,coalesced", GVar); + EmitAlignment(Align, GVar); + O << name << ":\t\t\t\t" << TAI->getCommentString() << " "; + PrintUnmangledNameSafely(GVar, O); + O << "\n"; + EmitGlobalConstant(C); + return; } else { - if (!Subtarget->isTargetCygMing()) { - if (I->hasInternalLinkage()) - O << "\t.local\t" << name << "\n"; - } O << TAI->getCOMMDirective() << name << "," << Size; - if (TAI->getCOMMDirectiveTakesAlignment()) - O << "," << (TAI->getAlignmentIsInBytes() ? (1 << Align) : Align); - } - O << "\t\t" << TAI->getCommentString() << " "; - PrintUnmangledNameSafely(I, O); - O << "\n"; - continue; - } - } - switch (I->getLinkage()) { - case GlobalValue::CommonLinkage: - case GlobalValue::LinkOnceLinkage: - case GlobalValue::WeakLinkage: - if (Subtarget->isTargetDarwin()) { - O << "\t.globl " << name << "\n" - << TAI->getWeakDefDirective() << name << "\n"; - if (!I->isConstant()) - SwitchToDataSection("\t.section __DATA,__datacoal_nt,coalesced", I); - else { - const ArrayType *AT = dyn_cast(Type); - if (AT && AT->getElementType()==Type::Int8Ty) - SwitchToDataSection("\t.section __TEXT,__const_coal,coalesced", I); - else - SwitchToDataSection("\t.section __DATA,__const_coal,coalesced", I); + // Leopard and above support aligned common symbols. + if (Subtarget->getDarwinVers() >= 9) + O << "," << Align; } - } else if (Subtarget->isTargetCygMing()) { - std::string SectionName(".section\t.data$linkonce." + - name + - ",\"aw\""); - SwitchToDataSection(SectionName.c_str(), I); - O << "\t.globl\t" << name << "\n" - << "\t.linkonce same_size\n"; } else { - std::string SectionName("\t.section\t.llvm.linkonce.d." + - name + - ",\"aw\", at progbits"); - SwitchToDataSection(SectionName.c_str(), I); - O << "\t.weak\t" << name << "\n"; - } - break; - case GlobalValue::DLLExportLinkage: - DLLExportedGVs.insert(Mang->makeNameProper(I->getName(),"")); - // FALL THROUGH - case GlobalValue::AppendingLinkage: - // FIXME: appending linkage variables should go into a section of - // their name or something. For now, just emit them as external. - case GlobalValue::ExternalLinkage: - // If external or appending, declare as a global symbol - O << "\t.globl " << name << "\n"; - // FALL THROUGH - case GlobalValue::InternalLinkage: { - if (I->isConstant()) { - const ConstantArray *CVA = dyn_cast(C); - if (TAI->getCStringSection() && CVA && CVA->isCString()) { - SwitchToDataSection(TAI->getCStringSection(), I); - break; + if (!Subtarget->isTargetCygMing()) { + if (GVar->hasInternalLinkage()) + O << "\t.local\t" << name << "\n"; } + O << TAI->getCOMMDirective() << name << "," << Size; + if (TAI->getCOMMDirectiveTakesAlignment()) + O << "," << (TAI->getAlignmentIsInBytes() ? (1 << Align) : Align); } - // FIXME: special handling for ".ctors" & ".dtors" sections - if (I->hasSection() && - (I->getSection() == ".ctors" || - I->getSection() == ".dtors")) { - std::string SectionName = ".section " + I->getSection(); + O << "\t\t" << TAI->getCommentString() << " "; + PrintUnmangledNameSafely(GVar, O); + O << "\n"; + return; + } + } - if (Subtarget->isTargetCygMing()) { - SectionName += ",\"aw\""; - } else { - assert(!Subtarget->isTargetDarwin()); - SectionName += ",\"aw\", at progbits"; - } - SwitchToDataSection(SectionName.c_str()); - } else if (I->hasSection() && Subtarget->isTargetDarwin()) { - // Honor all section names on Darwin; ObjC uses this - std::string SectionName = ".section " + I->getSection(); - SwitchToDataSection(SectionName.c_str()); - } else { - if (C->isNullValue() && !NoZerosInBSS && TAI->getBSSSection()) - SwitchToDataSection(I->isThreadLocal() ? TAI->getTLSBSSSection() : - TAI->getBSSSection(), I); - else if (!I->isConstant()) - SwitchToDataSection(I->isThreadLocal() ? TAI->getTLSDataSection() : - TAI->getDataSection(), I); - else if (I->isThreadLocal()) - SwitchToDataSection(TAI->getTLSDataSection()); - else { - // Read-only data. - bool HasReloc = C->ContainsRelocations(); - if (HasReloc && - Subtarget->isTargetDarwin() && - TM.getRelocationModel() != Reloc::Static) - SwitchToDataSection("\t.const_data\n"); - else if (!HasReloc && Size == 4 && - TAI->getFourByteConstantSection()) - SwitchToDataSection(TAI->getFourByteConstantSection(), I); - else if (!HasReloc && Size == 8 && - TAI->getEightByteConstantSection()) - SwitchToDataSection(TAI->getEightByteConstantSection(), I); - else if (!HasReloc && Size == 16 && - TAI->getSixteenByteConstantSection()) - SwitchToDataSection(TAI->getSixteenByteConstantSection(), I); - else if (TAI->getReadOnlySection()) - SwitchToDataSection(TAI->getReadOnlySection(), I); - else - SwitchToDataSection(TAI->getDataSection(), I); - } + switch (GVar->getLinkage()) { + case GlobalValue::CommonLinkage: + case GlobalValue::LinkOnceLinkage: + case GlobalValue::WeakLinkage: + if (Subtarget->isTargetDarwin()) { + O << "\t.globl " << name << "\n" + << TAI->getWeakDefDirective() << name << "\n"; + if (!GVar->isConstant()) + SwitchToDataSection("\t.section __DATA,__datacoal_nt,coalesced", GVar); + else { + const ArrayType *AT = dyn_cast(Type); + if (AT && AT->getElementType()==Type::Int8Ty) + SwitchToDataSection("\t.section __TEXT,__const_coal,coalesced", GVar); + else + SwitchToDataSection("\t.section __DATA,__const_coal,coalesced", GVar); } - - break; - } - default: - assert(0 && "Unknown linkage type!"); + } else if (Subtarget->isTargetCygMing()) { + std::string SectionName(".section\t.data$linkonce." + + name + + ",\"aw\""); + SwitchToDataSection(SectionName.c_str(), GVar); + O << "\t.globl\t" << name << "\n" + << "\t.linkonce same_size\n"; + } else { + std::string SectionName("\t.section\t.llvm.linkonce.d." + + name + + ",\"aw\", at progbits"); + SwitchToDataSection(SectionName.c_str(), GVar); + O << "\t.weak\t" << name << "\n"; } + break; + case GlobalValue::DLLExportLinkage: + DLLExportedGVs.insert(Mang->makeNameProper(GVar->getName(),"")); + // FALL THROUGH + case GlobalValue::AppendingLinkage: + // FIXME: appending linkage variables should go into a section of + // their name or something. For now, just emit them as external. + case GlobalValue::ExternalLinkage: + // If external or appending, declare as a global symbol + O << "\t.globl " << name << "\n"; + // FALL THROUGH + case GlobalValue::InternalLinkage: { + if (GVar->isConstant()) { + const ConstantArray *CVA = dyn_cast(C); + if (TAI->getCStringSection() && CVA && CVA->isCString()) { + SwitchToDataSection(TAI->getCStringSection(), GVar); + break; + } + } + // FIXME: special handling for ".ctors" & ".dtors" sections + if (GVar->hasSection() && + (GVar->getSection() == ".ctors" || GVar->getSection() == ".dtors")) { + std::string SectionName = ".section " + GVar->getSection(); + + if (Subtarget->isTargetCygMing()) { + SectionName += ",\"aw\""; + } else { + assert(!Subtarget->isTargetDarwin()); + SectionName += ",\"aw\", at progbits"; + } + SwitchToDataSection(SectionName.c_str()); + } else if (GVar->hasSection() && Subtarget->isTargetDarwin()) { + // Honor all section names on Darwin; ObjC uses this + std::string SectionName = ".section " + GVar->getSection(); + SwitchToDataSection(SectionName.c_str()); + } else { + if (C->isNullValue() && !NoZerosInBSS && TAI->getBSSSection()) + SwitchToDataSection(GVar->isThreadLocal() ? TAI->getTLSBSSSection() : + TAI->getBSSSection(), GVar); + else if (!GVar->isConstant()) + SwitchToDataSection(GVar->isThreadLocal() ? TAI->getTLSDataSection() : + TAI->getDataSection(), GVar); + else if (GVar->isThreadLocal()) + SwitchToDataSection(TAI->getTLSDataSection()); + else { + // Read-only data. + bool HasReloc = C->ContainsRelocations(); + if (HasReloc && + Subtarget->isTargetDarwin() && + TM.getRelocationModel() != Reloc::Static) + SwitchToDataSection("\t.const_data\n"); + else if (!HasReloc && Size == 4 && + TAI->getFourByteConstantSection()) + SwitchToDataSection(TAI->getFourByteConstantSection(), GVar); + else if (!HasReloc && Size == 8 && + TAI->getEightByteConstantSection()) + SwitchToDataSection(TAI->getEightByteConstantSection(), GVar); + else if (!HasReloc && Size == 16 && + TAI->getSixteenByteConstantSection()) + SwitchToDataSection(TAI->getSixteenByteConstantSection(), GVar); + else if (TAI->getReadOnlySection()) + SwitchToDataSection(TAI->getReadOnlySection(), GVar); + else + SwitchToDataSection(TAI->getDataSection(), GVar); + } + } + + break; + } + default: + assert(0 && "Unknown linkage type!"); + } - EmitAlignment(Align, I); - O << name << ":\t\t\t\t" << TAI->getCommentString() << " "; - PrintUnmangledNameSafely(I, O); - O << "\n"; - if (TAI->hasDotTypeDotSizeDirective()) - O << "\t.size\t" << name << ", " << Size << "\n"; - // If the initializer is a extern weak symbol, remember to emit the weak - // reference! - if (const GlobalValue *GV = dyn_cast(C)) - if (GV->hasExternalWeakLinkage()) - ExtWeakSymbols.insert(GV); + EmitAlignment(Align, GVar); + O << name << ":\t\t\t\t" << TAI->getCommentString() << " "; + PrintUnmangledNameSafely(GVar, O); + O << "\n"; + if (TAI->hasDotTypeDotSizeDirective()) + O << "\t.size\t" << name << ", " << Size << "\n"; + + // If the initializer is a extern weak symbol, remember to emit the weak + // reference! + if (const GlobalValue *GV = dyn_cast(C)) + if (GV->hasExternalWeakLinkage()) + ExtWeakSymbols.insert(GV); - EmitGlobalConstant(C); - } + EmitGlobalConstant(C); +} + + +bool X86ATTAsmPrinter::doFinalization(Module &M) { + // Print out module-level global variables here. + for (Module::const_global_iterator I = M.global_begin(), E = M.global_end(); + I != E; ++I) + printModuleLevelGV(I); // Output linker support code for dllexported globals if (!DLLExportedGVs.empty()) Modified: llvm/trunk/lib/Target/X86/X86ATTAsmPrinter.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ATTAsmPrinter.h?rev=52864&r1=52863&r2=52864&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86ATTAsmPrinter.h (original) +++ llvm/trunk/lib/Target/X86/X86ATTAsmPrinter.h Sat Jun 28 06:09:32 2008 @@ -118,6 +118,8 @@ unsigned uid) const; void printPICLabel(const MachineInstr *MI, unsigned Op); + void printModuleLevelGV(const GlobalVariable* GVar); + bool runOnMachineFunction(MachineFunction &F); /// getSectionForFunction - Return the section that we should emit the From asl at math.spbu.ru Sat Jun 28 06:09:49 2008 From: asl at math.spbu.ru (Anton Korobeynikov) Date: Sat, 28 Jun 2008 11:09:49 -0000 Subject: [llvm-commits] [llvm] r52865 - in /llvm/trunk/lib/Target/X86: X86ATTAsmPrinter.cpp X86ATTAsmPrinter.h Message-ID: <200806281109.m5SB9njj012391@zion.cs.uiuc.edu> Author: asl Date: Sat Jun 28 06:09:48 2008 New Revision: 52865 URL: http://llvm.org/viewvc/llvm-project?rev=52865&view=rev Log: Temporary rever invalid commit Modified: llvm/trunk/lib/Target/X86/X86ATTAsmPrinter.cpp llvm/trunk/lib/Target/X86/X86ATTAsmPrinter.h Modified: llvm/trunk/lib/Target/X86/X86ATTAsmPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ATTAsmPrinter.cpp?rev=52865&r1=52864&r2=52865&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86ATTAsmPrinter.cpp (original) +++ llvm/trunk/lib/Target/X86/X86ATTAsmPrinter.cpp Sat Jun 28 06:09:48 2008 @@ -658,7 +658,7 @@ printBasicBlockLabel(MBB, false, false, false); } -bool X86ATTAsmPrinter::printAsmMRegister(const MachineOperand &MO, +bool X86ATTAsmPrinter::PrintAsmMRegister(const MachineOperand &MO, const char Mode) { unsigned Reg = MO.getReg(); switch (Mode) { @@ -688,7 +688,7 @@ /// PrintAsmOperand - Print out an operand for an inline asm expression. /// -bool X86ATTAsmPrinter::printAsmOperand(const MachineInstr *MI, unsigned OpNo, +bool X86ATTAsmPrinter::PrintAsmOperand(const MachineInstr *MI, unsigned OpNo, unsigned AsmVariant, const char *ExtraCode) { // Does this asm operand have a single letter operand modifier? @@ -892,8 +892,6 @@ } break; case GlobalValue::DLLExportLinkage: - DLLExportedGVs.insert(Mang->makeNameProper(GVar->getName(),"")); - // FALL THROUGH case GlobalValue::AppendingLinkage: // FIXME: appending linkage variables should go into a section of // their name or something. For now, just emit them as external. @@ -983,9 +981,13 @@ bool X86ATTAsmPrinter::doFinalization(Module &M) { // Print out module-level global variables here. for (Module::const_global_iterator I = M.global_begin(), E = M.global_end(); - I != E; ++I) + I != E; ++I) { printModuleLevelGV(I); + if (I->hasDLLExportLinkage()) + DLLExportedGVs.insert(Mang->makeNameProper(I->getName(),"")); + } + // Output linker support code for dllexported globals if (!DLLExportedGVs.empty()) SwitchToDataSection(".section .drectve"); Modified: llvm/trunk/lib/Target/X86/X86ATTAsmPrinter.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ATTAsmPrinter.h?rev=52865&r1=52864&r2=52865&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86ATTAsmPrinter.h (original) +++ llvm/trunk/lib/Target/X86/X86ATTAsmPrinter.h Sat Jun 28 06:09:48 2008 @@ -98,9 +98,9 @@ } bool printAsmMRegister(const MachineOperand &MO, const char Mode); - bool printAsmOperand(const MachineInstr *MI, unsigned OpNo, + bool PrintAsmOperand(const MachineInstr *MI, unsigned OpNo, unsigned AsmVariant, const char *ExtraCode); - bool printAsmMemoryOperand(const MachineInstr *MI, unsigned OpNo, + bool PrintAsmMemoryOperand(const MachineInstr *MI, unsigned OpNo, unsigned AsmVariant, const char *ExtraCode); void printMachineInstruction(const MachineInstr *MI); From asl at math.spbu.ru Sat Jun 28 06:10:11 2008 From: asl at math.spbu.ru (Anton Korobeynikov) Date: Sat, 28 Jun 2008 11:10:11 -0000 Subject: [llvm-commits] [llvm] r52866 - /llvm/trunk/lib/Target/X86/X86ATTAsmPrinter.cpp Message-ID: <200806281110.m5SBACSC012416@zion.cs.uiuc.edu> Author: asl Date: Sat Jun 28 06:10:06 2008 New Revision: 52866 URL: http://llvm.org/viewvc/llvm-project?rev=52866&view=rev Log: Unbreak Modified: llvm/trunk/lib/Target/X86/X86ATTAsmPrinter.cpp Modified: llvm/trunk/lib/Target/X86/X86ATTAsmPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ATTAsmPrinter.cpp?rev=52866&r1=52865&r2=52866&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86ATTAsmPrinter.cpp (original) +++ llvm/trunk/lib/Target/X86/X86ATTAsmPrinter.cpp Sat Jun 28 06:10:06 2008 @@ -658,7 +658,7 @@ printBasicBlockLabel(MBB, false, false, false); } -bool X86ATTAsmPrinter::PrintAsmMRegister(const MachineOperand &MO, +bool X86ATTAsmPrinter::printAsmMRegister(const MachineOperand &MO, const char Mode) { unsigned Reg = MO.getReg(); switch (Mode) { @@ -720,7 +720,7 @@ return false; } -bool X86ATTAsmPrinter::printAsmMemoryOperand(const MachineInstr *MI, +bool X86ATTAsmPrinter::PrintAsmMemoryOperand(const MachineInstr *MI, unsigned OpNo, unsigned AsmVariant, const char *ExtraCode) { From asl at math.spbu.ru Sat Jun 28 08:45:57 2008 From: asl at math.spbu.ru (Anton Korobeynikov) Date: Sat, 28 Jun 2008 13:45:57 -0000 Subject: [llvm-commits] [llvm] r52868 - in /llvm/trunk: include/llvm/Target/TargetAsmInfo.h lib/Target/TargetAsmInfo.cpp Message-ID: <200806281345.m5SDjvr0017391@zion.cs.uiuc.edu> Author: asl Date: Sat Jun 28 08:45:57 2008 New Revision: 52868 URL: http://llvm.org/viewvc/llvm-project?rev=52868&view=rev Log: Start refactoring of asmprinters: provide a TAI hook, which will select a 'section kind' for a global. Modified: llvm/trunk/include/llvm/Target/TargetAsmInfo.h llvm/trunk/lib/Target/TargetAsmInfo.cpp Modified: llvm/trunk/include/llvm/Target/TargetAsmInfo.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetAsmInfo.h?rev=52868&r1=52867&r2=52868&view=diff ============================================================================== --- llvm/trunk/include/llvm/Target/TargetAsmInfo.h (original) +++ llvm/trunk/include/llvm/Target/TargetAsmInfo.h Sat Jun 28 08:45:57 2008 @@ -29,8 +29,22 @@ }; } + namespace SectionKind { + enum Kind { + Text, ///< Text section + Data, ///< Data section + BSS, ///< BSS section + ROData, ///< Readonly data section + RODataMergeStr, ///< Readonly data section (mergeable strings) + RODataMergeConst, ///< Readonly data section (mergeable constants) + ThreadData, ///< Initialized TLS data objects + ThreadBSS ///< Uninitialized TLS data objects + }; + } + class TargetMachine; class CallInst; + class GlobalValue; /// TargetAsmInfo - This class is intended to be used as a base class for asm /// properties and features specific to the target. @@ -427,7 +441,11 @@ /// if the symbol can be relocated. virtual unsigned PreferredEHDataFormat(DwarfEncoding::Target Reason, bool Global) const; - + + /// SectionKindForGlobal - This hook allows the target to select proper + /// section kind used for global emission. + SectionKind::Kind SectionKindForGlobal(const GlobalValue *GV) const; + // Accessors. // const char *getTextSection() const { @@ -642,7 +660,7 @@ } const char *getDwarfSectionOffsetDirective() const { return DwarfSectionOffsetDirective; - } + } const char *getDwarfAbbrevSection() const { return DwarfAbbrevSection; } Modified: llvm/trunk/lib/Target/TargetAsmInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/TargetAsmInfo.cpp?rev=52868&r1=52867&r2=52868&view=diff ============================================================================== --- llvm/trunk/lib/Target/TargetAsmInfo.cpp (original) +++ llvm/trunk/lib/Target/TargetAsmInfo.cpp Sat Jun 28 08:45:57 2008 @@ -12,7 +12,13 @@ // //===----------------------------------------------------------------------===// +#include "llvm/Constants.h" +#include "llvm/GlobalVariable.h" +#include "llvm/Function.h" +#include "llvm/Module.h" +#include "llvm/Type.h" #include "llvm/Target/TargetAsmInfo.h" +#include "llvm/Target/TargetOptions.h" #include "llvm/Support/Dwarf.h" #include #include @@ -142,3 +148,46 @@ return dwarf::DW_EH_PE_absptr; } +static bool isSuitableForBSS(const GlobalVariable *GV) { + if (!GV->hasInitializer()) + return true; + + // Leave constant zeros in readonly constant sections, so they can be shared + Constant *C = GV->getInitializer(); + return (C->isNullValue() && !GV->isConstant() && !NoZerosInBSS); +} + +SectionKind::Kind +TargetAsmInfo::SectionKindForGlobal(const GlobalValue *GV) const { + // Early exit - functions should be always in text sections. + if (isa(GV)) + return SectionKind::Text; + + const GlobalVariable* GVar = dyn_cast(GV); + bool isThreadLocal = GVar->isThreadLocal(); + assert(GVar && "Invalid global value for section selection"); + + SectionKind::Kind kind; + if (isSuitableForBSS(GVar)) { + // Variable can be easily put to BSS section. + return (isThreadLocal ? SectionKind::ThreadBSS : SectionKind::BSS); + } else if (GVar->isConstant() && !isThreadLocal) { + // Now we know, that varible has initializer and it is constant. We need to + // check its initializer to decide, which section to output it into. Also + // note, there is no thread-local r/o section. + Constant *C = GVar->getInitializer(); + if (C->ContainsRelocations()) + kind = SectionKind::ROData; + else { + const ConstantArray *CVA = dyn_cast(C); + // Check, if initializer is a null-terminated string + if (CVA && CVA->isCString()) + kind = SectionKind::RODataMergeStr; + else + kind = SectionKind::RODataMergeConst; + } + } + + // Variable is not constant or thread-local - emit to generic data section. + return (isThreadLocal ? SectionKind::ThreadData : SectionKind::Data); +} From dalej at apple.com Sat Jun 28 12:14:53 2008 From: dalej at apple.com (Dale Johannesen) Date: Sat, 28 Jun 2008 10:14:53 -0700 Subject: [llvm-commits] [llvm] r52854 - /llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp In-Reply-To: <1214650526.8922.53.camel@localhost> References: <200806280624.m5S6OpPs025870@zion.cs.uiuc.edu> <1214650526.8922.53.camel@localhost> Message-ID: <45C12D28-BB2C-4AE8-8498-03C10C95AF2B@apple.com> Well, x86-32 Darwin bootstraps for me now, so he fixed something. On Jun 28, 2008, at 3:55 AM, Anton Korobeynikov wrote: > Hi, Chris > >> Really fix the bootstrap failure. > TOT is still broken for me: > > Comparing stages 2 and 3 > warning: ./cc1obj-checksum.o differs > warning: ./cc1plus-checksum.o differs > warning: ./cc1-checksum.o differs > warning: ./cc1objplus-checksum.o differs > Bootstrap comparison failure! > ./i386.o differs > > -- > With best regards, Anton Korobeynikov. > > Faculty of Mathematics & Mechanics, Saint Petersburg State University. > > > _______________________________________________ > 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 Sat Jun 28 14:02:54 2008 From: evan.cheng at apple.com (Evan Cheng) Date: Sat, 28 Jun 2008 12:02:54 -0700 Subject: [llvm-commits] [llvm] r52854 - /llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp In-Reply-To: <45C12D28-BB2C-4AE8-8498-03C10C95AF2B@apple.com> References: <200806280624.m5S6OpPs025870@zion.cs.uiuc.edu> <1214650526.8922.53.camel@localhost> <45C12D28-BB2C-4AE8-8498-03C10C95AF2B@apple.com> Message-ID: I haven't had a chance to look into it. But 64-bit llvm compiles this bc file compiles to different code from 32-bit llvm. Evan -------------- next part -------------- A non-text attachment was scrubbed... Name: bug.bc Type: application/octet-stream Size: 12872 bytes Desc: not available Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20080628/e9d89af4/attachment.obj -------------- next part -------------- On Jun 28, 2008, at 10:14 AM, Dale Johannesen wrote: > Well, x86-32 Darwin bootstraps for me now, so he fixed something. > > On Jun 28, 2008, at 3:55 AM, Anton Korobeynikov wrote: > >> Hi, Chris >> >>> Really fix the bootstrap failure. >> TOT is still broken for me: >> >> Comparing stages 2 and 3 >> warning: ./cc1obj-checksum.o differs >> warning: ./cc1plus-checksum.o differs >> warning: ./cc1-checksum.o differs >> warning: ./cc1objplus-checksum.o differs >> Bootstrap comparison failure! >> ./i386.o differs >> >> -- >> With best regards, Anton Korobeynikov. >> >> Fac