From echristo at apple.com Mon Sep 27 00:55:34 2010 From: echristo at apple.com (Eric Christopher) Date: Sun, 26 Sep 2010 22:55:34 -0700 Subject: [llvm-commits] [llvm] r114577 - /llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp In-Reply-To: References: <20100922204209.27DF92A6C12C@llvm.org> Message-ID: <48BAA12C-D4B0-401B-B7B2-D0B592FBB165@apple.com> On Sep 22, 2010, at 2:50 PM, Chris Lattner wrote: > > On Sep 22, 2010, at 1:42 PM, Eric Christopher wrote: > >> Author: echristo >> Date: Wed Sep 22 15:42:08 2010 >> New Revision: 114577 >> >> URL: http://llvm.org/viewvc/llvm-project?rev=114577&view=rev >> Log: >> Temporarily work around new address lowering while I figure out what >> needs to happen for darwin. > > This happens when an instruction is matched with a pattern that uses "addr:$ptr" to represent a memory location. The assert fires when it doesn't derive from MemSDNode, so it doesn't have memory location. Is "TLSCALL" doing a memory access? If so, what kind? It is, it's loading a thunk from the location in memory that has the tls variable that we'll then call through. The code is happening in LowerGlobalTLSAddress in X86ISelLowering and then lowered again via a custom lower later. It's easily possible I'm doing something hacky in the first code. -eric From echristo at apple.com Mon Sep 27 01:01:51 2010 From: echristo at apple.com (Eric Christopher) Date: Mon, 27 Sep 2010 06:01:51 -0000 Subject: [llvm-commits] [llvm] r114811 - /llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Message-ID: <20100927060151.E91D92A6C12C@llvm.org> Author: echristo Date: Mon Sep 27 01:01:51 2010 New Revision: 114811 URL: http://llvm.org/viewvc/llvm-project?rev=114811&view=rev Log: This code should never fire on non-darwin subtargets. Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.cpp?rev=114811&r1=114810&r2=114811&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original) +++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Mon Sep 27 01:01:51 2010 @@ -9660,8 +9660,8 @@ = static_cast(getTargetMachine().getInstrInfo()); DebugLoc DL = MI->getDebugLoc(); MachineFunction *F = BB->getParent(); - bool IsWin64 = Subtarget->isTargetWin64(); - + + assert(Subtarget->isTargetDarwin() && "Darwin only instr emitted?"); assert(MI->getOperand(3).isGlobal() && "This should be a global"); if (Subtarget->is64Bit()) { @@ -9672,7 +9672,7 @@ .addGlobalAddress(MI->getOperand(3).getGlobal(), 0, MI->getOperand(3).getTargetFlags()) .addReg(0); - MIB = BuildMI(*BB, MI, DL, TII->get(IsWin64 ? X86::WINCALL64m : X86::CALL64m)); + MIB = BuildMI(*BB, MI, DL, TII->get(X86::CALL64m)); addDirectMem(MIB, X86::RDI); } else if (getTargetMachine().getRelocationModel() != Reloc::PIC_) { MachineInstrBuilder MIB = BuildMI(*BB, MI, DL, From echristo at apple.com Mon Sep 27 01:02:23 2010 From: echristo at apple.com (Eric Christopher) Date: Mon, 27 Sep 2010 06:02:23 -0000 Subject: [llvm-commits] [llvm] r114812 - /llvm/trunk/lib/Target/ARM/ARMFastISel.cpp Message-ID: <20100927060223.583422A6C12D@llvm.org> Author: echristo Date: Mon Sep 27 01:02:23 2010 New Revision: 114812 URL: http://llvm.org/viewvc/llvm-project?rev=114812&view=rev Log: Mass rename for Jim. Modified: llvm/trunk/lib/Target/ARM/ARMFastISel.cpp Modified: llvm/trunk/lib/Target/ARM/ARMFastISel.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMFastISel.cpp?rev=114812&r1=114811&r2=114812&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMFastISel.cpp (original) +++ llvm/trunk/lib/Target/ARM/ARMFastISel.cpp Mon Sep 27 01:02:23 2010 @@ -113,16 +113,16 @@ // Instruction selection routines. private: - virtual bool ARMSelectLoad(const Instruction *I); - virtual bool ARMSelectStore(const Instruction *I); - virtual bool ARMSelectBranch(const Instruction *I); - virtual bool ARMSelectCmp(const Instruction *I); - virtual bool ARMSelectFPExt(const Instruction *I); - virtual bool ARMSelectFPTrunc(const Instruction *I); - virtual bool ARMSelectBinaryOp(const Instruction *I, unsigned ISDOpcode); - virtual bool ARMSelectSIToFP(const Instruction *I); - virtual bool ARMSelectFPToSI(const Instruction *I); - virtual bool ARMSelectSDiv(const Instruction *I); + virtual bool SelectLoad(const Instruction *I); + virtual bool SelectStore(const Instruction *I); + virtual bool SelectBranch(const Instruction *I); + virtual bool SelectCmp(const Instruction *I); + virtual bool SelectFPExt(const Instruction *I); + virtual bool SelectFPTrunc(const Instruction *I); + virtual bool SelectBinaryOp(const Instruction *I, unsigned ISDOpcode); + virtual bool SelectSIToFP(const Instruction *I); + virtual bool SelectFPToSI(const Instruction *I); + virtual bool SelectSDiv(const Instruction *I); // Utility routines. private: @@ -602,7 +602,7 @@ return true; } -bool ARMFastISel::ARMSelectLoad(const Instruction *I) { +bool ARMFastISel::SelectLoad(const Instruction *I) { // Verify we have a legal type before going any further. EVT VT; if (!isLoadTypeLegal(I->getType(), VT)) @@ -689,7 +689,7 @@ return true; } -bool ARMFastISel::ARMSelectStore(const Instruction *I) { +bool ARMFastISel::SelectStore(const Instruction *I) { Value *Op0 = I->getOperand(0); unsigned SrcReg = 0; @@ -768,14 +768,14 @@ } } -bool ARMFastISel::ARMSelectBranch(const Instruction *I) { +bool ARMFastISel::SelectBranch(const Instruction *I) { const BranchInst *BI = cast(I); MachineBasicBlock *TBB = FuncInfo.MBBMap[BI->getSuccessor(0)]; MachineBasicBlock *FBB = FuncInfo.MBBMap[BI->getSuccessor(1)]; // Simple branch support. // TODO: Hopefully we've already handled the condition since we won't - // have left an update in the value map. See the TODO below in ARMSelectCMP. + // have left an update in the value map. See the TODO below in SelectCMP. Value *Cond = BI->getCondition(); unsigned CondReg = getRegForValue(Cond); if (CondReg == 0) return false; @@ -798,7 +798,7 @@ return true; } -bool ARMFastISel::ARMSelectCmp(const Instruction *I) { +bool ARMFastISel::SelectCmp(const Instruction *I) { const CmpInst *CI = cast(I); EVT VT; @@ -849,7 +849,7 @@ return true; } -bool ARMFastISel::ARMSelectFPExt(const Instruction *I) { +bool ARMFastISel::SelectFPExt(const Instruction *I) { // Make sure we have VFP and that we're extending float to double. if (!Subtarget->hasVFP2()) return false; @@ -868,7 +868,7 @@ return true; } -bool ARMFastISel::ARMSelectFPTrunc(const Instruction *I) { +bool ARMFastISel::SelectFPTrunc(const Instruction *I) { // Make sure we have VFP and that we're truncating double to float. if (!Subtarget->hasVFP2()) return false; @@ -887,7 +887,7 @@ return true; } -bool ARMFastISel::ARMSelectSIToFP(const Instruction *I) { +bool ARMFastISel::SelectSIToFP(const Instruction *I) { // Make sure we have VFP. if (!Subtarget->hasVFP2()) return false; @@ -917,7 +917,7 @@ return true; } -bool ARMFastISel::ARMSelectFPToSI(const Instruction *I) { +bool ARMFastISel::SelectFPToSI(const Instruction *I) { // Make sure we have VFP. if (!Subtarget->hasVFP2()) return false; @@ -950,7 +950,7 @@ return true; } -bool ARMFastISel::ARMSelectBinaryOp(const Instruction *I, unsigned ISDOpcode) { +bool ARMFastISel::SelectBinaryOp(const Instruction *I, unsigned ISDOpcode) { EVT VT = TLI.getValueType(I->getType(), true); // We can get here in the case when we want to use NEON for our fp @@ -1139,7 +1139,7 @@ return true; } -bool ARMFastISel::ARMSelectSDiv(const Instruction *I) { +bool ARMFastISel::SelectSDiv(const Instruction *I) { EVT VT; const Type *Ty = I->getType(); if (!isTypeLegal(Ty, VT)) @@ -1180,30 +1180,30 @@ switch (I->getOpcode()) { case Instruction::Load: - return ARMSelectLoad(I); + return SelectLoad(I); case Instruction::Store: - return ARMSelectStore(I); + return SelectStore(I); case Instruction::Br: - return ARMSelectBranch(I); + return SelectBranch(I); case Instruction::ICmp: case Instruction::FCmp: - return ARMSelectCmp(I); + return SelectCmp(I); case Instruction::FPExt: - return ARMSelectFPExt(I); + return SelectFPExt(I); case Instruction::FPTrunc: - return ARMSelectFPTrunc(I); + return SelectFPTrunc(I); case Instruction::SIToFP: - return ARMSelectSIToFP(I); + return SelectSIToFP(I); case Instruction::FPToSI: - return ARMSelectFPToSI(I); + return SelectFPToSI(I); case Instruction::FAdd: - return ARMSelectBinaryOp(I, ISD::FADD); + return SelectBinaryOp(I, ISD::FADD); case Instruction::FSub: - return ARMSelectBinaryOp(I, ISD::FSUB); + return SelectBinaryOp(I, ISD::FSUB); case Instruction::FMul: - return ARMSelectBinaryOp(I, ISD::FMUL); + return SelectBinaryOp(I, ISD::FMUL); case Instruction::SDiv: - return ARMSelectSDiv(I); + return SelectSDiv(I); default: break; } return false; From echristo at apple.com Mon Sep 27 01:08:12 2010 From: echristo at apple.com (Eric Christopher) Date: Mon, 27 Sep 2010 06:08:12 -0000 Subject: [llvm-commits] [llvm] r114813 - /llvm/trunk/lib/Target/ARM/ARMFastISel.cpp Message-ID: <20100927060812.D66D32A6C12C@llvm.org> Author: echristo Date: Mon Sep 27 01:08:12 2010 New Revision: 114813 URL: http://llvm.org/viewvc/llvm-project?rev=114813&view=rev Log: Insert missing coherency in comment. Add a quick check for hardware divide support also. Modified: llvm/trunk/lib/Target/ARM/ARMFastISel.cpp Modified: llvm/trunk/lib/Target/ARM/ARMFastISel.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMFastISel.cpp?rev=114813&r1=114812&r2=114813&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMFastISel.cpp (original) +++ llvm/trunk/lib/Target/ARM/ARMFastISel.cpp Mon Sep 27 01:08:12 2010 @@ -1144,9 +1144,13 @@ const Type *Ty = I->getType(); if (!isTypeLegal(Ty, VT)) return false; - - // If we have integer div support we should have gotten already, emit a - // libcall. + + // If we have integer div support we should have selected this automagically. + // In case we have a real miss go ahead and return false and we'll pick + // it up later. + if (Subtarget->hasDivide()) return false; + + // Otherwise emit a libcall. RTLIB::Libcall LC = RTLIB::UNKNOWN_LIBCALL; if (VT == MVT::i16) LC = RTLIB::SDIV_I16; From sabre at nondot.org Mon Sep 27 01:34:01 2010 From: sabre at nondot.org (Chris Lattner) Date: Mon, 27 Sep 2010 06:34:01 -0000 Subject: [llvm-commits] [llvm] r114815 - /llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Message-ID: <20100927063401.481632A6C12C@llvm.org> Author: lattner Date: Mon Sep 27 01:34:01 2010 New Revision: 114815 URL: http://llvm.org/viewvc/llvm-project?rev=114815&view=rev Log: improve indentation Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.cpp?rev=114815&r1=114814&r2=114815&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original) +++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Mon Sep 27 01:34:01 2010 @@ -2199,8 +2199,8 @@ GV->hasDefaultVisibility() && !GV->hasLocalLinkage()) { OpFlags = X86II::MO_PLT; } else if (Subtarget->isPICStyleStubAny() && - (GV->isDeclaration() || GV->isWeakForLinker()) && - Subtarget->getDarwinVers() < 9) { + (GV->isDeclaration() || GV->isWeakForLinker()) && + Subtarget->getDarwinVers() < 9) { // PC-relative references to external symbols should go through $stub, // unless we're building with the leopard linker or later, which // automatically synthesizes these stubs. @@ -2219,7 +2219,7 @@ getTargetMachine().getRelocationModel() == Reloc::PIC_) { OpFlags = X86II::MO_PLT; } else if (Subtarget->isPICStyleStubAny() && - Subtarget->getDarwinVers() < 9) { + Subtarget->getDarwinVers() < 9) { // PC-relative references to external symbols should go through $stub, // unless we're building with the leopard linker or later, which // automatically synthesizes these stubs. From sabre at nondot.org Mon Sep 27 01:44:54 2010 From: sabre at nondot.org (Chris Lattner) Date: Mon, 27 Sep 2010 06:44:54 -0000 Subject: [llvm-commits] [llvm] r114817 - in /llvm/trunk: include/llvm/Target/TargetLoweringObjectFile.h include/llvm/Target/TargetMachine.h lib/CodeGen/AsmPrinter/AsmPrinter.cpp lib/CodeGen/TargetLoweringObjectFileImpl.cpp lib/Target/TargetLoweringObjectFile.cpp test/CodeGen/PowerPC/align.ll Message-ID: <20100927064454.65B012A6C12C@llvm.org> Author: lattner Date: Mon Sep 27 01:44:54 2010 New Revision: 114817 URL: http://llvm.org/viewvc/llvm-project?rev=114817&view=rev Log: the latest assembler that runs on powerpc 10.4 machines doesn't support aligned comm. Detect when compiling for 10.4 and don't emit an alignment for comm. THis will hopefully fix PR8198. Modified: llvm/trunk/include/llvm/Target/TargetLoweringObjectFile.h llvm/trunk/include/llvm/Target/TargetMachine.h llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp llvm/trunk/lib/CodeGen/TargetLoweringObjectFileImpl.cpp llvm/trunk/lib/Target/TargetLoweringObjectFile.cpp llvm/trunk/test/CodeGen/PowerPC/align.ll Modified: llvm/trunk/include/llvm/Target/TargetLoweringObjectFile.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetLoweringObjectFile.h?rev=114817&r1=114816&r2=114817&view=diff ============================================================================== --- llvm/trunk/include/llvm/Target/TargetLoweringObjectFile.h (original) +++ llvm/trunk/include/llvm/Target/TargetLoweringObjectFile.h Mon Sep 27 01:44:54 2010 @@ -92,6 +92,11 @@ // information for a TLS variable, it'll go here. const MCSection *TLSExtraDataSection; + /// CommDirectiveSupportsAlignment - True if .comm supports alignment. This + /// is a hack for as long as we support 10.4 Tiger, whose assembler doesn't + /// support alignment on comm. + bool CommDirectiveSupportsAlignment; + /// SupportsWeakEmptyEHFrame - True if target object file supports a /// weak_definition of constant 0 for an omitted EH frame. bool SupportsWeakOmittedEHFrame; @@ -128,6 +133,10 @@ return SupportsWeakOmittedEHFrame; } + bool getCommDirectiveSupportsAlignment() const { + return CommDirectiveSupportsAlignment; + } + const MCSection *getTextSection() const { return TextSection; } const MCSection *getDataSection() const { return DataSection; } const MCSection *getBSSSection() const { return BSSSection; } Modified: llvm/trunk/include/llvm/Target/TargetMachine.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetMachine.h?rev=114817&r1=114816&r2=114817&view=diff ============================================================================== --- llvm/trunk/include/llvm/Target/TargetMachine.h (original) +++ llvm/trunk/include/llvm/Target/TargetMachine.h Mon Sep 27 01:44:54 2010 @@ -280,6 +280,8 @@ public: + const std::string &getTargetTriple() const { return TargetTriple; } + /// addPassesToEmitFile - Add passes to the specified pass manager to get the /// specified file emitted. Typically this will involve several steps of code /// generation. If OptLevel is None, the code generator should emit code as Modified: llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp?rev=114817&r1=114816&r2=114817&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp (original) +++ llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp Mon Sep 27 01:44:54 2010 @@ -282,8 +282,12 @@ // Handle common symbols. if (GVKind.isCommon()) { + unsigned Align = 1 << AlignLog; + if (!getObjFileLowering().getCommDirectiveSupportsAlignment()) + Align = 0; + // .comm _foo, 42, 4 - OutStreamer.EmitCommonSymbol(GVSym, Size, 1 << AlignLog); + OutStreamer.EmitCommonSymbol(GVSym, Size, Align); return; } @@ -301,11 +305,15 @@ OutStreamer.EmitLocalCommonSymbol(GVSym, Size); return; } + + unsigned Align = 1 << AlignLog; + if (!getObjFileLowering().getCommDirectiveSupportsAlignment()) + Align = 0; // .local _foo OutStreamer.EmitSymbolAttribute(GVSym, MCSA_Local); // .comm _foo, 42, 4 - OutStreamer.EmitCommonSymbol(GVSym, Size, 1 << AlignLog); + OutStreamer.EmitCommonSymbol(GVSym, Size, Align); return; } Modified: llvm/trunk/lib/CodeGen/TargetLoweringObjectFileImpl.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/TargetLoweringObjectFileImpl.cpp?rev=114817&r1=114816&r2=114817&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/TargetLoweringObjectFileImpl.cpp (original) +++ llvm/trunk/lib/CodeGen/TargetLoweringObjectFileImpl.cpp Mon Sep 27 01:44:54 2010 @@ -33,6 +33,7 @@ #include "llvm/Support/raw_ostream.h" #include "llvm/ADT/SmallString.h" #include "llvm/ADT/StringExtras.h" +#include "llvm/ADT/Triple.h" using namespace llvm; using namespace dwarf; @@ -450,6 +451,19 @@ IsFunctionEHSymbolGlobal = true; IsFunctionEHFrameSymbolPrivate = false; SupportsWeakOmittedEHFrame = false; + + Triple T(((LLVMTargetMachine&)TM).getTargetTriple()); + if (T.getOS() == Triple::Darwin) { + switch (T.getDarwinMajorNumber()) { + case 7: // 10.3 Panther. + case 8: // 10.4 Tiger. + CommDirectiveSupportsAlignment = false; + break; + case 9: // 10.5 Leopard. + case 10: // 10.6 SnowLeopard. + break; + } + } TargetLoweringObjectFile::Initialize(Ctx, TM); Modified: llvm/trunk/lib/Target/TargetLoweringObjectFile.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/TargetLoweringObjectFile.cpp?rev=114817&r1=114816&r2=114817&view=diff ============================================================================== --- llvm/trunk/lib/Target/TargetLoweringObjectFile.cpp (original) +++ llvm/trunk/lib/Target/TargetLoweringObjectFile.cpp Mon Sep 27 01:44:54 2010 @@ -45,6 +45,7 @@ LSDASection = 0; EHFrameSection = 0; + CommDirectiveSupportsAlignment = true; DwarfAbbrevSection = 0; DwarfInfoSection = 0; DwarfLineSection = 0; Modified: llvm/trunk/test/CodeGen/PowerPC/align.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/PowerPC/align.ll?rev=114817&r1=114816&r2=114817&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/PowerPC/align.ll (original) +++ llvm/trunk/test/CodeGen/PowerPC/align.ll Mon Sep 27 01:44:54 2010 @@ -1,5 +1,6 @@ ; RUN: llc < %s -mtriple=powerpc-linux-gnu | FileCheck %s -check-prefix=ELF ; RUN: llc < %s -mtriple=powerpc-apple-darwin9 | FileCheck %s -check-prefix=DARWIN +; RUN: llc < %s -mtriple=powerpc-apple-darwin8 | FileCheck %s -check-prefix=DARWIN8 @a = global i1 true ; no alignment @@ -40,3 +41,6 @@ @bar = common global [75 x i8] zeroinitializer, align 128 ;ELF: .comm bar,75,128 ;DARWIN: .comm _bar,75,7 + +;; Darwin8 doesn't support aligned comm. Just miscompile this. +; DARWIN8: .comm _bar,75 ; From sabre at nondot.org Mon Sep 27 02:08:21 2010 From: sabre at nondot.org (Chris Lattner) Date: Mon, 27 Sep 2010 07:08:21 -0000 Subject: [llvm-commits] [llvm] r114818 - in /llvm/trunk: lib/Target/X86/AsmParser/X86AsmParser.cpp test/MC/AsmParser/X86/x86_instructions.s Message-ID: <20100927070821.323CD2A6C12C@llvm.org> Author: lattner Date: Mon Sep 27 02:08:21 2010 New Revision: 114818 URL: http://llvm.org/viewvc/llvm-project?rev=114818&view=rev Log: Fix rdar://8468087 - llvm-mc commutes fmul (and friend) operands. My previous fix for rdar://8456371 should only apply to fmulp/faddp, not to fmul/fadd. Instruction set orthogonality is overrated or something. Modified: llvm/trunk/lib/Target/X86/AsmParser/X86AsmParser.cpp llvm/trunk/test/MC/AsmParser/X86/x86_instructions.s Modified: llvm/trunk/lib/Target/X86/AsmParser/X86AsmParser.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/AsmParser/X86AsmParser.cpp?rev=114818&r1=114817&r2=114818&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/AsmParser/X86AsmParser.cpp (original) +++ llvm/trunk/lib/Target/X86/AsmParser/X86AsmParser.cpp Mon Sep 27 02:08:21 2010 @@ -910,11 +910,10 @@ delete Operands[2]; Operands.erase(Operands.begin() + 2); } - - // FIXME: Hack to handle "f{mul*,add*} st(0), $op" the same as - // "f{mul*,add*} $op", since they commute. - if ((Name.startswith("fmul") || Name.startswith("fadd")) && - Operands.size() == 3 && + + // FIXME: Hack to handle "f{mulp,addp} st(0), $op" the same as + // "f{mulp,addp} $op", since they commute. + if ((Name == "fmulp" || Name == "faddp") && Operands.size() == 3 && static_cast(Operands[1])->isReg() && static_cast(Operands[1])->getReg() == X86::ST0) { delete Operands[1]; Modified: llvm/trunk/test/MC/AsmParser/X86/x86_instructions.s URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/AsmParser/X86/x86_instructions.s?rev=114818&r1=114817&r2=114818&view=diff ============================================================================== --- llvm/trunk/test/MC/AsmParser/X86/x86_instructions.s (original) +++ llvm/trunk/test/MC/AsmParser/X86/x86_instructions.s Mon Sep 27 02:08:21 2010 @@ -360,6 +360,22 @@ faddp %st, %st(1) fmulp %st, %st(2) +// rdar://8468087 - Encode these accurately, they are not synonyms. +// CHECK: fmul %st(0), %st(1) +// CHECK: encoding: [0xdc,0xc9] +// CHECK: fmul %st(1) +// CHECK: encoding: [0xd8,0xc9] +fmul %st, %st(1) +fmul %st(1), %st + +// CHECK: fadd %st(0), %st(1) +// CHECK: encoding: [0xdc,0xc1] +// CHECK: fadd %st(1) +// CHECK: encoding: [0xd8,0xc1] +fadd %st, %st(1) +fadd %st(1), %st + + // rdar://8416805 // CHECK: xorb %al, %al // CHECK: encoding: [0x30,0xc0] From sabre at nondot.org Mon Sep 27 02:11:53 2010 From: sabre at nondot.org (Chris Lattner) Date: Mon, 27 Sep 2010 07:11:53 -0000 Subject: [llvm-commits] [llvm] r114819 - in /llvm/trunk: lib/Target/X86/AsmParser/X86AsmParser.cpp test/MC/AsmParser/X86/x86_instructions.s Message-ID: <20100927071154.0B42A2A6C12C@llvm.org> Author: lattner Date: Mon Sep 27 02:11:53 2010 New Revision: 114819 URL: http://llvm.org/viewvc/llvm-project?rev=114819&view=rev Log: fix rdar://8470918 - llvm-mc can't assemble smovl Modified: llvm/trunk/lib/Target/X86/AsmParser/X86AsmParser.cpp llvm/trunk/test/MC/AsmParser/X86/x86_instructions.s Modified: llvm/trunk/lib/Target/X86/AsmParser/X86AsmParser.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/AsmParser/X86AsmParser.cpp?rev=114819&r1=114818&r2=114819&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/AsmParser/X86AsmParser.cpp (original) +++ llvm/trunk/lib/Target/X86/AsmParser/X86AsmParser.cpp Mon Sep 27 02:11:53 2010 @@ -634,6 +634,10 @@ .Case("repnz", "repne") .Case("iret", "iretl") .Case("sysret", "sysretl") + .Case("smovb", "movsb") + .Case("smovw", "movsw") + .Case("smovl", "movsl") + .Case("smovq", "movsq") .Case("push", Is64Bit ? "pushq" : "pushl") .Case("pop", Is64Bit ? "popq" : "popl") .Case("pushf", Is64Bit ? "pushfq" : "pushfl") Modified: llvm/trunk/test/MC/AsmParser/X86/x86_instructions.s URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/AsmParser/X86/x86_instructions.s?rev=114819&r1=114818&r2=114819&view=diff ============================================================================== --- llvm/trunk/test/MC/AsmParser/X86/x86_instructions.s (original) +++ llvm/trunk/test/MC/AsmParser/X86/x86_instructions.s Mon Sep 27 02:11:53 2010 @@ -83,6 +83,13 @@ // CHECK: movsb rep;movsb + +// rdar://8470918 +smovb // CHECK: movsb +smovw // CHECK: movsw +smovl // CHECK: movsl +smovq // CHECK: movsq + // rdar://8456361 // CHECK: rep // CHECK: movsl From sabre at nondot.org Mon Sep 27 02:21:41 2010 From: sabre at nondot.org (Chris Lattner) Date: Mon, 27 Sep 2010 07:21:41 -0000 Subject: [llvm-commits] [llvm] r114821 - in /llvm/trunk: lib/Target/X86/AsmParser/X86AsmParser.cpp test/MC/AsmParser/X86/x86_instructions.s Message-ID: <20100927072141.C45512A6C12C@llvm.org> Author: lattner Date: Mon Sep 27 02:21:41 2010 New Revision: 114821 URL: http://llvm.org/viewvc/llvm-project?rev=114821&view=rev Log: add a couple more aliases, rdar://8456378 Modified: llvm/trunk/lib/Target/X86/AsmParser/X86AsmParser.cpp llvm/trunk/test/MC/AsmParser/X86/x86_instructions.s Modified: llvm/trunk/lib/Target/X86/AsmParser/X86AsmParser.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/AsmParser/X86AsmParser.cpp?rev=114821&r1=114820&r2=114821&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/AsmParser/X86AsmParser.cpp (original) +++ llvm/trunk/lib/Target/X86/AsmParser/X86AsmParser.cpp Mon Sep 27 02:21:41 2010 @@ -634,6 +634,8 @@ .Case("repnz", "repne") .Case("iret", "iretl") .Case("sysret", "sysretl") + .Case("cwde", "cwtl") + .Case("cdqe", "cltq") .Case("smovb", "movsb") .Case("smovw", "movsw") .Case("smovl", "movsl") Modified: llvm/trunk/test/MC/AsmParser/X86/x86_instructions.s URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/AsmParser/X86/x86_instructions.s?rev=114821&r1=114820&r2=114821&view=diff ============================================================================== --- llvm/trunk/test/MC/AsmParser/X86/x86_instructions.s (original) +++ llvm/trunk/test/MC/AsmParser/X86/x86_instructions.s Mon Sep 27 02:21:41 2010 @@ -397,4 +397,9 @@ clr %esi clr %rsi +// rdar://8456378 +cltq // CHECK: cltq +cdqe // CHECK: cltq +cwde // CHECK: cwtl +cwtl // CHECK: cwtl From sabre at nondot.org Mon Sep 27 02:24:57 2010 From: sabre at nondot.org (Chris Lattner) Date: Mon, 27 Sep 2010 07:24:57 -0000 Subject: [llvm-commits] [llvm] r114822 - in /llvm/trunk: lib/Target/X86/AsmParser/X86AsmParser.cpp test/MC/AsmParser/X86/x86_instructions.s Message-ID: <20100927072457.C96912A6C12C@llvm.org> Author: lattner Date: Mon Sep 27 02:24:57 2010 New Revision: 114822 URL: http://llvm.org/viewvc/llvm-project?rev=114822&view=rev Log: yet more aliases. Modified: llvm/trunk/lib/Target/X86/AsmParser/X86AsmParser.cpp llvm/trunk/test/MC/AsmParser/X86/x86_instructions.s Modified: llvm/trunk/lib/Target/X86/AsmParser/X86AsmParser.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/AsmParser/X86AsmParser.cpp?rev=114822&r1=114821&r2=114822&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/AsmParser/X86AsmParser.cpp (original) +++ llvm/trunk/lib/Target/X86/AsmParser/X86AsmParser.cpp Mon Sep 27 02:24:57 2010 @@ -634,6 +634,9 @@ .Case("repnz", "repne") .Case("iret", "iretl") .Case("sysret", "sysretl") + .Case("cbw", "cbtw") + .Case("cwd", "cwtd") + .Case("cdq", "cltd") .Case("cwde", "cwtl") .Case("cdqe", "cltq") .Case("smovb", "movsb") Modified: llvm/trunk/test/MC/AsmParser/X86/x86_instructions.s URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/AsmParser/X86/x86_instructions.s?rev=114822&r1=114821&r2=114822&view=diff ============================================================================== --- llvm/trunk/test/MC/AsmParser/X86/x86_instructions.s (original) +++ llvm/trunk/test/MC/AsmParser/X86/x86_instructions.s Mon Sep 27 02:24:57 2010 @@ -403,3 +403,7 @@ cwde // CHECK: cwtl cwtl // CHECK: cwtl +// rdar://8416805 +cbw // CHECK: cbtw +cwd // CHECK: cwtd +cdq // CHECK: cltd From bigcheesegs at gmail.com Mon Sep 27 03:58:26 2010 From: bigcheesegs at gmail.com (Michael J. Spencer) Date: Mon, 27 Sep 2010 08:58:26 -0000 Subject: [llvm-commits] [llvm] r114823 - in /llvm/trunk: lib/MC/WinCOFFObjectWriter.cpp test/MC/COFF/basic-coff.ll test/MC/COFF/symbol-fragment-offset.ll Message-ID: <20100927085826.78D732A6C12C@llvm.org> Author: mspencer Date: Mon Sep 27 03:58:26 2010 New Revision: 114823 URL: http://llvm.org/viewvc/llvm-project?rev=114823&view=rev Log: MC-COFF: Drop empty sections, and label symbols. Convert relocations targeted at symbols into relocations relative to the containing section. Patch by Nathan Jeffords! Modified: llvm/trunk/lib/MC/WinCOFFObjectWriter.cpp llvm/trunk/test/MC/COFF/basic-coff.ll llvm/trunk/test/MC/COFF/symbol-fragment-offset.ll Modified: llvm/trunk/lib/MC/WinCOFFObjectWriter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/WinCOFFObjectWriter.cpp?rev=114823&r1=114822&r2=114823&view=diff ============================================================================== --- llvm/trunk/lib/MC/WinCOFFObjectWriter.cpp (original) +++ llvm/trunk/lib/MC/WinCOFFObjectWriter.cpp Mon Sep 27 03:58:26 2010 @@ -55,6 +55,9 @@ COFF::Auxiliary Aux; }; +class COFFSymbol; +class COFFSection; + class COFFSymbol { public: COFF::symbol Data; @@ -65,12 +68,16 @@ size_t Index; AuxiliarySymbols Aux; COFFSymbol *Other; + COFFSection *Section; + int Relocations; MCSymbolData const *MCData; - COFFSymbol(llvm::StringRef name, size_t index); + COFFSymbol(llvm::StringRef name); size_t size() const; void set_name_offset(uint32_t Offset); + + bool should_keep() const; }; // This class contains staging data for a COFF relocation entry. @@ -91,10 +98,10 @@ std::string Name; size_t Number; MCSectionData const *MCData; - COFFSymbol *Symb; + COFFSymbol *Symbol; relocations Relocations; - COFFSection(llvm::StringRef name, size_t Index); + COFFSection(llvm::StringRef name); static size_t size(); }; @@ -141,18 +148,20 @@ COFFSymbol *createSymbol(llvm::StringRef Name); COFFSection *createSection(llvm::StringRef Name); - void InitCOFFEntity(COFFSymbol &Symbol); - void InitCOFFEntity(COFFSection &Section); - template object_t *createCOFFEntity(llvm::StringRef Name, list_t &List); void DefineSection(MCSectionData const &SectionData); void DefineSymbol(MCSymbolData const &SymbolData, MCAssembler &Assembler); - bool ExportSection(COFFSection *S); + void MakeSymbolReal(COFFSymbol &S, size_t Index); + void MakeSectionReal(COFFSection &S, size_t Number); + + bool ExportSection(COFFSection const *S); bool ExportSymbol(MCSymbolData const &SymbolData, MCAssembler &Asm); + bool IsPhysicalSection(COFFSection *S); + // Entity writing methods. void WriteFileHeader(const COFF::header &Header); @@ -198,9 +207,12 @@ //------------------------------------------------------------------------------ // Symbol class implementation -COFFSymbol::COFFSymbol(llvm::StringRef name, size_t index) - : Name(name.begin(), name.end()), Index(-1) - , Other(NULL), MCData(NULL) { +COFFSymbol::COFFSymbol(llvm::StringRef name) + : Name(name.begin(), name.end()) + , Other(NULL) + , Section(NULL) + , Relocations(0) + , MCData(NULL) { memset(&Data, 0, sizeof(Data)); } @@ -216,12 +228,41 @@ write_uint32_le(Data.Name + 4, Offset); } +/// logic to decide if the symbol should be reported in the symbol table +bool COFFSymbol::should_keep() const { + // no section means its external, keep it + if (Section == NULL) + return true; + + // if it has relocations pointing at it, keep it + if (Relocations > 0) { + assert(Section->Number != -1 && "Sections with relocations must be real!"); + return true; + } + + // if the section its in is being droped, drop it + if (Section->Number == -1) + return false; + + // if it is the section symbol, keep it + if (Section->Symbol == this) + return true; + + // if its temporary, drop it + if (MCData && MCData->getSymbol().isTemporary()) + return false; + + // otherwise, keep it + return true; +} + //------------------------------------------------------------------------------ // Section class implementation -COFFSection::COFFSection(llvm::StringRef name, size_t Index) - : Name(name), Number(Index + 1) - , MCData(NULL), Symb(NULL) { +COFFSection::COFFSection(llvm::StringRef name) + : Name(name) + , MCData(NULL) + , Symbol(NULL) { memset(&Header, 0, sizeof(Header)); } @@ -298,45 +339,12 @@ return createCOFFEntity(Name, Sections); } -/// This function initializes a symbol by entering its name into the string -/// table if it is too long to fit in the symbol table header. -void WinCOFFObjectWriter::InitCOFFEntity(COFFSymbol &S) { - if (S.Name.size() > COFF::NameSize) { - size_t StringTableEntry = Strings.insert(S.Name.c_str()); - - S.set_name_offset(StringTableEntry); - } else - memcpy(S.Data.Name, S.Name.c_str(), S.Name.size()); -} - -/// This function initializes a section by entering its name into the string -/// table if it is too long to fit in the section table header. -void WinCOFFObjectWriter::InitCOFFEntity(COFFSection &S) { - if (S.Name.size() > COFF::NameSize) { - size_t StringTableEntry = Strings.insert(S.Name.c_str()); - - // FIXME: Why is this number 999999? This number is never mentioned in the - // spec. I'm assuming this is due to the printed value needing to fit into - // the S.Header.Name field. In which case why not 9999999 (7 9's instead of - // 6)? The spec does not state if this entry should be null terminated in - // this case, and thus this seems to be the best way to do it. I think I - // just solved my own FIXME... - if (StringTableEntry > 999999) - report_fatal_error("COFF string table is greater than 999999 bytes."); - - sprintf(S.Header.Name, "/%d", (unsigned)StringTableEntry); - } else - memcpy(S.Header.Name, S.Name.c_str(), S.Name.size()); -} - /// A template used to lookup or create a symbol/section, and initialize it if /// needed. template object_t *WinCOFFObjectWriter::createCOFFEntity(llvm::StringRef Name, list_t &List) { - object_t *Object = new object_t(Name, List.size()); - - InitCOFFEntity(*Object); + object_t *Object = new object_t(Name); List.push_back(Object); @@ -353,15 +361,14 @@ COFFSection *coff_section = createSection(Sec.getSectionName()); COFFSymbol *coff_symbol = createSymbol(Sec.getSectionName()); - coff_section->Symb = coff_symbol; + coff_section->Symbol = coff_symbol; + coff_symbol->Section = coff_section; coff_symbol->Data.StorageClass = COFF::IMAGE_SYM_CLASS_STATIC; - coff_symbol->Data.SectionNumber = coff_section->Number; // In this case the auxiliary symbol is a Section Definition. coff_symbol->Aux.resize(1); memset(&coff_symbol->Aux[0], 0, sizeof(coff_symbol->Aux[0])); coff_symbol->Aux[0].AuxType = ATSectionDefinition; - coff_symbol->Aux[0].Aux.SectionDefinition.Number = coff_section->Number; coff_symbol->Aux[0].Aux.SectionDefinition.Selection = Sec.getSelection(); coff_section->Header.Characteristics = Sec.getCharacteristics(); @@ -394,7 +401,9 @@ /// This function takes a section data object from the assembler /// and creates the associated COFF symbol staging object. void WinCOFFObjectWriter::DefineSymbol(MCSymbolData const &SymbolData, - MCAssembler &Assembler) { + MCAssembler &Assembler) { + assert(!SymbolData.getSymbol().isVariable() + && "Cannot define a symbol that is a variable!"); COFFSymbol *coff_symbol = createSymbol(SymbolData.getSymbol().getName()); coff_symbol->Data.Type = (SymbolData.getFlags() & 0x0000FFFF) >> 0; @@ -405,7 +414,7 @@ bool external = SymbolData.isExternal() || (SymbolData.Fragment == NULL); coff_symbol->Data.StorageClass = - external ? COFF::IMAGE_SYM_CLASS_EXTERNAL : COFF::IMAGE_SYM_CLASS_STATIC; + external ? COFF::IMAGE_SYM_CLASS_EXTERNAL : COFF::IMAGE_SYM_CLASS_LABEL; } if (SymbolData.getFlags() & COFF::SF_WeakReference) { @@ -438,14 +447,50 @@ COFF::IMAGE_WEAK_EXTERN_SEARCH_LIBRARY; } + if (SymbolData.Fragment != NULL) + coff_symbol->Section = SectionMap[SymbolData.Fragment->getParent()]; + // Bind internal COFF symbol to MC symbol. coff_symbol->MCData = &SymbolData; SymbolMap[&SymbolData] = coff_symbol; } -bool WinCOFFObjectWriter::ExportSection(COFFSection *S) { - return (S->Header.Characteristics - & COFF::IMAGE_SCN_CNT_UNINITIALIZED_DATA) == 0; +/// making a section real involves assigned it a number and putting +/// name into the string table if needed +void WinCOFFObjectWriter::MakeSectionReal(COFFSection &S, size_t Number) { + if (S.Name.size() > COFF::NameSize) { + size_t StringTableEntry = Strings.insert(S.Name.c_str()); + + // FIXME: Why is this number 999999? This number is never mentioned in the + // spec. I'm assuming this is due to the printed value needing to fit into + // the S.Header.Name field. In which case why not 9999999 (7 9's instead of + // 6)? The spec does not state if this entry should be null terminated in + // this case, and thus this seems to be the best way to do it. I think I + // just solved my own FIXME... + if (StringTableEntry > 999999) + report_fatal_error("COFF string table is greater than 999999 bytes."); + + std::sprintf(S.Header.Name, "/%d", unsigned(StringTableEntry)); + } else + std::memcpy(S.Header.Name, S.Name.c_str(), S.Name.size()); + + S.Number = Number; + S.Symbol->Data.SectionNumber = S.Number; + S.Symbol->Aux[0].Aux.SectionDefinition.Number = S.Number; +} + +void WinCOFFObjectWriter::MakeSymbolReal(COFFSymbol &S, size_t Index) { + if (S.Name.size() > COFF::NameSize) { + size_t StringTableEntry = Strings.insert(S.Name.c_str()); + + S.set_name_offset(StringTableEntry); + } else + std::memcpy(S.Data.Name, S.Name.c_str(), S.Name.size()); + S.Index = Index; +} + +bool WinCOFFObjectWriter::ExportSection(COFFSection const *S) { + return !S->MCData->getFragmentList().empty(); } bool WinCOFFObjectWriter::ExportSymbol(MCSymbolData const &SymbolData, @@ -455,8 +500,14 @@ // return Asm.isSymbolLinkerVisible (&SymbolData); - // For now, all symbols are exported, the linker will sort it out for us. - return true; + // For now, all non-variable symbols are exported, + // the linker will sort the rest out for us. + return !SymbolData.getSymbol().isVariable(); +} + +bool WinCOFFObjectWriter::IsPhysicalSection(COFFSection *S) { + return (S->Header.Characteristics + & COFF::IMAGE_SCN_CNT_UNINITIALIZED_DATA) == 0; } //------------------------------------------------------------------------------ @@ -548,7 +599,7 @@ void WinCOFFObjectWriter::ExecutePostLayoutBinding(MCAssembler &Asm) { // "Define" each section & symbol. This creates section & symbol - // entries in the staging area and gives them their final indexes. + // entries in the staging area. for (MCAssembler::const_iterator i = Asm.begin(), e = Asm.end(); i != e; i++) DefineSection(*i); @@ -600,7 +651,15 @@ Reloc.Data.SymbolTableIndex = 0; Reloc.Data.VirtualAddress = Layout.getFragmentOffset(Fragment); - Reloc.Symb = coff_symbol; + + // turn relocations for temporary symbols into section relocations + if (coff_symbol->MCData->getSymbol().isTemporary()) { + Reloc.Symb = coff_symbol->Section->Symbol; + FixedValue += Layout.getFragmentOffset(coff_symbol->MCData->Fragment); + } else + Reloc.Symb = coff_symbol; + + ++Reloc.Symb->Relocations; Reloc.Data.VirtualAddress += Fixup.getOffset(); @@ -634,6 +693,16 @@ void WinCOFFObjectWriter::WriteObject(const MCAssembler &Asm, const MCAsmLayout &Layout) { // Assign symbol and section indexes and offsets. + Header.NumberOfSections = 0; + + for (sections::iterator i = Sections.begin(), + e = Sections.end(); i != e; i++) { + if (Layout.getSectionSize((*i)->MCData) > 0) { + MakeSectionReal(**i, ++Header.NumberOfSections); + } else { + (*i)->Number = -1; + } + } Header.NumberOfSymbols = 0; @@ -641,32 +710,35 @@ COFFSymbol *coff_symbol = *i; MCSymbolData const *SymbolData = coff_symbol->MCData; - coff_symbol->Index = Header.NumberOfSymbols++; - // Update section number & offset for symbols that have them. if ((SymbolData != NULL) && (SymbolData->Fragment != NULL)) { - COFFSection *coff_section = SectionMap[SymbolData->Fragment->getParent()]; + assert(coff_symbol->Section != NULL); - coff_symbol->Data.SectionNumber = coff_section->Number; + coff_symbol->Data.SectionNumber = coff_symbol->Section->Number; coff_symbol->Data.Value = Layout.getFragmentOffset(SymbolData->Fragment) + SymbolData->Offset; } - // Update auxiliary symbol info. - coff_symbol->Data.NumberOfAuxSymbols = coff_symbol->Aux.size(); - Header.NumberOfSymbols += coff_symbol->Data.NumberOfAuxSymbols; + if (coff_symbol->should_keep()) { + MakeSymbolReal(*coff_symbol, Header.NumberOfSymbols++); + + // Update auxiliary symbol info. + coff_symbol->Data.NumberOfAuxSymbols = coff_symbol->Aux.size(); + Header.NumberOfSymbols += coff_symbol->Data.NumberOfAuxSymbols; + } else + coff_symbol->Index = -1; } // Fixup weak external references. for (symbols::iterator i = Symbols.begin(), e = Symbols.end(); i != e; i++) { - COFFSymbol *symb = *i; - - if (symb->Other != NULL) { - assert(symb->Aux.size() == 1 && + COFFSymbol *coff_symbol = *i; + if (coff_symbol->Other != NULL) { + assert(coff_symbol->Index != -1); + assert(coff_symbol->Aux.size() == 1 && "Symbol must contain one aux symbol!"); - assert(symb->Aux[0].AuxType == ATWeakExternal && + assert(coff_symbol->Aux[0].AuxType == ATWeakExternal && "Symbol's aux symbol must be a Weak External!"); - symb->Aux[0].Aux.WeakExternal.TagIndex = symb->Other->Index; + coff_symbol->Aux[0].Aux.WeakExternal.TagIndex = coff_symbol->Other->Index; } } @@ -675,18 +747,19 @@ unsigned offset = 0; offset += COFF::HeaderSize; - offset += COFF::SectionSize * Asm.size(); - - Header.NumberOfSections = Sections.size(); + offset += COFF::SectionSize * Header.NumberOfSections; for (MCAssembler::const_iterator i = Asm.begin(), e = Asm.end(); i != e; i++) { COFFSection *Sec = SectionMap[i]; + if (Sec->Number == -1) + continue; + Sec->Header.SizeOfRawData = Layout.getSectionFileSize(i); - if (ExportSection(Sec)) { + if (IsPhysicalSection(Sec)) { Sec->Header.PointerToRawData = offset; offset += Sec->Header.SizeOfRawData; @@ -700,13 +773,15 @@ for (relocations::iterator cr = Sec->Relocations.begin(), er = Sec->Relocations.end(); - cr != er; cr++) { + cr != er; ++cr) { + assert((*cr).Symb->Index != -1); (*cr).Data.SymbolTableIndex = (*cr).Symb->Index; } } - assert(Sec->Symb->Aux.size() == 1 && "Section's symbol must have one aux!"); - AuxSymbol &Aux = Sec->Symb->Aux[0]; + assert(Sec->Symbol->Aux.size() == 1 + && "Section's symbol must have one aux!"); + AuxSymbol &Aux = Sec->Symbol->Aux[0]; assert(Aux.AuxType == ATSectionDefinition && "Section's symbol's aux symbol must be a Section Definition!"); Aux.Aux.SectionDefinition.Length = Sec->Header.SizeOfRawData; @@ -728,11 +803,16 @@ MCAssembler::const_iterator j, je; for (i = Sections.begin(), ie = Sections.end(); i != ie; i++) - WriteSectionHeader((*i)->Header); + if ((*i)->Number != -1) + WriteSectionHeader((*i)->Header); for (i = Sections.begin(), ie = Sections.end(), j = Asm.begin(), je = Asm.end(); - (i != ie) && (j != je); i++, j++) { + (i != ie) && (j != je); ++i, ++j) { + + if ((*i)->Number == -1) + continue; + if ((*i)->Header.PointerToRawData != 0) { assert(OS.tell() == (*i)->Header.PointerToRawData && "Section::PointerToRawData is insane!"); @@ -759,7 +839,8 @@ "Header::PointerToSymbolTable is insane!"); for (symbols::iterator i = Symbols.begin(), e = Symbols.end(); i != e; i++) - WriteSymbol(*i); + if ((*i)->Index != -1) + WriteSymbol(*i); OS.write((char const *)&Strings.Data.front(), Strings.Data.size()); } Modified: llvm/trunk/test/MC/COFF/basic-coff.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/COFF/basic-coff.ll?rev=114823&r1=114822&r2=114823&view=diff ============================================================================== --- llvm/trunk/test/MC/COFF/basic-coff.ll (original) +++ llvm/trunk/test/MC/COFF/basic-coff.ll Mon Sep 27 03:58:26 2010 @@ -19,8 +19,8 @@ ; CHECK: MachineType = IMAGE_FILE_MACHINE_I386 (0x14C) ; CHECK: NumberOfSections = 2 ; CHECK: TimeDateStamp = {{[0-9]+}} -; CHECK: PointerToSymbolTable = 0x99 -; CHECK: NumberOfSymbols = 7 +; CHECK: PointerToSymbolTable = 0x{{[0-9A-F]+}} +; CHECK: NumberOfSymbols = 6 ; CHECK: SizeOfOptionalHeader = 0 ; CHECK: Characteristics = 0x0 ; CHECK: Sections = [ @@ -28,9 +28,9 @@ ; CHECK: Name = .text ; CHECK: VirtualSize = 0 ; CHECK: VirtualAddress = 0 -; CHECK: SizeOfRawData = 21 -; CHECK: PointerToRawData = 0x64 -; CHECK: PointerToRelocations = 0x79 +; CHECK: SizeOfRawData = {{[0-9]+}} +; CHECK: PointerToRawData = 0x{{[0-9A-F]+}} +; CHECK: PointerToRelocations = 0x{{[0-9A-F]+}} ; CHECK: PointerToLineNumbers = 0x0 ; CHECK: NumberOfRelocations = 2 ; CHECK: NumberOfLineNumbers = 0 @@ -40,20 +40,18 @@ ; CHECK: IMAGE_SCN_MEM_EXECUTE ; CHECK: IMAGE_SCN_MEM_READ ; CHECK: SectionData = -; CHECK: 83 EC 04 C7 04 24 00 00 - 00 00 E8 00 00 00 00 31 |.....$.........1| -; CHECK: C0 83 C4 04 C3 |.....| ; CHECK: Relocations = [ ; CHECK: 0 = { -; CHECK: VirtualAddress = 0x6 -; CHECK: SymbolTableIndex = 5 +; CHECK: VirtualAddress = 0x{{[0-9A-F]+}} +; CHECK: SymbolTableIndex = 2 ; CHECK: Type = IMAGE_REL_I386_DIR32 (6) -; CHECK: SymbolName = _main +; CHECK: SymbolName = ; CHECK: } ; CHECK: 1 = { -; CHECK: VirtualAddress = 0xB -; CHECK: SymbolTableIndex = 6 +; CHECK: VirtualAddress = 0x{{[0-9A-F]+}} +; CHECK: SymbolTableIndex = 5 ; CHECK: Type = IMAGE_REL_I386_REL32 (20) -; CHECK: SymbolName = L_.str +; CHECK: SymbolName = _main ; CHECK: } ; CHECK: ] ; CHECK: } @@ -61,8 +59,8 @@ ; CHECK: Name = .data ; CHECK: VirtualSize = 0 ; CHECK: VirtualAddress = 0 -; CHECK: SizeOfRawData = 12 -; CHECK: PointerToRawData = 0x8D +; CHECK: SizeOfRawData = {{[0-9]+}} +; CHECK: PointerToRawData = 0x{{[0-9A-F]+}} ; CHECK: PointerToRelocations = 0x0 ; CHECK: PointerToLineNumbers = 0x0 ; CHECK: NumberOfRelocations = 0 @@ -113,16 +111,6 @@ ; CHECK: AuxillaryData = ; CHECK: } ; CHECK: 3 = { -; CHECK: Name = L_.str -; CHECK: Value = 0 -; CHECK: SectionNumber = 2 -; CHECK: SimpleType = IMAGE_SYM_TYPE_NULL (0) -; CHECK: ComplexType = IMAGE_SYM_DTYPE_NULL (0) -; CHECK: StorageClass = IMAGE_SYM_CLASS_STATIC (3) -; CHECK: NumberOfAuxSymbols = 0 -; CHECK: AuxillaryData = -; CHECK: } -; CHECK: 4 = { ; CHECK: Name = _printf ; CHECK: Value = 0 ; CHECK: SectionNumber = 0 Modified: llvm/trunk/test/MC/COFF/symbol-fragment-offset.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/COFF/symbol-fragment-offset.ll?rev=114823&r1=114822&r2=114823&view=diff ============================================================================== --- llvm/trunk/test/MC/COFF/symbol-fragment-offset.ll (original) +++ llvm/trunk/test/MC/COFF/symbol-fragment-offset.ll Mon Sep 27 03:58:26 2010 @@ -23,8 +23,8 @@ ; CHECK: MachineType = IMAGE_FILE_MACHINE_I386 (0x14C) ; CHECK: NumberOfSections = 2 ; CHECK: TimeDateStamp = {{[0-9]+}} -; CHECK: PointerToSymbolTable = 0xBB -; CHECK: NumberOfSymbols = 9 +; CHECK: PointerToSymbolTable = 0x{{[0-9A-F]+}} +; CHECK: NumberOfSymbols = 8 ; CHECK: SizeOfOptionalHeader = 0 ; CHECK: Characteristics = 0x0 ; CHECK: Sections = [ @@ -32,9 +32,9 @@ ; CHECK: Name = .text ; CHECK: VirtualSize = 0 ; CHECK: VirtualAddress = 0 -; CHECK: SizeOfRawData = 33 -; CHECK: PointerToRawData = 0x64 -; CHECK: PointerToRelocations = 0x85 +; CHECK: SizeOfRawData = {{[0-9]+}} +; CHECK: PointerToRawData = 0x{{[0-9A-F]+}} +; CHECK: PointerToRelocations = 0x{{[0-9A-F]+}} ; CHECK: PointerToLineNumbers = 0x0 ; CHECK: NumberOfRelocations = 4 ; CHECK: NumberOfLineNumbers = 0 @@ -44,32 +44,28 @@ ; CHECK: IMAGE_SCN_MEM_EXECUTE ; CHECK: IMAGE_SCN_MEM_READ ; CHECK: SectionData = -; CHECK: 83 EC 04 C7 04 24 00 00 - 00 00 E8 00 00 00 00 C7 |.....$..........| -; CHECK: 04 24 00 00 00 00 E8 00 - 00 00 00 31 C0 83 C4 04 |.$.........1....| -; CHECK: C3 |.| - ; CHECK: Relocations = [ ; CHECK: 0 = { -; CHECK: VirtualAddress = 0x6 -; CHECK: SymbolTableIndex = 5 +; CHECK: VirtualAddress = 0x{{[0-9A-F]+}} +; CHECK: SymbolTableIndex = 2 ; CHECK: Type = IMAGE_REL_I386_DIR32 (6) -; CHECK: SymbolName = _main +; CHECK: SymbolName = ; CHECK: } ; CHECK: 1 = { -; CHECK: VirtualAddress = 0xB -; CHECK: SymbolTableIndex = 6 +; CHECK: VirtualAddress = 0x{{[0-9A-F]+}} +; CHECK: SymbolTableIndex = 5 ; CHECK: Type = IMAGE_REL_I386_REL32 (20) -; CHECK: SymbolName = L_.str +; CHECK: SymbolName = _main ; CHECK: } ; CHECK: 2 = { -; CHECK: VirtualAddress = 0x12 -; CHECK: SymbolTableIndex = 7 +; CHECK: VirtualAddress = 0x{{[0-9A-F]+}} +; CHECK: SymbolTableIndex = 6 ; CHECK: Type = IMAGE_REL_I386_DIR32 (6) ; CHECK: SymbolName = _printf ; CHECK: } ; CHECK: 3 = { -; CHECK: VirtualAddress = 0x17 -; CHECK: SymbolTableIndex = 8 +; CHECK: VirtualAddress = 0x{{[0-9A-F]+}} +; CHECK: SymbolTableIndex = 7 ; CHECK: Type = IMAGE_REL_I386_REL32 (20) ; CHECK: SymbolName = _str ; CHECK: } @@ -79,8 +75,8 @@ ; CHECK: Name = .data ; CHECK: VirtualSize = 0 ; CHECK: VirtualAddress = 0 -; CHECK: SizeOfRawData = 14 -; CHECK: PointerToRawData = 0xAD +; CHECK: SizeOfRawData = {{[0-9]+}} +; CHECK: PointerToRawData = 0x{{[0-9A-F]+}} ; CHECK: PointerToRelocations = 0x0 ; CHECK: PointerToLineNumbers = 0x0 ; CHECK: NumberOfRelocations = 0 @@ -133,19 +129,7 @@ ; CHECK: NumberOfAuxSymbols = 0 ; CHECK: AuxillaryData = -; CHECK: } ; CHECK: 3 = { -; CHECK: Name = L_.str -; CHECK: Value = 0 -; CHECK: SectionNumber = 2 -; CHECK: SimpleType = IMAGE_SYM_TYPE_NULL (0) -; CHECK: ComplexType = IMAGE_SYM_DTYPE_NULL (0) -; CHECK: StorageClass = IMAGE_SYM_CLASS_STATIC (3) -; CHECK: NumberOfAuxSymbols = 0 -; CHECK: AuxillaryData = - -; CHECK: } -; CHECK: 4 = { ; CHECK: Name = _printf ; CHECK: Value = 0 ; CHECK: SectionNumber = 0 @@ -156,18 +140,18 @@ ; CHECK: AuxillaryData = ; CHECK: } -; CHECK: 5 = { +; CHECK: 4 = { ; CHECK: Name = _str ; CHECK: Value = 7 ; CHECK: SectionNumber = 2 ; CHECK: SimpleType = IMAGE_SYM_TYPE_NULL (0) ; CHECK: ComplexType = IMAGE_SYM_DTYPE_NULL (0) -; CHECK: StorageClass = IMAGE_SYM_CLASS_STATIC (3) +; CHECK: StorageClass = IMAGE_SYM_CLASS_LABEL (6) ; CHECK: NumberOfAuxSymbols = 0 ; CHECK: AuxillaryData = ; CHECK: } -; CHECK: 6 = { +; CHECK: 5 = { ; CHECK: Name = _puts ; CHECK: Value = 0 ; CHECK: SectionNumber = 0 From baldrick at free.fr Mon Sep 27 08:16:29 2010 From: baldrick at free.fr (Duncan Sands) Date: Mon, 27 Sep 2010 13:16:29 -0000 Subject: [llvm-commits] [dragonegg] r114824 - in /dragonegg/trunk: llvm-abi-default.cpp llvm-backend.cpp llvm-convert.cpp llvm-internal.h llvm-types.cpp x86/llvm-target.cpp Message-ID: <20100927131629.93C9B2A6C12C@llvm.org> Author: baldrick Date: Mon Sep 27 08:16:29 2010 New Revision: 114824 URL: http://llvm.org/viewvc/llvm-project?rev=114824&view=rev Log: Silence some unused parameter warnings. Most of the parameters cannot be removed because the function needs to conform to an externally defined interface which specifies them. Modified: dragonegg/trunk/llvm-abi-default.cpp dragonegg/trunk/llvm-backend.cpp dragonegg/trunk/llvm-convert.cpp dragonegg/trunk/llvm-internal.h dragonegg/trunk/llvm-types.cpp dragonegg/trunk/x86/llvm-target.cpp Modified: dragonegg/trunk/llvm-abi-default.cpp URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/llvm-abi-default.cpp?rev=114824&r1=114823&r2=114824&view=diff ============================================================================== --- dragonegg/trunk/llvm-abi-default.cpp (original) +++ dragonegg/trunk/llvm-abi-default.cpp Mon Sep 27 08:16:29 2010 @@ -17,7 +17,8 @@ // doNotUseShadowReturn - Return true if the specified GCC type // should not be returned using a pointer to struct parameter. -bool doNotUseShadowReturn(tree type, tree fndecl, CallingConv::ID CC) { +bool doNotUseShadowReturn(tree type, tree fndecl, + CallingConv::ID CC ATTRIBUTE_UNUSED) { if (!TYPE_SIZE(type)) return false; if (TREE_CODE(TYPE_SIZE(type)) != INTEGER_CST) Modified: dragonegg/trunk/llvm-backend.cpp URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/llvm-backend.cpp?rev=114824&r1=114823&r2=114824&view=diff ============================================================================== --- dragonegg/trunk/llvm-backend.cpp (original) +++ dragonegg/trunk/llvm-backend.cpp Mon Sep 27 08:16:29 2010 @@ -1554,7 +1554,8 @@ /// before processing the compilation unit. /// NOTE: called even when only doing syntax checking, so do not initialize the /// module etc here. -static void llvm_start_unit(void *gcc_data, void *user_data) { +static void llvm_start_unit(void *gcc_data ATTRIBUTE_UNUSED, + void *user_data ATTRIBUTE_UNUSED) { if (!quiet_flag) errs() << "Starting compilation unit\n"; @@ -1868,7 +1869,7 @@ /// emit_same_body_alias - Turn a same-body alias into LLVM IR. static void emit_same_body_alias(struct cgraph_node *alias, - struct cgraph_node *target) { + struct cgraph_node *target ATTRIBUTE_UNUSED) { if (errorcount || sorrycount) return; // Do not process broken code. @@ -1962,7 +1963,7 @@ }; /// emit_variables - Output GCC global variables to the LLVM IR. -static void emit_variables(cgraph_node_set set +static void emit_variables(cgraph_node_set set ATTRIBUTE_UNUSED #if (GCC_MINOR > 5) , varpool_node_set vset ATTRIBUTE_UNUSED #endif @@ -2096,13 +2097,15 @@ /// llvm_finish - Run shutdown code when GCC exits. -static void llvm_finish(void *gcc_data, void *user_data) { +static void llvm_finish(void *gcc_data ATTRIBUTE_UNUSED, + void *user_data ATTRIBUTE_UNUSED) { FinalizePlugin(); } /// llvm_finish_unit - Finish the .s file. This is called by GCC once the /// compilation unit has been completely processed. -static void llvm_finish_unit(void *gcc_data, void *user_data) { +static void llvm_finish_unit(void *gcc_data ATTRIBUTE_UNUSED, + void *user_data ATTRIBUTE_UNUSED) { if (errorcount || sorrycount) return; // Do not process broken code. Modified: dragonegg/trunk/llvm-convert.cpp URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/llvm-convert.cpp?rev=114824&r1=114823&r2=114824&view=diff ============================================================================== --- dragonegg/trunk/llvm-convert.cpp (original) +++ dragonegg/trunk/llvm-convert.cpp Mon Sep 27 08:16:29 2010 @@ -375,7 +375,7 @@ /// getCallingConv - This provides the desired CallingConv for the function. CallingConv::ID& getCallingConv(void) { return CallingConv; } - void HandlePad(const llvm::Type *LLVMTy) { + void HandlePad(const llvm::Type *LLVMTy ATTRIBUTE_UNUSED) { ++AI; } @@ -394,8 +394,9 @@ LocStack.clear(); } - void HandleAggregateShadowResult(const PointerType *PtrArgTy, - bool RetPtr) { + void HandleAggregateShadowResult( + const PointerType *PtrArgTy ATTRIBUTE_UNUSED, + bool RetPtr ATTRIBUTE_UNUSED) { // If the function returns a structure by value, we transform the function // to take a pointer to the result as the first argument of the function // instead. @@ -429,7 +430,8 @@ ++AI; } - void HandleScalarShadowResult(const PointerType *PtrArgTy, bool RetPtr) { + void HandleScalarShadowResult(const PointerType *PtrArgTy ATTRIBUTE_UNUSED, + bool RetPtr ATTRIBUTE_UNUSED) { assert(AI != Builder.GetInsertBlock()->getParent()->arg_end() && "No explicit return value?"); AI->setName("scalar.result"); @@ -438,7 +440,8 @@ ++AI; } - void HandleScalarArgument(const llvm::Type *LLVMTy, tree type, + void HandleScalarArgument(const llvm::Type *LLVMTy, + tree type ATTRIBUTE_UNUSED, unsigned RealSize = 0) { Value *ArgVal = AI; if (ArgVal->getType() != LLVMTy) { @@ -467,11 +470,12 @@ ++AI; } - void HandleByValArgument(const llvm::Type *LLVMTy, tree type) { + void HandleByValArgument(const llvm::Type *LLVMTy ATTRIBUTE_UNUSED, + tree type ATTRIBUTE_UNUSED) { ++AI; } - void HandleFCAArgument(const llvm::Type *LLVMTy, + void HandleFCAArgument(const llvm::Type *LLVMTy ATTRIBUTE_UNUSED, tree type ATTRIBUTE_UNUSED) { // Store the FCA argument into alloca. assert(!LocStack.empty()); @@ -481,7 +485,8 @@ ++AI; } - void HandleAggregateResultAsScalar(const Type *ScalarTy, unsigned Offset=0){ + void HandleAggregateResultAsScalar(const Type *ScalarTy ATTRIBUTE_UNUSED, + unsigned Offset=0) { this->Offset = Offset; } @@ -506,7 +511,8 @@ // passed in memory byval. static bool isPassedByVal(tree type, const Type *Ty, std::vector &ScalarArgs, - bool isShadowRet, CallingConv::ID &CC) { + bool isShadowRet, + CallingConv::ID &CC ATTRIBUTE_UNUSED) { if (LLVM_SHOULD_PASS_AGGREGATE_USING_BYVAL_ATTR(type, Ty)) return true; @@ -742,7 +748,7 @@ // Emit gcroot intrinsic if arg has attribute if (POINTER_TYPE_P(TREE_TYPE(Args)) && lookup_attribute ("gcroot", TYPE_ATTRIBUTES(TREE_TYPE(Args)))) - EmitTypeGcroot(Tmp, Args); + EmitTypeGcroot(Tmp); Client.setName(Name); Client.setLocation(Tmp); @@ -1433,7 +1439,7 @@ /// CopyAggregate - Recursively traverse the potientially aggregate src/dest /// ptrs, copying all of the elements. static void CopyAggregate(MemRef DestLoc, MemRef SrcLoc, - LLVMBuilder &Builder, tree gccType){ + LLVMBuilder &Builder, tree gccType) { assert(DestLoc.Ptr->getType() == SrcLoc.Ptr->getType() && "Cannot copy between two pointers of different type!"); const Type *ElTy = @@ -1661,7 +1667,7 @@ // Emits code to do something for a type attribute -void TreeToLLVM::EmitTypeGcroot(Value *V, tree decl) { +void TreeToLLVM::EmitTypeGcroot(Value *V) { // GC intrinsics can only be used in functions which specify a collector. Fn->setGC("shadow-stack"); @@ -1806,7 +1812,7 @@ // We should null out local variables so that a stack crawl // before initialization doesn't get garbage results to follow. const Type *T = cast(AI->getType())->getElementType(); - EmitTypeGcroot(AI, decl); + EmitTypeGcroot(AI); Builder.CreateStore(Constant::getNullValue(T), AI); } @@ -2566,7 +2572,7 @@ /// HandleScalarResult - This callback is invoked if the function returns a /// simple scalar result value. - void HandleScalarResult(const Type *RetTy) { + void HandleScalarResult(const Type *RetTy ATTRIBUTE_UNUSED) { // There is nothing to do here if we return a scalar or void. assert(DestLoc == 0 && "Call returns a scalar but caller expects aggregate!"); @@ -2575,14 +2581,14 @@ /// HandleAggregateResultAsScalar - This callback is invoked if the function /// returns an aggregate value by bit converting it to the specified scalar /// type and returning that. - void HandleAggregateResultAsScalar(const Type *ScalarTy, + void HandleAggregateResultAsScalar(const Type *ScalarTy ATTRIBUTE_UNUSED, unsigned Offset = 0) { this->Offset = Offset; } /// HandleAggregateResultAsAggregate - This callback is invoked if the /// function returns an aggregate value using multiple return values. - void HandleAggregateResultAsAggregate(const Type *AggrTy) { + void HandleAggregateResultAsAggregate(const Type *AggrTy ATTRIBUTE_UNUSED) { // There is nothing to do here. isAggrRet = true; } @@ -2592,7 +2598,7 @@ /// RetPtr is set to true, the pointer argument itself is returned from the /// function. void HandleAggregateShadowResult(const PointerType *PtrArgTy, - bool RetPtr) { + bool RetPtr ATTRIBUTE_UNUSED) { // We need to pass memory to write the return value into. // FIXME: alignment and volatility are being ignored! assert(!DestLoc || PtrArgTy == DestLoc->Ptr->getType()); @@ -2625,7 +2631,8 @@ /// returns a scalar value by using a "shadow" first parameter, which is a /// pointer to the scalar, of type PtrArgTy. If RetPtr is set to true, /// the pointer argument itself is returned from the function. - void HandleScalarShadowResult(const PointerType *PtrArgTy, bool RetPtr) { + void HandleScalarShadowResult(const PointerType *PtrArgTy, + bool RetPtr ATTRIBUTE_UNUSED) { assert(DestLoc == 0 && "Call returns a scalar but caller expects aggregate!"); // Create a buffer to hold the result. The result will be loaded out of @@ -2664,7 +2671,8 @@ /// HandleByInvisibleReferenceArgument - This callback is invoked if a /// pointer (of type PtrTy) to the argument is passed rather than the /// argument itself. - void HandleByInvisibleReferenceArgument(const llvm::Type *PtrTy, tree type){ + void HandleByInvisibleReferenceArgument(const llvm::Type *PtrTy, + tree type ATTRIBUTE_UNUSED) { Value *Loc = getAddress(); Loc = Builder.CreateBitCast(Loc, PtrTy); CallOperands.push_back(Loc); @@ -2673,7 +2681,8 @@ /// HandleByValArgument - This callback is invoked if the aggregate function /// argument is passed by value. It is lowered to a parameter passed by /// reference with an additional parameter attribute "ByVal". - void HandleByValArgument(const llvm::Type *LLVMTy, tree type) { + void HandleByValArgument(const llvm::Type *LLVMTy, + tree type ATTRIBUTE_UNUSED) { Value *Loc = getAddress(); assert(LLVMTy->getPointerTo() == Loc->getType()); CallOperands.push_back(Loc); Modified: dragonegg/trunk/llvm-internal.h URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/llvm-internal.h?rev=114824&r1=114823&r2=114824&view=diff ============================================================================== --- dragonegg/trunk/llvm-internal.h (original) +++ dragonegg/trunk/llvm-internal.h Mon Sep 27 08:16:29 2010 @@ -584,7 +584,7 @@ void EmitAnnotateIntrinsic(Value *V, tree_node *decl); /// EmitTypeGcroot - Emits call to make type a gcroot - void EmitTypeGcroot(Value *V, tree_node *decl); + void EmitTypeGcroot(Value *V); private: Modified: dragonegg/trunk/llvm-types.cpp URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/llvm-types.cpp?rev=114824&r1=114823&r2=114824&view=diff ============================================================================== --- dragonegg/trunk/llvm-types.cpp (original) +++ dragonegg/trunk/llvm-types.cpp Mon Sep 27 08:16:29 2010 @@ -1027,7 +1027,7 @@ } void HandleScalarArgument(const llvm::Type *LLVMTy, tree type, - unsigned RealSize = 0) { + unsigned RealSize ATTRIBUTE_UNUSED = 0) { if (KNRPromotion) { if (type == float_type_node) LLVMTy = ConvertType(double_type_node); @@ -1040,7 +1040,8 @@ /// HandleByInvisibleReferenceArgument - This callback is invoked if a pointer /// (of type PtrTy) to the argument is passed rather than the argument itself. - void HandleByInvisibleReferenceArgument(const llvm::Type *PtrTy, tree type) { + void HandleByInvisibleReferenceArgument(const llvm::Type *PtrTy, + tree type ATTRIBUTE_UNUSED) { ArgTypes.push_back(PtrTy); } @@ -1460,7 +1461,8 @@ /// includes the specified byte, remove it. Return true struct /// layout is sized properly. Return false if unable to handle ByteOffset. /// In this case caller should redo this struct as a packed structure. - bool ResizeLastElementIfOverlapsWith(uint64_t ByteOffset, tree Field, + bool ResizeLastElementIfOverlapsWith(uint64_t ByteOffset, + tree Field ATTRIBUTE_UNUSED, const Type *Ty) { const Type *SavedTy = NULL; Modified: dragonegg/trunk/x86/llvm-target.cpp URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/x86/llvm-target.cpp?rev=114824&r1=114823&r2=114824&view=diff ============================================================================== --- dragonegg/trunk/x86/llvm-target.cpp (original) +++ dragonegg/trunk/x86/llvm-target.cpp Mon Sep 27 08:16:29 2010 @@ -88,7 +88,7 @@ */ bool TreeToLLVM::TargetIntrinsicLower(gimple stmt, tree fndecl, - const MemRef *DestLoc, + const MemRef *DestLoc ATTRIBUTE_UNUSED, Value *&Result, const Type *ResultType, std::vector &Ops) { @@ -1325,8 +1325,9 @@ /// The original implementation of this routine is based on /// llvm_x86_64_should_pass_aggregate_in_mixed_regs code. void -llvm_x86_64_get_multiple_return_reg_classes(tree TreeType, const Type *Ty, - std::vector &Elts){ +llvm_x86_64_get_multiple_return_reg_classes(tree TreeType, + const Type *Ty ATTRIBUTE_UNUSED, + std::vector &Elts) { enum x86_64_reg_class Class[MAX_CLASSES]; enum machine_mode Mode = type_natural_mode(TreeType, NULL); HOST_WIDE_INT Bytes = From ofv at wanadoo.es Mon Sep 27 08:33:17 2010 From: ofv at wanadoo.es (Oscar Fuentes) Date: Mon, 27 Sep 2010 13:33:17 -0000 Subject: [llvm-commits] [llvm] r114825 - /llvm/trunk/cmake/modules/LLVMLibDeps.cmake Message-ID: <20100927133317.8AFF72A6C12C@llvm.org> Author: ofv Date: Mon Sep 27 08:33:17 2010 New Revision: 114825 URL: http://llvm.org/viewvc/llvm-project?rev=114825&view=rev Log: Updated LLVMLibDeps.cmake Modified: llvm/trunk/cmake/modules/LLVMLibDeps.cmake Modified: llvm/trunk/cmake/modules/LLVMLibDeps.cmake URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/cmake/modules/LLVMLibDeps.cmake?rev=114825&r1=114824&r2=114825&view=diff ============================================================================== --- llvm/trunk/cmake/modules/LLVMLibDeps.cmake (original) +++ llvm/trunk/cmake/modules/LLVMLibDeps.cmake Mon Sep 27 08:33:17 2010 @@ -1,8 +1,8 @@ -set(MSVC_LIB_DEPS_LLVMARMAsmParser LLVMARMCodeGen LLVMARMInfo LLVMMC LLVMMCParser LLVMSupport LLVMTarget) +set(MSVC_LIB_DEPS_LLVMARMAsmParser LLVMARMInfo LLVMMC LLVMMCParser LLVMSupport LLVMTarget) set(MSVC_LIB_DEPS_LLVMARMAsmPrinter LLVMMC LLVMSupport) set(MSVC_LIB_DEPS_LLVMARMCodeGen LLVMARMInfo LLVMAnalysis LLVMAsmPrinter LLVMCodeGen LLVMCore LLVMMC LLVMSelectionDAG LLVMSupport LLVMSystem LLVMTarget) set(MSVC_LIB_DEPS_LLVMARMInfo LLVMSupport) -set(MSVC_LIB_DEPS_LLVMAlphaAsmPrinter LLVMAlphaCodeGen LLVMAlphaInfo LLVMAsmPrinter LLVMCodeGen LLVMCore LLVMMC LLVMSupport LLVMTarget) +set(MSVC_LIB_DEPS_LLVMAlphaAsmPrinter LLVMAlphaInfo LLVMAsmPrinter LLVMCodeGen LLVMCore LLVMMC LLVMSupport LLVMTarget) set(MSVC_LIB_DEPS_LLVMAlphaCodeGen LLVMAlphaInfo LLVMCodeGen LLVMCore LLVMMC LLVMSelectionDAG LLVMSupport LLVMSystem LLVMTarget) set(MSVC_LIB_DEPS_LLVMAlphaInfo LLVMSupport) set(MSVC_LIB_DEPS_LLVMAnalysis LLVMCore LLVMSupport LLVMSystem LLVMTarget) @@ -11,12 +11,12 @@ set(MSVC_LIB_DEPS_LLVMAsmPrinter LLVMAnalysis LLVMCodeGen LLVMCore LLVMMC LLVMMCParser LLVMSupport LLVMSystem LLVMTarget) set(MSVC_LIB_DEPS_LLVMBitReader LLVMCore LLVMSupport) set(MSVC_LIB_DEPS_LLVMBitWriter LLVMCore LLVMSupport) -set(MSVC_LIB_DEPS_LLVMBlackfinAsmPrinter LLVMAsmPrinter LLVMBlackfinCodeGen LLVMBlackfinInfo LLVMCodeGen LLVMCore LLVMMC LLVMSupport LLVMTarget) +set(MSVC_LIB_DEPS_LLVMBlackfinAsmPrinter LLVMAsmPrinter LLVMBlackfinInfo LLVMCodeGen LLVMCore LLVMMC LLVMSupport LLVMTarget) set(MSVC_LIB_DEPS_LLVMBlackfinCodeGen LLVMBlackfinInfo LLVMCodeGen LLVMCore LLVMMC LLVMSelectionDAG LLVMSupport LLVMTarget) set(MSVC_LIB_DEPS_LLVMBlackfinInfo LLVMSupport) set(MSVC_LIB_DEPS_LLVMCBackend LLVMAnalysis LLVMCBackendInfo LLVMCodeGen LLVMCore LLVMMC LLVMScalarOpts LLVMSupport LLVMSystem LLVMTarget LLVMTransformUtils LLVMipa) set(MSVC_LIB_DEPS_LLVMCBackendInfo LLVMSupport) -set(MSVC_LIB_DEPS_LLVMCellSPUAsmPrinter LLVMAsmPrinter LLVMCellSPUCodeGen LLVMCellSPUInfo LLVMCodeGen LLVMCore LLVMMC LLVMSupport LLVMTarget) +set(MSVC_LIB_DEPS_LLVMCellSPUAsmPrinter LLVMAsmPrinter LLVMCellSPUInfo LLVMCodeGen LLVMCore LLVMMC LLVMSupport LLVMTarget) set(MSVC_LIB_DEPS_LLVMCellSPUCodeGen LLVMCellSPUInfo LLVMCodeGen LLVMCore LLVMMC LLVMSelectionDAG LLVMSupport LLVMTarget) set(MSVC_LIB_DEPS_LLVMCellSPUInfo LLVMSupport) set(MSVC_LIB_DEPS_LLVMCodeGen LLVMAnalysis LLVMCore LLVMMC LLVMScalarOpts LLVMSupport LLVMSystem LLVMTarget LLVMTransformUtils) @@ -35,7 +35,9 @@ set(MSVC_LIB_DEPS_LLVMMC LLVMSupport LLVMSystem) set(MSVC_LIB_DEPS_LLVMMCDisassembler LLVMARMAsmParser LLVMARMCodeGen LLVMARMInfo LLVMAlphaAsmPrinter LLVMAlphaCodeGen LLVMAlphaInfo LLVMBlackfinAsmPrinter LLVMBlackfinCodeGen LLVMBlackfinInfo LLVMCBackend LLVMCBackendInfo LLVMCellSPUAsmPrinter LLVMCellSPUCodeGen LLVMCellSPUInfo LLVMCppBackend LLVMCppBackendInfo LLVMMBlazeAsmPrinter LLVMMBlazeCodeGen LLVMMBlazeInfo LLVMMC LLVMMCParser LLVMMSP430AsmPrinter LLVMMSP430CodeGen LLVMMSP430Info LLVMMipsAsmPrinter LLVMMipsCodeGen LLVMMipsInfo LLVMPIC16AsmPrinter LLVMPIC16CodeGen LLVMPIC16Info LLVMPowerPCAsmPrinter LLVMPowerPCCodeGen LLVMPowerPCInfo LLVMSparcAsmPrinter LLVMSparcCodeGen LLVMSparcInfo LLVMSupport LLVMSystem LLVMSystemZAsmPrinter LLVMSystemZCodeGen LLVMSystemZInfo LLVMX86AsmParser LLVMX86CodeGen LLVMX86Disassembler LLVMX86Info LLVMXCoreAsmPrinter LLVMXCoreCodeGen LLVMXCoreInfo) set(MSVC_LIB_DEPS_LLVMMCParser LLVMMC LLVMSupport) -set(MSVC_LIB_DEPS_LLVMMSP430AsmPrinter LLVMAsmPrinter LLVMCodeGen LLVMCore LLVMMC LLVMMSP430CodeGen LLVMMSP430Info LLVMSupport LLVMTarget) +set(MSVC_LIB_DEPS_LLVMMSIL LLVMAnalysis LLVMCodeGen LLVMCore LLVMMSILInfo LLVMScalarOpts LLVMSupport LLVMTarget LLVMTransformUtils LLVMipa) +set(MSVC_LIB_DEPS_LLVMMSILInfo LLVMSupport) +set(MSVC_LIB_DEPS_LLVMMSP430AsmPrinter LLVMAsmPrinter LLVMCodeGen LLVMCore LLVMMC LLVMMSP430Info LLVMSupport LLVMTarget) set(MSVC_LIB_DEPS_LLVMMSP430CodeGen LLVMCodeGen LLVMCore LLVMMC LLVMMSP430Info LLVMSelectionDAG LLVMSupport LLVMSystem LLVMTarget) set(MSVC_LIB_DEPS_LLVMMSP430Info LLVMSupport) set(MSVC_LIB_DEPS_LLVMMipsAsmPrinter LLVMAsmPrinter LLVMCodeGen LLVMCore LLVMMC LLVMMipsCodeGen LLVMMipsInfo LLVMSupport LLVMTarget) @@ -44,17 +46,17 @@ set(MSVC_LIB_DEPS_LLVMPIC16AsmPrinter LLVMAsmPrinter LLVMCodeGen LLVMCore LLVMMC LLVMPIC16CodeGen LLVMPIC16Info LLVMSupport LLVMTarget) set(MSVC_LIB_DEPS_LLVMPIC16CodeGen LLVMAnalysis LLVMCodeGen LLVMCore LLVMMC LLVMPIC16Info LLVMSelectionDAG LLVMSupport LLVMTarget) set(MSVC_LIB_DEPS_LLVMPIC16Info LLVMSupport) -set(MSVC_LIB_DEPS_LLVMPowerPCAsmPrinter LLVMAnalysis LLVMAsmPrinter LLVMCodeGen LLVMCore LLVMMC LLVMPowerPCCodeGen LLVMPowerPCInfo LLVMSupport LLVMTarget) +set(MSVC_LIB_DEPS_LLVMPowerPCAsmPrinter LLVMAnalysis LLVMAsmPrinter LLVMCodeGen LLVMCore LLVMMC LLVMPowerPCInfo LLVMSupport LLVMTarget) set(MSVC_LIB_DEPS_LLVMPowerPCCodeGen LLVMCodeGen LLVMCore LLVMMC LLVMPowerPCInfo LLVMSelectionDAG LLVMSupport LLVMSystem LLVMTarget) set(MSVC_LIB_DEPS_LLVMPowerPCInfo LLVMSupport) set(MSVC_LIB_DEPS_LLVMScalarOpts LLVMAnalysis LLVMCore LLVMInstCombine LLVMSupport LLVMSystem LLVMTarget LLVMTransformUtils) set(MSVC_LIB_DEPS_LLVMSelectionDAG LLVMAnalysis LLVMCodeGen LLVMCore LLVMMC LLVMSupport LLVMSystem LLVMTarget) -set(MSVC_LIB_DEPS_LLVMSparcAsmPrinter LLVMAsmPrinter LLVMCodeGen LLVMCore LLVMMC LLVMSparcCodeGen LLVMSparcInfo LLVMSupport LLVMTarget) +set(MSVC_LIB_DEPS_LLVMSparcAsmPrinter LLVMAsmPrinter LLVMCodeGen LLVMCore LLVMMC LLVMSparcInfo LLVMSupport LLVMTarget) set(MSVC_LIB_DEPS_LLVMSparcCodeGen LLVMCodeGen LLVMCore LLVMMC LLVMSelectionDAG LLVMSparcInfo LLVMSupport LLVMSystem LLVMTarget) set(MSVC_LIB_DEPS_LLVMSparcInfo LLVMSupport) set(MSVC_LIB_DEPS_LLVMSupport LLVMSystem) set(MSVC_LIB_DEPS_LLVMSystem ) -set(MSVC_LIB_DEPS_LLVMSystemZAsmPrinter LLVMAsmPrinter LLVMCodeGen LLVMCore LLVMMC LLVMSupport LLVMSystemZCodeGen LLVMSystemZInfo LLVMTarget) +set(MSVC_LIB_DEPS_LLVMSystemZAsmPrinter LLVMAsmPrinter LLVMCodeGen LLVMCore LLVMMC LLVMSupport LLVMSystemZInfo LLVMTarget) set(MSVC_LIB_DEPS_LLVMSystemZCodeGen LLVMCodeGen LLVMCore LLVMMC LLVMSelectionDAG LLVMSupport LLVMSystemZInfo LLVMTarget) set(MSVC_LIB_DEPS_LLVMSystemZInfo LLVMSupport) set(MSVC_LIB_DEPS_LLVMTarget LLVMCore LLVMMC LLVMSupport) @@ -64,7 +66,7 @@ set(MSVC_LIB_DEPS_LLVMX86CodeGen LLVMAnalysis LLVMAsmPrinter LLVMCodeGen LLVMCore LLVMMC LLVMSelectionDAG LLVMSupport LLVMSystem LLVMTarget LLVMX86AsmPrinter LLVMX86Info) set(MSVC_LIB_DEPS_LLVMX86Disassembler LLVMMC LLVMSupport LLVMX86Info) set(MSVC_LIB_DEPS_LLVMX86Info LLVMSupport) -set(MSVC_LIB_DEPS_LLVMXCoreAsmPrinter LLVMAsmPrinter LLVMCodeGen LLVMCore LLVMMC LLVMSupport LLVMTarget LLVMXCoreCodeGen LLVMXCoreInfo) +set(MSVC_LIB_DEPS_LLVMXCoreAsmPrinter LLVMAsmPrinter LLVMCodeGen LLVMCore LLVMMC LLVMSupport LLVMTarget LLVMXCoreInfo) set(MSVC_LIB_DEPS_LLVMXCoreCodeGen LLVMCodeGen LLVMCore LLVMMC LLVMSelectionDAG LLVMSupport LLVMTarget LLVMXCoreInfo) set(MSVC_LIB_DEPS_LLVMXCoreInfo LLVMSupport) set(MSVC_LIB_DEPS_LLVMipa LLVMAnalysis LLVMCore LLVMSupport LLVMSystem) From ofv at wanadoo.es Mon Sep 27 08:49:41 2010 From: ofv at wanadoo.es (Oscar Fuentes) Date: Mon, 27 Sep 2010 13:49:41 -0000 Subject: [llvm-commits] [llvm] r114826 - /llvm/trunk/cmake/modules/LLVMLibDeps.cmake Message-ID: <20100927134941.65DFF2A6C12C@llvm.org> Author: ofv Date: Mon Sep 27 08:49:41 2010 New Revision: 114826 URL: http://llvm.org/viewvc/llvm-project?rev=114826&view=rev Log: Removed remnant target library dependencies from LLVMLibDeps.cmake Modified: llvm/trunk/cmake/modules/LLVMLibDeps.cmake Modified: llvm/trunk/cmake/modules/LLVMLibDeps.cmake URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/cmake/modules/LLVMLibDeps.cmake?rev=114826&r1=114825&r2=114826&view=diff ============================================================================== --- llvm/trunk/cmake/modules/LLVMLibDeps.cmake (original) +++ llvm/trunk/cmake/modules/LLVMLibDeps.cmake Mon Sep 27 08:49:41 2010 @@ -35,8 +35,6 @@ set(MSVC_LIB_DEPS_LLVMMC LLVMSupport LLVMSystem) set(MSVC_LIB_DEPS_LLVMMCDisassembler LLVMARMAsmParser LLVMARMCodeGen LLVMARMInfo LLVMAlphaAsmPrinter LLVMAlphaCodeGen LLVMAlphaInfo LLVMBlackfinAsmPrinter LLVMBlackfinCodeGen LLVMBlackfinInfo LLVMCBackend LLVMCBackendInfo LLVMCellSPUAsmPrinter LLVMCellSPUCodeGen LLVMCellSPUInfo LLVMCppBackend LLVMCppBackendInfo LLVMMBlazeAsmPrinter LLVMMBlazeCodeGen LLVMMBlazeInfo LLVMMC LLVMMCParser LLVMMSP430AsmPrinter LLVMMSP430CodeGen LLVMMSP430Info LLVMMipsAsmPrinter LLVMMipsCodeGen LLVMMipsInfo LLVMPIC16AsmPrinter LLVMPIC16CodeGen LLVMPIC16Info LLVMPowerPCAsmPrinter LLVMPowerPCCodeGen LLVMPowerPCInfo LLVMSparcAsmPrinter LLVMSparcCodeGen LLVMSparcInfo LLVMSupport LLVMSystem LLVMSystemZAsmPrinter LLVMSystemZCodeGen LLVMSystemZInfo LLVMX86AsmParser LLVMX86CodeGen LLVMX86Disassembler LLVMX86Info LLVMXCoreAsmPrinter LLVMXCoreCodeGen LLVMXCoreInfo) set(MSVC_LIB_DEPS_LLVMMCParser LLVMMC LLVMSupport) -set(MSVC_LIB_DEPS_LLVMMSIL LLVMAnalysis LLVMCodeGen LLVMCore LLVMMSILInfo LLVMScalarOpts LLVMSupport LLVMTarget LLVMTransformUtils LLVMipa) -set(MSVC_LIB_DEPS_LLVMMSILInfo LLVMSupport) set(MSVC_LIB_DEPS_LLVMMSP430AsmPrinter LLVMAsmPrinter LLVMCodeGen LLVMCore LLVMMC LLVMMSP430Info LLVMSupport LLVMTarget) set(MSVC_LIB_DEPS_LLVMMSP430CodeGen LLVMCodeGen LLVMCore LLVMMC LLVMMSP430Info LLVMSelectionDAG LLVMSupport LLVMSystem LLVMTarget) set(MSVC_LIB_DEPS_LLVMMSP430Info LLVMSupport) From gohman at apple.com Mon Sep 27 09:44:15 2010 From: gohman at apple.com (Dan Gohman) Date: Mon, 27 Sep 2010 14:44:15 -0000 Subject: [llvm-commits] [llvm] r114827 - /llvm/trunk/include/llvm/Support/GraphWriter.h Message-ID: <20100927144415.259802A6C12C@llvm.org> Author: djg Date: Mon Sep 27 09:44:14 2010 New Revision: 114827 URL: http://llvm.org/viewvc/llvm-project?rev=114827&view=rev Log: Fix indentation. Modified: llvm/trunk/include/llvm/Support/GraphWriter.h Modified: llvm/trunk/include/llvm/Support/GraphWriter.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/GraphWriter.h?rev=114827&r1=114826&r2=114827&view=diff ============================================================================== --- llvm/trunk/include/llvm/Support/GraphWriter.h (original) +++ llvm/trunk/include/llvm/Support/GraphWriter.h Mon Sep 27 09:44:14 2010 @@ -89,8 +89,8 @@ public: GraphWriter(raw_ostream &o, const GraphType &g, bool SN) : O(o), G(g) { - DTraits = DOTTraits(SN); -} + DTraits = DOTTraits(SN); + } void writeHeader(const std::string &Name) { std::string GraphName = DTraits.getGraphName(G); From gohman at apple.com Mon Sep 27 10:15:44 2010 From: gohman at apple.com (Dan Gohman) Date: Mon, 27 Sep 2010 15:15:44 -0000 Subject: [llvm-commits] [llvm] r114828 - /llvm/trunk/lib/VMCore/Instructions.cpp Message-ID: <20100927151544.8A47E2A6C12C@llvm.org> Author: djg Date: Mon Sep 27 10:15:44 2010 New Revision: 114828 URL: http://llvm.org/viewvc/llvm-project?rev=114828&view=rev Log: Make this code 65-bit clean. 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=114828&r1=114827&r2=114828&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/Instructions.cpp (original) +++ llvm/trunk/lib/VMCore/Instructions.cpp Mon Sep 27 10:15:44 2010 @@ -899,7 +899,7 @@ bool AllocaInst::isArrayAllocation() const { if (ConstantInt *CI = dyn_cast(getOperand(0))) - return CI->getZExtValue() != 1; + return !CI->isOne(); return true; } From gohman at apple.com Mon Sep 27 10:34:20 2010 From: gohman at apple.com (Dan Gohman) Date: Mon, 27 Sep 2010 15:34:20 -0000 Subject: [llvm-commits] [llvm] r114829 - in /llvm/trunk/include/llvm: Analysis/DOTGraphTraitsPass.h Support/GraphWriter.h Message-ID: <20100927153420.1C1C82A6C12C@llvm.org> Author: djg Date: Mon Sep 27 10:34:19 2010 New Revision: 114829 URL: http://llvm.org/viewvc/llvm-project?rev=114829&view=rev Log: Remove WriteGraph's Name argument, which it didn't use, and rename writeHeader's Name argument to Title, to be consistent with WriteGraph. Modified: llvm/trunk/include/llvm/Analysis/DOTGraphTraitsPass.h llvm/trunk/include/llvm/Support/GraphWriter.h Modified: llvm/trunk/include/llvm/Analysis/DOTGraphTraitsPass.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/DOTGraphTraitsPass.h?rev=114829&r1=114828&r2=114829&view=diff ============================================================================== --- llvm/trunk/include/llvm/Analysis/DOTGraphTraitsPass.h (original) +++ llvm/trunk/include/llvm/Analysis/DOTGraphTraitsPass.h Mon Sep 27 10:34:19 2010 @@ -67,7 +67,7 @@ Title = GraphName + " for '" + F.getNameStr() + "' function"; if (ErrorInfo.empty()) - WriteGraph(File, Graph, Simple, Name, Title); + WriteGraph(File, Graph, Simple, Title); else errs() << " error opening file for writing!"; errs() << "\n"; Modified: llvm/trunk/include/llvm/Support/GraphWriter.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/GraphWriter.h?rev=114829&r1=114828&r2=114829&view=diff ============================================================================== --- llvm/trunk/include/llvm/Support/GraphWriter.h (original) +++ llvm/trunk/include/llvm/Support/GraphWriter.h Mon Sep 27 10:34:19 2010 @@ -92,11 +92,11 @@ DTraits = DOTTraits(SN); } - void writeHeader(const std::string &Name) { + void writeHeader(const std::string &Title) { std::string GraphName = DTraits.getGraphName(G); - if (!Name.empty()) - O << "digraph \"" << DOT::EscapeString(Name) << "\" {\n"; + if (!Title.empty()) + O << "digraph \"" << DOT::EscapeString(Title) << "\" {\n"; else if (!GraphName.empty()) O << "digraph \"" << DOT::EscapeString(GraphName) << "\" {\n"; else @@ -105,8 +105,8 @@ if (DTraits.renderGraphFromBottomUp()) O << "\trankdir=\"BT\";\n"; - if (!Name.empty()) - O << "\tlabel=\"" << DOT::EscapeString(Name) << "\";\n"; + if (!Title.empty()) + O << "\tlabel=\"" << DOT::EscapeString(Title) << "\";\n"; else if (!GraphName.empty()) O << "\tlabel=\"" << DOT::EscapeString(GraphName) << "\";\n"; O << DTraits.getGraphProperties(G); @@ -282,7 +282,6 @@ template raw_ostream &WriteGraph(raw_ostream &O, const GraphType &G, bool ShortNames = false, - const std::string &Name = "", const std::string &Title = "") { // Start the graph emission process... GraphWriter W(O, G, ShortNames); @@ -322,7 +321,7 @@ raw_fd_ostream O(Filename.c_str(), ErrorInfo); if (ErrorInfo.empty()) { - llvm::WriteGraph(O, G, ShortNames, Name, Title); + llvm::WriteGraph(O, G, ShortNames, Title); errs() << " done. \n"; } else { errs() << "error opening file '" << Filename.str() << "' for writing!\n"; From gohman at apple.com Mon Sep 27 10:48:37 2010 From: gohman at apple.com (Dan Gohman) Date: Mon, 27 Sep 2010 15:48:37 -0000 Subject: [llvm-commits] [llvm] r114830 - in /llvm/trunk: include/llvm/ADT/BitVector.h include/llvm/ADT/SmallBitVector.h unittests/ADT/BitVectorTest.cpp unittests/ADT/SmallBitVectorTest.cpp Message-ID: <20100927154837.983A52A6C12C@llvm.org> Author: djg Date: Mon Sep 27 10:48:37 2010 New Revision: 114830 URL: http://llvm.org/viewvc/llvm-project?rev=114830&view=rev Log: Add an all() method to BitVector, for testing whether all bits are set. Modified: llvm/trunk/include/llvm/ADT/BitVector.h llvm/trunk/include/llvm/ADT/SmallBitVector.h llvm/trunk/unittests/ADT/BitVectorTest.cpp llvm/trunk/unittests/ADT/SmallBitVectorTest.cpp Modified: llvm/trunk/include/llvm/ADT/BitVector.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/BitVector.h?rev=114830&r1=114829&r2=114830&view=diff ============================================================================== --- llvm/trunk/include/llvm/ADT/BitVector.h (original) +++ llvm/trunk/include/llvm/ADT/BitVector.h Mon Sep 27 10:48:37 2010 @@ -127,6 +127,12 @@ return false; } + /// all - Returns true if all bits are set. + bool all() const { + // TODO: Optimize this. + return count() == size(); + } + /// none - Returns true if none of the bits are set. bool none() const { return !any(); Modified: llvm/trunk/include/llvm/ADT/SmallBitVector.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/SmallBitVector.h?rev=114830&r1=114829&r2=114830&view=diff ============================================================================== --- llvm/trunk/include/llvm/ADT/SmallBitVector.h (original) +++ llvm/trunk/include/llvm/ADT/SmallBitVector.h Mon Sep 27 10:48:37 2010 @@ -187,6 +187,13 @@ return getPointer()->any(); } + /// all - Returns true if all bits are set. + bool all() const { + if (isSmall()) + return getSmallBits() == (uintptr_t(1) << getSmallSize()) - 1; + return getPointer()->all(); + } + /// none - Returns true if none of the bits are set. bool none() const { if (isSmall()) Modified: llvm/trunk/unittests/ADT/BitVectorTest.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/ADT/BitVectorTest.cpp?rev=114830&r1=114829&r2=114830&view=diff ============================================================================== --- llvm/trunk/unittests/ADT/BitVectorTest.cpp (original) +++ llvm/trunk/unittests/ADT/BitVectorTest.cpp Mon Sep 27 10:48:37 2010 @@ -22,6 +22,7 @@ EXPECT_EQ(0U, Vec.count()); EXPECT_EQ(0U, Vec.size()); EXPECT_FALSE(Vec.any()); + EXPECT_TRUE(Vec.all()); EXPECT_TRUE(Vec.none()); EXPECT_TRUE(Vec.empty()); @@ -29,6 +30,7 @@ EXPECT_EQ(5U, Vec.count()); EXPECT_EQ(5U, Vec.size()); EXPECT_TRUE(Vec.any()); + EXPECT_TRUE(Vec.all()); EXPECT_FALSE(Vec.none()); EXPECT_FALSE(Vec.empty()); @@ -36,6 +38,7 @@ EXPECT_EQ(5U, Vec.count()); EXPECT_EQ(11U, Vec.size()); EXPECT_TRUE(Vec.any()); + EXPECT_FALSE(Vec.all()); EXPECT_FALSE(Vec.none()); EXPECT_FALSE(Vec.empty()); @@ -43,6 +46,7 @@ EXPECT_EQ(6U, Inv.count()); EXPECT_EQ(11U, Inv.size()); EXPECT_TRUE(Inv.any()); + EXPECT_FALSE(Inv.all()); EXPECT_FALSE(Inv.none()); EXPECT_FALSE(Inv.empty()); @@ -123,6 +127,7 @@ EXPECT_EQ(0U, Vec.count()); EXPECT_EQ(130U, Vec.size()); EXPECT_FALSE(Vec.any()); + EXPECT_FALSE(Vec.all()); EXPECT_TRUE(Vec.none()); EXPECT_FALSE(Vec.empty()); @@ -130,6 +135,7 @@ EXPECT_EQ(0U, Inv.count()); EXPECT_EQ(0U, Inv.size()); EXPECT_FALSE(Inv.any()); + EXPECT_TRUE(Inv.all()); EXPECT_TRUE(Inv.none()); EXPECT_TRUE(Inv.empty()); @@ -137,6 +143,7 @@ EXPECT_EQ(0U, Vec.count()); EXPECT_EQ(0U, Vec.size()); EXPECT_FALSE(Vec.any()); + EXPECT_TRUE(Vec.all()); EXPECT_TRUE(Vec.none()); EXPECT_TRUE(Vec.empty()); } Modified: llvm/trunk/unittests/ADT/SmallBitVectorTest.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/ADT/SmallBitVectorTest.cpp?rev=114830&r1=114829&r2=114830&view=diff ============================================================================== --- llvm/trunk/unittests/ADT/SmallBitVectorTest.cpp (original) +++ llvm/trunk/unittests/ADT/SmallBitVectorTest.cpp Mon Sep 27 10:48:37 2010 @@ -19,6 +19,7 @@ EXPECT_EQ(0U, Vec.count()); EXPECT_EQ(0U, Vec.size()); EXPECT_FALSE(Vec.any()); + EXPECT_TRUE(Vec.all()); EXPECT_TRUE(Vec.none()); EXPECT_TRUE(Vec.empty()); @@ -26,6 +27,7 @@ EXPECT_EQ(5U, Vec.count()); EXPECT_EQ(5U, Vec.size()); EXPECT_TRUE(Vec.any()); + EXPECT_TRUE(Vec.all()); EXPECT_FALSE(Vec.none()); EXPECT_FALSE(Vec.empty()); @@ -33,6 +35,7 @@ EXPECT_EQ(5U, Vec.count()); EXPECT_EQ(11U, Vec.size()); EXPECT_TRUE(Vec.any()); + EXPECT_FALSE(Vec.all()); EXPECT_FALSE(Vec.none()); EXPECT_FALSE(Vec.empty()); @@ -40,6 +43,7 @@ EXPECT_EQ(6U, Inv.count()); EXPECT_EQ(11U, Inv.size()); EXPECT_TRUE(Inv.any()); + EXPECT_FALSE(Inv.all()); EXPECT_FALSE(Inv.none()); EXPECT_FALSE(Inv.empty()); @@ -120,6 +124,7 @@ EXPECT_EQ(0U, Vec.count()); EXPECT_EQ(130U, Vec.size()); EXPECT_FALSE(Vec.any()); + EXPECT_FALSE(Vec.all()); EXPECT_TRUE(Vec.none()); EXPECT_FALSE(Vec.empty()); @@ -127,6 +132,7 @@ EXPECT_EQ(0U, Inv.count()); EXPECT_EQ(0U, Inv.size()); EXPECT_FALSE(Inv.any()); + EXPECT_TRUE(Inv.all()); EXPECT_TRUE(Inv.none()); EXPECT_TRUE(Inv.empty()); @@ -134,6 +140,7 @@ EXPECT_EQ(0U, Vec.count()); EXPECT_EQ(0U, Vec.size()); EXPECT_FALSE(Vec.any()); + EXPECT_TRUE(Vec.all()); EXPECT_TRUE(Vec.none()); EXPECT_TRUE(Vec.empty()); } From gohman at apple.com Mon Sep 27 10:50:08 2010 From: gohman at apple.com (Dan Gohman) Date: Mon, 27 Sep 2010 15:50:08 -0000 Subject: [llvm-commits] [llvm] r114831 - in /llvm/trunk/unittests: ADT/Makefile ADT/ValueMapTest.cpp VMCore/ValueMapTest.cpp Message-ID: <20100927155008.D3C122A6C12C@llvm.org> Author: djg Date: Mon Sep 27 10:50:08 2010 New Revision: 114831 URL: http://llvm.org/viewvc/llvm-project?rev=114831&view=rev Log: Move ValueMapTest from ADT to VMCore so that ADT doesn't need to link in "core". Added: llvm/trunk/unittests/VMCore/ValueMapTest.cpp - copied unchanged from r114829, llvm/trunk/unittests/ADT/ValueMapTest.cpp Removed: llvm/trunk/unittests/ADT/ValueMapTest.cpp Modified: llvm/trunk/unittests/ADT/Makefile Modified: llvm/trunk/unittests/ADT/Makefile URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/ADT/Makefile?rev=114831&r1=114830&r2=114831&view=diff ============================================================================== --- llvm/trunk/unittests/ADT/Makefile (original) +++ llvm/trunk/unittests/ADT/Makefile Mon Sep 27 10:50:08 2010 @@ -9,7 +9,7 @@ LEVEL = ../.. TESTNAME = ADT -LINK_COMPONENTS := core support +LINK_COMPONENTS := support include $(LEVEL)/Makefile.config Removed: llvm/trunk/unittests/ADT/ValueMapTest.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/ADT/ValueMapTest.cpp?rev=114830&view=auto ============================================================================== --- llvm/trunk/unittests/ADT/ValueMapTest.cpp (original) +++ llvm/trunk/unittests/ADT/ValueMapTest.cpp (removed) @@ -1,294 +0,0 @@ -//===- llvm/unittest/ADT/ValueMapTest.cpp - ValueMap unit tests -*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -#include "llvm/ADT/ValueMap.h" -#include "llvm/Instructions.h" -#include "llvm/LLVMContext.h" -#include "llvm/ADT/OwningPtr.h" -#include "llvm/Config/config.h" - -#include "gtest/gtest.h" - -using namespace llvm; - -namespace { - -// Test fixture -template -class ValueMapTest : public testing::Test { -protected: - Constant *ConstantV; - OwningPtr BitcastV; - OwningPtr AddV; - - ValueMapTest() : - ConstantV(ConstantInt::get(Type::getInt32Ty(getGlobalContext()), 0)), - BitcastV(new BitCastInst(ConstantV, Type::getInt32Ty(getGlobalContext()))), - AddV(BinaryOperator::CreateAdd(ConstantV, ConstantV)) { - } -}; - -// Run everything on Value*, a subtype to make sure that casting works as -// expected, and a const subtype to make sure we cast const correctly. -typedef ::testing::Types KeyTypes; -TYPED_TEST_CASE(ValueMapTest, KeyTypes); - -TYPED_TEST(ValueMapTest, Null) { - ValueMap VM1; - VM1[NULL] = 7; - EXPECT_EQ(7, VM1.lookup(NULL)); -} - -TYPED_TEST(ValueMapTest, FollowsValue) { - ValueMap VM; - VM[this->BitcastV.get()] = 7; - EXPECT_EQ(7, VM.lookup(this->BitcastV.get())); - EXPECT_EQ(0, VM.count(this->AddV.get())); - this->BitcastV->replaceAllUsesWith(this->AddV.get()); - EXPECT_EQ(7, VM.lookup(this->AddV.get())); - EXPECT_EQ(0, VM.count(this->BitcastV.get())); - this->AddV.reset(); - EXPECT_EQ(0, VM.count(this->AddV.get())); - EXPECT_EQ(0, VM.count(this->BitcastV.get())); - EXPECT_EQ(0U, VM.size()); -} - -TYPED_TEST(ValueMapTest, OperationsWork) { - ValueMap VM; - ValueMap VM2(16); (void)VM2; - typename ValueMapConfig::ExtraData Data; - ValueMap VM3(Data, 16); (void)VM3; - EXPECT_TRUE(VM.empty()); - - VM[this->BitcastV.get()] = 7; - - // Find: - typename ValueMap::iterator I = - VM.find(this->BitcastV.get()); - ASSERT_TRUE(I != VM.end()); - EXPECT_EQ(this->BitcastV.get(), I->first); - EXPECT_EQ(7, I->second); - EXPECT_TRUE(VM.find(this->AddV.get()) == VM.end()); - - // Const find: - const ValueMap &CVM = VM; - typename ValueMap::const_iterator CI = - CVM.find(this->BitcastV.get()); - ASSERT_TRUE(CI != CVM.end()); - EXPECT_EQ(this->BitcastV.get(), CI->first); - EXPECT_EQ(7, CI->second); - EXPECT_TRUE(CVM.find(this->AddV.get()) == CVM.end()); - - // Insert: - std::pair::iterator, bool> InsertResult1 = - VM.insert(std::make_pair(this->AddV.get(), 3)); - EXPECT_EQ(this->AddV.get(), InsertResult1.first->first); - EXPECT_EQ(3, InsertResult1.first->second); - EXPECT_TRUE(InsertResult1.second); - EXPECT_EQ(true, VM.count(this->AddV.get())); - std::pair::iterator, bool> InsertResult2 = - VM.insert(std::make_pair(this->AddV.get(), 5)); - EXPECT_EQ(this->AddV.get(), InsertResult2.first->first); - EXPECT_EQ(3, InsertResult2.first->second); - EXPECT_FALSE(InsertResult2.second); - - // Erase: - VM.erase(InsertResult2.first); - EXPECT_EQ(0U, VM.count(this->AddV.get())); - EXPECT_EQ(1U, VM.count(this->BitcastV.get())); - VM.erase(this->BitcastV.get()); - EXPECT_EQ(0U, VM.count(this->BitcastV.get())); - EXPECT_EQ(0U, VM.size()); - - // Range insert: - SmallVector, 2> Elems; - Elems.push_back(std::make_pair(this->AddV.get(), 1)); - Elems.push_back(std::make_pair(this->BitcastV.get(), 2)); - VM.insert(Elems.begin(), Elems.end()); - EXPECT_EQ(1, VM.lookup(this->AddV.get())); - EXPECT_EQ(2, VM.lookup(this->BitcastV.get())); -} - -template -void CompileAssertHasType(VarType) { - typedef char assert[is_same::value ? 1 : -1]; -} - -TYPED_TEST(ValueMapTest, Iteration) { - ValueMap VM; - VM[this->BitcastV.get()] = 2; - VM[this->AddV.get()] = 3; - size_t size = 0; - for (typename ValueMap::iterator I = VM.begin(), E = VM.end(); - I != E; ++I) { - ++size; - std::pair value = *I; (void)value; - CompileAssertHasType(I->first); - if (I->second == 2) { - EXPECT_EQ(this->BitcastV.get(), I->first); - I->second = 5; - } else if (I->second == 3) { - EXPECT_EQ(this->AddV.get(), I->first); - I->second = 6; - } else { - ADD_FAILURE() << "Iterated through an extra value."; - } - } - EXPECT_EQ(2U, size); - EXPECT_EQ(5, VM[this->BitcastV.get()]); - EXPECT_EQ(6, VM[this->AddV.get()]); - - size = 0; - // Cast to const ValueMap to avoid a bug in DenseMap's iterators. - const ValueMap& CVM = VM; - for (typename ValueMap::const_iterator I = CVM.begin(), - E = CVM.end(); I != E; ++I) { - ++size; - std::pair value = *I; (void)value; - CompileAssertHasType(I->first); - if (I->second == 5) { - EXPECT_EQ(this->BitcastV.get(), I->first); - } else if (I->second == 6) { - EXPECT_EQ(this->AddV.get(), I->first); - } else { - ADD_FAILURE() << "Iterated through an extra value."; - } - } - EXPECT_EQ(2U, size); -} - -TYPED_TEST(ValueMapTest, DefaultCollisionBehavior) { - // By default, we overwrite the old value with the replaced value. - ValueMap VM; - VM[this->BitcastV.get()] = 7; - VM[this->AddV.get()] = 9; - this->BitcastV->replaceAllUsesWith(this->AddV.get()); - EXPECT_EQ(0, VM.count(this->BitcastV.get())); - EXPECT_EQ(9, VM.lookup(this->AddV.get())); -} - -TYPED_TEST(ValueMapTest, ConfiguredCollisionBehavior) { - // TODO: Implement this when someone needs it. -} - -template -struct LockMutex : ValueMapConfig { - struct ExtraData { - sys::Mutex *M; - bool *CalledRAUW; - bool *CalledDeleted; - }; - static void onRAUW(const ExtraData &Data, KeyT Old, KeyT New) { - *Data.CalledRAUW = true; - EXPECT_FALSE(Data.M->tryacquire()) << "Mutex should already be locked."; - } - static void onDelete(const ExtraData &Data, KeyT Old) { - *Data.CalledDeleted = true; - EXPECT_FALSE(Data.M->tryacquire()) << "Mutex should already be locked."; - } - static sys::Mutex *getMutex(const ExtraData &Data) { return Data.M; } -}; -#if ENABLE_THREADS -TYPED_TEST(ValueMapTest, LocksMutex) { - sys::Mutex M(false); // Not recursive. - bool CalledRAUW = false, CalledDeleted = false; - typename LockMutex::ExtraData Data = - {&M, &CalledRAUW, &CalledDeleted}; - ValueMap > VM(Data); - VM[this->BitcastV.get()] = 7; - this->BitcastV->replaceAllUsesWith(this->AddV.get()); - this->AddV.reset(); - EXPECT_TRUE(CalledRAUW); - EXPECT_TRUE(CalledDeleted); -} -#endif - -template -struct NoFollow : ValueMapConfig { - enum { FollowRAUW = false }; -}; - -TYPED_TEST(ValueMapTest, NoFollowRAUW) { - ValueMap > VM; - VM[this->BitcastV.get()] = 7; - EXPECT_EQ(7, VM.lookup(this->BitcastV.get())); - EXPECT_EQ(0, VM.count(this->AddV.get())); - this->BitcastV->replaceAllUsesWith(this->AddV.get()); - EXPECT_EQ(7, VM.lookup(this->BitcastV.get())); - EXPECT_EQ(0, VM.lookup(this->AddV.get())); - this->AddV.reset(); - EXPECT_EQ(7, VM.lookup(this->BitcastV.get())); - EXPECT_EQ(0, VM.lookup(this->AddV.get())); - this->BitcastV.reset(); - EXPECT_EQ(0, VM.lookup(this->BitcastV.get())); - EXPECT_EQ(0, VM.lookup(this->AddV.get())); - EXPECT_EQ(0U, VM.size()); -} - -template -struct CountOps : ValueMapConfig { - struct ExtraData { - int *Deletions; - int *RAUWs; - }; - - static void onRAUW(const ExtraData &Data, KeyT Old, KeyT New) { - ++*Data.RAUWs; - } - static void onDelete(const ExtraData &Data, KeyT Old) { - ++*Data.Deletions; - } -}; - -TYPED_TEST(ValueMapTest, CallsConfig) { - int Deletions = 0, RAUWs = 0; - typename CountOps::ExtraData Data = {&Deletions, &RAUWs}; - ValueMap > VM(Data); - VM[this->BitcastV.get()] = 7; - this->BitcastV->replaceAllUsesWith(this->AddV.get()); - EXPECT_EQ(0, Deletions); - EXPECT_EQ(1, RAUWs); - this->AddV.reset(); - EXPECT_EQ(1, Deletions); - EXPECT_EQ(1, RAUWs); - this->BitcastV.reset(); - EXPECT_EQ(1, Deletions); - EXPECT_EQ(1, RAUWs); -} - -template -struct ModifyingConfig : ValueMapConfig { - // We'll put a pointer here back to the ValueMap this key is in, so - // that we can modify it (and clobber *this) before the ValueMap - // tries to do the same modification. In previous versions of - // ValueMap, that exploded. - typedef ValueMap > **ExtraData; - - static void onRAUW(ExtraData Map, KeyT Old, KeyT New) { - (*Map)->erase(Old); - } - static void onDelete(ExtraData Map, KeyT Old) { - (*Map)->erase(Old); - } -}; -TYPED_TEST(ValueMapTest, SurvivesModificationByConfig) { - ValueMap > *MapAddress; - ValueMap > VM(&MapAddress); - MapAddress = &VM; - // Now the ModifyingConfig can modify the Map inside a callback. - VM[this->BitcastV.get()] = 7; - this->BitcastV->replaceAllUsesWith(this->AddV.get()); - EXPECT_FALSE(VM.count(this->BitcastV.get())); - EXPECT_FALSE(VM.count(this->AddV.get())); - VM[this->AddV.get()] = 7; - this->AddV.reset(); - EXPECT_FALSE(VM.count(this->AddV.get())); -} - -} From gohman at apple.com Mon Sep 27 11:28:34 2010 From: gohman at apple.com (Dan Gohman) Date: Mon, 27 Sep 2010 16:28:34 -0000 Subject: [llvm-commits] [llvm] r114832 - in /llvm/trunk: autoconf/configure.ac configure include/llvm/Config/config.h.in lib/Support/GraphWriter.cpp Message-ID: <20100927162834.E41FE2A6C12C@llvm.org> Author: djg Date: Mon Sep 27 11:28:34 2010 New Revision: 114832 URL: http://llvm.org/viewvc/llvm-project?rev=114832&view=rev Log: Add support for viewing graphviz graphs with xdot.py. Modified: llvm/trunk/autoconf/configure.ac llvm/trunk/configure llvm/trunk/include/llvm/Config/config.h.in llvm/trunk/lib/Support/GraphWriter.cpp Modified: llvm/trunk/autoconf/configure.ac URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/autoconf/configure.ac?rev=114832&r1=114831&r2=114832&view=diff ============================================================================== --- llvm/trunk/autoconf/configure.ac (original) +++ llvm/trunk/autoconf/configure.ac Mon Sep 27 11:28:34 2010 @@ -979,6 +979,16 @@ AC_DEFINE_UNQUOTED([LLVM_PATH_DOTTY],"$DOTTY${EXEEXT}", [Define to path to dotty program if found or 'echo dotty' otherwise]) fi +AC_PATH_PROG(XDOT_PY, [xdot.py], [echo xdot.py]) +if test "$XDOT_PY" != "echo xdot.py" ; then + AC_DEFINE([HAVE_XDOT_PY],[1],[Define if the xdot.py program is available]) + dnl If we're targeting for mingw we should emit windows paths, not msys + if test "$llvm_cv_os_type" = "MingW" ; then + XDOT_PY=`echo $XDOT_PY | sed 's/^\/\([[A-Za-z]]\)\//\1:\//' ` + fi + AC_DEFINE_UNQUOTED([LLVM_PATH_XDOT_PY],"$XDOT_PY${EXEEXT}", + [Define to path to xdot.py program if found or 'echo xdot.py' otherwise]) +fi dnl Look for a sufficiently recent version of Perl. LLVM_PROG_PERL([5.006]) Modified: llvm/trunk/configure URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/configure?rev=114832&r1=114831&r2=114832&view=diff ============================================================================== --- llvm/trunk/configure (original) +++ llvm/trunk/configure Mon Sep 27 11:28:34 2010 @@ -729,6 +729,7 @@ CIRCO GV DOTTY +XDOT_PY PERL HAVE_PERL INSTALL_PROGRAM @@ -7834,6 +7835,62 @@ _ACEOF fi +# Extract the first word of "xdot.py", so it can be a program name with args. +set dummy xdot.py; 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_XDOT_PY+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + case $XDOT_PY in + [\\/]* | ?:[\\/]*) + ac_cv_path_XDOT_PY="$XDOT_PY" # 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_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_path_XDOT_PY="$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_XDOT_PY" && ac_cv_path_XDOT_PY="echo xdot.py" + ;; +esac +fi +XDOT_PY=$ac_cv_path_XDOT_PY +if test -n "$XDOT_PY"; then + { echo "$as_me:$LINENO: result: $XDOT_PY" >&5 +echo "${ECHO_T}$XDOT_PY" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + +if test "$XDOT_PY" != "echo xdot.py" ; then + +cat >>confdefs.h <<\_ACEOF +#define HAVE_XDOT_PY 1 +_ACEOF + + if test "$llvm_cv_os_type" = "MingW" ; then + XDOT_PY=`echo $XDOT_PY | sed 's/^\/\([A-Za-z]\)\//\1:\//' ` + fi + +cat >>confdefs.h <<_ACEOF +#define LLVM_PATH_XDOT_PY "$XDOT_PY${EXEEXT}" +_ACEOF + +fi # Extract the first word of "perl", so it can be a program name with args. @@ -11394,7 +11451,7 @@ lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <&5 Modified: llvm/trunk/include/llvm/Config/config.h.in URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Config/config.h.in?rev=114832&r1=114831&r2=114832&view=diff ============================================================================== --- llvm/trunk/include/llvm/Config/config.h.in (original) +++ llvm/trunk/include/llvm/Config/config.h.in Mon Sep 27 11:28:34 2010 @@ -118,6 +118,9 @@ /* Define if the neat program is available */ #undef HAVE_FDP +/* Define to 1 if you have the header file. */ +#undef HAVE_FENV_H + /* Define if libffi is available on this platform. */ #undef HAVE_FFI_CALL @@ -455,12 +458,12 @@ /* Define to 1 if you have the header file. */ #undef HAVE_VALGRIND_VALGRIND_H -/* Define to 1 if you have the header file. */ -#undef HAVE_FENV_H - /* Define to 1 if you have the header file. */ #undef HAVE_WINDOWS_H +/* Define if the xdot.py program is available */ +#undef HAVE_XDOT_PY + /* Define to 1 if you have the `__dso_handle' function. */ #undef HAVE___DSO_HANDLE @@ -542,6 +545,9 @@ /* Define to path to twopi program if found or 'echo twopi' otherwise */ #undef LLVM_PATH_TWOPI +/* Define to path to xdot.py program if found or 'echo xdot.py' otherwise */ +#undef LLVM_PATH_XDOT_PY + /* Installation prefix directory */ #undef LLVM_PREFIX Modified: llvm/trunk/lib/Support/GraphWriter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/GraphWriter.cpp?rev=114832&r1=114831&r2=114832&view=diff ============================================================================== --- llvm/trunk/lib/Support/GraphWriter.cpp (original) +++ llvm/trunk/lib/Support/GraphWriter.cpp Mon Sep 27 11:28:34 2010 @@ -69,6 +69,32 @@ else Filename.eraseFromDisk(); +#elif HAVE_XDOT_PY + sys::Path XDotPy(); + + std::vector args; + args.push_back(LLVM_PATH_XDOT_PY); + args.push_back(Filename.c_str()); + + switch (program) { + case GraphProgram::DOT: args.push_back("-f"); args.push_back("dot"); break; + case GraphProgram::FDP: args.push_back("-f"); args.push_back("fdp"); break; + case GraphProgram::NEATO: args.push_back("-f"); args.push_back("neato");break; + case GraphProgram::TWOPI: args.push_back("-f"); args.push_back("twopi");break; + case GraphProgram::CIRCO: args.push_back("-f"); args.push_back("circo");break; + default: errs() << "Unknown graph layout name; using default.\n"; + } + + args.push_back(0); + + errs() << "Running 'xdot.py' program... "; + if (sys::Program::ExecuteAndWait(sys::Path(LLVM_PATH_XDOT_PY), + &args[0],0,0,0,0,&ErrMsg)) + errs() << "Error viewing graph " << Filename.str() << ": " << ErrMsg + << "\n"; + else + Filename.eraseFromDisk(); + #elif (HAVE_GV && (HAVE_DOT || HAVE_FDP || HAVE_NEATO || \ HAVE_TWOPI || HAVE_CIRCO)) sys::Path PSFilename = Filename; From baldrick at free.fr Mon Sep 27 11:33:01 2010 From: baldrick at free.fr (Duncan Sands) Date: Mon, 27 Sep 2010 16:33:01 -0000 Subject: [llvm-commits] [dragonegg] r114833 - in /dragonegg/trunk: Makefile llvm-abi.h llvm-convert.cpp llvm-debug.cpp llvm-debug.h Message-ID: <20100927163301.4A4432A6C12C@llvm.org> Author: baldrick Date: Mon Sep 27 11:33:01 2010 New Revision: 114833 URL: http://llvm.org/viewvc/llvm-project?rev=114833&view=rev Log: Make the build -Wextra clean (and add -Wextra to the list of compile flags). Modified: dragonegg/trunk/Makefile dragonegg/trunk/llvm-abi.h dragonegg/trunk/llvm-convert.cpp dragonegg/trunk/llvm-debug.cpp dragonegg/trunk/llvm-debug.h Modified: dragonegg/trunk/Makefile URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/Makefile?rev=114833&r1=114832&r2=114833&view=diff ============================================================================== --- dragonegg/trunk/Makefile (original) +++ dragonegg/trunk/Makefile Mon Sep 27 11:33:01 2010 @@ -17,8 +17,9 @@ QUIET:=@ endif -CFLAGS+=-Wall $(shell $(LLVM_CONFIG) --cflags) -fvisibility=hidden -CXXFLAGS+=-Wall $(shell $(LLVM_CONFIG) --cxxflags) -fvisibility=hidden +COMMON_FLAGS=-Wall -Wextra -fvisibility=hidden +CFLAGS+=$(COMMON_FLAGS) $(shell $(LLVM_CONFIG) --cflags) +CXXFLAGS+=$(COMMON_FLAGS) $(shell $(LLVM_CONFIG) --cxxflags) ifeq ($(shell uname),Darwin) LOADABLE_MODULE_OPTIONS=-bundle -undefined dynamic_lookup Modified: dragonegg/trunk/llvm-abi.h URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/llvm-abi.h?rev=114833&r1=114832&r2=114833&view=diff ============================================================================== --- dragonegg/trunk/llvm-abi.h (original) +++ dragonegg/trunk/llvm-abi.h Mon Sep 27 11:33:01 2010 @@ -54,59 +54,70 @@ /// HandleScalarResult - This callback is invoked if the function returns a /// simple scalar result value, which is of type RetTy. - virtual void HandleScalarResult(const Type *RetTy) {} + virtual void HandleScalarResult(const Type *RetTy ATTRIBUTE_UNUSED) {} /// HandleAggregateResultAsScalar - This callback is invoked if the function /// returns an aggregate value by bit converting it to the specified scalar /// type and returning that. The bit conversion should start at byte Offset /// within the struct, and ScalarTy is not necessarily big enough to cover /// the entire struct. - virtual void HandleAggregateResultAsScalar(const Type *ScalarTy, unsigned Offset=0) {} + virtual void HandleAggregateResultAsScalar( + const Type *ScalarTy ATTRIBUTE_UNUSED, + unsigned Offset ATTRIBUTE_UNUSED = 0) {} /// HandleAggregateResultAsAggregate - This callback is invoked if the function /// returns an aggregate value using multiple return values. - virtual void HandleAggregateResultAsAggregate(const Type *AggrTy) {} + virtual void HandleAggregateResultAsAggregate( + const Type *AggrTy ATTRIBUTE_UNUSED) {} /// HandleAggregateShadowResult - This callback is invoked if the function /// returns an aggregate value by using a "shadow" first parameter, which is /// a pointer to the aggregate, of type PtrArgTy. If RetPtr is set to true, /// the pointer argument itself is returned from the function. - virtual void HandleAggregateShadowResult(const PointerType *PtrArgTy, bool RetPtr){} + virtual void HandleAggregateShadowResult( + const PointerType *PtrArgTy ATTRIBUTE_UNUSED, + bool RetPtr ATTRIBUTE_UNUSED) {} /// HandleScalarShadowResult - This callback is invoked if the function /// returns a scalar value by using a "shadow" first parameter, which is a /// pointer to the scalar, of type PtrArgTy. If RetPtr is set to true, /// the pointer argument itself is returned from the function. - virtual void HandleScalarShadowResult(const PointerType *PtrArgTy, bool RetPtr) {} + virtual void HandleScalarShadowResult( + const PointerType *PtrArgTy ATTRIBUTE_UNUSED, + bool RetPtr ATTRIBUTE_UNUSED) {} /// HandleScalarArgument - This is the primary callback that specifies an /// LLVM argument to pass. It is only used for first class types. /// If RealSize is non Zero then it specifies number of bytes to access /// from LLVMTy. - virtual void HandleScalarArgument(const llvm::Type *LLVMTy, tree_node *type, - unsigned RealSize = 0) {} + virtual void HandleScalarArgument(const llvm::Type *LLVMTy ATTRIBUTE_UNUSED, + tree_node *type ATTRIBUTE_UNUSED, + unsigned RealSize ATTRIBUTE_UNUSED = 0) {} /// HandleByInvisibleReferenceArgument - This callback is invoked if a pointer /// (of type PtrTy) to the argument is passed rather than the argument itself. - virtual void HandleByInvisibleReferenceArgument(const llvm::Type *PtrTy, - tree_node *type) {} + virtual void HandleByInvisibleReferenceArgument( + const llvm::Type *PtrTy ATTRIBUTE_UNUSED, + tree_node *type ATTRIBUTE_UNUSED) {} /// HandleByValArgument - This callback is invoked if the aggregate function /// argument is passed by value. - virtual void HandleByValArgument(const llvm::Type *LLVMTy, tree_node *type) {} + virtual void HandleByValArgument(const llvm::Type *LLVMTy ATTRIBUTE_UNUSED, + tree_node *type ATTRIBUTE_UNUSED) {} /// HandleFCAArgument - This callback is invoked if the aggregate function /// argument is passed by value as a first class aggregate. - virtual void HandleFCAArgument(const llvm::Type *LLVMTy, + virtual void HandleFCAArgument(const llvm::Type *LLVMTy ATTRIBUTE_UNUSED, tree_node *type ATTRIBUTE_UNUSED) {} /// EnterField - Called when we're about the enter the field of a struct /// or union. FieldNo is the number of the element we are entering in the /// LLVM Struct, StructTy is the LLVM type of the struct we are entering. - virtual void EnterField(unsigned FieldNo, const llvm::Type *StructTy) {} + virtual void EnterField(unsigned FieldNo ATTRIBUTE_UNUSED, + const llvm::Type *StructTy ATTRIBUTE_UNUSED) {} virtual void ExitField() {} - virtual void HandlePad(const llvm::Type *LLVMTy) {} + virtual void HandlePad(const llvm::Type *LLVMTy ATTRIBUTE_UNUSED) {} }; // LLVM_SHOULD_NOT_RETURN_COMPLEX_IN_MEMORY - A hook to allow @@ -172,7 +183,8 @@ // getLLVMAggregateTypeForStructReturn - Return LLVM type if TY can be // returns as multiple values, otherwise return NULL. This is the default // target independent implementation. -static inline const Type* getLLVMAggregateTypeForStructReturn(tree_node *type) { +static inline const Type* getLLVMAggregateTypeForStructReturn( + tree_node *type ATTRIBUTE_UNUSED) { return NULL; } @@ -298,9 +310,9 @@ llvm_default_extract_multiple_return_value((Src),(Dest),(V),(B)) #endif static inline -void llvm_default_extract_multiple_return_value(Value *Src, Value *Dest, - bool isVolatile, - LLVMBuilder &Builder) { +void llvm_default_extract_multiple_return_value( + Value *Src ATTRIBUTE_UNUSED, Value *Dest ATTRIBUTE_UNUSED, + bool isVolatile ATTRIBUTE_UNUSED, LLVMBuilder &Builder ATTRIBUTE_UNUSED) { assert (0 && "LLVM_EXTRACT_MULTIPLE_RETURN_VALUE is not implemented!"); } Modified: dragonegg/trunk/llvm-convert.cpp URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/llvm-convert.cpp?rev=114833&r1=114832&r2=114833&view=diff ============================================================================== --- dragonegg/trunk/llvm-convert.cpp (original) +++ dragonegg/trunk/llvm-convert.cpp Mon Sep 27 11:33:01 2010 @@ -685,7 +685,7 @@ Builder.SetInsertPoint(EntryBlock); if (EmitDebugInfo()) - TheDebugInfo->EmitFunctionStart(FnDecl, Fn, Builder.GetInsertBlock()); + TheDebugInfo->EmitFunctionStart(FnDecl, Fn); // Loop over all of the arguments to the function, setting Argument names and // creating argument alloca's for the PARM_DECLs in case their address is @@ -773,7 +773,7 @@ } if (EmitDebugInfo()) - TheDebugInfo->EmitStopPoint(Fn, Builder.GetInsertBlock(), Builder); + TheDebugInfo->EmitStopPoint(Builder.GetInsertBlock(), Builder); // Create a new block for the return node, but don't insert it yet. ReturnBB = BasicBlock::Create(Context, "return"); @@ -981,8 +981,8 @@ // call to PopulatePhiNodes (for example) generates complicated debug info, // then the debug info logic barfs. Testcases showing this are 20011126-2.c // or pr42221.c from the gcc testsuite compiled with -g -O3. - TheDebugInfo->EmitStopPoint(Fn, ReturnBB, Builder); - TheDebugInfo->EmitFunctionEnd(ReturnBB, true); + TheDebugInfo->EmitStopPoint(ReturnBB, Builder); + TheDebugInfo->EmitFunctionEnd(true); } #ifndef NDEBUG @@ -1111,7 +1111,7 @@ TheDebugInfo->setLocationFile(""); TheDebugInfo->setLocationLine(0); } - TheDebugInfo->EmitStopPoint(Fn, Builder.GetInsertBlock(), Builder); + TheDebugInfo->EmitStopPoint(Builder.GetInsertBlock(), Builder); } switch (gimple_code(stmt)) { @@ -1169,7 +1169,7 @@ if (EmitDebugInfo()) { TheDebugInfo->setLocationFile(""); TheDebugInfo->setLocationLine(0); - TheDebugInfo->EmitStopPoint(Fn, Builder.GetInsertBlock(), Builder); + TheDebugInfo->EmitStopPoint(Builder.GetInsertBlock(), Builder); } // Add a branch to the fallthru block. Modified: dragonegg/trunk/llvm-debug.cpp URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/llvm-debug.cpp?rev=114833&r1=114832&r2=114833&view=diff ============================================================================== --- dragonegg/trunk/llvm-debug.cpp (original) +++ dragonegg/trunk/llvm-debug.cpp Mon Sep 27 11:33:01 2010 @@ -161,7 +161,7 @@ /// whether the node is a TYPE or DECL. UseStub is true if we should consider /// the type stub as the actually location (ignored in struct/unions/enums.) static expanded_location GetNodeLocation(tree Node, bool UseStub = true) { - expanded_location Location = { NULL, 0 }; + expanded_location Location = { NULL, 0, 0, false }; if (Node == NULL_TREE) return Location; @@ -246,9 +246,7 @@ } /// EmitFunctionStart - Constructs the debug code for entering a function. -void DebugInfo::EmitFunctionStart(tree FnDecl, Function *Fn, - BasicBlock *CurBB) { - +void DebugInfo::EmitFunctionStart(tree FnDecl, Function *Fn) { DIType FNType = getOrCreateType(TREE_TYPE(FnDecl)); std::map::iterator I = SPCache.find(FnDecl); @@ -371,7 +369,7 @@ } /// EmitFunctionEnd - Pop the region stack and reset current lexical block. -void DebugInfo::EmitFunctionEnd(BasicBlock *CurBB, bool EndFunction) { +void DebugInfo::EmitFunctionEnd(bool EndFunction) { assert(!RegionStack.empty() && "Region stack mismatch, stack empty!"); RegionStack.pop_back(); // Blocks get erased; clearing these is needed for determinism, and also @@ -417,8 +415,7 @@ } /// EmitStopPoint - Set current source location. -void DebugInfo::EmitStopPoint(Function *Fn, BasicBlock *CurBB, - LLVMBuilder &Builder) { +void DebugInfo::EmitStopPoint(BasicBlock *CurBB, LLVMBuilder &Builder) { // Don't bother if things are the same as last time. if (PrevLineNo == CurLineNo && PrevBB == CurBB && @@ -703,7 +700,7 @@ llvm::DIArray EltArray = DebugFactory.GetOrCreateArray(Elements.data(), Elements.size()); - expanded_location Loc = { NULL, 0 }; + expanded_location Loc = { NULL, 0, 0, false }; if (TYPE_SIZE(type)) // Incomplete enums do not have any location info. Loc = GetNodeLocation(TREE_CHAIN(type), false); Modified: dragonegg/trunk/llvm-debug.h URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/llvm-debug.h?rev=114833&r1=114832&r2=114833&view=diff ============================================================================== --- dragonegg/trunk/llvm-debug.h (original) +++ dragonegg/trunk/llvm-debug.h Mon Sep 27 11:33:01 2010 @@ -102,11 +102,11 @@ /// EmitFunctionStart - Constructs the debug code for entering a function - /// "llvm.dbg.func.start." - void EmitFunctionStart(tree_node *FnDecl, Function *Fn, BasicBlock *CurBB); + void EmitFunctionStart(tree_node *FnDecl, Function *Fn); /// EmitFunctionEnd - Constructs the debug code for exiting a declarative /// region - "llvm.dbg.region.end." - void EmitFunctionEnd(BasicBlock *CurBB, bool EndFunction); + void EmitFunctionEnd(bool EndFunction); /// EmitDeclare - Constructs the debug code for allocation of a new variable. /// region - "llvm.dbg.declare." @@ -115,7 +115,7 @@ /// EmitStopPoint - Emit a call to llvm.dbg.stoppoint to indicate a change of /// source line. - void EmitStopPoint(Function *Fn, BasicBlock *CurBB, LLVMBuilder &Builder); + void EmitStopPoint(BasicBlock *CurBB, LLVMBuilder &Builder); /// EmitGlobalVariable - Emit information about a global variable. /// From gohman at apple.com Mon Sep 27 11:33:31 2010 From: gohman at apple.com (Dan Gohman) Date: Mon, 27 Sep 2010 16:33:31 -0000 Subject: [llvm-commits] [llvm] r114834 - /llvm/trunk/include/llvm/Analysis/Dominators.h Message-ID: <20100927163331.C53D02A6C12C@llvm.org> Author: djg Date: Mon Sep 27 11:33:31 2010 New Revision: 114834 URL: http://llvm.org/viewvc/llvm-project?rev=114834&view=rev Log: Constify properlyDominates in the same manner as dominates. Add constified overloads for findNearestCommonDominator. Modified: llvm/trunk/include/llvm/Analysis/Dominators.h Modified: llvm/trunk/include/llvm/Analysis/Dominators.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/Dominators.h?rev=114834&r1=114833&r2=114834&view=diff ============================================================================== --- llvm/trunk/include/llvm/Analysis/Dominators.h (original) +++ llvm/trunk/include/llvm/Analysis/Dominators.h Mon Sep 27 11:33:31 2010 @@ -361,8 +361,15 @@ return dominatedBySlowTreeWalk(A, B); } - inline bool properlyDominates(NodeT *A, NodeT *B) { - return properlyDominates(getNode(A), getNode(B)); + inline bool properlyDominates(const NodeT *A, const NodeT *B) { + if (A == B) + return false; + + // Cast away the const qualifiers here. This is ok since + // this function doesn't actually return the values returned + // from getNode. + return properlyDominates(getNode(const_cast(A)), + getNode(const_cast(B))); } bool dominatedBySlowTreeWalk(const DomTreeNodeBase *A, @@ -478,6 +485,13 @@ return NULL; } + const NodeT *findNearestCommonDominator(const NodeT *A, const NodeT *B) { + // Cast away the const qualifiers here. This is ok since + // const is re-introduced on the return type. + return findNearestCommonDominator(const_cast(A), + const_cast(B)); + } + //===--------------------------------------------------------------------===// // API to update (Post)DominatorTree information based on modifications to // the CFG... @@ -767,7 +781,7 @@ return DT->properlyDominates(A, B); } - bool properlyDominates(BasicBlock *A, BasicBlock *B) const { + bool properlyDominates(const BasicBlock *A, const BasicBlock *B) const { return DT->properlyDominates(A, B); } @@ -777,6 +791,11 @@ return DT->findNearestCommonDominator(A, B); } + inline const BasicBlock *findNearestCommonDominator(const BasicBlock *A, + const BasicBlock *B) { + return DT->findNearestCommonDominator(A, B); + } + inline DomTreeNode *operator[](BasicBlock *BB) const { return DT->getNode(BB); } From clattner at apple.com Mon Sep 27 11:37:35 2010 From: clattner at apple.com (Chris Lattner) Date: Mon, 27 Sep 2010 09:37:35 -0700 Subject: [llvm-commits] [llvm] r114832 - in /llvm/trunk: autoconf/configure.ac configure include/llvm/Config/config.h.in lib/Support/GraphWriter.cpp In-Reply-To: <20100927162834.E41FE2A6C12C@llvm.org> References: <20100927162834.E41FE2A6C12C@llvm.org> Message-ID: <98D85BBA-1C97-46FA-B8DB-B62DD75200E9@apple.com> On Sep 27, 2010, at 9:28 AM, Dan Gohman wrote: > +++ llvm/trunk/lib/Support/GraphWriter.cpp Mon Sep 27 11:28:34 2010 > @@ -69,6 +69,32 @@ > else > Filename.eraseFromDisk(); > > +#elif HAVE_XDOT_PY > + sys::Path XDotPy(); Does this work? Aren't you declaring a function here, not default constructing a sys::Path? -Chris > + > + std::vector args; > + args.push_back(LLVM_PATH_XDOT_PY); > + args.push_back(Filename.c_str()); > + > + switch (program) { > + case GraphProgram::DOT: args.push_back("-f"); args.push_back("dot"); break; From dgregor at apple.com Mon Sep 27 11:40:43 2010 From: dgregor at apple.com (Douglas Gregor) Date: Mon, 27 Sep 2010 16:40:43 -0000 Subject: [llvm-commits] [llvm] r114835 - /llvm/trunk/unittests/CMakeLists.txt Message-ID: <20100927164043.A87352A6C12C@llvm.org> Author: dgregor Date: Mon Sep 27 11:40:43 2010 New Revision: 114835 URL: http://llvm.org/viewvc/llvm-project?rev=114835&view=rev Log: Remove reference to nonexistent test in CMake makefile for unit tests Modified: llvm/trunk/unittests/CMakeLists.txt Modified: llvm/trunk/unittests/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/CMakeLists.txt?rev=114835&r1=114834&r2=114835&view=diff ============================================================================== --- llvm/trunk/unittests/CMakeLists.txt (original) +++ llvm/trunk/unittests/CMakeLists.txt Mon Sep 27 11:40:43 2010 @@ -49,8 +49,7 @@ ADT/StringRefTest.cpp ADT/TripleTest.cpp ADT/TwineTest.cpp - ADT/ValueMapTest.cpp - ) + ) add_llvm_unittest(Analysis Analysis/ScalarEvolutionTest.cpp From gohman at apple.com Mon Sep 27 11:44:11 2010 From: gohman at apple.com (Dan Gohman) Date: Mon, 27 Sep 2010 16:44:11 -0000 Subject: [llvm-commits] [llvm] r114837 - /llvm/trunk/include/llvm/Support/GraphWriter.h Message-ID: <20100927164411.8B50B2A6C12C@llvm.org> Author: djg Date: Mon Sep 27 11:44:11 2010 New Revision: 114837 URL: http://llvm.org/viewvc/llvm-project?rev=114837&view=rev Log: Factor out code from the standalone WriteGraph function into a helper function on GraphWriter. Modified: llvm/trunk/include/llvm/Support/GraphWriter.h Modified: llvm/trunk/include/llvm/Support/GraphWriter.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/GraphWriter.h?rev=114837&r1=114836&r2=114837&view=diff ============================================================================== --- llvm/trunk/include/llvm/Support/GraphWriter.h (original) +++ llvm/trunk/include/llvm/Support/GraphWriter.h Mon Sep 27 11:44:11 2010 @@ -92,6 +92,24 @@ DTraits = DOTTraits(SN); } + void writeGraph(bool ShortNames = false, + const std::string &Title = "") { + // Start the graph emission process... + GraphWriter W(O, G, ShortNames); + + // Output the header for the graph... + W.writeHeader(Title); + + // Emit all of the nodes in the graph... + W.writeNodes(); + + // Output any customizations on the graph + DOTGraphTraits::addCustomGraphFeatures(G, W); + + // Output the end of the graph + W.writeFooter(); + } + void writeHeader(const std::string &Title) { std::string GraphName = DTraits.getGraphName(G); @@ -286,17 +304,9 @@ // Start the graph emission process... GraphWriter W(O, G, ShortNames); - // Output the header for the graph... - W.writeHeader(Title); - - // Emit all of the nodes in the graph... - W.writeNodes(); - - // Output any customizations on the graph - DOTGraphTraits::addCustomGraphFeatures(G, W); + // Emit the graph. + W.writeGraph(ShortNames, Title); - // Output the end of the graph - W.writeFooter(); return O; } From gohman at apple.com Mon Sep 27 11:54:13 2010 From: gohman at apple.com (Dan Gohman) Date: Mon, 27 Sep 2010 16:54:13 -0000 Subject: [llvm-commits] [llvm] r114838 - /llvm/trunk/include/llvm/Support/GraphWriter.h Message-ID: <20100927165413.6A51E2A6C12C@llvm.org> Author: djg Date: Mon Sep 27 11:54:13 2010 New Revision: 114838 URL: http://llvm.org/viewvc/llvm-project?rev=114838&view=rev Log: Don't construct a redundant GraphWriter object. Modified: llvm/trunk/include/llvm/Support/GraphWriter.h Modified: llvm/trunk/include/llvm/Support/GraphWriter.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/GraphWriter.h?rev=114838&r1=114837&r2=114838&view=diff ============================================================================== --- llvm/trunk/include/llvm/Support/GraphWriter.h (original) +++ llvm/trunk/include/llvm/Support/GraphWriter.h Mon Sep 27 11:54:13 2010 @@ -94,20 +94,17 @@ void writeGraph(bool ShortNames = false, const std::string &Title = "") { - // Start the graph emission process... - GraphWriter W(O, G, ShortNames); - // Output the header for the graph... - W.writeHeader(Title); + writeHeader(Title); // Emit all of the nodes in the graph... - W.writeNodes(); + writeNodes(); // Output any customizations on the graph - DOTGraphTraits::addCustomGraphFeatures(G, W); + DOTGraphTraits::addCustomGraphFeatures(G, *this); // Output the end of the graph - W.writeFooter(); + writeFooter(); } void writeHeader(const std::string &Title) { From gohman at apple.com Mon Sep 27 11:54:49 2010 From: gohman at apple.com (Dan Gohman) Date: Mon, 27 Sep 2010 16:54:49 -0000 Subject: [llvm-commits] [llvm] r114839 - /llvm/trunk/lib/Support/GraphWriter.cpp Message-ID: <20100927165449.A3B002A6C12C@llvm.org> Author: djg Date: Mon Sep 27 11:54:49 2010 New Revision: 114839 URL: http://llvm.org/viewvc/llvm-project?rev=114839&view=rev Log: Delete an unused declaration. Modified: llvm/trunk/lib/Support/GraphWriter.cpp Modified: llvm/trunk/lib/Support/GraphWriter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/GraphWriter.cpp?rev=114839&r1=114838&r2=114839&view=diff ============================================================================== --- llvm/trunk/lib/Support/GraphWriter.cpp (original) +++ llvm/trunk/lib/Support/GraphWriter.cpp Mon Sep 27 11:54:49 2010 @@ -70,8 +70,6 @@ Filename.eraseFromDisk(); #elif HAVE_XDOT_PY - sys::Path XDotPy(); - std::vector args; args.push_back(LLVM_PATH_XDOT_PY); args.push_back(Filename.c_str()); From gohman at apple.com Mon Sep 27 11:58:10 2010 From: gohman at apple.com (Dan Gohman) Date: Mon, 27 Sep 2010 09:58:10 -0700 Subject: [llvm-commits] [llvm] r114832 - in /llvm/trunk: autoconf/configure.ac configure include/llvm/Config/config.h.in lib/Support/GraphWriter.cpp In-Reply-To: <98D85BBA-1C97-46FA-B8DB-B62DD75200E9@apple.com> References: <20100927162834.E41FE2A6C12C@llvm.org> <98D85BBA-1C97-46FA-B8DB-B62DD75200E9@apple.com> Message-ID: On Sep 27, 2010, at 9:37 AM, Chris Lattner wrote: > > On Sep 27, 2010, at 9:28 AM, Dan Gohman wrote: > >> +++ llvm/trunk/lib/Support/GraphWriter.cpp Mon Sep 27 11:28:34 2010 >> @@ -69,6 +69,32 @@ >> else >> Filename.eraseFromDisk(); >> >> +#elif HAVE_XDOT_PY >> + sys::Path XDotPy(); > > Does this work? Aren't you declaring a function here, not default > constructing a sys::Path? It was unused. I removed it now. Dan From gohman at apple.com Mon Sep 27 11:58:21 2010 From: gohman at apple.com (Dan Gohman) Date: Mon, 27 Sep 2010 16:58:21 -0000 Subject: [llvm-commits] [llvm] r114841 - /llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp Message-ID: <20100927165821.75EF82A6C12D@llvm.org> Author: djg Date: Mon Sep 27 11:58:21 2010 New Revision: 114841 URL: http://llvm.org/viewvc/llvm-project?rev=114841&view=rev Log: Delete an unused function. 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=114841&r1=114840&r2=114841&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp Mon Sep 27 11:58:21 2010 @@ -645,8 +645,6 @@ : NumRegs(0), AddRecCost(0), NumIVMuls(0), NumBaseAdds(0), ImmCost(0), SetupCost(0) {} - unsigned getNumRegs() const { return NumRegs; } - bool operator<(const Cost &Other) const; void Loose(); From gohman at apple.com Mon Sep 27 11:59:52 2010 From: gohman at apple.com (Dan Gohman) Date: Mon, 27 Sep 2010 16:59:52 -0000 Subject: [llvm-commits] [llvm] r114842 - /llvm/trunk/include/llvm/Support/GraphWriter.h Message-ID: <20100927165952.1DB3B2A6C12C@llvm.org> Author: djg Date: Mon Sep 27 11:59:51 2010 New Revision: 114842 URL: http://llvm.org/viewvc/llvm-project?rev=114842&view=rev Log: writeGraph doesn't need its ShortNames argument. Modified: llvm/trunk/include/llvm/Support/GraphWriter.h Modified: llvm/trunk/include/llvm/Support/GraphWriter.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/GraphWriter.h?rev=114842&r1=114841&r2=114842&view=diff ============================================================================== --- llvm/trunk/include/llvm/Support/GraphWriter.h (original) +++ llvm/trunk/include/llvm/Support/GraphWriter.h Mon Sep 27 11:59:51 2010 @@ -92,8 +92,7 @@ DTraits = DOTTraits(SN); } - void writeGraph(bool ShortNames = false, - const std::string &Title = "") { + void writeGraph(const std::string &Title = "") { // Output the header for the graph... writeHeader(Title); @@ -302,7 +301,7 @@ GraphWriter W(O, G, ShortNames); // Emit the graph. - W.writeGraph(ShortNames, Title); + W.writeGraph(Title); return O; } From espindola at google.com Mon Sep 27 12:02:39 2010 From: espindola at google.com (Rafael Espindola) Date: Mon, 27 Sep 2010 13:02:39 -0400 Subject: [llvm-commits] Initial cut of ARM MC ELF emitter (PATCH) In-Reply-To: References: <461E2CD0-5905-48E9-8730-AFF37C693B2A@apple.com> <1B431CFE-CD10-4DC9-8387-560EFADCAC67@apple.com> Message-ID: I think the patch is fine. Jim, any last comments before I commit it? Cheers, -- Rafael ?vila de Esp?ndola From espindola at google.com Mon Sep 27 12:07:17 2010 From: espindola at google.com (Rafael Espindola) Date: Mon, 27 Sep 2010 13:07:17 -0400 Subject: [llvm-commits] [PATCH] Possible bug fix in LegalizeDAG.cpp In-Reply-To: <680044E4997F5343A2C58032DDD099160705D9@ZIPPY.Emea.Arm.com> References: <680044E4997F5343A2C58032DDD099160705D9@ZIPPY.Emea.Arm.com> Message-ID: On 24 September 2010 10:09, Edmund Grimley-Evans wrote: > I don't have a test case, but the original code looks suspicious and none of the regression tests fails for me when I make this change. > > On the other hand, see the comment a few lines above the altered line ... > The code is really strange, but I am not familiar with it to be sure it is wrong. There is the Node->getNumValues() following by Tmp1.getValue that you noticed. There is also the "e == 1" if in a loop where e is constant! :-( Cheers, -- Rafael ?vila de Esp?ndola From dalej at apple.com Mon Sep 27 12:13:20 2010 From: dalej at apple.com (Dale Johannesen) Date: Mon, 27 Sep 2010 10:13:20 -0700 Subject: [llvm-commits] [PATCH] Possible bug fix in LegalizeDAG.cpp In-Reply-To: <680044E4997F5343A2C58032DDD099160705D9@ZIPPY.Emea.Arm.com> References: <680044E4997F5343A2C58032DDD099160705D9@ZIPPY.Emea.Arm.com> Message-ID: <3F623F22-8256-459E-8735-3E1A56637A75@apple.com> On Sep 24, 2010, at 7:09 AMPDT, Edmund Grimley-Evans wrote: > I don't have a test case, but the original code looks suspicious and none of the regression tests fails for me when I make this change. > > On the other hand, see the comment a few lines above the altered line ... I think they are equivalent, i.e. Tmp is supposed to have the same number of results as Node. Not sure though. Testing e inside the loop is...peculiar. > -- > IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you. -------------- next part -------------- A non-text attachment was scrubbed... Name: a.patch Type: text/x-patch Size: 584 bytes Desc: not available Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20100927/19bfbc5b/attachment.bin -------------- next part -------------- > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From stoklund at 2pi.dk Mon Sep 27 12:29:42 2010 From: stoklund at 2pi.dk (Jakob Stoklund Olesen) Date: Mon, 27 Sep 2010 10:29:42 -0700 Subject: [llvm-commits] [llvm] r114791 - in /llvm/trunk: include/llvm/CodeGen/LiveInterval.h lib/CodeGen/InlineSpiller.cpp lib/CodeGen/LiveInterval.cpp lib/CodeGen/LiveIntervalAnalysis.cpp lib/CodeGen/PreAllocSplitting.cpp lib/CodeGen/RegAllocLinearScan.c In-Reply-To: References: Message-ID: <84241ADC-44EA-4EF6-9BA0-CC3A1B7176D9@2pi.dk> On Sep 25, 2010, at 8:50 PM, Lang Hames wrote: > > Thanks for the suggestions. They've been applied in r114798. Thanks . > Would it be possible to simply use SlotIndex() here? I am not completely clear on the difference, but it would be nice to have just one exceptional SlotIndex. > > LiveIntervals::getZeroIndex() returns an index which will compare lower than any other (and is the valid first index in the function). SlotIndex() values will compare higher than any other. Whether any code actually relies on this property I am not sure. SlotIndex() values are _not_ valid slots for any function, and it's impossible to traverse from them to any valid slot. They're self contained "weird" values. For that reason I think SlotIndex() would be better as the exceptional value. I agree. There are not many uses of getZeroIndex. One place in SimpleRegisterCoalescing is using it to recognize live-in registers. That assumes getZeroIndex == getMBBStartIndex(entry-block). Which is probably OK. /jakob From dalej at apple.com Mon Sep 27 12:29:14 2010 From: dalej at apple.com (Dale Johannesen) Date: Mon, 27 Sep 2010 17:29:14 -0000 Subject: [llvm-commits] [llvm] r114843 - /llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp Message-ID: <20100927172914.89A9F2A6C12C@llvm.org> Author: johannes Date: Mon Sep 27 12:29:14 2010 New Revision: 114843 URL: http://llvm.org/viewvc/llvm-project?rev=114843&view=rev Log: Don't try to make a vector of x86mmx; this won't work, and asserts. Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp?rev=114843&r1=114842&r2=114843&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp Mon Sep 27 12:29:14 2010 @@ -1572,7 +1572,8 @@ unsigned WidenSize = WidenVT.getSizeInBits(); unsigned InSize = InVT.getSizeInBits(); - if (WidenSize % InSize == 0) { + // x86mmx is not an acceptable vector element type, so don't try. + if (WidenSize % InSize == 0 && InVT != MVT::x86mmx) { // Determine new input vector type. The new input vector type will use // the same element type (if its a vector) or use the input type as a // vector. It is the same size as the type to widen to. @@ -2049,7 +2050,8 @@ // Check if we can convert between two legal vector types and extract. unsigned InWidenSize = InWidenVT.getSizeInBits(); unsigned Size = VT.getSizeInBits(); - if (InWidenSize % Size == 0 && !VT.isVector()) { + // x86mmx is not an acceptable vector element type, so don't try. + if (InWidenSize % Size == 0 && !VT.isVector() && VT != MVT::x86mmx) { unsigned NewNumElts = InWidenSize / Size; EVT NewVT = EVT::getVectorVT(*DAG.getContext(), VT, NewNumElts); if (TLI.isTypeSynthesizable(NewVT)) { From dalej at apple.com Mon Sep 27 12:29:47 2010 From: dalej at apple.com (Dale Johannesen) Date: Mon, 27 Sep 2010 17:29:47 -0000 Subject: [llvm-commits] [llvm] r114844 - /llvm/trunk/lib/Target/X86/X86FastISel.cpp Message-ID: <20100927172947.B588C2A6C12C@llvm.org> Author: johannes Date: Mon Sep 27 12:29:47 2010 New Revision: 114844 URL: http://llvm.org/viewvc/llvm-project?rev=114844&view=rev Log: MMX parameters aren't handled here yet. Modified: llvm/trunk/lib/Target/X86/X86FastISel.cpp Modified: llvm/trunk/lib/Target/X86/X86FastISel.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86FastISel.cpp?rev=114844&r1=114843&r2=114844&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86FastISel.cpp (original) +++ llvm/trunk/lib/Target/X86/X86FastISel.cpp Mon Sep 27 12:29:47 2010 @@ -1599,6 +1599,9 @@ break; } case CCValAssign::AExt: { + // We don't handle MMX parameters yet. + if (VA.getLocVT().isVector() && VA.getLocVT().getSizeInBits() == 128) + return false; bool Emitted = X86FastEmitExtend(ISD::ANY_EXTEND, VA.getLocVT(), Arg, ArgVT, Arg); if (!Emitted) From grosbach at apple.com Mon Sep 27 12:31:48 2010 From: grosbach at apple.com (Jim Grosbach) Date: Mon, 27 Sep 2010 10:31:48 -0700 Subject: [llvm-commits] Initial cut of ARM MC ELF emitter (PATCH) In-Reply-To: References: <461E2CD0-5905-48E9-8730-AFF37C693B2A@apple.com> <1B431CFE-CD10-4DC9-8387-560EFADCAC67@apple.com> Message-ID: It's much improved, but theres still one thing from my original comments that needs fixing. The most recent patch still contains the bits moving the TargetData information into the base ARMBaseTargetMachine class from the ARMTargetMachine and ThumbTargetMachine classes. That's not appropriate. That sort of information is what the subclasses are there for. Please undo those changes. -Jim On Sep 27, 2010, at 10:02 AM, Rafael Espindola wrote: > I think the patch is fine. Jim, any last comments before I commit it? > > Cheers, > -- > Rafael ?vila de Esp?ndola From grosbach at apple.com Mon Sep 27 12:34:30 2010 From: grosbach at apple.com (Jim Grosbach) Date: Mon, 27 Sep 2010 10:34:30 -0700 Subject: [llvm-commits] [llvm] r114812 - /llvm/trunk/lib/Target/ARM/ARMFastISel.cpp In-Reply-To: <20100927060223.583422A6C12D@llvm.org> References: <20100927060223.583422A6C12D@llvm.org> Message-ID: Yay! Thankee :) On Sep 26, 2010, at 11:02 PM, Eric Christopher wrote: > Author: echristo > Date: Mon Sep 27 01:02:23 2010 > New Revision: 114812 > > URL: http://llvm.org/viewvc/llvm-project?rev=114812&view=rev > Log: > Mass rename for Jim. > > Modified: > llvm/trunk/lib/Target/ARM/ARMFastISel.cpp > > Modified: llvm/trunk/lib/Target/ARM/ARMFastISel.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMFastISel.cpp?rev=114812&r1=114811&r2=114812&view=diff > ============================================================================== > --- llvm/trunk/lib/Target/ARM/ARMFastISel.cpp (original) > +++ llvm/trunk/lib/Target/ARM/ARMFastISel.cpp Mon Sep 27 01:02:23 2010 > @@ -113,16 +113,16 @@ > > // Instruction selection routines. > private: > - virtual bool ARMSelectLoad(const Instruction *I); > - virtual bool ARMSelectStore(const Instruction *I); > - virtual bool ARMSelectBranch(const Instruction *I); > - virtual bool ARMSelectCmp(const Instruction *I); > - virtual bool ARMSelectFPExt(const Instruction *I); > - virtual bool ARMSelectFPTrunc(const Instruction *I); > - virtual bool ARMSelectBinaryOp(const Instruction *I, unsigned ISDOpcode); > - virtual bool ARMSelectSIToFP(const Instruction *I); > - virtual bool ARMSelectFPToSI(const Instruction *I); > - virtual bool ARMSelectSDiv(const Instruction *I); > + virtual bool SelectLoad(const Instruction *I); > + virtual bool SelectStore(const Instruction *I); > + virtual bool SelectBranch(const Instruction *I); > + virtual bool SelectCmp(const Instruction *I); > + virtual bool SelectFPExt(const Instruction *I); > + virtual bool SelectFPTrunc(const Instruction *I); > + virtual bool SelectBinaryOp(const Instruction *I, unsigned ISDOpcode); > + virtual bool SelectSIToFP(const Instruction *I); > + virtual bool SelectFPToSI(const Instruction *I); > + virtual bool SelectSDiv(const Instruction *I); > > // Utility routines. > private: > @@ -602,7 +602,7 @@ > return true; > } > > -bool ARMFastISel::ARMSelectLoad(const Instruction *I) { > +bool ARMFastISel::SelectLoad(const Instruction *I) { > // Verify we have a legal type before going any further. > EVT VT; > if (!isLoadTypeLegal(I->getType(), VT)) > @@ -689,7 +689,7 @@ > return true; > } > > -bool ARMFastISel::ARMSelectStore(const Instruction *I) { > +bool ARMFastISel::SelectStore(const Instruction *I) { > Value *Op0 = I->getOperand(0); > unsigned SrcReg = 0; > > @@ -768,14 +768,14 @@ > } > } > > -bool ARMFastISel::ARMSelectBranch(const Instruction *I) { > +bool ARMFastISel::SelectBranch(const Instruction *I) { > const BranchInst *BI = cast(I); > MachineBasicBlock *TBB = FuncInfo.MBBMap[BI->getSuccessor(0)]; > MachineBasicBlock *FBB = FuncInfo.MBBMap[BI->getSuccessor(1)]; > > // Simple branch support. > // TODO: Hopefully we've already handled the condition since we won't > - // have left an update in the value map. See the TODO below in ARMSelectCMP. > + // have left an update in the value map. See the TODO below in SelectCMP. > Value *Cond = BI->getCondition(); > unsigned CondReg = getRegForValue(Cond); > if (CondReg == 0) return false; > @@ -798,7 +798,7 @@ > return true; > } > > -bool ARMFastISel::ARMSelectCmp(const Instruction *I) { > +bool ARMFastISel::SelectCmp(const Instruction *I) { > const CmpInst *CI = cast(I); > > EVT VT; > @@ -849,7 +849,7 @@ > return true; > } > > -bool ARMFastISel::ARMSelectFPExt(const Instruction *I) { > +bool ARMFastISel::SelectFPExt(const Instruction *I) { > // Make sure we have VFP and that we're extending float to double. > if (!Subtarget->hasVFP2()) return false; > > @@ -868,7 +868,7 @@ > return true; > } > > -bool ARMFastISel::ARMSelectFPTrunc(const Instruction *I) { > +bool ARMFastISel::SelectFPTrunc(const Instruction *I) { > // Make sure we have VFP and that we're truncating double to float. > if (!Subtarget->hasVFP2()) return false; > > @@ -887,7 +887,7 @@ > return true; > } > > -bool ARMFastISel::ARMSelectSIToFP(const Instruction *I) { > +bool ARMFastISel::SelectSIToFP(const Instruction *I) { > // Make sure we have VFP. > if (!Subtarget->hasVFP2()) return false; > > @@ -917,7 +917,7 @@ > return true; > } > > -bool ARMFastISel::ARMSelectFPToSI(const Instruction *I) { > +bool ARMFastISel::SelectFPToSI(const Instruction *I) { > // Make sure we have VFP. > if (!Subtarget->hasVFP2()) return false; > > @@ -950,7 +950,7 @@ > return true; > } > > -bool ARMFastISel::ARMSelectBinaryOp(const Instruction *I, unsigned ISDOpcode) { > +bool ARMFastISel::SelectBinaryOp(const Instruction *I, unsigned ISDOpcode) { > EVT VT = TLI.getValueType(I->getType(), true); > > // We can get here in the case when we want to use NEON for our fp > @@ -1139,7 +1139,7 @@ > return true; > } > > -bool ARMFastISel::ARMSelectSDiv(const Instruction *I) { > +bool ARMFastISel::SelectSDiv(const Instruction *I) { > EVT VT; > const Type *Ty = I->getType(); > if (!isTypeLegal(Ty, VT)) > @@ -1180,30 +1180,30 @@ > > switch (I->getOpcode()) { > case Instruction::Load: > - return ARMSelectLoad(I); > + return SelectLoad(I); > case Instruction::Store: > - return ARMSelectStore(I); > + return SelectStore(I); > case Instruction::Br: > - return ARMSelectBranch(I); > + return SelectBranch(I); > case Instruction::ICmp: > case Instruction::FCmp: > - return ARMSelectCmp(I); > + return SelectCmp(I); > case Instruction::FPExt: > - return ARMSelectFPExt(I); > + return SelectFPExt(I); > case Instruction::FPTrunc: > - return ARMSelectFPTrunc(I); > + return SelectFPTrunc(I); > case Instruction::SIToFP: > - return ARMSelectSIToFP(I); > + return SelectSIToFP(I); > case Instruction::FPToSI: > - return ARMSelectFPToSI(I); > + return SelectFPToSI(I); > case Instruction::FAdd: > - return ARMSelectBinaryOp(I, ISD::FADD); > + return SelectBinaryOp(I, ISD::FADD); > case Instruction::FSub: > - return ARMSelectBinaryOp(I, ISD::FSUB); > + return SelectBinaryOp(I, ISD::FSUB); > case Instruction::FMul: > - return ARMSelectBinaryOp(I, ISD::FMUL); > + return SelectBinaryOp(I, ISD::FMUL); > case Instruction::SDiv: > - return ARMSelectSDiv(I); > + return SelectSDiv(I); > default: break; > } > return false; > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From benny.kra at googlemail.com Mon Sep 27 12:42:11 2010 From: benny.kra at googlemail.com (Benjamin Kramer) Date: Mon, 27 Sep 2010 17:42:11 -0000 Subject: [llvm-commits] [llvm] r114847 - in /llvm/trunk: include/llvm/Support/SourceMgr.h lib/AsmParser/LLLexer.cpp lib/AsmParser/LLLexer.h lib/AsmParser/LLParser.cpp lib/AsmParser/LLParser.h lib/MC/MCParser/AsmParser.cpp lib/Support/SourceMgr.cpp tools/llvm-mc/Disassembler.cpp utils/TableGen/Record.h utils/TableGen/TGLexer.cpp utils/TableGen/TGLexer.h utils/TableGen/TGParser.h utils/TableGen/TableGen.cpp Message-ID: <20100927174212.083652A6C12C@llvm.org> Author: d0k Date: Mon Sep 27 12:42:11 2010 New Revision: 114847 URL: http://llvm.org/viewvc/llvm-project?rev=114847&view=rev Log: Push twines deeper into SourceMgr's error handling methods. Modified: llvm/trunk/include/llvm/Support/SourceMgr.h llvm/trunk/lib/AsmParser/LLLexer.cpp llvm/trunk/lib/AsmParser/LLLexer.h llvm/trunk/lib/AsmParser/LLParser.cpp llvm/trunk/lib/AsmParser/LLParser.h llvm/trunk/lib/MC/MCParser/AsmParser.cpp llvm/trunk/lib/Support/SourceMgr.cpp llvm/trunk/tools/llvm-mc/Disassembler.cpp llvm/trunk/utils/TableGen/Record.h llvm/trunk/utils/TableGen/TGLexer.cpp llvm/trunk/utils/TableGen/TGLexer.h llvm/trunk/utils/TableGen/TGParser.h llvm/trunk/utils/TableGen/TableGen.cpp Modified: llvm/trunk/include/llvm/Support/SourceMgr.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/SourceMgr.h?rev=114847&r1=114846&r2=114847&view=diff ============================================================================== --- llvm/trunk/include/llvm/Support/SourceMgr.h (original) +++ llvm/trunk/include/llvm/Support/SourceMgr.h Mon Sep 27 12:42:11 2010 @@ -26,6 +26,7 @@ class MemoryBuffer; class SourceMgr; class SMDiagnostic; + class Twine; class raw_ostream; /// SourceMgr - This owns the files read by a parser, handles include stacks, @@ -125,7 +126,7 @@ /// @param Type - If non-null, the kind of message (e.g., "error") which is /// prefixed to the message. /// @param ShowLine - Should the diagnostic show the source line. - void PrintMessage(SMLoc Loc, const std::string &Msg, const char *Type, + void PrintMessage(SMLoc Loc, const Twine &Msg, const char *Type, bool ShowLine = true) const; @@ -136,7 +137,7 @@ /// prefixed to the message. /// @param ShowLine - Should the diagnostic show the source line. SMDiagnostic GetMessage(SMLoc Loc, - const std::string &Msg, const char *Type, + const Twine &Msg, const char *Type, bool ShowLine = true) const; Modified: llvm/trunk/lib/AsmParser/LLLexer.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/AsmParser/LLLexer.cpp?rev=114847&r1=114846&r2=114847&view=diff ============================================================================== --- llvm/trunk/lib/AsmParser/LLLexer.cpp (original) +++ llvm/trunk/lib/AsmParser/LLLexer.cpp Mon Sep 27 12:42:11 2010 @@ -15,18 +15,19 @@ #include "llvm/DerivedTypes.h" #include "llvm/Instruction.h" #include "llvm/LLVMContext.h" +#include "llvm/ADT/Twine.h" +#include "llvm/Assembly/Parser.h" #include "llvm/Support/ErrorHandling.h" #include "llvm/Support/MemoryBuffer.h" #include "llvm/Support/MathExtras.h" #include "llvm/Support/SourceMgr.h" #include "llvm/Support/raw_ostream.h" -#include "llvm/Assembly/Parser.h" #include #include #include using namespace llvm; -bool LLLexer::Error(LocTy ErrorLoc, const std::string &Msg) const { +bool LLLexer::Error(LocTy ErrorLoc, const Twine &Msg) const { ErrorInfo = SM.GetMessage(ErrorLoc, Msg, "error"); return true; } Modified: llvm/trunk/lib/AsmParser/LLLexer.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/AsmParser/LLLexer.h?rev=114847&r1=114846&r2=114847&view=diff ============================================================================== --- llvm/trunk/lib/AsmParser/LLLexer.h (original) +++ llvm/trunk/lib/AsmParser/LLLexer.h Mon Sep 27 12:42:11 2010 @@ -62,8 +62,8 @@ const APFloat &getAPFloatVal() const { return APFloatVal; } - bool Error(LocTy L, const std::string &Msg) const; - bool Error(const std::string &Msg) const { return Error(getLoc(), Msg); } + bool Error(LocTy L, const Twine &Msg) const; + bool Error(const Twine &Msg) const { return Error(getLoc(), Msg); } std::string getFilename() const; private: Modified: llvm/trunk/lib/AsmParser/LLParser.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/AsmParser/LLParser.cpp?rev=114847&r1=114846&r2=114847&view=diff ============================================================================== --- llvm/trunk/lib/AsmParser/LLParser.cpp (original) +++ llvm/trunk/lib/AsmParser/LLParser.cpp Mon Sep 27 12:42:11 2010 @@ -22,7 +22,6 @@ #include "llvm/Operator.h" #include "llvm/ValueSymbolTable.h" #include "llvm/ADT/SmallPtrSet.h" -#include "llvm/ADT/StringExtras.h" #include "llvm/Support/ErrorHandling.h" #include "llvm/Support/raw_ostream.h" using namespace llvm; @@ -52,7 +51,7 @@ if (SlotNo >= NumberedMetadata.size() || NumberedMetadata[SlotNo] == 0) return Error(MDList[i].Loc, "use of undefined metadata '!" + - utostr(SlotNo) + "'"); + Twine(SlotNo) + "'"); Inst->setMetadata(MDList[i].MDKind, NumberedMetadata[SlotNo]); } } @@ -109,7 +108,7 @@ if (!ForwardRefTypeIDs.empty()) return Error(ForwardRefTypeIDs.begin()->second.second, "use of undefined type '%" + - utostr(ForwardRefTypeIDs.begin()->first) + "'"); + Twine(ForwardRefTypeIDs.begin()->first) + "'"); if (!ForwardRefVals.empty()) return Error(ForwardRefVals.begin()->second.second, @@ -119,12 +118,12 @@ if (!ForwardRefValIDs.empty()) return Error(ForwardRefValIDs.begin()->second.second, "use of undefined value '@" + - utostr(ForwardRefValIDs.begin()->first) + "'"); + Twine(ForwardRefValIDs.begin()->first) + "'"); if (!ForwardRefMDNodes.empty()) return Error(ForwardRefMDNodes.begin()->second.second, "use of undefined metadata '!" + - utostr(ForwardRefMDNodes.begin()->first) + "'"); + Twine(ForwardRefMDNodes.begin()->first) + "'"); // Look for intrinsic functions and CallInst that need to be upgraded @@ -317,7 +316,7 @@ if (Lex.getKind() == lltok::LocalVarID) { if (Lex.getUIntVal() != TypeID) return Error(Lex.getLoc(), "type expected to be numbered '%" + - utostr(TypeID) + "'"); + Twine(TypeID) + "'"); Lex.Lex(); // eat LocalVarID; if (ParseToken(lltok::equal, "expected '=' after name")) @@ -444,7 +443,7 @@ if (Lex.getKind() == lltok::GlobalID) { if (Lex.getUIntVal() != VarID) return Error(Lex.getLoc(), "variable expected to be numbered '%" + - utostr(VarID) + "'"); + Twine(VarID) + "'"); Lex.Lex(); // eat GlobalID; if (ParseToken(lltok::equal, "expected '=' after name")) @@ -855,7 +854,7 @@ // If we have the value in the symbol table or fwd-ref table, return it. if (Val) { if (Val->getType() == Ty) return Val; - Error(Loc, "'@" + utostr(ID) + "' defined with type '" + + Error(Loc, "'@" + Twine(ID) + "' defined with type '" + Val->getType()->getDescription() + "'"); return 0; } @@ -1782,7 +1781,7 @@ if (!ForwardRefValIDs.empty()) return P.Error(ForwardRefValIDs.begin()->second.second, "use of undefined value '%" + - utostr(ForwardRefValIDs.begin()->first) + "'"); + Twine(ForwardRefValIDs.begin()->first) + "'"); return false; } @@ -1850,9 +1849,9 @@ if (Val) { if (Val->getType() == Ty) return Val; if (Ty->isLabelTy()) - P.Error(Loc, "'%" + utostr(ID) + "' is not a basic block"); + P.Error(Loc, "'%" + Twine(ID) + "' is not a basic block"); else - P.Error(Loc, "'%" + utostr(ID) + "' defined with type '" + + P.Error(Loc, "'%" + Twine(ID) + "' defined with type '" + Val->getType()->getDescription() + "'"); return 0; } @@ -1894,7 +1893,7 @@ if (unsigned(NameID) != NumberedVals.size()) return P.Error(NameLoc, "instruction expected to be numbered '%" + - utostr(NumberedVals.size()) + "'"); + Twine(NumberedVals.size()) + "'"); std::map >::iterator FI = ForwardRefValIDs.find(NameID); @@ -2072,7 +2071,7 @@ for (unsigned i = 1, e = Elts.size(); i != e; ++i) if (Elts[i]->getType() != Elts[0]->getType()) return Error(FirstEltLoc, - "vector element #" + utostr(i) + + "vector element #" + Twine(i) + " is not of type '" + Elts[0]->getType()->getDescription()); ID.ConstantVal = ConstantVector::get(Elts.data(), Elts.size()); @@ -2105,7 +2104,7 @@ for (unsigned i = 0, e = Elts.size(); i != e; ++i) { if (Elts[i]->getType() != Elts[0]->getType()) return Error(FirstEltLoc, - "array element #" + utostr(i) + + "array element #" + Twine(i) + " is not of type '" +Elts[0]->getType()->getDescription()); } @@ -2718,7 +2717,7 @@ if (NameID != NumberedVals.size()) return TokError("function expected to be numbered '%" + - utostr(NumberedVals.size()) + "'"); + Twine(NumberedVals.size()) + "'"); } else { return TokError("expected function name"); } @@ -2825,7 +2824,7 @@ Fn = cast(I->second.first); if (Fn->getType() != PFT) return Error(NameLoc, "type of definition and forward reference of '@" + - utostr(NumberedVals.size()) +"' disagree"); + Twine(NumberedVals.size()) + "' disagree"); ForwardRefValIDs.erase(I); } } Modified: llvm/trunk/lib/AsmParser/LLParser.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/AsmParser/LLParser.h?rev=114847&r1=114846&r2=114847&view=diff ============================================================================== --- llvm/trunk/lib/AsmParser/LLParser.h (original) +++ llvm/trunk/lib/AsmParser/LLParser.h Mon Sep 27 12:42:11 2010 @@ -142,10 +142,10 @@ private: - bool Error(LocTy L, const std::string &Msg) const { + bool Error(LocTy L, const Twine &Msg) const { return Lex.Error(L, Msg); } - bool TokError(const std::string &Msg) const { + bool TokError(const Twine &Msg) const { return Error(Lex.getLoc(), Msg); } Modified: llvm/trunk/lib/MC/MCParser/AsmParser.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCParser/AsmParser.cpp?rev=114847&r1=114846&r2=114847&view=diff ============================================================================== --- llvm/trunk/lib/MC/MCParser/AsmParser.cpp (original) +++ llvm/trunk/lib/MC/MCParser/AsmParser.cpp Mon Sep 27 12:42:11 2010 @@ -149,8 +149,10 @@ void HandleMacroExit(); void PrintMacroInstantiations(); - void PrintMessage(SMLoc Loc, const std::string &Msg, const char *Type) const; - + void PrintMessage(SMLoc Loc, const Twine &Msg, const char *Type) const { + SrcMgr.PrintMessage(Loc, Msg, Type); + } + /// EnterIncludeFile - Enter the specified file. This returns true on failure. bool EnterIncludeFile(const std::string &Filename); @@ -317,22 +319,17 @@ } void AsmParser::Warning(SMLoc L, const Twine &Msg) { - PrintMessage(L, Msg.str(), "warning"); + PrintMessage(L, Msg, "warning"); PrintMacroInstantiations(); } bool AsmParser::Error(SMLoc L, const Twine &Msg) { HadError = true; - PrintMessage(L, Msg.str(), "error"); + PrintMessage(L, Msg, "error"); PrintMacroInstantiations(); return true; } -void AsmParser::PrintMessage(SMLoc Loc, const std::string &Msg, - const char *Type) const { - SrcMgr.PrintMessage(Loc, Msg, Type); -} - bool AsmParser::EnterIncludeFile(const std::string &Filename) { int NewBuf = SrcMgr.AddIncludeFile(Filename, Lexer.getLoc()); if (NewBuf == -1) Modified: llvm/trunk/lib/Support/SourceMgr.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/SourceMgr.cpp?rev=114847&r1=114846&r2=114847&view=diff ============================================================================== --- llvm/trunk/lib/Support/SourceMgr.cpp (original) +++ llvm/trunk/lib/Support/SourceMgr.cpp Mon Sep 27 12:42:11 2010 @@ -13,6 +13,7 @@ // //===----------------------------------------------------------------------===// +#include "llvm/ADT/Twine.h" #include "llvm/Support/SourceMgr.h" #include "llvm/Support/MemoryBuffer.h" #include "llvm/Support/raw_ostream.h" @@ -135,7 +136,7 @@ /// /// @param Type - If non-null, the kind of message (e.g., "error") which is /// prefixed to the message. -SMDiagnostic SourceMgr::GetMessage(SMLoc Loc, const std::string &Msg, +SMDiagnostic SourceMgr::GetMessage(SMLoc Loc, const Twine &Msg, const char *Type, bool ShowLine) const { // First thing to do: find the current buffer containing the specified @@ -162,19 +163,18 @@ } std::string PrintedMsg; - if (Type) { - PrintedMsg = Type; - PrintedMsg += ": "; - } - PrintedMsg += Msg; + raw_string_ostream OS(PrintedMsg); + if (Type) + OS << Type << ": "; + OS << Msg; return SMDiagnostic(*this, Loc, CurMB->getBufferIdentifier(), FindLineNumber(Loc, CurBuf), - Loc.getPointer()-LineStart, PrintedMsg, + Loc.getPointer()-LineStart, OS.str(), LineStr, ShowLine); } -void SourceMgr::PrintMessage(SMLoc Loc, const std::string &Msg, +void SourceMgr::PrintMessage(SMLoc Loc, const Twine &Msg, const char *Type, bool ShowLine) const { // Report the message with the diagnostic handler if present. if (DiagHandler) { Modified: llvm/trunk/tools/llvm-mc/Disassembler.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-mc/Disassembler.cpp?rev=114847&r1=114846&r2=114847&view=diff ============================================================================== --- llvm/trunk/tools/llvm-mc/Disassembler.cpp (original) +++ llvm/trunk/tools/llvm-mc/Disassembler.cpp Mon Sep 27 12:42:11 2010 @@ -24,6 +24,7 @@ #include "llvm/Target/TargetRegistry.h" #include "llvm/ADT/OwningPtr.h" #include "llvm/ADT/Triple.h" +#include "llvm/ADT/Twine.h" #include "llvm/Support/MemoryBuffer.h" #include "llvm/Support/MemoryObject.h" #include "llvm/Support/raw_ostream.h" Modified: llvm/trunk/utils/TableGen/Record.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/Record.h?rev=114847&r1=114846&r2=114847&view=diff ============================================================================== --- llvm/trunk/utils/TableGen/Record.h (original) +++ llvm/trunk/utils/TableGen/Record.h Mon Sep 27 12:42:11 2010 @@ -1490,7 +1490,7 @@ extern RecordKeeper Records; -void PrintError(SMLoc ErrorLoc, const std::string &Msg); +void PrintError(SMLoc ErrorLoc, const Twine &Msg); } // End llvm namespace Modified: llvm/trunk/utils/TableGen/TGLexer.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/TGLexer.cpp?rev=114847&r1=114846&r2=114847&view=diff ============================================================================== --- llvm/trunk/utils/TableGen/TGLexer.cpp (original) +++ llvm/trunk/utils/TableGen/TGLexer.cpp Mon Sep 27 12:42:11 2010 @@ -12,6 +12,7 @@ //===----------------------------------------------------------------------===// #include "TGLexer.h" +#include "llvm/ADT/Twine.h" #include "llvm/Support/SourceMgr.h" #include "llvm/Support/MemoryBuffer.h" #include "llvm/Config/config.h" @@ -36,17 +37,17 @@ /// ReturnError - Set the error to the specified string at the specified /// location. This is defined to always return tgtok::Error. -tgtok::TokKind TGLexer::ReturnError(const char *Loc, const std::string &Msg) { +tgtok::TokKind TGLexer::ReturnError(const char *Loc, const Twine &Msg) { PrintError(Loc, Msg); return tgtok::Error; } -void TGLexer::PrintError(const char *Loc, const std::string &Msg) const { +void TGLexer::PrintError(const char *Loc, const Twine &Msg) const { SrcMgr.PrintMessage(SMLoc::getFromPointer(Loc), Msg, "error"); } -void TGLexer::PrintError(SMLoc Loc, const std::string &Msg) const { +void TGLexer::PrintError(SMLoc Loc, const Twine &Msg) const { SrcMgr.PrintMessage(Loc, Msg, "error"); } Modified: llvm/trunk/utils/TableGen/TGLexer.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/TGLexer.h?rev=114847&r1=114846&r2=114847&view=diff ============================================================================== --- llvm/trunk/utils/TableGen/TGLexer.h (original) +++ llvm/trunk/utils/TableGen/TGLexer.h Mon Sep 27 12:42:11 2010 @@ -23,7 +23,8 @@ class MemoryBuffer; class SourceMgr; class SMLoc; - +class Twine; + namespace tgtok { enum TokKind { // Markers @@ -95,14 +96,14 @@ SMLoc getLoc() const; - void PrintError(const char *Loc, const std::string &Msg) const; - void PrintError(SMLoc Loc, const std::string &Msg) const; + void PrintError(const char *Loc, const Twine &Msg) const; + void PrintError(SMLoc Loc, const Twine &Msg) const; private: /// LexToken - Read the next token and return its code. tgtok::TokKind LexToken(); - tgtok::TokKind ReturnError(const char *Loc, const std::string &Msg); + tgtok::TokKind ReturnError(const char *Loc, const Twine &Msg); int getNextChar(); void SkipBCPLComment(); Modified: llvm/trunk/utils/TableGen/TGParser.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/TGParser.h?rev=114847&r1=114846&r2=114847&view=diff ============================================================================== --- llvm/trunk/utils/TableGen/TGParser.h (original) +++ llvm/trunk/utils/TableGen/TGParser.h Mon Sep 27 12:42:11 2010 @@ -15,6 +15,7 @@ #define TGPARSER_H #include "TGLexer.h" +#include "llvm/ADT/Twine.h" #include "llvm/Support/SourceMgr.h" #include @@ -53,11 +54,11 @@ /// routines return true on error, or false on success. bool ParseFile(); - bool Error(SMLoc L, const std::string &Msg) const { + bool Error(SMLoc L, const Twine &Msg) const { Lex.PrintError(L, Msg); return true; } - bool TokError(const std::string &Msg) const { + bool TokError(const Twine &Msg) const { return Error(Lex.getLoc(), Msg); } private: // Semantic analysis methods. Modified: llvm/trunk/utils/TableGen/TableGen.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/TableGen.cpp?rev=114847&r1=114846&r2=114847&view=diff ============================================================================== --- llvm/trunk/utils/TableGen/TableGen.cpp (original) +++ llvm/trunk/utils/TableGen/TableGen.cpp Mon Sep 27 12:42:11 2010 @@ -174,7 +174,7 @@ static SourceMgr SrcMgr; -void llvm::PrintError(SMLoc ErrorLoc, const std::string &Msg) { +void llvm::PrintError(SMLoc ErrorLoc, const Twine &Msg) { SrcMgr.PrintMessage(ErrorLoc, Msg, "error"); } From espindola at google.com Mon Sep 27 12:49:30 2010 From: espindola at google.com (Rafael Espindola) Date: Mon, 27 Sep 2010 13:49:30 -0400 Subject: [llvm-commits] Initial cut of ARM MC ELF emitter (PATCH) In-Reply-To: References: <461E2CD0-5905-48E9-8730-AFF37C693B2A@apple.com> <1B431CFE-CD10-4DC9-8387-560EFADCAC67@apple.com> Message-ID: On 27 September 2010 13:31, Jim Grosbach wrote: > It's much improved, but theres still one thing from my original comments that needs fixing. > > The most recent patch still contains the bits moving the TargetData information into the base ARMBaseTargetMachine class from the ARMTargetMachine and ThumbTargetMachine classes. That's not appropriate. That sort of information is what the subclasses are there for. Please undo those changes. I noticed that too, but X86 does the same thing. Would you like me to move TargetData to the subclasses of X86TargetMachine? I agree that the current situation is a bit silly since getTargetData is virtual and DataLayout is set only in X86TargetMachine. > -Jim Cheers, -- Rafael ?vila de Esp?ndola From grosbach at apple.com Mon Sep 27 12:57:14 2010 From: grosbach at apple.com (Jim Grosbach) Date: Mon, 27 Sep 2010 10:57:14 -0700 Subject: [llvm-commits] Initial cut of ARM MC ELF emitter (PATCH) In-Reply-To: References: <461E2CD0-5905-48E9-8730-AFF37C693B2A@apple.com> <1B431CFE-CD10-4DC9-8387-560EFADCAC67@apple.com> Message-ID: <51B0D938-6825-413F-8A6A-C8A45962B68B@apple.com> On Sep 27, 2010, at 10:49 AM, Rafael Espindola wrote: > On 27 September 2010 13:31, Jim Grosbach wrote: >> It's much improved, but theres still one thing from my original comments that needs fixing. >> >> The most recent patch still contains the bits moving the TargetData information into the base ARMBaseTargetMachine class from the ARMTargetMachine and ThumbTargetMachine classes. That's not appropriate. That sort of information is what the subclasses are there for. Please undo those changes. > > I noticed that too, but X86 does the same thing. Would you like me to > move TargetData to the subclasses of X86TargetMachine? I agree that > the current situation is a bit silly since getTargetData is virtual > and DataLayout is set only in X86TargetMachine. > That makes sense to me. I do agree with the sentiment that the implementations of this should be consistent from target to target. Thanks again to both of you for working on this stuff. Very excited to see the ARM bits moving forward in these areas. Regards, Jim From isanbard at gmail.com Mon Sep 27 13:05:19 2010 From: isanbard at gmail.com (Bill Wendling) Date: Mon, 27 Sep 2010 18:05:19 -0000 Subject: [llvm-commits] [llvm] r114850 - /llvm/trunk/tools/lto/LTOModule.cpp Message-ID: <20100927180519.697B82A6C12C@llvm.org> Author: void Date: Mon Sep 27 13:05:19 2010 New Revision: 114850 URL: http://llvm.org/viewvc/llvm-project?rev=114850&view=rev Log: The "linker_private_weak*" linkages should set the LTO_SYMBOL_DEFINITION_WEAK during LTO. Modified: llvm/trunk/tools/lto/LTOModule.cpp Modified: llvm/trunk/tools/lto/LTOModule.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/lto/LTOModule.cpp?rev=114850&r1=114849&r2=114850&view=diff ============================================================================== --- llvm/trunk/tools/lto/LTOModule.cpp (original) +++ llvm/trunk/tools/lto/LTOModule.cpp Mon Sep 27 13:05:19 2010 @@ -325,7 +325,9 @@ } // set definition part - if (def->hasWeakLinkage() || def->hasLinkOnceLinkage()) { + if (def->hasWeakLinkage() || def->hasLinkOnceLinkage() || + def->hasLinkerPrivateWeakLinkage() || + def->hasLinkerPrivateWeakDefAutoLinkage()) { attr |= LTO_SYMBOL_DEFINITION_WEAK; } else if (def->hasCommonLinkage()) { From rafael.espindola at gmail.com Mon Sep 27 13:13:03 2010 From: rafael.espindola at gmail.com (Rafael Espindola) Date: Mon, 27 Sep 2010 18:13:03 -0000 Subject: [llvm-commits] [llvm] r114852 - in /llvm/trunk: include/llvm/MC/MCAssembler.h lib/MC/MCAssembler.cpp lib/MC/MachObjectWriter.cpp Message-ID: <20100927181303.4A6B42A6C12C@llvm.org> Author: rafael Date: Mon Sep 27 13:13:03 2010 New Revision: 114852 URL: http://llvm.org/viewvc/llvm-project?rev=114852&view=rev Log: Remove unused argument. Modified: llvm/trunk/include/llvm/MC/MCAssembler.h llvm/trunk/lib/MC/MCAssembler.cpp llvm/trunk/lib/MC/MachObjectWriter.cpp Modified: llvm/trunk/include/llvm/MC/MCAssembler.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCAssembler.h?rev=114852&r1=114851&r2=114852&view=diff ============================================================================== --- llvm/trunk/include/llvm/MC/MCAssembler.h (original) +++ llvm/trunk/include/llvm/MC/MCAssembler.h Mon Sep 27 13:13:03 2010 @@ -650,8 +650,7 @@ public: /// Find the symbol which defines the atom containing the given symbol, or /// null if there is no such symbol. - const MCSymbolData *getAtom(const MCAsmLayout &Layout, - const MCSymbolData *Symbol) const; + const MCSymbolData *getAtom(const MCSymbolData *Symbol) const; /// Check whether a particular symbol is visible to the linker and is required /// in the symbol table, or whether it can be discarded by the assembler. This Modified: llvm/trunk/lib/MC/MCAssembler.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCAssembler.cpp?rev=114852&r1=114851&r2=114852&view=diff ============================================================================== --- llvm/trunk/lib/MC/MCAssembler.cpp (original) +++ llvm/trunk/lib/MC/MCAssembler.cpp Mon Sep 27 13:13:03 2010 @@ -291,7 +291,7 @@ if (A->getKind() != MCSymbolRefExpr::VK_None) return false; - A_Base = Asm.getAtom(Layout, &Asm.getSymbolData(A->getSymbol())); + A_Base = Asm.getAtom(&Asm.getSymbolData(A->getSymbol())); if (!A_Base) return false; } @@ -301,7 +301,7 @@ if (B->getKind() != MCSymbolRefExpr::VK_None) return false; - B_Base = Asm.getAtom(Layout, &Asm.getSymbolData(B->getSymbol())); + B_Base = Asm.getAtom(&Asm.getSymbolData(B->getSymbol())); if (!B_Base) return false; } @@ -328,8 +328,7 @@ return getBackend().doesSectionRequireSymbols(Symbol.getSection()); } -const MCSymbolData *MCAssembler::getAtom(const MCAsmLayout &Layout, - const MCSymbolData *SD) const { +const MCSymbolData *MCAssembler::getAtom(const MCSymbolData *SD) const { // Linker visible symbols define atoms. if (isSymbolLinkerVisible(SD->getSymbol())) return SD; Modified: llvm/trunk/lib/MC/MachObjectWriter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MachObjectWriter.cpp?rev=114852&r1=114851&r2=114852&view=diff ============================================================================== --- llvm/trunk/lib/MC/MachObjectWriter.cpp (original) +++ llvm/trunk/lib/MC/MachObjectWriter.cpp Mon Sep 27 13:13:03 2010 @@ -518,11 +518,11 @@ } else if (Target.getSymB()) { // A - B + constant const MCSymbol *A = &Target.getSymA()->getSymbol(); MCSymbolData &A_SD = Asm.getSymbolData(*A); - const MCSymbolData *A_Base = Asm.getAtom(Layout, &A_SD); + const MCSymbolData *A_Base = Asm.getAtom(&A_SD); const MCSymbol *B = &Target.getSymB()->getSymbol(); MCSymbolData &B_SD = Asm.getSymbolData(*B); - const MCSymbolData *B_Base = Asm.getAtom(Layout, &B_SD); + const MCSymbolData *B_Base = Asm.getAtom(&B_SD); // Neither symbol can be modified. if (Target.getSymA()->getKind() != MCSymbolRefExpr::VK_None || @@ -567,7 +567,7 @@ } else { const MCSymbol *Symbol = &Target.getSymA()->getSymbol(); MCSymbolData &SD = Asm.getSymbolData(*Symbol); - const MCSymbolData *Base = Asm.getAtom(Layout, &SD); + const MCSymbolData *Base = Asm.getAtom(&SD); // Relocations inside debug sections always use local relocations when // possible. This seems to be done because the debugger doesn't fully From kledzik at apple.com Mon Sep 27 13:27:08 2010 From: kledzik at apple.com (Nick Kledzik) Date: Mon, 27 Sep 2010 18:27:08 -0000 Subject: [llvm-commits] [compiler-rt] r114853 - /compiler-rt/tags/Apple/Libcompiler_rt-8.1/ Message-ID: <20100927182708.678332A6C12C@llvm.org> Author: kledzik Date: Mon Sep 27 13:27:08 2010 New Revision: 114853 URL: http://llvm.org/viewvc/llvm-project?rev=114853&view=rev Log: Libcompiler_rt-8.1 Added: compiler-rt/tags/Apple/Libcompiler_rt-8.1/ - copied from r114852, compiler-rt/tags/Apple/Libcompiler_rt-8/ From kledzik at apple.com Mon Sep 27 13:28:15 2010 From: kledzik at apple.com (Nick Kledzik) Date: Mon, 27 Sep 2010 18:28:15 -0000 Subject: [llvm-commits] [compiler-rt] r114854 - /compiler-rt/trunk/make/platform/darwin_bni.mk Message-ID: <20100927182815.872432A6C12C@llvm.org> Author: kledzik Date: Mon Sep 27 13:28:15 2010 New Revision: 114854 URL: http://llvm.org/viewvc/llvm-project?rev=114854&view=rev Log: Add Soft Floating Compares for armv6 and armv7 Modified: compiler-rt/trunk/make/platform/darwin_bni.mk Modified: compiler-rt/trunk/make/platform/darwin_bni.mk URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/make/platform/darwin_bni.mk?rev=114854&r1=114853&r2=114854&view=diff ============================================================================== --- compiler-rt/trunk/make/platform/darwin_bni.mk (original) +++ compiler-rt/trunk/make/platform/darwin_bni.mk Mon Sep 27 13:28:15 2010 @@ -66,6 +66,7 @@ sync_synchronize FUNCTIONS.armv6 := $(FUNCTIONS) \ + comparedf2 comparesf2 \ adddf3vfp addsf3vfp bswapdi2 bswapsi2 divdf3vfp \ divsf3vfp eqdf2vfp eqsf2vfp extendsfdf2vfp \ fixdfsivfp fixsfsivfp fixunsdfsivfp fixunssfsivfp \ @@ -80,6 +81,7 @@ restore_vfp_d8_d15_regs save_vfp_d8_d15_regs \ sync_synchronize FUNCTIONS.armv7 := $(FUNCTIONS) \ + comparedf2 comparesf2 \ adddf3vfp addsf3vfp bswapdi2 bswapsi2 divdf3vfp \ divsf3vfp eqdf2vfp eqsf2vfp extendsfdf2vfp \ fixdfsivfp fixsfsivfp fixunsdfsivfp fixunssfsivfp \ From kledzik at apple.com Mon Sep 27 13:29:09 2010 From: kledzik at apple.com (Nick Kledzik) Date: Mon, 27 Sep 2010 18:29:09 -0000 Subject: [llvm-commits] [compiler-rt] r114855 - /compiler-rt/tags/Apple/Libcompiler_rt-8.1/make/platform/darwin_bni.mk Message-ID: <20100927182909.8D9902A6C12C@llvm.org> Author: kledzik Date: Mon Sep 27 13:29:09 2010 New Revision: 114855 URL: http://llvm.org/viewvc/llvm-project?rev=114855&view=rev Log: Add Soft Floating Compares for armv6 and armv7 Modified: compiler-rt/tags/Apple/Libcompiler_rt-8.1/make/platform/darwin_bni.mk Modified: compiler-rt/tags/Apple/Libcompiler_rt-8.1/make/platform/darwin_bni.mk URL: http://llvm.org/viewvc/llvm-project/compiler-rt/tags/Apple/Libcompiler_rt-8.1/make/platform/darwin_bni.mk?rev=114855&r1=114854&r2=114855&view=diff ============================================================================== --- compiler-rt/tags/Apple/Libcompiler_rt-8.1/make/platform/darwin_bni.mk (original) +++ compiler-rt/tags/Apple/Libcompiler_rt-8.1/make/platform/darwin_bni.mk Mon Sep 27 13:29:09 2010 @@ -66,6 +66,7 @@ sync_synchronize FUNCTIONS.armv6 := $(FUNCTIONS) \ + comparedf2 comparesf2 \ adddf3vfp addsf3vfp bswapdi2 bswapsi2 divdf3vfp \ divsf3vfp eqdf2vfp eqsf2vfp extendsfdf2vfp \ fixdfsivfp fixsfsivfp fixunsdfsivfp fixunssfsivfp \ @@ -80,6 +81,7 @@ restore_vfp_d8_d15_regs save_vfp_d8_d15_regs \ sync_synchronize FUNCTIONS.armv7 := $(FUNCTIONS) \ + comparedf2 comparesf2 \ adddf3vfp addsf3vfp bswapdi2 bswapsi2 divdf3vfp \ divsf3vfp eqdf2vfp eqsf2vfp extendsfdf2vfp \ fixdfsivfp fixsfsivfp fixunsdfsivfp fixunssfsivfp \ From rafael.espindola at gmail.com Mon Sep 27 13:31:37 2010 From: rafael.espindola at gmail.com (Rafael Espindola) Date: Mon, 27 Sep 2010 18:31:37 -0000 Subject: [llvm-commits] [llvm] r114856 - in /llvm/trunk/lib/Target/ARM: ARMELFWriterInfo.cpp ARMELFWriterInfo.h ARMSubtarget.h ARMTargetMachine.cpp ARMTargetMachine.h CMakeLists.txt Message-ID: <20100927183137.D0A962A6C12C@llvm.org> Author: rafael Date: Mon Sep 27 13:31:37 2010 New Revision: 114856 URL: http://llvm.org/viewvc/llvm-project?rev=114856&view=rev Log: Odd additional stub framework for the ARM MC ELF emission. llc now recognizes the "intent" to support MC/obj emission for ARM, but given that they are all stubs, it asserts on --filetype=obj --march=arm Patch by Jason Kim. Added: llvm/trunk/lib/Target/ARM/ARMELFWriterInfo.cpp llvm/trunk/lib/Target/ARM/ARMELFWriterInfo.h Modified: llvm/trunk/lib/Target/ARM/ARMSubtarget.h llvm/trunk/lib/Target/ARM/ARMTargetMachine.cpp llvm/trunk/lib/Target/ARM/ARMTargetMachine.h llvm/trunk/lib/Target/ARM/CMakeLists.txt Added: llvm/trunk/lib/Target/ARM/ARMELFWriterInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMELFWriterInfo.cpp?rev=114856&view=auto ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMELFWriterInfo.cpp (added) +++ llvm/trunk/lib/Target/ARM/ARMELFWriterInfo.cpp Mon Sep 27 13:31:37 2010 @@ -0,0 +1,65 @@ +//===-- ARMELFWriterInfo.cpp - ELF Writer Info for the ARM backend --------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// This file implements ELF writer information for the ARM backend. +// +//===----------------------------------------------------------------------===// + +#include "ARMELFWriterInfo.h" +#include "ARMRelocations.h" +#include "llvm/Function.h" +#include "llvm/Support/ErrorHandling.h" +#include "llvm/Target/TargetData.h" +#include "llvm/Target/TargetMachine.h" + +using namespace llvm; + +//===----------------------------------------------------------------------===// +// Implementation of the ARMELFWriterInfo class +//===----------------------------------------------------------------------===// + +ARMELFWriterInfo::ARMELFWriterInfo(TargetMachine &TM) + : TargetELFWriterInfo(TM) { + // silently OK construction +} + +ARMELFWriterInfo::~ARMELFWriterInfo() {} + +unsigned ARMELFWriterInfo::getRelocationType(unsigned MachineRelTy) const { + assert(0 && "ARMELFWriterInfo::getRelocationType() not implemented"); + return 0; +} + +long int ARMELFWriterInfo::getDefaultAddendForRelTy(unsigned RelTy, + long int Modifier) const { + assert(0 && "ARMELFWriterInfo::getDefaultAddendForRelTy() not implemented"); + return 0; +} + +unsigned ARMELFWriterInfo::getRelocationTySize(unsigned RelTy) const { + assert(0 && "ARMELFWriterInfo::getRelocationTySize() not implemented"); + return 0; +} + +bool ARMELFWriterInfo::isPCRelativeRel(unsigned RelTy) const { + assert(0 && "ARMELFWriterInfo::isPCRelativeRel() not implemented"); + return 1; +} + +unsigned ARMELFWriterInfo::getAbsoluteLabelMachineRelTy() const { + assert(0 && "ARMELFWriterInfo::getAbsoluteLabelMachineRelTy() not implemented"); + return 0; +} + +long int ARMELFWriterInfo::computeRelocation(unsigned SymOffset, + unsigned RelOffset, + unsigned RelTy) const { + assert(0 && "ARMELFWriterInfo::getAbsoluteLabelMachineRelTy() not implemented"); + return 0; +} Added: llvm/trunk/lib/Target/ARM/ARMELFWriterInfo.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMELFWriterInfo.h?rev=114856&view=auto ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMELFWriterInfo.h (added) +++ llvm/trunk/lib/Target/ARM/ARMELFWriterInfo.h Mon Sep 27 13:31:37 2010 @@ -0,0 +1,66 @@ +//===-- ARMELFWriterInfo.h - ELF Writer Info for ARM ------------*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// This file implements ELF writer information for the ARM backend. +// +//===----------------------------------------------------------------------===// + +#ifndef ARM_ELF_WRITER_INFO_H +#define ARM_ELF_WRITER_INFO_H + +#include "llvm/Target/TargetELFWriterInfo.h" + +namespace llvm { + + class ARMELFWriterInfo : public TargetELFWriterInfo { + + // ELF Relocation types for ARM + // FIXME: TODO(jasonwkim): [2010/09/17 14:52:25 PDT (Friday)] + // Come up with a better way to orgnize the 100+ ARM reloc types. + + enum ARMRelocationType { + }; + + public: + ARMELFWriterInfo(TargetMachine &TM); + virtual ~ARMELFWriterInfo(); + + /// getRelocationType - Returns the target specific ELF Relocation type. + /// 'MachineRelTy' contains the object code independent relocation type + virtual unsigned getRelocationType(unsigned MachineRelTy) const; + + /// hasRelocationAddend - True if the target uses an addend in the + /// ELF relocation entry. + virtual bool hasRelocationAddend() const { return false; } + + /// getDefaultAddendForRelTy - Gets the default addend value for a + /// relocation entry based on the target ELF relocation type. + virtual long int getDefaultAddendForRelTy(unsigned RelTy, + long int Modifier = 0) const; + + /// getRelTySize - Returns the size of relocatable field in bits + virtual unsigned getRelocationTySize(unsigned RelTy) const; + + /// isPCRelativeRel - True if the relocation type is pc relative + virtual bool isPCRelativeRel(unsigned RelTy) const; + + /// getJumpTableRelocationTy - Returns the machine relocation type used + /// to reference a jumptable. + virtual unsigned getAbsoluteLabelMachineRelTy() const; + + /// computeRelocation - Some relocatable fields could be relocated + /// directly, avoiding the relocation symbol emission, compute the + /// final relocation value for this symbol. + virtual long int computeRelocation(unsigned SymOffset, unsigned RelOffset, + unsigned RelTy) const; + }; + +} // end llvm namespace + +#endif // ARM_ELF_WRITER_INFO_H Modified: llvm/trunk/lib/Target/ARM/ARMSubtarget.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMSubtarget.h?rev=114856&r1=114855&r2=114856&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMSubtarget.h (original) +++ llvm/trunk/lib/Target/ARM/ARMSubtarget.h Mon Sep 27 13:31:37 2010 @@ -204,6 +204,29 @@ /// GVIsIndirectSymbol - true if the GV will be accessed via an indirect /// symbol. bool GVIsIndirectSymbol(const GlobalValue *GV, Reloc::Model RelocM) const; + + /// getDataLayout() - returns the ARM/Thumb specific TargetLayout string + std::string getDataLayout() const { + if (isThumb()) { + if (isAPCS_ABI()) { + return std::string("e-p:32:32-f64:32:32-i64:32:32-" + "i16:16:32-i8:8:32-i1:8:32-" + "v128:32:128-v64:32:64-a:0:32-n32"); + } else { + return std::string("e-p:32:32-f64:64:64-i64:64:64-" + "i16:16:32-i8:8:32-i1:8:32-" + "v128:64:128-v64:64:64-a:0:32-n32"); + } + } else { + if (isAPCS_ABI()) { + return std::string("e-p:32:32-f64:32:32-i64:32:32-" + "v128:32:128-v64:32:64-n32"); + } else { + return std::string("e-p:32:32-f64:64:64-i64:64:64-" + "v128:64:128-v64:64:64-n32"); + } + } + }; }; } // End llvm namespace Modified: llvm/trunk/lib/Target/ARM/ARMTargetMachine.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMTargetMachine.cpp?rev=114856&r1=114855&r2=114856&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMTargetMachine.cpp (original) +++ llvm/trunk/lib/Target/ARM/ARMTargetMachine.cpp Mon Sep 27 13:31:37 2010 @@ -31,6 +31,26 @@ } } +// This is duplicated code. Refactor this. +static MCStreamer *createMCStreamer(const Target &T, const std::string &TT, + MCContext &Ctx, TargetAsmBackend &TAB, + raw_ostream &_OS, + MCCodeEmitter *_Emitter, + bool RelaxAll) { + Triple TheTriple(TT); + switch (TheTriple.getOS()) { + case Triple::Darwin: + return createMachOStreamer(Ctx, TAB, _OS, _Emitter, RelaxAll); + case Triple::MinGW32: + case Triple::MinGW64: + case Triple::Cygwin: + case Triple::Win32: + assert(0 && "ARM does not support Windows COFF format"); break; + default: + return createELFStreamer(Ctx, TAB, _OS, _Emitter, RelaxAll); + } +} + extern "C" void LLVMInitializeARMTarget() { // Register the target. RegisterTargetMachine X(TheARMTarget); @@ -39,6 +59,19 @@ // Register the target asm info. RegisterAsmInfoFn A(TheARMTarget, createMCAsmInfo); RegisterAsmInfoFn B(TheThumbTarget, createMCAsmInfo); + + // Register the MC Code Emitter + TargetRegistry::RegisterCodeEmitter(TheARMTarget, + createARMMCCodeEmitter); + TargetRegistry::RegisterCodeEmitter(TheThumbTarget, + createARMMCCodeEmitter); + + // Register the object streamer. + TargetRegistry::RegisterObjectStreamer(TheARMTarget, + createMCStreamer); + TargetRegistry::RegisterObjectStreamer(TheThumbTarget, + createMCStreamer); + } /// TargetMachine ctor - Create an ARM architecture model. @@ -51,18 +84,17 @@ Subtarget(TT, FS, isThumb), FrameInfo(Subtarget), JITInfo(), - InstrItins(Subtarget.getInstrItineraryData()) { + InstrItins(Subtarget.getInstrItineraryData()), + DataLayout(Subtarget.getDataLayout()), + ELFWriterInfo(*this) +{ DefRelocModel = getRelocationModel(); } ARMTargetMachine::ARMTargetMachine(const Target &T, const std::string &TT, const std::string &FS) - : ARMBaseTargetMachine(T, TT, FS, false), InstrInfo(Subtarget), - DataLayout(Subtarget.isAPCS_ABI() ? - std::string("e-p:32:32-f64:32:32-i64:32:32-" - "v128:32:128-v64:32:64-n32") : - std::string("e-p:32:32-f64:64:64-i64:64:64-" - "v128:64:128-v64:64:64-n32")), + : ARMBaseTargetMachine(T, TT, FS, false), + InstrInfo(Subtarget), TLInfo(*this), TSInfo(*this) { if (!Subtarget.hasARMOps()) @@ -76,13 +108,6 @@ InstrInfo(Subtarget.hasThumb2() ? ((ARMBaseInstrInfo*)new Thumb2InstrInfo(Subtarget)) : ((ARMBaseInstrInfo*)new Thumb1InstrInfo(Subtarget))), - DataLayout(Subtarget.isAPCS_ABI() ? - std::string("e-p:32:32-f64:32:32-i64:32:32-" - "i16:16:32-i8:8:32-i1:8:32-" - "v128:32:128-v64:32:64-a:0:32-n32") : - std::string("e-p:32:32-f64:64:64-i64:64:64-" - "i16:16:32-i8:8:32-i1:8:32-" - "v128:64:128-v64:64:64-a:0:32-n32")), TLInfo(*this), TSInfo(*this) { } Modified: llvm/trunk/lib/Target/ARM/ARMTargetMachine.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMTargetMachine.h?rev=114856&r1=114855&r2=114856&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMTargetMachine.h (original) +++ llvm/trunk/lib/Target/ARM/ARMTargetMachine.h Mon Sep 27 13:31:37 2010 @@ -16,7 +16,9 @@ #include "llvm/Target/TargetMachine.h" #include "llvm/Target/TargetData.h" +#include "llvm/MC/MCStreamer.h" #include "ARMInstrInfo.h" +#include "ARMELFWriterInfo.h" #include "ARMFrameInfo.h" #include "ARMJITInfo.h" #include "ARMSubtarget.h" @@ -38,10 +40,19 @@ InstrItineraryData InstrItins; Reloc::Model DefRelocModel; // Reloc model before it's overridden. +protected: + const TargetData DataLayout; // Calculates type size & alignment + ARMELFWriterInfo ELFWriterInfo; + public: ARMBaseTargetMachine(const Target &T, const std::string &TT, const std::string &FS, bool isThumb); + virtual const TargetData *getTargetData() const { return &DataLayout; } + virtual const ARMELFWriterInfo *getELFWriterInfo() const { + return Subtarget.isTargetELF() ? &ELFWriterInfo : 0; + }; + virtual const ARMFrameInfo *getFrameInfo() const { return &FrameInfo; } virtual ARMJITInfo *getJITInfo() { return &JITInfo; } virtual const ARMSubtarget *getSubtargetImpl() const { return &Subtarget; } @@ -63,7 +74,6 @@ /// class ARMTargetMachine : public ARMBaseTargetMachine { ARMInstrInfo InstrInfo; - const TargetData DataLayout; // Calculates type size & alignment ARMTargetLowering TLInfo; ARMSelectionDAGInfo TSInfo; public: @@ -93,7 +103,6 @@ class ThumbTargetMachine : public ARMBaseTargetMachine { // Either Thumb1InstrInfo or Thumb2InstrInfo. OwningPtr InstrInfo; - const TargetData DataLayout; // Calculates type size & alignment ARMTargetLowering TLInfo; ARMSelectionDAGInfo TSInfo; public: Modified: llvm/trunk/lib/Target/ARM/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/CMakeLists.txt?rev=114856&r1=114855&r2=114856&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/CMakeLists.txt (original) +++ llvm/trunk/lib/Target/ARM/CMakeLists.txt Mon Sep 27 13:31:37 2010 @@ -21,6 +21,7 @@ ARMCodeEmitter.cpp ARMConstantIslandPass.cpp ARMConstantPoolValue.cpp + ARMELFWriterInfo.cpp ARMExpandPseudoInsts.cpp ARMFastISel.cpp ARMGlobalMerge.cpp From grosbach at apple.com Mon Sep 27 13:41:30 2010 From: grosbach at apple.com (Jim Grosbach) Date: Mon, 27 Sep 2010 11:41:30 -0700 Subject: [llvm-commits] [llvm] r114856 - in /llvm/trunk/lib/Target/ARM: ARMELFWriterInfo.cpp ARMELFWriterInfo.h ARMSubtarget.h ARMTargetMachine.cpp ARMTargetMachine.h CMakeLists.txt In-Reply-To: <20100927183137.D0A962A6C12C@llvm.org> References: <20100927183137.D0A962A6C12C@llvm.org> Message-ID: <7023261C-FFD0-4B80-AC38-128BEB0CD674@apple.com> Um, this still changes the DataLayout bits. On Sep 27, 2010, at 11:31 AM, Rafael Espindola wrote: > Author: rafael > Date: Mon Sep 27 13:31:37 2010 > New Revision: 114856 > > URL: http://llvm.org/viewvc/llvm-project?rev=114856&view=rev > Log: > Odd additional stub framework for the ARM MC ELF emission. > llc now recognizes the "intent" to support MC/obj emission for ARM, but > given that they are all stubs, it asserts on --filetype=obj --march=arm > > Patch by Jason Kim. > > Added: > llvm/trunk/lib/Target/ARM/ARMELFWriterInfo.cpp > llvm/trunk/lib/Target/ARM/ARMELFWriterInfo.h > Modified: > llvm/trunk/lib/Target/ARM/ARMSubtarget.h > llvm/trunk/lib/Target/ARM/ARMTargetMachine.cpp > llvm/trunk/lib/Target/ARM/ARMTargetMachine.h > llvm/trunk/lib/Target/ARM/CMakeLists.txt > > Added: llvm/trunk/lib/Target/ARM/ARMELFWriterInfo.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMELFWriterInfo.cpp?rev=114856&view=auto > ============================================================================== > --- llvm/trunk/lib/Target/ARM/ARMELFWriterInfo.cpp (added) > +++ llvm/trunk/lib/Target/ARM/ARMELFWriterInfo.cpp Mon Sep 27 13:31:37 2010 > @@ -0,0 +1,65 @@ > +//===-- ARMELFWriterInfo.cpp - ELF Writer Info for the ARM backend --------===// > +// > +// The LLVM Compiler Infrastructure > +// > +// This file is distributed under the University of Illinois Open Source > +// License. See LICENSE.TXT for details. > +// > +//===----------------------------------------------------------------------===// > +// > +// This file implements ELF writer information for the ARM backend. > +// > +//===----------------------------------------------------------------------===// > + > +#include "ARMELFWriterInfo.h" > +#include "ARMRelocations.h" > +#include "llvm/Function.h" > +#include "llvm/Support/ErrorHandling.h" > +#include "llvm/Target/TargetData.h" > +#include "llvm/Target/TargetMachine.h" > + > +using namespace llvm; > + > +//===----------------------------------------------------------------------===// > +// Implementation of the ARMELFWriterInfo class > +//===----------------------------------------------------------------------===// > + > +ARMELFWriterInfo::ARMELFWriterInfo(TargetMachine &TM) > + : TargetELFWriterInfo(TM) { > + // silently OK construction > +} > + > +ARMELFWriterInfo::~ARMELFWriterInfo() {} > + > +unsigned ARMELFWriterInfo::getRelocationType(unsigned MachineRelTy) const { > + assert(0 && "ARMELFWriterInfo::getRelocationType() not implemented"); > + return 0; > +} > + > +long int ARMELFWriterInfo::getDefaultAddendForRelTy(unsigned RelTy, > + long int Modifier) const { > + assert(0 && "ARMELFWriterInfo::getDefaultAddendForRelTy() not implemented"); > + return 0; > +} > + > +unsigned ARMELFWriterInfo::getRelocationTySize(unsigned RelTy) const { > + assert(0 && "ARMELFWriterInfo::getRelocationTySize() not implemented"); > + return 0; > +} > + > +bool ARMELFWriterInfo::isPCRelativeRel(unsigned RelTy) const { > + assert(0 && "ARMELFWriterInfo::isPCRelativeRel() not implemented"); > + return 1; > +} > + > +unsigned ARMELFWriterInfo::getAbsoluteLabelMachineRelTy() const { > + assert(0 && "ARMELFWriterInfo::getAbsoluteLabelMachineRelTy() not implemented"); > + return 0; > +} > + > +long int ARMELFWriterInfo::computeRelocation(unsigned SymOffset, > + unsigned RelOffset, > + unsigned RelTy) const { > + assert(0 && "ARMELFWriterInfo::getAbsoluteLabelMachineRelTy() not implemented"); > + return 0; > +} > > Added: llvm/trunk/lib/Target/ARM/ARMELFWriterInfo.h > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMELFWriterInfo.h?rev=114856&view=auto > ============================================================================== > --- llvm/trunk/lib/Target/ARM/ARMELFWriterInfo.h (added) > +++ llvm/trunk/lib/Target/ARM/ARMELFWriterInfo.h Mon Sep 27 13:31:37 2010 > @@ -0,0 +1,66 @@ > +//===-- ARMELFWriterInfo.h - ELF Writer Info for ARM ------------*- C++ -*-===// > +// > +// The LLVM Compiler Infrastructure > +// > +// This file is distributed under the University of Illinois Open Source > +// License. See LICENSE.TXT for details. > +// > +//===----------------------------------------------------------------------===// > +// > +// This file implements ELF writer information for the ARM backend. > +// > +//===----------------------------------------------------------------------===// > + > +#ifndef ARM_ELF_WRITER_INFO_H > +#define ARM_ELF_WRITER_INFO_H > + > +#include "llvm/Target/TargetELFWriterInfo.h" > + > +namespace llvm { > + > + class ARMELFWriterInfo : public TargetELFWriterInfo { > + > + // ELF Relocation types for ARM > + // FIXME: TODO(jasonwkim): [2010/09/17 14:52:25 PDT (Friday)] > + // Come up with a better way to orgnize the 100+ ARM reloc types. > + > + enum ARMRelocationType { > + }; > + > + public: > + ARMELFWriterInfo(TargetMachine &TM); > + virtual ~ARMELFWriterInfo(); > + > + /// getRelocationType - Returns the target specific ELF Relocation type. > + /// 'MachineRelTy' contains the object code independent relocation type > + virtual unsigned getRelocationType(unsigned MachineRelTy) const; > + > + /// hasRelocationAddend - True if the target uses an addend in the > + /// ELF relocation entry. > + virtual bool hasRelocationAddend() const { return false; } > + > + /// getDefaultAddendForRelTy - Gets the default addend value for a > + /// relocation entry based on the target ELF relocation type. > + virtual long int getDefaultAddendForRelTy(unsigned RelTy, > + long int Modifier = 0) const; > + > + /// getRelTySize - Returns the size of relocatable field in bits > + virtual unsigned getRelocationTySize(unsigned RelTy) const; > + > + /// isPCRelativeRel - True if the relocation type is pc relative > + virtual bool isPCRelativeRel(unsigned RelTy) const; > + > + /// getJumpTableRelocationTy - Returns the machine relocation type used > + /// to reference a jumptable. > + virtual unsigned getAbsoluteLabelMachineRelTy() const; > + > + /// computeRelocation - Some relocatable fields could be relocated > + /// directly, avoiding the relocation symbol emission, compute the > + /// final relocation value for this symbol. > + virtual long int computeRelocation(unsigned SymOffset, unsigned RelOffset, > + unsigned RelTy) const; > + }; > + > +} // end llvm namespace > + > +#endif // ARM_ELF_WRITER_INFO_H > > Modified: llvm/trunk/lib/Target/ARM/ARMSubtarget.h > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMSubtarget.h?rev=114856&r1=114855&r2=114856&view=diff > ============================================================================== > --- llvm/trunk/lib/Target/ARM/ARMSubtarget.h (original) > +++ llvm/trunk/lib/Target/ARM/ARMSubtarget.h Mon Sep 27 13:31:37 2010 > @@ -204,6 +204,29 @@ > /// GVIsIndirectSymbol - true if the GV will be accessed via an indirect > /// symbol. > bool GVIsIndirectSymbol(const GlobalValue *GV, Reloc::Model RelocM) const; > + > + /// getDataLayout() - returns the ARM/Thumb specific TargetLayout string > + std::string getDataLayout() const { > + if (isThumb()) { > + if (isAPCS_ABI()) { > + return std::string("e-p:32:32-f64:32:32-i64:32:32-" > + "i16:16:32-i8:8:32-i1:8:32-" > + "v128:32:128-v64:32:64-a:0:32-n32"); > + } else { > + return std::string("e-p:32:32-f64:64:64-i64:64:64-" > + "i16:16:32-i8:8:32-i1:8:32-" > + "v128:64:128-v64:64:64-a:0:32-n32"); > + } > + } else { > + if (isAPCS_ABI()) { > + return std::string("e-p:32:32-f64:32:32-i64:32:32-" > + "v128:32:128-v64:32:64-n32"); > + } else { > + return std::string("e-p:32:32-f64:64:64-i64:64:64-" > + "v128:64:128-v64:64:64-n32"); > + } > + } > + }; > }; > } // End llvm namespace > > > Modified: llvm/trunk/lib/Target/ARM/ARMTargetMachine.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMTargetMachine.cpp?rev=114856&r1=114855&r2=114856&view=diff > ============================================================================== > --- llvm/trunk/lib/Target/ARM/ARMTargetMachine.cpp (original) > +++ llvm/trunk/lib/Target/ARM/ARMTargetMachine.cpp Mon Sep 27 13:31:37 2010 > @@ -31,6 +31,26 @@ > } > } > > +// This is duplicated code. Refactor this. > +static MCStreamer *createMCStreamer(const Target &T, const std::string &TT, > + MCContext &Ctx, TargetAsmBackend &TAB, > + raw_ostream &_OS, > + MCCodeEmitter *_Emitter, > + bool RelaxAll) { > + Triple TheTriple(TT); > + switch (TheTriple.getOS()) { > + case Triple::Darwin: > + return createMachOStreamer(Ctx, TAB, _OS, _Emitter, RelaxAll); > + case Triple::MinGW32: > + case Triple::MinGW64: > + case Triple::Cygwin: > + case Triple::Win32: > + assert(0 && "ARM does not support Windows COFF format"); break; > + default: > + return createELFStreamer(Ctx, TAB, _OS, _Emitter, RelaxAll); > + } > +} > + > extern "C" void LLVMInitializeARMTarget() { > // Register the target. > RegisterTargetMachine X(TheARMTarget); > @@ -39,6 +59,19 @@ > // Register the target asm info. > RegisterAsmInfoFn A(TheARMTarget, createMCAsmInfo); > RegisterAsmInfoFn B(TheThumbTarget, createMCAsmInfo); > + > + // Register the MC Code Emitter > + TargetRegistry::RegisterCodeEmitter(TheARMTarget, > + createARMMCCodeEmitter); > + TargetRegistry::RegisterCodeEmitter(TheThumbTarget, > + createARMMCCodeEmitter); > + > + // Register the object streamer. > + TargetRegistry::RegisterObjectStreamer(TheARMTarget, > + createMCStreamer); > + TargetRegistry::RegisterObjectStreamer(TheThumbTarget, > + createMCStreamer); > + > } > > /// TargetMachine ctor - Create an ARM architecture model. > @@ -51,18 +84,17 @@ > Subtarget(TT, FS, isThumb), > FrameInfo(Subtarget), > JITInfo(), > - InstrItins(Subtarget.getInstrItineraryData()) { > + InstrItins(Subtarget.getInstrItineraryData()), > + DataLayout(Subtarget.getDataLayout()), > + ELFWriterInfo(*this) > +{ > DefRelocModel = getRelocationModel(); > } > > ARMTargetMachine::ARMTargetMachine(const Target &T, const std::string &TT, > const std::string &FS) > - : ARMBaseTargetMachine(T, TT, FS, false), InstrInfo(Subtarget), > - DataLayout(Subtarget.isAPCS_ABI() ? > - std::string("e-p:32:32-f64:32:32-i64:32:32-" > - "v128:32:128-v64:32:64-n32") : > - std::string("e-p:32:32-f64:64:64-i64:64:64-" > - "v128:64:128-v64:64:64-n32")), > + : ARMBaseTargetMachine(T, TT, FS, false), > + InstrInfo(Subtarget), > TLInfo(*this), > TSInfo(*this) { > if (!Subtarget.hasARMOps()) > @@ -76,13 +108,6 @@ > InstrInfo(Subtarget.hasThumb2() > ? ((ARMBaseInstrInfo*)new Thumb2InstrInfo(Subtarget)) > : ((ARMBaseInstrInfo*)new Thumb1InstrInfo(Subtarget))), > - DataLayout(Subtarget.isAPCS_ABI() ? > - std::string("e-p:32:32-f64:32:32-i64:32:32-" > - "i16:16:32-i8:8:32-i1:8:32-" > - "v128:32:128-v64:32:64-a:0:32-n32") : > - std::string("e-p:32:32-f64:64:64-i64:64:64-" > - "i16:16:32-i8:8:32-i1:8:32-" > - "v128:64:128-v64:64:64-a:0:32-n32")), > TLInfo(*this), > TSInfo(*this) { > } > > Modified: llvm/trunk/lib/Target/ARM/ARMTargetMachine.h > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMTargetMachine.h?rev=114856&r1=114855&r2=114856&view=diff > ============================================================================== > --- llvm/trunk/lib/Target/ARM/ARMTargetMachine.h (original) > +++ llvm/trunk/lib/Target/ARM/ARMTargetMachine.h Mon Sep 27 13:31:37 2010 > @@ -16,7 +16,9 @@ > > #include "llvm/Target/TargetMachine.h" > #include "llvm/Target/TargetData.h" > +#include "llvm/MC/MCStreamer.h" > #include "ARMInstrInfo.h" > +#include "ARMELFWriterInfo.h" > #include "ARMFrameInfo.h" > #include "ARMJITInfo.h" > #include "ARMSubtarget.h" > @@ -38,10 +40,19 @@ > InstrItineraryData InstrItins; > Reloc::Model DefRelocModel; // Reloc model before it's overridden. > > +protected: > + const TargetData DataLayout; // Calculates type size & alignment > + ARMELFWriterInfo ELFWriterInfo; > + > public: > ARMBaseTargetMachine(const Target &T, const std::string &TT, > const std::string &FS, bool isThumb); > > + virtual const TargetData *getTargetData() const { return &DataLayout; } > + virtual const ARMELFWriterInfo *getELFWriterInfo() const { > + return Subtarget.isTargetELF() ? &ELFWriterInfo : 0; > + }; > + > virtual const ARMFrameInfo *getFrameInfo() const { return &FrameInfo; } > virtual ARMJITInfo *getJITInfo() { return &JITInfo; } > virtual const ARMSubtarget *getSubtargetImpl() const { return &Subtarget; } > @@ -63,7 +74,6 @@ > /// > class ARMTargetMachine : public ARMBaseTargetMachine { > ARMInstrInfo InstrInfo; > - const TargetData DataLayout; // Calculates type size & alignment > ARMTargetLowering TLInfo; > ARMSelectionDAGInfo TSInfo; > public: > @@ -93,7 +103,6 @@ > class ThumbTargetMachine : public ARMBaseTargetMachine { > // Either Thumb1InstrInfo or Thumb2InstrInfo. > OwningPtr InstrInfo; > - const TargetData DataLayout; // Calculates type size & alignment > ARMTargetLowering TLInfo; > ARMSelectionDAGInfo TSInfo; > public: > > Modified: llvm/trunk/lib/Target/ARM/CMakeLists.txt > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/CMakeLists.txt?rev=114856&r1=114855&r2=114856&view=diff > ============================================================================== > --- llvm/trunk/lib/Target/ARM/CMakeLists.txt (original) > +++ llvm/trunk/lib/Target/ARM/CMakeLists.txt Mon Sep 27 13:31:37 2010 > @@ -21,6 +21,7 @@ > ARMCodeEmitter.cpp > ARMConstantIslandPass.cpp > ARMConstantPoolValue.cpp > + ARMELFWriterInfo.cpp > ARMExpandPseudoInsts.cpp > ARMFastISel.cpp > ARMGlobalMerge.cpp > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From stoklund at 2pi.dk Mon Sep 27 13:43:40 2010 From: stoklund at 2pi.dk (Jakob Stoklund Olesen) Date: Mon, 27 Sep 2010 18:43:40 -0000 Subject: [llvm-commits] [llvm] r114857 - /llvm/trunk/test/CodeGen/ARM/code-placement.ll Message-ID: <20100927184340.EDFAA2A6C12C@llvm.org> Author: stoklund Date: Mon Sep 27 13:43:40 2010 New Revision: 114857 URL: http://llvm.org/viewvc/llvm-project?rev=114857&view=rev Log: Don't depend on basic block numbering. Modified: llvm/trunk/test/CodeGen/ARM/code-placement.ll Modified: llvm/trunk/test/CodeGen/ARM/code-placement.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/ARM/code-placement.ll?rev=114857&r1=114856&r2=114857&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/ARM/code-placement.ll (original) +++ llvm/trunk/test/CodeGen/ARM/code-placement.ll Mon Sep 27 13:43:40 2010 @@ -34,14 +34,14 @@ define i32 @t2(i32 %passes, i32* nocapture %src, i32 %size) nounwind readonly { entry: ; CHECK: t2: -; CHECK: beq LBB1_5 +; CHECK: beq LBB1_[[RET:.]] %0 = icmp eq i32 %passes, 0 ; [#uses=1] br i1 %0, label %bb5, label %bb.nph15 -; CHECK: LBB1_2 +; CHECK: LBB1_[[PREHDR:.]]: @ %bb2.preheader bb1: ; preds = %bb2.preheader, %bb1 -; CHECK: LBB1_3: -; CHECK: bne LBB1_3 +; CHECK: LBB1_[[BB1:.]]: @ %bb1 +; CHECK: bne LBB1_[[BB1]] %indvar = phi i32 [ %indvar.next, %bb1 ], [ 0, %bb2.preheader ] ; [#uses=2] %sum.08 = phi i32 [ %2, %bb1 ], [ %sum.110, %bb2.preheader ] ; [#uses=1] %tmp17 = sub i32 %i.07, %indvar ; [#uses=1] @@ -53,10 +53,9 @@ br i1 %exitcond, label %bb3, label %bb1 bb3: ; preds = %bb1, %bb2.preheader -; CHECK: LBB1_4 -; CHECK: bne LBB1_2 +; CHECK: LBB1_[[BB3:.]]: @ %bb3 +; CHECK: bne LBB1_[[PREHDR]] ; CHECK-NOT: b LBB1_ -; CHECK: ldmia sp! %sum.0.lcssa = phi i32 [ %sum.110, %bb2.preheader ], [ %2, %bb1 ] ; [#uses=2] %3 = add i32 %pass.011, 1 ; [#uses=2] %exitcond18 = icmp eq i32 %3, %passes ; [#uses=1] @@ -72,6 +71,8 @@ %sum.110 = phi i32 [ 0, %bb.nph15 ], [ %sum.0.lcssa, %bb3 ] ; [#uses=2] br i1 %4, label %bb1, label %bb3 +; CHECK: LBB1_[[RET]]: @ %bb5 +; CHECK: ldmia sp! bb5: ; preds = %bb3, %entry %sum.1.lcssa = phi i32 [ 0, %entry ], [ %sum.0.lcssa, %bb3 ] ; [#uses=1] ret i32 %sum.1.lcssa From stoklund at 2pi.dk Mon Sep 27 13:43:43 2010 From: stoklund at 2pi.dk (Jakob Stoklund Olesen) Date: Mon, 27 Sep 2010 18:43:43 -0000 Subject: [llvm-commits] [llvm] r114858 - /llvm/trunk/test/CodeGen/ARM/code-placement.ll Message-ID: <20100927184343.88F142A6C12D@llvm.org> Author: stoklund Date: Mon Sep 27 13:43:43 2010 New Revision: 114858 URL: http://llvm.org/viewvc/llvm-project?rev=114858&view=rev Log: Explicitly disable CGP critical edge splitting for this test so it won't break by reenabling it temporarily. Modified: llvm/trunk/test/CodeGen/ARM/code-placement.ll Modified: llvm/trunk/test/CodeGen/ARM/code-placement.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/ARM/code-placement.ll?rev=114858&r1=114857&r2=114858&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/ARM/code-placement.ll (original) +++ llvm/trunk/test/CodeGen/ARM/code-placement.ll Mon Sep 27 13:43:43 2010 @@ -1,4 +1,4 @@ -; RUN: llc < %s -mtriple=armv7-apple-darwin | FileCheck %s +; RUN: llc < %s -mtriple=armv7-apple-darwin -cgp-critical-edge-splitting=0 | FileCheck %s ; PHI elimination shouldn't break backedge. ; rdar://8263994 From stoklund at 2pi.dk Mon Sep 27 13:43:48 2010 From: stoklund at 2pi.dk (Jakob Stoklund Olesen) Date: Mon, 27 Sep 2010 18:43:48 -0000 Subject: [llvm-commits] [llvm] r114859 - in /llvm/trunk: lib/Transforms/Scalar/CodeGenPrepare.cpp test/CodeGen/ARM/lsr-on-unrolled-loops.ll test/CodeGen/Thumb/2010-07-15-debugOrdering.ll test/CodeGen/X86/2008-02-18-TailMergingBug.ll test/CodeGen/X86/lsr-reuse.ll test/CodeGen/X86/phi-immediate-factoring.ll test/CodeGen/X86/phys_subreg_coalesce-2.ll test/CodeGen/X86/postra-licm.ll test/CodeGen/X86/pr2659.ll test/CodeGen/X86/tail-opts.ll Message-ID: <20100927184348.934F52A6C12C@llvm.org> Author: stoklund Date: Mon Sep 27 13:43:48 2010 New Revision: 114859 URL: http://llvm.org/viewvc/llvm-project?rev=114859&view=rev Log: Revert "Disable codegen prepare critical edge splitting. Machine instruction passes now" This reverts revision 114633. It was breaking llvm-gcc-i386-linux-selfhost. It seems there is a downstream bug that is exposed by -cgp-critical-edge-splitting=0. When that bug is fixed, this patch can go back in. Note that the changes to tailcallfp2.ll are not reverted. They were good are required. Modified: llvm/trunk/lib/Transforms/Scalar/CodeGenPrepare.cpp llvm/trunk/test/CodeGen/ARM/lsr-on-unrolled-loops.ll llvm/trunk/test/CodeGen/Thumb/2010-07-15-debugOrdering.ll llvm/trunk/test/CodeGen/X86/2008-02-18-TailMergingBug.ll llvm/trunk/test/CodeGen/X86/lsr-reuse.ll llvm/trunk/test/CodeGen/X86/phi-immediate-factoring.ll llvm/trunk/test/CodeGen/X86/phys_subreg_coalesce-2.ll llvm/trunk/test/CodeGen/X86/postra-licm.ll llvm/trunk/test/CodeGen/X86/pr2659.ll llvm/trunk/test/CodeGen/X86/tail-opts.ll Modified: llvm/trunk/lib/Transforms/Scalar/CodeGenPrepare.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/CodeGenPrepare.cpp?rev=114859&r1=114858&r2=114859&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/CodeGenPrepare.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/CodeGenPrepare.cpp Mon Sep 27 13:43:48 2010 @@ -31,7 +31,6 @@ #include "llvm/Transforms/Utils/BuildLibCalls.h" #include "llvm/ADT/DenseMap.h" #include "llvm/ADT/SmallSet.h" -#include "llvm/ADT/Statistic.h" #include "llvm/Assembly/Writer.h" #include "llvm/Support/CallSite.h" #include "llvm/Support/CommandLine.h" @@ -43,12 +42,10 @@ using namespace llvm; using namespace llvm::PatternMatch; -STATISTIC(NumElim, "Number of blocks eliminated"); - static cl::opt CriticalEdgeSplit("cgp-critical-edge-splitting", cl::desc("Split critical edges during codegen prepare"), - cl::init(false), cl::Hidden); + cl::init(true), cl::Hidden); namespace { class CodeGenPrepare : public FunctionPass { @@ -305,7 +302,6 @@ PFI->removeEdge(ProfileInfo::getEdge(BB, DestBB)); } BB->eraseFromParent(); - ++NumElim; DEBUG(dbgs() << "AFTER:\n" << *DestBB << "\n\n\n"); } Modified: llvm/trunk/test/CodeGen/ARM/lsr-on-unrolled-loops.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/ARM/lsr-on-unrolled-loops.ll?rev=114859&r1=114858&r2=114859&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/ARM/lsr-on-unrolled-loops.ll (original) +++ llvm/trunk/test/CodeGen/ARM/lsr-on-unrolled-loops.ll Mon Sep 27 13:43:48 2010 @@ -624,12 +624,12 @@ bb24: ; preds = %bb23 ; LSR should use count-down iteration to avoid requiring the trip count -; in a register. +; in a register, and it shouldn't require any reloads here. ; CHECK: @ %bb24 ; CHECK-NEXT: @ in Loop: Header=BB1_1 Depth=1 -; CHECK: subs [[REGISTER:(r[0-9]+)|(lr)]], #1 -; CHECK: bne.w +; CHECK-NEXT: sub{{.*}} [[REGISTER:(r[0-9]+)|(lr)]], #1 +; CHECK-NEXT: bne.w %92 = icmp eq i32 %tmp81, %indvar78 ; [#uses=1] %indvar.next79 = add i32 %indvar78, 1 ; [#uses=1] Modified: llvm/trunk/test/CodeGen/Thumb/2010-07-15-debugOrdering.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Thumb/2010-07-15-debugOrdering.ll?rev=114859&r1=114858&r2=114859&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/Thumb/2010-07-15-debugOrdering.ll (original) +++ llvm/trunk/test/CodeGen/Thumb/2010-07-15-debugOrdering.ll Mon Sep 27 13:43:48 2010 @@ -10,7 +10,7 @@ define void @_Z19getClosestDiagonal3ii(%0* noalias sret, i32, i32) nounwind { ; CHECK: blx ___muldf3 ; CHECK: blx ___muldf3 -; CHECK: beq LBB0_7 +; CHECK: beq LBB0_8 ; CHECK: blx ___muldf3 ;