From sabre at nondot.org Mon Jul 27 00:32:17 2009 From: sabre at nondot.org (Chris Lattner) Date: Mon, 27 Jul 2009 05:32:17 -0000 Subject: [llvm-commits] [llvm] r77184 - in /llvm/trunk: include/llvm/Target/ lib/CodeGen/ lib/CodeGen/AsmPrinter/ lib/Target/ lib/Target/ARM/ lib/Target/ARM/AsmPrinter/ lib/Target/CellSPU/ lib/Target/MSP430/ lib/Target/Mips/ lib/Target/PIC16/ lib/Target/PowerPC/ lib/Target/PowerPC/AsmPrinter/ lib/Target/Sparc/ lib/Target/SystemZ/ lib/Target/X86/ lib/Target/X86/AsmPrinter/ lib/Target/XCore/ Message-ID: <200907270532.n6R5WI4G011799@zion.cs.uiuc.edu> Author: lattner Date: Mon Jul 27 00:32:16 2009 New Revision: 77184 URL: http://llvm.org/viewvc/llvm-project?rev=77184&view=rev Log: Eliminate SectionFlags, just embed a SectionKind into Section instead and drive things based off of that. Modified: llvm/trunk/include/llvm/Target/ELFTargetAsmInfo.h llvm/trunk/include/llvm/Target/TargetAsmInfo.h llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp llvm/trunk/lib/CodeGen/ELFWriter.cpp llvm/trunk/lib/CodeGen/ELFWriter.h llvm/trunk/lib/Target/ARM/ARMTargetAsmInfo.cpp llvm/trunk/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp llvm/trunk/lib/Target/CellSPU/SPUTargetAsmInfo.cpp llvm/trunk/lib/Target/DarwinTargetAsmInfo.cpp llvm/trunk/lib/Target/ELFTargetAsmInfo.cpp llvm/trunk/lib/Target/MSP430/MSP430TargetAsmInfo.cpp llvm/trunk/lib/Target/Mips/MipsTargetAsmInfo.cpp llvm/trunk/lib/Target/PIC16/PIC16AsmPrinter.cpp llvm/trunk/lib/Target/PIC16/PIC16TargetAsmInfo.cpp llvm/trunk/lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp llvm/trunk/lib/Target/PowerPC/PPCTargetAsmInfo.cpp llvm/trunk/lib/Target/Sparc/SparcTargetAsmInfo.cpp llvm/trunk/lib/Target/Sparc/SparcTargetAsmInfo.h llvm/trunk/lib/Target/SystemZ/SystemZTargetAsmInfo.cpp llvm/trunk/lib/Target/TargetAsmInfo.cpp llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp llvm/trunk/lib/Target/X86/X86TargetAsmInfo.cpp llvm/trunk/lib/Target/X86/X86TargetAsmInfo.h llvm/trunk/lib/Target/XCore/XCoreTargetAsmInfo.cpp Modified: llvm/trunk/include/llvm/Target/ELFTargetAsmInfo.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/ELFTargetAsmInfo.h?rev=77184&r1=77183&r2=77184&view=diff ============================================================================== --- llvm/trunk/include/llvm/Target/ELFTargetAsmInfo.h (original) +++ llvm/trunk/include/llvm/Target/ELFTargetAsmInfo.h Mon Jul 27 00:32:16 2009 @@ -31,19 +31,16 @@ virtual const Section * getSectionForMergeableConstant(SectionKind Kind) const; - /// getFlagsForNamedSection - If this target wants to be able to infer - /// section flags based on the name of the section specified for a global - /// variable, it can implement this. This is used on ELF systems so that - /// ".tbss" gets the TLS bit set etc. - virtual unsigned getFlagsForNamedSection(const char *Section) const; + virtual SectionKind::Kind getKindForNamedSection(const char *Section, + SectionKind::Kind K) const; + void getSectionFlagsAsString(SectionKind Kind, + SmallVectorImpl &Str) const; const char *getSectionPrefixForUniqueGlobal(SectionKind Kind) const; virtual const Section* SelectSectionForGlobal(const GlobalValue *GV, SectionKind Kind) const; - virtual void getSectionFlags(unsigned Flags, - SmallVectorImpl &Str) const; - + const Section *DataRelSection; const Section *DataRelLocalSection; const Section *DataRelROSection; Modified: llvm/trunk/include/llvm/Target/TargetAsmInfo.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetAsmInfo.h?rev=77184&r1=77183&r2=77184&view=diff ============================================================================== --- llvm/trunk/include/llvm/Target/TargetAsmInfo.h (original) +++ llvm/trunk/include/llvm/Target/TargetAsmInfo.h Mon Jul 27 00:32:16 2009 @@ -22,6 +22,9 @@ namespace llvm { template class SmallVectorImpl; + class TargetMachine; + class GlobalValue; + class Mangler; // DWARF encoding query type namespace DwarfEncoding { @@ -39,8 +42,12 @@ /// /// The comments below describe these as if they were an inheritance hierarchy /// in order to explain the predicates below. - struct SectionKind { + class SectionKind { + public: enum Kind { + /// Metadata - Debug info sections or other metadata. + Metadata, + /// Text - Text section, used for functions and other executable code. Text, @@ -140,6 +147,8 @@ bool isWeak() const { return Weak; } bool hasExplicitSection() const { return ExplicitSection; } + + bool isMetadata() const { return K == Metadata; } bool isText() const { return K == Text; } bool isReadOnly() const { @@ -191,7 +200,7 @@ return K == ReadOnlyWithRelLocal; } - static SectionKind get(Kind K, bool isWeak, + static SectionKind get(Kind K, bool isWeak = false, bool hasExplicitSection = false) { SectionKind Res; Res.K = K; @@ -201,65 +210,18 @@ } }; - namespace SectionFlags { - const unsigned Invalid = -1U; - const unsigned None = 0; - const unsigned Code = 1 << 0; ///< Section contains code - const unsigned Writable = 1 << 1; ///< Section is writeable - const unsigned BSS = 1 << 2; ///< Section contains only zeroes - const unsigned Mergeable = 1 << 3; ///< Section contains mergeable data - const unsigned Strings = 1 << 4; ///< Section contains C-type strings - const unsigned TLS = 1 << 5; ///< Section contains thread-local data - const unsigned Debug = 1 << 6; ///< Section contains debug data - const unsigned Linkonce = 1 << 7; ///< Section is linkonce - const unsigned TypeFlags = 0xFF; - // Some gap for future flags - - /// Named - True if this section should be printed with ".section ", - /// false if the section name is something like ".const". - const unsigned Named = 1 << 23; ///< Section is named - const unsigned EntitySize = 0xFF << 24; ///< Entity size for mergeable stuff - - static inline unsigned getEntitySize(unsigned Flags) { - return (Flags >> 24) & 0xFF; - } - - // FIXME: Why does this return a value? - static inline unsigned setEntitySize(unsigned Flags, unsigned Size) { - return (Flags & ~EntitySize) | ((Size & 0xFF) << 24); - } - - struct KeyInfo { - static inline unsigned getEmptyKey() { return Invalid; } - static inline unsigned getTombstoneKey() { return Invalid - 1; } - static unsigned getHashValue(const unsigned &Key) { return Key; } - static bool isEqual(unsigned LHS, unsigned RHS) { return LHS == RHS; } - static bool isPod() { return true; } - }; - } - - class TargetMachine; - class CallInst; - class GlobalValue; - class Type; - class Mangler; - class Section { friend class TargetAsmInfo; friend class StringMapEntry
; friend class StringMap
; std::string Name; - unsigned Flags; - explicit Section(unsigned F = SectionFlags::Invalid) : Flags(F) { } + SectionKind Kind; + explicit Section() { } public: - unsigned getEntitySize() const { return (Flags >> 24) & 0xFF; } - const std::string &getName() const { return Name; } - unsigned getFlags() const { return Flags; } - - bool hasFlag(unsigned F) const { return (Flags & F) != 0; } + SectionKind getKind() const { return Kind; } }; /// TargetAsmInfo - This class is intended to be used as a base class for asm @@ -678,9 +640,9 @@ virtual ~TargetAsmInfo(); const Section* getNamedSection(const char *Name, - unsigned Flags = SectionFlags::None) const; + SectionKind::Kind K) const; const Section* getUnnamedSection(const char *Directive, - unsigned Flags = SectionFlags::None) const; + SectionKind::Kind K) const; /// Measure the specified inline asm to determine an approximation of its /// length. @@ -717,12 +679,13 @@ return 0; } - /// getFlagsForNamedSection - If this target wants to be able to infer + /// getKindForNamedSection - If this target wants to be able to override /// section flags based on the name of the section specified for a global /// variable, it can implement this. This is used on ELF systems so that /// ".tbss" gets the TLS bit set etc. - virtual unsigned getFlagsForNamedSection(const char *Section) const { - return 0; + virtual SectionKind::Kind getKindForNamedSection(const char *Section, + SectionKind::Kind K) const{ + return K; } /// SectionForGlobal - This method computes the appropriate section to emit @@ -741,10 +704,11 @@ return 0; } - /// Turn the specified flags into a string that can be printed to the - /// assembly file. - virtual void getSectionFlags(unsigned Flags, - SmallVectorImpl &Str) const { + /// getSectionFlagsAsString - Turn the flags in the specified SectionKind + /// into a string that can be printed to the assembly file after the + /// ".section foo" part of a section directive. + virtual void getSectionFlagsAsString(SectionKind Kind, + SmallVectorImpl &Str) const { } // FIXME: Eliminate this. Modified: llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp?rev=77184&r1=77183&r2=77184&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp (original) +++ llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp Mon Jul 27 00:32:16 2009 @@ -117,8 +117,8 @@ /// SwitchToSection - Switch to the specified section of the executable if we /// are not already in it! -void AsmPrinter::SwitchToSection(const Section* NS) { - const std::string& NewSection = NS->getName(); +void AsmPrinter::SwitchToSection(const Section *NS) { + const std::string &NewSection = NS->getName(); // If we're already in this section, we're done. if (CurrentSection == NewSection) return; @@ -135,20 +135,20 @@ // If section is named we need to switch into it via special '.section' // directive and also append funky flags. Otherwise - section name is just // some magic assembler directive. - if (NS->hasFlag(SectionFlags::Named)) { - O << TAI->getSwitchToSectionDirective() - << CurrentSection; - + if (NS->getKind().hasExplicitSection()) { SmallString<32> FlagsStr; - TAI->getSectionFlags(NS->getFlags(), FlagsStr); - O << FlagsStr.c_str(); + TAI->getSectionFlagsAsString(NS->getKind(), FlagsStr); + + O << TAI->getSwitchToSectionDirective() + << CurrentSection + << FlagsStr.c_str(); } else { O << CurrentSection; } O << TAI->getDataSectionStartSuffix() << '\n'; } - IsInTextSection = (NS->getFlags() & SectionFlags::Code); + IsInTextSection = NS->getKind().isText(); } void AsmPrinter::getAnalysisUsage(AnalysisUsage &AU) const { @@ -404,7 +404,7 @@ bool JTInDiffSection = false; if ((IsPic && !(LoweringInfo && LoweringInfo->usesGlobalOffsetTable())) || !JumpTableDataSection || - FuncSection->hasFlag(SectionFlags::Linkonce)) { + FuncSection->getKind().isWeak()) { // In PIC mode, we need to emit the jump table to the same section as the // function body itself, otherwise the label differences won't make sense. // We should also do if the section name is NULL or function is declared in Modified: llvm/trunk/lib/CodeGen/ELFWriter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/ELFWriter.cpp?rev=77184&r1=77183&r2=77184&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/ELFWriter.cpp (original) +++ llvm/trunk/lib/CodeGen/ELFWriter.cpp Mon Jul 27 00:32:16 2009 @@ -228,18 +228,18 @@ // getElfSectionFlags - Get the ELF Section Header flags based // on the flags defined in ELFTargetAsmInfo. -unsigned ELFWriter::getElfSectionFlags(unsigned Flags) { +unsigned ELFWriter::getElfSectionFlags(SectionKind Kind) { unsigned ElfSectionFlags = ELFSection::SHF_ALLOC; - if (Flags & SectionFlags::Code) + if (Kind.isText()) ElfSectionFlags |= ELFSection::SHF_EXECINSTR; - if (Flags & SectionFlags::Writable) + if (Kind.isWriteable()) ElfSectionFlags |= ELFSection::SHF_WRITE; - if (Flags & SectionFlags::Mergeable) + if (Kind.isMergeableConst()) ElfSectionFlags |= ELFSection::SHF_MERGE; - if (Flags & SectionFlags::TLS) + if (Kind.isThreadLocal()) ElfSectionFlags |= ELFSection::SHF_TLS; - if (Flags & SectionFlags::Strings) + if (Kind.isMergeableCString()) ElfSectionFlags |= ELFSection::SHF_STRINGS; return ElfSectionFlags; @@ -293,7 +293,7 @@ // Get ELF section from TAI const Section *S = TAI->SectionForGlobal(GV); - unsigned SectionFlags = getElfSectionFlags(S->getFlags()); + unsigned SectionFlags = getElfSectionFlags(S->getKind()); // The symbol align should update the section alignment if needed const TargetData *TD = TM.getTargetData(); Modified: llvm/trunk/lib/CodeGen/ELFWriter.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/ELFWriter.h?rev=77184&r1=77183&r2=77184&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/ELFWriter.h (original) +++ llvm/trunk/lib/CodeGen/ELFWriter.h Mon Jul 27 00:32:16 2009 @@ -34,6 +34,7 @@ class TargetAsmInfo; class TargetELFWriterInfo; class raw_ostream; + class SectionKind; typedef std::vector::iterator ELFSymIter; typedef std::vector::iterator ELFSectionIter; @@ -209,7 +210,7 @@ unsigned getGlobalELFBinding(const GlobalValue *GV); unsigned getGlobalELFType(const GlobalValue *GV); unsigned getGlobalELFVisibility(const GlobalValue *GV); - unsigned getElfSectionFlags(unsigned Flags); + unsigned getElfSectionFlags(SectionKind Kind); // setGlobalSymLookup - Set global value 'GV' with 'Index' in the lookup map void setGlobalSymLookup(const GlobalValue *GV, unsigned Index) { Modified: llvm/trunk/lib/Target/ARM/ARMTargetAsmInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMTargetAsmInfo.cpp?rev=77184&r1=77183&r2=77184&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMTargetAsmInfo.cpp (original) +++ llvm/trunk/lib/Target/ARM/ARMTargetAsmInfo.cpp Mon Jul 27 00:32:16 2009 @@ -59,8 +59,7 @@ ARMTargetAsmInfo(TM) { Subtarget = &TM.getSubtarget(); - BSSSection_ = getUnnamedSection("\t.bss", - SectionFlags::Writable | SectionFlags::BSS); + BSSSection_ = getUnnamedSection("\t.bss", SectionKind::BSS); NeedsSet = false; HasLEB128 = true; Modified: llvm/trunk/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp?rev=77184&r1=77183&r2=77184&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp (original) +++ llvm/trunk/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp Mon Jul 27 00:32:16 2009 @@ -1130,9 +1130,10 @@ const Section *TheSection = TAI->SectionForGlobal(GVar); SwitchToSection(TheSection); + // FIXME: get this stuff from section kind flags. if (C->isNullValue() && !GVar->hasSection() && !GVar->isThreadLocal() && // Don't put things that should go in the cstring section into "comm". - !TheSection->hasFlag(SectionFlags::Strings)) { + !TheSection->getKind().isMergeableCString()) { if (GVar->hasExternalLinkage()) { if (const char *Directive = TAI->getZeroFillDirective()) { O << "\t.globl\t" << name << "\n"; Modified: llvm/trunk/lib/Target/CellSPU/SPUTargetAsmInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/CellSPU/SPUTargetAsmInfo.cpp?rev=77184&r1=77183&r2=77184&view=diff ============================================================================== --- llvm/trunk/lib/Target/CellSPU/SPUTargetAsmInfo.cpp (original) +++ llvm/trunk/lib/Target/CellSPU/SPUTargetAsmInfo.cpp Mon Jul 27 00:32:16 2009 @@ -35,8 +35,7 @@ // BSS section needs to be emitted as ".section" BSSSection = "\t.section\t.bss"; - BSSSection_ = getUnnamedSection("\t.section\t.bss", - SectionFlags::Writable | SectionFlags::BSS); + BSSSection_ = getUnnamedSection("\t.section\t.bss", SectionKind::BSS); SupportsDebugInformation = true; NeedsSet = true; Modified: llvm/trunk/lib/Target/DarwinTargetAsmInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/DarwinTargetAsmInfo.cpp?rev=77184&r1=77183&r2=77184&view=diff ============================================================================== --- llvm/trunk/lib/Target/DarwinTargetAsmInfo.cpp (original) +++ llvm/trunk/lib/Target/DarwinTargetAsmInfo.cpp Mon Jul 27 00:32:16 2009 @@ -29,28 +29,29 @@ : TargetAsmInfo(TM) { CStringSection_ = getUnnamedSection("\t.cstring", - SectionFlags::Mergeable |SectionFlags::Strings); + SectionKind::MergeableCString); FourByteConstantSection = getUnnamedSection("\t.literal4\n", - SectionFlags::Mergeable); + SectionKind::MergeableConst4); EightByteConstantSection = getUnnamedSection("\t.literal8\n", - SectionFlags::Mergeable); + SectionKind::MergeableConst8); // Note: 16-byte constant section is subtarget specific and should be provided // there, if needed. SixteenByteConstantSection = 0; - ReadOnlySection = getUnnamedSection("\t.const", SectionFlags::None); + ReadOnlySection = getUnnamedSection("\t.const", SectionKind::ReadOnly); TextCoalSection = getNamedSection("\t__TEXT,__textcoal_nt,coalesced,pure_instructions", - SectionFlags::Code); + SectionKind::Text); ConstTextCoalSection = getNamedSection("\t__TEXT,__const_coal,coalesced", - SectionFlags::None); + SectionKind::Text); ConstDataCoalSection = getNamedSection("\t__DATA,__const_coal,coalesced", - SectionFlags::None); - ConstDataSection = getUnnamedSection("\t.const_data", SectionFlags::None); + SectionKind::Text); + ConstDataSection = getUnnamedSection("\t.const_data", + SectionKind::ReadOnlyWithRel); DataCoalSection = getNamedSection("\t__DATA,__datacoal_nt,coalesced", - SectionFlags::Writable); + SectionKind::DataRel); // Common settings for all Darwin targets. Modified: llvm/trunk/lib/Target/ELFTargetAsmInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ELFTargetAsmInfo.cpp?rev=77184&r1=77183&r2=77184&view=diff ============================================================================== --- llvm/trunk/lib/Target/ELFTargetAsmInfo.cpp (original) +++ llvm/trunk/lib/Target/ELFTargetAsmInfo.cpp Mon Jul 27 00:32:16 2009 @@ -27,28 +27,24 @@ ELFTargetAsmInfo::ELFTargetAsmInfo(const TargetMachine &TM) : TargetAsmInfo(TM) { - BSSSection_ = getUnnamedSection("\t.bss", - SectionFlags::Writable | SectionFlags::BSS); - ReadOnlySection = getNamedSection("\t.rodata", SectionFlags::None); - TLSDataSection = getNamedSection("\t.tdata", - SectionFlags::Writable | SectionFlags::TLS); - TLSBSSSection = getNamedSection("\t.tbss", - SectionFlags::Writable | SectionFlags::TLS | SectionFlags::BSS); + ReadOnlySection = getNamedSection("\t.rodata", SectionKind::ReadOnly); + TLSDataSection = getNamedSection("\t.tdata", SectionKind::ThreadData); + TLSBSSSection = getNamedSection("\t.tbss", SectionKind::ThreadBSS); - DataRelSection = getNamedSection("\t.data.rel", SectionFlags::Writable); + DataRelSection = getNamedSection("\t.data.rel", SectionKind::DataRel); DataRelLocalSection = getNamedSection("\t.data.rel.local", - SectionFlags::Writable); + SectionKind::DataRelLocal); DataRelROSection = getNamedSection("\t.data.rel.ro", - SectionFlags::Writable); + SectionKind::ReadOnlyWithRel); DataRelROLocalSection = getNamedSection("\t.data.rel.ro.local", - SectionFlags::Writable); + SectionKind::ReadOnlyWithRelLocal); MergeableConst4Section = getNamedSection(".rodata.cst4", - SectionFlags::setEntitySize(SectionFlags::Mergeable, 4)); + SectionKind::MergeableConst4); MergeableConst8Section = getNamedSection(".rodata.cst8", - SectionFlags::setEntitySize(SectionFlags::Mergeable, 8)); + SectionKind::MergeableConst8); MergeableConst16Section = getNamedSection(".rodata.cst16", - SectionFlags::setEntitySize(SectionFlags::Mergeable, 16)); + SectionKind::MergeableConst16); } @@ -98,28 +94,30 @@ /// getFlagsForNamedSection - If this target wants to be able to infer /// section flags based on the name of the section specified for a global /// variable, it can implement this. -unsigned ELFTargetAsmInfo::getFlagsForNamedSection(const char *Name) const { - unsigned Flags = 0; - if (Name[0] != '.') return 0; +SectionKind::Kind ELFTargetAsmInfo::getKindForNamedSection(const char *Name, + SectionKind::Kind K) const { + if (Name[0] != '.') return K; // Some lame default implementation based on some magic section names. if (strncmp(Name, ".gnu.linkonce.b.", 16) == 0 || strncmp(Name, ".llvm.linkonce.b.", 17) == 0 || strncmp(Name, ".gnu.linkonce.sb.", 17) == 0 || strncmp(Name, ".llvm.linkonce.sb.", 18) == 0) - Flags |= SectionFlags::BSS; - else if (strcmp(Name, ".tdata") == 0 || - strncmp(Name, ".tdata.", 7) == 0 || - strncmp(Name, ".gnu.linkonce.td.", 17) == 0 || - strncmp(Name, ".llvm.linkonce.td.", 18) == 0) - Flags |= SectionFlags::TLS; - else if (strcmp(Name, ".tbss") == 0 || - strncmp(Name, ".tbss.", 6) == 0 || - strncmp(Name, ".gnu.linkonce.tb.", 17) == 0 || - strncmp(Name, ".llvm.linkonce.tb.", 18) == 0) - Flags |= SectionFlags::BSS | SectionFlags::TLS; + return SectionKind::BSS; - return Flags; + if (strcmp(Name, ".tdata") == 0 || + strncmp(Name, ".tdata.", 7) == 0 || + strncmp(Name, ".gnu.linkonce.td.", 17) == 0 || + strncmp(Name, ".llvm.linkonce.td.", 18) == 0) + return SectionKind::ThreadData; + + if (strcmp(Name, ".tbss") == 0 || + strncmp(Name, ".tbss.", 6) == 0 || + strncmp(Name, ".gnu.linkonce.tb.", 17) == 0 || + strncmp(Name, ".llvm.linkonce.tb.", 18) == 0) + return SectionKind::ThreadBSS; + + return K; } const char * @@ -152,37 +150,36 @@ if (Size <= 16) { assert(getCStringSection() && "Should have string section prefix"); - // We also need alignment here + // We also need alignment here. + // FIXME: this is getting the alignment of the character, not the alignment + // of the string!! unsigned Align = TD->getPrefTypeAlignment(Ty); if (Align < Size) Align = Size; std::string Name = getCStringSection() + utostr(Size) + '.' + utostr(Align); - unsigned Flags = SectionFlags::setEntitySize(SectionFlags::Mergeable | - SectionFlags::Strings, - Size); - return getNamedSection(Name.c_str(), Flags); + return getNamedSection(Name.c_str(), SectionKind::MergeableCString); } return getReadOnlySection(); } -void ELFTargetAsmInfo::getSectionFlags(unsigned Flags, - SmallVectorImpl &Str) const { +void ELFTargetAsmInfo::getSectionFlagsAsString(SectionKind Kind, + SmallVectorImpl &Str) const { Str.push_back(','); Str.push_back('"'); - if (!(Flags & SectionFlags::Debug)) + if (!Kind.isMetadata()) Str.push_back('a'); - if (Flags & SectionFlags::Code) + if (Kind.isText()) Str.push_back('x'); - if (Flags & SectionFlags::Writable) + if (Kind.isWriteable()) Str.push_back('w'); - if (Flags & SectionFlags::Mergeable) + if (Kind.isMergeableConst() || Kind.isMergeableCString()) Str.push_back('M'); - if (Flags & SectionFlags::Strings) + if (Kind.isMergeableCString()) Str.push_back('S'); - if (Flags & SectionFlags::TLS) + if (Kind.isThreadLocal()) Str.push_back('T'); Str.push_back('"'); @@ -195,16 +192,27 @@ Str.push_back('@'); const char *KindStr; - if (Flags & SectionFlags::BSS) + if (Kind.isBSS()) KindStr = "nobits"; else KindStr = "progbits"; Str.append(KindStr, KindStr+strlen(KindStr)); - if (unsigned entitySize = SectionFlags::getEntitySize(Flags)) { + if (Kind.isMergeableCString()) { + // TODO: Eventually handle multiple byte character strings. For now, all + // mergable C strings are single byte. + Str.push_back(','); + Str.push_back('1'); + } else if (Kind.isMergeableConst4()) { + Str.push_back(','); + Str.push_back('4'); + } else if (Kind.isMergeableConst8()) { + Str.push_back(','); + Str.push_back('8'); + } else if (Kind.isMergeableConst16()) { Str.push_back(','); - std::string Size = utostr(entitySize); - Str.append(Size.begin(), Size.end()); + Str.push_back('1'); + Str.push_back('6'); } } Modified: llvm/trunk/lib/Target/MSP430/MSP430TargetAsmInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/MSP430/MSP430TargetAsmInfo.cpp?rev=77184&r1=77183&r2=77184&view=diff ============================================================================== --- llvm/trunk/lib/Target/MSP430/MSP430TargetAsmInfo.cpp (original) +++ llvm/trunk/lib/Target/MSP430/MSP430TargetAsmInfo.cpp Mon Jul 27 00:32:16 2009 @@ -18,6 +18,5 @@ : ELFTargetAsmInfo(TM) { AlignmentIsInBytes = false; - BSSSection_ = getUnnamedSection("\t.bss", - SectionFlags::Writable | SectionFlags::BSS); + BSSSection_ = getUnnamedSection("\t.bss", SectionKind::BSS); } Modified: llvm/trunk/lib/Target/Mips/MipsTargetAsmInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mips/MipsTargetAsmInfo.cpp?rev=77184&r1=77183&r2=77184&view=diff ============================================================================== --- llvm/trunk/lib/Target/Mips/MipsTargetAsmInfo.cpp (original) +++ llvm/trunk/lib/Target/Mips/MipsTargetAsmInfo.cpp Mon Jul 27 00:32:16 2009 @@ -30,8 +30,7 @@ BSSSection = "\t.section\t.bss"; CStringSection = ".rodata.str"; - BSSSection_ = getUnnamedSection("\t.bss", - SectionFlags::Writable | SectionFlags::BSS); + BSSSection_ = getUnnamedSection("\t.bss", SectionKind::BSS); if (!TM.getSubtarget().hasABICall()) JumpTableDirective = "\t.word\t"; Modified: llvm/trunk/lib/Target/PIC16/PIC16AsmPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PIC16/PIC16AsmPrinter.cpp?rev=77184&r1=77183&r2=77184&view=diff ============================================================================== --- llvm/trunk/lib/Target/PIC16/PIC16AsmPrinter.cpp (original) +++ llvm/trunk/lib/Target/PIC16/PIC16AsmPrinter.cpp Mon Jul 27 00:32:16 2009 @@ -61,8 +61,8 @@ // Now emit the instructions of function in its code section. const char *codeSection = PAN::getCodeSectionName(CurrentFnName).c_str(); - const Section *fCodeSection = TAI->getNamedSection(codeSection, - SectionFlags::Code); + const Section *fCodeSection = + TAI->getNamedSection(codeSection, SectionKind::Text); // Start the Code Section. O << "\n"; SwitchToSection(fCodeSection); @@ -291,8 +291,8 @@ O << "\n"; const char *SectionName = PAN::getFrameSectionName(CurrentFnName).c_str(); - const Section *fPDataSection = TAI->getNamedSection(SectionName, - SectionFlags::Writable); + const Section *fPDataSection = + TAI->getNamedSection(SectionName, SectionKind::DataRel); SwitchToSection(fPDataSection); // Emit function frame label Modified: llvm/trunk/lib/Target/PIC16/PIC16TargetAsmInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PIC16/PIC16TargetAsmInfo.cpp?rev=77184&r1=77183&r2=77184&view=diff ============================================================================== --- llvm/trunk/lib/Target/PIC16/PIC16TargetAsmInfo.cpp (original) +++ llvm/trunk/lib/Target/PIC16/PIC16TargetAsmInfo.cpp Mon Jul 27 00:32:16 2009 @@ -37,18 +37,21 @@ ZeroDirective = NULL; AsciiDirective = " dt "; AscizDirective = NULL; - BSSSection_ = getNamedSection("udata.# UDATA", - SectionFlags::Writable | SectionFlags::BSS); - ReadOnlySection = getNamedSection("romdata.# ROMDATA", SectionFlags::None); - DataSection = getNamedSection("idata.# IDATA", SectionFlags::Writable); + BSSSection_ = getNamedSection("udata.# UDATA", SectionKind::BSS); + ReadOnlySection = getNamedSection("romdata.# ROMDATA", SectionKind::ReadOnly); + DataSection = getNamedSection("idata.# IDATA", SectionKind::DataRel); SwitchToSectionDirective = ""; // Need because otherwise a .text symbol is emitted by DwarfWriter // in BeginModule, and gpasm cribbs for that .text symbol. - TextSection = getUnnamedSection("", SectionFlags::Code); + TextSection = getUnnamedSection("", SectionKind::Text); PIC16Section *ROSection = new PIC16Section(getReadOnlySection()); ROSections.push_back(ROSection); - ExternalVarDecls = new PIC16Section(getNamedSection("ExternalVarDecls")); - ExternalVarDefs = new PIC16Section(getNamedSection("ExternalVarDefs")); + + // FIXME: I don't know what the classification of these sections really is. + ExternalVarDecls = new PIC16Section(getNamedSection("ExternalVarDecls", + SectionKind::Metadata)); + ExternalVarDefs = new PIC16Section(getNamedSection("ExternalVarDefs", + SectionKind::Metadata)); // Set it to false because we weed to generate c file name and not bc file // name. HasSingleParameterDotFile = false; @@ -95,7 +98,9 @@ // No BSS section spacious enough was found. Crate a new one. if (!FoundBSS) { std::string name = PAN::getUdataSectionName(BSSSections.size()); - const Section *NewSection = getNamedSection(name.c_str()); + const Section *NewSection = getNamedSection(name.c_str(), + // FIXME. + SectionKind::Metadata); FoundBSS = new PIC16Section(NewSection); @@ -135,7 +140,9 @@ // No IDATA section spacious enough was found. Crate a new one. if (!FoundIDATA) { std::string name = PAN::getIdataSectionName(IDATASections.size()); - const Section *NewSection = getNamedSection(name.c_str()); + const Section *NewSection = getNamedSection(name.c_str(), + // FIXME. + SectionKind::Metadata); FoundIDATA = new PIC16Section(NewSection); @@ -168,7 +175,9 @@ // No Auto section was found. Crate a new one. if (!FoundAutoSec) { - const Section *NewSection = getNamedSection(name.c_str()); + const Section *NewSection = getNamedSection(name.c_str(), + // FIXME. + SectionKind::Metadata); FoundAutoSec = new PIC16Section(NewSection); @@ -316,7 +325,7 @@ PIC16Section *NewBSS = FoundBSS; if (NewBSS == NULL) { - const Section *NewSection = getNamedSection(Name.c_str()); + const Section *NewSection = getNamedSection(Name.c_str(), SectionKind::BSS); NewBSS = new PIC16Section(NewSection); BSSSections.push_back(NewBSS); } @@ -367,7 +376,9 @@ PIC16Section *NewIDATASec = FoundIDATASec; if (NewIDATASec == NULL) { - const Section *NewSection = getNamedSection(Name.c_str()); + const Section *NewSection = getNamedSection(Name.c_str(), + // FIXME: + SectionKind::Metadata); NewIDATASec = new PIC16Section(NewSection); IDATASections.push_back(NewIDATASec); } @@ -405,7 +416,8 @@ PIC16Section *NewRomSec = FoundROSec; if (NewRomSec == NULL) { - const Section *NewSection = getNamedSection(Name.c_str()); + const Section *NewSection = getNamedSection(Name.c_str(), + SectionKind::ReadOnly); NewRomSec = new PIC16Section(NewSection); ROSections.push_back(NewRomSec); } Modified: llvm/trunk/lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp?rev=77184&r1=77183&r2=77184&view=diff ============================================================================== --- llvm/trunk/lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp (original) +++ llvm/trunk/lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp Mon Jul 27 00:32:16 2009 @@ -899,7 +899,7 @@ (GVar->hasLocalLinkage() || GVar->hasExternalLinkage() || GVar->isWeakForLinker()) && // Don't put things that should go in the cstring section into "comm". - !TheSection->hasFlag(SectionFlags::Strings)) { + !TheSection->getKind().isMergeableCString()) { if (Size == 0) Size = 1; // .comm Foo, 0 is undefined, avoid it. if (GVar->hasExternalLinkage()) { Modified: llvm/trunk/lib/Target/PowerPC/PPCTargetAsmInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/PPCTargetAsmInfo.cpp?rev=77184&r1=77183&r2=77184&view=diff ============================================================================== --- llvm/trunk/lib/Target/PowerPC/PPCTargetAsmInfo.cpp (original) +++ llvm/trunk/lib/Target/PowerPC/PPCTargetAsmInfo.cpp Mon Jul 27 00:32:16 2009 @@ -49,8 +49,7 @@ return DW_EH_PE_absptr; } -const char * -PPCDarwinTargetAsmInfo::getEHGlobalPrefix() const { +const char *PPCDarwinTargetAsmInfo::getEHGlobalPrefix() const { const PPCSubtarget* Subtarget = &TM.getSubtarget(); if (Subtarget->getDarwinVers() > 9) return PrivateGlobalPrefix; @@ -72,8 +71,7 @@ BSSSection = "\t.section\t\".sbss\",\"aw\", at nobits"; // PPC/Linux normally uses named section for BSS. - BSSSection_ = getNamedSection("\t.bss", - SectionFlags::Writable | SectionFlags::BSS); + BSSSection_ = getNamedSection("\t.bss", SectionKind::BSS); // Debug Information AbsoluteDebugSectionOffsets = true; Modified: llvm/trunk/lib/Target/Sparc/SparcTargetAsmInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Sparc/SparcTargetAsmInfo.cpp?rev=77184&r1=77183&r2=77184&view=diff ============================================================================== --- llvm/trunk/lib/Target/Sparc/SparcTargetAsmInfo.cpp (original) +++ llvm/trunk/lib/Target/Sparc/SparcTargetAsmInfo.cpp Mon Jul 27 00:32:16 2009 @@ -27,25 +27,24 @@ CStringSection=".rodata.str"; // Sparc normally uses named section for BSS. - BSSSection_ = getNamedSection("\t.bss", - SectionFlags::Writable | SectionFlags::BSS); + BSSSection_ = getNamedSection("\t.bss", SectionKind::BSS); } -void SparcELFTargetAsmInfo::getSectionFlags(unsigned Flags, +void SparcELFTargetAsmInfo::getSectionFlagsAsString(SectionKind Kind, SmallVectorImpl &Str) const { - if (Flags & SectionFlags::Mergeable) - return ELFTargetAsmInfo::getSectionFlags(Flags, Str); + if (Kind.isMergeableConst() || Kind.isMergeableCString()) + return ELFTargetAsmInfo::getSectionFlagsAsString(Kind, Str); // FIXME: Inefficient. std::string Res; - if (!(Flags & SectionFlags::Debug)) + if (!Kind.isMetadata()) Res += ",#alloc"; - if (Flags & SectionFlags::Code) + if (Kind.isText()) Res += ",#execinstr"; - if (Flags & SectionFlags::Writable) + if (Kind.isWriteable()) Res += ",#write"; - if (Flags & SectionFlags::TLS) + if (Kind.isThreadLocal()) Res += ",#tls"; Str.append(Res.begin(), Res.end()); Modified: llvm/trunk/lib/Target/Sparc/SparcTargetAsmInfo.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Sparc/SparcTargetAsmInfo.h?rev=77184&r1=77183&r2=77184&view=diff ============================================================================== --- llvm/trunk/lib/Target/Sparc/SparcTargetAsmInfo.h (original) +++ llvm/trunk/lib/Target/Sparc/SparcTargetAsmInfo.h Mon Jul 27 00:32:16 2009 @@ -24,8 +24,8 @@ struct SparcELFTargetAsmInfo : public ELFTargetAsmInfo { explicit SparcELFTargetAsmInfo(const TargetMachine &TM); - virtual void getSectionFlags(unsigned Flags, - SmallVectorImpl &Str) const; + virtual void getSectionFlagsAsString(SectionKind Kind, + SmallVectorImpl &Str) const; }; Modified: llvm/trunk/lib/Target/SystemZ/SystemZTargetAsmInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/SystemZ/SystemZTargetAsmInfo.cpp?rev=77184&r1=77183&r2=77184&view=diff ============================================================================== --- llvm/trunk/lib/Target/SystemZ/SystemZTargetAsmInfo.cpp (original) +++ llvm/trunk/lib/Target/SystemZ/SystemZTargetAsmInfo.cpp Mon Jul 27 00:32:16 2009 @@ -28,6 +28,5 @@ NonexecutableStackDirective = "\t.section\t.note.GNU-stack,\"\", at progbits"; - BSSSection_ = getUnnamedSection("\t.bss", - SectionFlags::Writable | SectionFlags::BSS); + BSSSection_ = getUnnamedSection("\t.bss", SectionKind::BSS); } Modified: llvm/trunk/lib/Target/TargetAsmInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/TargetAsmInfo.cpp?rev=77184&r1=77183&r2=77184&view=diff ============================================================================== --- llvm/trunk/lib/Target/TargetAsmInfo.cpp (original) +++ llvm/trunk/lib/Target/TargetAsmInfo.cpp Mon Jul 27 00:32:16 2009 @@ -122,8 +122,8 @@ DwarfEHFrameSection = ".eh_frame"; DwarfExceptionSection = ".gcc_except_table"; AsmTransCBE = 0; - TextSection = getUnnamedSection("\t.text", SectionFlags::Code); - DataSection = getUnnamedSection("\t.data", SectionFlags::Writable); + TextSection = getUnnamedSection("\t.text", SectionKind::Text); + DataSection = getUnnamedSection("\t.data", SectionKind::DataRel); } TargetAsmInfo::~TargetAsmInfo() { @@ -199,23 +199,6 @@ return false; } -static unsigned SectionFlagsForGlobal(SectionKind Kind) { - // Decode flags from global and section kind. - unsigned Flags = SectionFlags::None; - if (Kind.isWeak()) - Flags |= SectionFlags::Linkonce; - if (Kind.isBSS() || Kind.isThreadBSS()) - Flags |= SectionFlags::BSS; - if (Kind.isThreadLocal()) - Flags |= SectionFlags::TLS; - if (Kind.isText()) - Flags |= SectionFlags::Code; - if (Kind.isWriteable()) - Flags |= SectionFlags::Writable; - - return Flags; -} - static SectionKind::Kind SectionKindForGlobal(const GlobalValue *GV, const TargetMachine &TM) { Reloc::Model ReloModel = TM.getRelocationModel(); @@ -326,29 +309,21 @@ if (const Section *TS = getSpecialCasedSectionGlobals(GV, Kind)) return TS; - // Honour section already set, if any. - unsigned Flags = SectionFlagsForGlobal(Kind); - - // This is an explicitly named section. - Flags |= SectionFlags::Named; - // If the target has magic semantics for certain section names, make sure to // pick up the flags. This allows the user to write things with attribute // section and still get the appropriate section flags printed. - Flags |= getFlagsForNamedSection(GV->getSection().c_str()); + GVKind = getKindForNamedSection(GV->getSection().c_str(), GVKind); - return getNamedSection(GV->getSection().c_str(), Flags); + return getNamedSection(GV->getSection().c_str(), GVKind); } // If this global is linkonce/weak and the target handles this by emitting it // into a 'uniqued' section name, create and return the section now. if (Kind.isWeak()) { if (const char *Prefix = getSectionPrefixForUniqueGlobal(Kind)) { - unsigned Flags = SectionFlagsForGlobal(Kind); - // FIXME: Use mangler interface (PR4584). std::string Name = Prefix+GV->getNameStr(); - return getNamedSection(Name.c_str(), Flags); + return getNamedSection(Name.c_str(), GVKind); } } @@ -390,12 +365,12 @@ const Section *TargetAsmInfo::getNamedSection(const char *Name, - unsigned Flags) const { + SectionKind::Kind Kind) const { Section &S = Sections[Name]; // This is newly-created section, set it up properly. if (S.Name.empty()) { - S.Flags = Flags | SectionFlags::Named; + S.Kind = SectionKind::get(Kind, false /*weak*/, true /*Named*/); S.Name = Name; } @@ -403,12 +378,13 @@ } const Section* -TargetAsmInfo::getUnnamedSection(const char *Directive, unsigned Flags) const { +TargetAsmInfo::getUnnamedSection(const char *Directive, + SectionKind::Kind Kind) const { Section& S = Sections[Directive]; // This is newly-created section, set it up properly. if (S.Name.empty()) { - S.Flags = Flags & ~SectionFlags::Named; + S.Kind = SectionKind::get(Kind, false /*weak*/, false /*Named*/); S.Name = Directive; } Modified: llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp?rev=77184&r1=77183&r2=77184&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp (original) +++ llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp Mon Jul 27 00:32:16 2009 @@ -799,7 +799,7 @@ if (C->isNullValue() && !GVar->hasSection() && // Don't put things that should go in the cstring section into "comm". - !TheSection->hasFlag(SectionFlags::Strings)) { + !TheSection->getKind().isMergeableCString()) { if (GVar->hasExternalLinkage()) { if (const char *Directive = TAI->getZeroFillDirective()) { O << "\t.globl " << name << '\n'; Modified: llvm/trunk/lib/Target/X86/X86TargetAsmInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86TargetAsmInfo.cpp?rev=77184&r1=77183&r2=77184&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86TargetAsmInfo.cpp (original) +++ llvm/trunk/lib/Target/X86/X86TargetAsmInfo.cpp Mon Jul 27 00:32:16 2009 @@ -58,7 +58,7 @@ // FIXME: Why don't we always use this section? if (is64Bit) SixteenByteConstantSection = getUnnamedSection("\t.literal16\n", - SectionFlags::Mergeable); + SectionKind::MergeableConst16); LCOMMDirective = "\t.lcomm\t"; // Leopard and above support aligned common symbols. @@ -128,8 +128,7 @@ // Set up DWARF directives HasLEB128 = true; // Target asm supports leb128 directives (little-endian) - BSSSection_ = getUnnamedSection("\t.bss", - SectionFlags::Writable | SectionFlags::BSS); + BSSSection_ = getUnnamedSection("\t.bss", SectionKind::BSS); // Debug Information AbsoluteDebugSectionOffsets = true; @@ -278,13 +277,14 @@ } -void X86COFFTargetAsmInfo::getSectionFlags(unsigned Flags, - SmallVectorImpl &Str) const { + +void X86COFFTargetAsmInfo::getSectionFlagsAsString(SectionKind Kind, + SmallVectorImpl &Str) const { // FIXME: Inefficient. std::string Res = ",\""; - if (Flags & SectionFlags::Code) + if (Kind.isText()) Res += 'x'; - if (Flags & SectionFlags::Writable) + if (Kind.isWriteable()) Res += 'w'; Res += "\""; @@ -314,8 +314,8 @@ AlignmentIsInBytes = true; - TextSection = getUnnamedSection("_text", SectionFlags::Code); - DataSection = getUnnamedSection("_data", SectionFlags::Writable); + TextSection = getUnnamedSection("_text", SectionKind::Text); + DataSection = getUnnamedSection("_data", SectionKind::DataRel); JumpTableDataSection = NULL; SwitchToSectionDirective = ""; Modified: llvm/trunk/lib/Target/X86/X86TargetAsmInfo.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86TargetAsmInfo.h?rev=77184&r1=77183&r2=77184&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86TargetAsmInfo.h (original) +++ llvm/trunk/lib/Target/X86/X86TargetAsmInfo.h Mon Jul 27 00:32:16 2009 @@ -56,8 +56,8 @@ virtual const char * getSectionPrefixForUniqueGlobal(SectionKind kind) const; - virtual void getSectionFlags(unsigned Flags, - SmallVectorImpl &Str) const; + virtual void getSectionFlagsAsString(SectionKind Kind, + SmallVectorImpl &Str) const; }; struct X86WinTargetAsmInfo : public X86GenericTargetAsmInfo { Modified: llvm/trunk/lib/Target/XCore/XCoreTargetAsmInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/XCore/XCoreTargetAsmInfo.cpp?rev=77184&r1=77183&r2=77184&view=diff ============================================================================== --- llvm/trunk/lib/Target/XCore/XCoreTargetAsmInfo.cpp (original) +++ llvm/trunk/lib/Target/XCore/XCoreTargetAsmInfo.cpp Mon Jul 27 00:32:16 2009 @@ -24,10 +24,9 @@ XCoreTargetAsmInfo::XCoreTargetAsmInfo(const XCoreTargetMachine &TM) : ELFTargetAsmInfo(TM) { SupportsDebugInformation = true; - TextSection = getUnnamedSection("\t.text", SectionFlags::Code); - DataSection = getNamedSection("\t.dp.data", SectionFlags::Writable); - BSSSection_ = getNamedSection("\t.dp.bss", SectionFlags::Writable | - SectionFlags::BSS); + TextSection = getUnnamedSection("\t.text", SectionKind::Text); + DataSection = getNamedSection("\t.dp.data", SectionKind::DataRel); + BSSSection_ = getNamedSection("\t.dp.bss", SectionKind::BSS); // TLS globals are lowered in the backend to arrays indexed by the current // thread id. After lowering they require no special handling by the linker @@ -36,9 +35,10 @@ TLSBSSSection = BSSSection_; if (TM.getSubtargetImpl()->isXS1A()) - ReadOnlySection = getNamedSection("\t.dp.rodata", SectionFlags::Writable); + // FIXME: Why is this writable??? + ReadOnlySection = getNamedSection("\t.dp.rodata", SectionKind::DataRel); else - ReadOnlySection = getNamedSection("\t.cp.rodata", SectionFlags::None); + ReadOnlySection = getNamedSection("\t.cp.rodata", SectionKind::ReadOnly); Data16bitsDirective = "\t.short\t"; Data32bitsDirective = "\t.long\t"; Data64bitsDirective = 0; From sabre at nondot.org Mon Jul 27 01:17:17 2009 From: sabre at nondot.org (Chris Lattner) Date: Mon, 27 Jul 2009 06:17:17 -0000 Subject: [llvm-commits] [llvm] r77186 - in /llvm/trunk: include/llvm/Target/ lib/Target/ lib/Target/ARM/ lib/Target/CellSPU/ lib/Target/MSP430/ lib/Target/Mips/ lib/Target/PIC16/ lib/Target/PowerPC/ lib/Target/Sparc/ lib/Target/SystemZ/ lib/Target/X86/ lib/Target/XCore/ Message-ID: <200907270617.n6R6HIOs012987@zion.cs.uiuc.edu> Author: lattner Date: Mon Jul 27 01:17:14 2009 New Revision: 77186 URL: http://llvm.org/viewvc/llvm-project?rev=77186&view=rev Log: Eliminate getNamed/getUnnamedSection, adding a new and unified getOrCreateSection instead. Modified: llvm/trunk/include/llvm/Target/TargetAsmInfo.h llvm/trunk/lib/Target/ARM/ARMTargetAsmInfo.cpp llvm/trunk/lib/Target/CellSPU/SPUTargetAsmInfo.cpp llvm/trunk/lib/Target/DarwinTargetAsmInfo.cpp llvm/trunk/lib/Target/ELFTargetAsmInfo.cpp llvm/trunk/lib/Target/MSP430/MSP430TargetAsmInfo.cpp llvm/trunk/lib/Target/Mips/MipsTargetAsmInfo.cpp llvm/trunk/lib/Target/PIC16/PIC16AsmPrinter.cpp llvm/trunk/lib/Target/PIC16/PIC16TargetAsmInfo.cpp llvm/trunk/lib/Target/PowerPC/PPCTargetAsmInfo.cpp llvm/trunk/lib/Target/Sparc/SparcTargetAsmInfo.cpp llvm/trunk/lib/Target/SystemZ/SystemZTargetAsmInfo.cpp llvm/trunk/lib/Target/TargetAsmInfo.cpp llvm/trunk/lib/Target/X86/X86TargetAsmInfo.cpp llvm/trunk/lib/Target/XCore/XCoreTargetAsmInfo.cpp Modified: llvm/trunk/include/llvm/Target/TargetAsmInfo.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetAsmInfo.h?rev=77186&r1=77185&r2=77186&view=diff ============================================================================== --- llvm/trunk/include/llvm/Target/TargetAsmInfo.h (original) +++ llvm/trunk/include/llvm/Target/TargetAsmInfo.h Mon Jul 27 01:17:14 2009 @@ -639,10 +639,9 @@ explicit TargetAsmInfo(const TargetMachine &TM); virtual ~TargetAsmInfo(); - const Section* getNamedSection(const char *Name, - SectionKind::Kind K) const; - const Section* getUnnamedSection(const char *Directive, - SectionKind::Kind K) const; + const Section *getOrCreateSection(const char *Name, + bool isDirective, + SectionKind::Kind K) const; /// Measure the specified inline asm to determine an approximation of its /// length. Modified: llvm/trunk/lib/Target/ARM/ARMTargetAsmInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMTargetAsmInfo.cpp?rev=77186&r1=77185&r2=77186&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMTargetAsmInfo.cpp (original) +++ llvm/trunk/lib/Target/ARM/ARMTargetAsmInfo.cpp Mon Jul 27 01:17:14 2009 @@ -59,7 +59,7 @@ ARMTargetAsmInfo(TM) { Subtarget = &TM.getSubtarget(); - BSSSection_ = getUnnamedSection("\t.bss", SectionKind::BSS); + BSSSection_ = getOrCreateSection("\t.bss", true, SectionKind::BSS); NeedsSet = false; HasLEB128 = true; Modified: llvm/trunk/lib/Target/CellSPU/SPUTargetAsmInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/CellSPU/SPUTargetAsmInfo.cpp?rev=77186&r1=77185&r2=77186&view=diff ============================================================================== --- llvm/trunk/lib/Target/CellSPU/SPUTargetAsmInfo.cpp (original) +++ llvm/trunk/lib/Target/CellSPU/SPUTargetAsmInfo.cpp Mon Jul 27 01:17:14 2009 @@ -35,7 +35,7 @@ // BSS section needs to be emitted as ".section" BSSSection = "\t.section\t.bss"; - BSSSection_ = getUnnamedSection("\t.section\t.bss", SectionKind::BSS); + BSSSection_ = getOrCreateSection("\t.bss", false, SectionKind::BSS); SupportsDebugInformation = true; NeedsSet = true; Modified: llvm/trunk/lib/Target/DarwinTargetAsmInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/DarwinTargetAsmInfo.cpp?rev=77186&r1=77185&r2=77186&view=diff ============================================================================== --- llvm/trunk/lib/Target/DarwinTargetAsmInfo.cpp (original) +++ llvm/trunk/lib/Target/DarwinTargetAsmInfo.cpp Mon Jul 27 01:17:14 2009 @@ -28,30 +28,30 @@ DarwinTargetAsmInfo::DarwinTargetAsmInfo(const TargetMachine &TM) : TargetAsmInfo(TM) { - CStringSection_ = getUnnamedSection("\t.cstring", - SectionKind::MergeableCString); - FourByteConstantSection = getUnnamedSection("\t.literal4\n", - SectionKind::MergeableConst4); - EightByteConstantSection = getUnnamedSection("\t.literal8\n", - SectionKind::MergeableConst8); + CStringSection_ = getOrCreateSection("\t.cstring", true, + SectionKind::MergeableCString); + FourByteConstantSection = getOrCreateSection("\t.literal4\n", true, + SectionKind::MergeableConst4); + EightByteConstantSection = getOrCreateSection("\t.literal8\n", true, + SectionKind::MergeableConst8); // Note: 16-byte constant section is subtarget specific and should be provided // there, if needed. SixteenByteConstantSection = 0; - ReadOnlySection = getUnnamedSection("\t.const", SectionKind::ReadOnly); + ReadOnlySection = getOrCreateSection("\t.const", true, SectionKind::ReadOnly); TextCoalSection = - getNamedSection("\t__TEXT,__textcoal_nt,coalesced,pure_instructions", - SectionKind::Text); - ConstTextCoalSection = getNamedSection("\t__TEXT,__const_coal,coalesced", - SectionKind::Text); - ConstDataCoalSection = getNamedSection("\t__DATA,__const_coal,coalesced", - SectionKind::Text); - ConstDataSection = getUnnamedSection("\t.const_data", - SectionKind::ReadOnlyWithRel); - DataCoalSection = getNamedSection("\t__DATA,__datacoal_nt,coalesced", - SectionKind::DataRel); + getOrCreateSection("\t__TEXT,__textcoal_nt,coalesced,pure_instructions", + false, SectionKind::Text); + ConstTextCoalSection = getOrCreateSection("\t__TEXT,__const_coal,coalesced", + false, SectionKind::Text); + ConstDataCoalSection = getOrCreateSection("\t__DATA,__const_coal,coalesced", + false, SectionKind::Text); + ConstDataSection = getOrCreateSection("\t.const_data", true, + SectionKind::ReadOnlyWithRel); + DataCoalSection = getOrCreateSection("\t__DATA,__datacoal_nt,coalesced", + false, SectionKind::DataRel); // Common settings for all Darwin targets. Modified: llvm/trunk/lib/Target/ELFTargetAsmInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ELFTargetAsmInfo.cpp?rev=77186&r1=77185&r2=77186&view=diff ============================================================================== --- llvm/trunk/lib/Target/ELFTargetAsmInfo.cpp (original) +++ llvm/trunk/lib/Target/ELFTargetAsmInfo.cpp Mon Jul 27 01:17:14 2009 @@ -26,25 +26,28 @@ ELFTargetAsmInfo::ELFTargetAsmInfo(const TargetMachine &TM) : TargetAsmInfo(TM) { - - ReadOnlySection = getNamedSection("\t.rodata", SectionKind::ReadOnly); - TLSDataSection = getNamedSection("\t.tdata", SectionKind::ThreadData); - TLSBSSSection = getNamedSection("\t.tbss", SectionKind::ThreadBSS); - - DataRelSection = getNamedSection("\t.data.rel", SectionKind::DataRel); - DataRelLocalSection = getNamedSection("\t.data.rel.local", - SectionKind::DataRelLocal); - DataRelROSection = getNamedSection("\t.data.rel.ro", - SectionKind::ReadOnlyWithRel); - DataRelROLocalSection = getNamedSection("\t.data.rel.ro.local", - SectionKind::ReadOnlyWithRelLocal); + ReadOnlySection = + getOrCreateSection("\t.rodata", false, SectionKind::ReadOnly); + TLSDataSection = + getOrCreateSection("\t.tdata", false, SectionKind::ThreadData); + TLSBSSSection = getOrCreateSection("\t.tbss", false, SectionKind::ThreadBSS); + + DataRelSection = getOrCreateSection("\t.data.rel", false, + SectionKind::DataRel); + DataRelLocalSection = getOrCreateSection("\t.data.rel.local", false, + SectionKind::DataRelLocal); + DataRelROSection = getOrCreateSection("\t.data.rel.ro", false, + SectionKind::ReadOnlyWithRel); + DataRelROLocalSection = + getOrCreateSection("\t.data.rel.ro.local", false, + SectionKind::ReadOnlyWithRelLocal); - MergeableConst4Section = getNamedSection(".rodata.cst4", - SectionKind::MergeableConst4); - MergeableConst8Section = getNamedSection(".rodata.cst8", - SectionKind::MergeableConst8); - MergeableConst16Section = getNamedSection(".rodata.cst16", - SectionKind::MergeableConst16); + MergeableConst4Section = getOrCreateSection(".rodata.cst4", false, + SectionKind::MergeableConst4); + MergeableConst8Section = getOrCreateSection(".rodata.cst8", false, + SectionKind::MergeableConst8); + MergeableConst16Section = getOrCreateSection(".rodata.cst16", false, + SectionKind::MergeableConst16); } @@ -158,7 +161,8 @@ Align = Size; std::string Name = getCStringSection() + utostr(Size) + '.' + utostr(Align); - return getNamedSection(Name.c_str(), SectionKind::MergeableCString); + return getOrCreateSection(Name.c_str(), false, + SectionKind::MergeableCString); } return getReadOnlySection(); Modified: llvm/trunk/lib/Target/MSP430/MSP430TargetAsmInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/MSP430/MSP430TargetAsmInfo.cpp?rev=77186&r1=77185&r2=77186&view=diff ============================================================================== --- llvm/trunk/lib/Target/MSP430/MSP430TargetAsmInfo.cpp (original) +++ llvm/trunk/lib/Target/MSP430/MSP430TargetAsmInfo.cpp Mon Jul 27 01:17:14 2009 @@ -18,5 +18,5 @@ : ELFTargetAsmInfo(TM) { AlignmentIsInBytes = false; - BSSSection_ = getUnnamedSection("\t.bss", SectionKind::BSS); + BSSSection_ = getOrCreateSection("\t.bss", true, SectionKind::BSS); } Modified: llvm/trunk/lib/Target/Mips/MipsTargetAsmInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mips/MipsTargetAsmInfo.cpp?rev=77186&r1=77185&r2=77186&view=diff ============================================================================== --- llvm/trunk/lib/Target/Mips/MipsTargetAsmInfo.cpp (original) +++ llvm/trunk/lib/Target/Mips/MipsTargetAsmInfo.cpp Mon Jul 27 01:17:14 2009 @@ -30,7 +30,7 @@ BSSSection = "\t.section\t.bss"; CStringSection = ".rodata.str"; - BSSSection_ = getUnnamedSection("\t.bss", SectionKind::BSS); + BSSSection_ = getOrCreateSection("\t.bss", true, SectionKind::BSS); if (!TM.getSubtarget().hasABICall()) JumpTableDirective = "\t.word\t"; Modified: llvm/trunk/lib/Target/PIC16/PIC16AsmPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PIC16/PIC16AsmPrinter.cpp?rev=77186&r1=77185&r2=77186&view=diff ============================================================================== --- llvm/trunk/lib/Target/PIC16/PIC16AsmPrinter.cpp (original) +++ llvm/trunk/lib/Target/PIC16/PIC16AsmPrinter.cpp Mon Jul 27 01:17:14 2009 @@ -62,7 +62,7 @@ const char *codeSection = PAN::getCodeSectionName(CurrentFnName).c_str(); const Section *fCodeSection = - TAI->getNamedSection(codeSection, SectionKind::Text); + TAI->getOrCreateSection(codeSection, false, SectionKind::Text); // Start the Code Section. O << "\n"; SwitchToSection(fCodeSection); @@ -292,7 +292,7 @@ const char *SectionName = PAN::getFrameSectionName(CurrentFnName).c_str(); const Section *fPDataSection = - TAI->getNamedSection(SectionName, SectionKind::DataRel); + TAI->getOrCreateSection(SectionName, false, SectionKind::DataRel); SwitchToSection(fPDataSection); // Emit function frame label Modified: llvm/trunk/lib/Target/PIC16/PIC16TargetAsmInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PIC16/PIC16TargetAsmInfo.cpp?rev=77186&r1=77185&r2=77186&view=diff ============================================================================== --- llvm/trunk/lib/Target/PIC16/PIC16TargetAsmInfo.cpp (original) +++ llvm/trunk/lib/Target/PIC16/PIC16TargetAsmInfo.cpp Mon Jul 27 01:17:14 2009 @@ -37,21 +37,24 @@ ZeroDirective = NULL; AsciiDirective = " dt "; AscizDirective = NULL; - BSSSection_ = getNamedSection("udata.# UDATA", SectionKind::BSS); - ReadOnlySection = getNamedSection("romdata.# ROMDATA", SectionKind::ReadOnly); - DataSection = getNamedSection("idata.# IDATA", SectionKind::DataRel); + BSSSection_ = getOrCreateSection("udata.# UDATA", false, SectionKind::BSS); + ReadOnlySection = getOrCreateSection("romdata.# ROMDATA", false, + SectionKind::ReadOnly); + DataSection = getOrCreateSection("idata.# IDATA", false,SectionKind::DataRel); SwitchToSectionDirective = ""; // Need because otherwise a .text symbol is emitted by DwarfWriter // in BeginModule, and gpasm cribbs for that .text symbol. - TextSection = getUnnamedSection("", SectionKind::Text); + TextSection = getOrCreateSection("", true, SectionKind::Text); PIC16Section *ROSection = new PIC16Section(getReadOnlySection()); ROSections.push_back(ROSection); // FIXME: I don't know what the classification of these sections really is. - ExternalVarDecls = new PIC16Section(getNamedSection("ExternalVarDecls", - SectionKind::Metadata)); - ExternalVarDefs = new PIC16Section(getNamedSection("ExternalVarDefs", - SectionKind::Metadata)); + ExternalVarDecls = new PIC16Section(getOrCreateSection("ExternalVarDecls", + false, + SectionKind::Metadata)); + ExternalVarDefs = new PIC16Section(getOrCreateSection("ExternalVarDefs", + false, + SectionKind::Metadata)); // Set it to false because we weed to generate c file name and not bc file // name. HasSingleParameterDotFile = false; @@ -98,9 +101,9 @@ // No BSS section spacious enough was found. Crate a new one. if (!FoundBSS) { std::string name = PAN::getUdataSectionName(BSSSections.size()); - const Section *NewSection = getNamedSection(name.c_str(), - // FIXME. - SectionKind::Metadata); + const Section *NewSection = getOrCreateSection(name.c_str(), false, + // FIXME. + SectionKind::Metadata); FoundBSS = new PIC16Section(NewSection); @@ -140,9 +143,10 @@ // No IDATA section spacious enough was found. Crate a new one. if (!FoundIDATA) { std::string name = PAN::getIdataSectionName(IDATASections.size()); - const Section *NewSection = getNamedSection(name.c_str(), - // FIXME. - SectionKind::Metadata); + const Section *NewSection = getOrCreateSection(name.c_str(), + false, + // FIXME. + SectionKind::Metadata); FoundIDATA = new PIC16Section(NewSection); @@ -175,9 +179,10 @@ // No Auto section was found. Crate a new one. if (!FoundAutoSec) { - const Section *NewSection = getNamedSection(name.c_str(), - // FIXME. - SectionKind::Metadata); + const Section *NewSection = getOrCreateSection(name.c_str(), + // FIXME. + false, + SectionKind::Metadata); FoundAutoSec = new PIC16Section(NewSection); @@ -325,7 +330,8 @@ PIC16Section *NewBSS = FoundBSS; if (NewBSS == NULL) { - const Section *NewSection = getNamedSection(Name.c_str(), SectionKind::BSS); + const Section *NewSection = getOrCreateSection(Name.c_str(), + false, SectionKind::BSS); NewBSS = new PIC16Section(NewSection); BSSSections.push_back(NewBSS); } @@ -376,9 +382,10 @@ PIC16Section *NewIDATASec = FoundIDATASec; if (NewIDATASec == NULL) { - const Section *NewSection = getNamedSection(Name.c_str(), - // FIXME: - SectionKind::Metadata); + const Section *NewSection = getOrCreateSection(Name.c_str(), + false, + // FIXME: + SectionKind::Metadata); NewIDATASec = new PIC16Section(NewSection); IDATASections.push_back(NewIDATASec); } @@ -416,8 +423,9 @@ PIC16Section *NewRomSec = FoundROSec; if (NewRomSec == NULL) { - const Section *NewSection = getNamedSection(Name.c_str(), - SectionKind::ReadOnly); + const Section *NewSection = getOrCreateSection(Name.c_str(), + false, + SectionKind::ReadOnly); NewRomSec = new PIC16Section(NewSection); ROSections.push_back(NewRomSec); } Modified: llvm/trunk/lib/Target/PowerPC/PPCTargetAsmInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/PPCTargetAsmInfo.cpp?rev=77186&r1=77185&r2=77186&view=diff ============================================================================== --- llvm/trunk/lib/Target/PowerPC/PPCTargetAsmInfo.cpp (original) +++ llvm/trunk/lib/Target/PowerPC/PPCTargetAsmInfo.cpp Mon Jul 27 01:17:14 2009 @@ -71,7 +71,7 @@ BSSSection = "\t.section\t\".sbss\",\"aw\", at nobits"; // PPC/Linux normally uses named section for BSS. - BSSSection_ = getNamedSection("\t.bss", SectionKind::BSS); + BSSSection_ = getOrCreateSection("\t.bss", true, SectionKind::BSS); // Debug Information AbsoluteDebugSectionOffsets = true; Modified: llvm/trunk/lib/Target/Sparc/SparcTargetAsmInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Sparc/SparcTargetAsmInfo.cpp?rev=77186&r1=77185&r2=77186&view=diff ============================================================================== --- llvm/trunk/lib/Target/Sparc/SparcTargetAsmInfo.cpp (original) +++ llvm/trunk/lib/Target/Sparc/SparcTargetAsmInfo.cpp Mon Jul 27 01:17:14 2009 @@ -27,7 +27,7 @@ CStringSection=".rodata.str"; // Sparc normally uses named section for BSS. - BSSSection_ = getNamedSection("\t.bss", SectionKind::BSS); + BSSSection_ = getOrCreateSection("\t.bss", true, SectionKind::BSS); } Modified: llvm/trunk/lib/Target/SystemZ/SystemZTargetAsmInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/SystemZ/SystemZTargetAsmInfo.cpp?rev=77186&r1=77185&r2=77186&view=diff ============================================================================== --- llvm/trunk/lib/Target/SystemZ/SystemZTargetAsmInfo.cpp (original) +++ llvm/trunk/lib/Target/SystemZ/SystemZTargetAsmInfo.cpp Mon Jul 27 01:17:14 2009 @@ -28,5 +28,5 @@ NonexecutableStackDirective = "\t.section\t.note.GNU-stack,\"\", at progbits"; - BSSSection_ = getUnnamedSection("\t.bss", SectionKind::BSS); + BSSSection_ = getOrCreateSection("\t.bss", true, SectionKind::BSS); } Modified: llvm/trunk/lib/Target/TargetAsmInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/TargetAsmInfo.cpp?rev=77186&r1=77185&r2=77186&view=diff ============================================================================== --- llvm/trunk/lib/Target/TargetAsmInfo.cpp (original) +++ llvm/trunk/lib/Target/TargetAsmInfo.cpp Mon Jul 27 01:17:14 2009 @@ -122,8 +122,8 @@ DwarfEHFrameSection = ".eh_frame"; DwarfExceptionSection = ".gcc_except_table"; AsmTransCBE = 0; - TextSection = getUnnamedSection("\t.text", SectionKind::Text); - DataSection = getUnnamedSection("\t.data", SectionKind::DataRel); + TextSection = getOrCreateSection("\t.text", true, SectionKind::Text); + DataSection = getOrCreateSection("\t.data", true, SectionKind::DataRel); } TargetAsmInfo::~TargetAsmInfo() { @@ -314,7 +314,7 @@ // section and still get the appropriate section flags printed. GVKind = getKindForNamedSection(GV->getSection().c_str(), GVKind); - return getNamedSection(GV->getSection().c_str(), GVKind); + return getOrCreateSection(GV->getSection().c_str(), false, GVKind); } // If this global is linkonce/weak and the target handles this by emitting it @@ -323,7 +323,7 @@ if (const char *Prefix = getSectionPrefixForUniqueGlobal(Kind)) { // FIXME: Use mangler interface (PR4584). std::string Name = Prefix+GV->getNameStr(); - return getNamedSection(Name.c_str(), GVKind); + return getOrCreateSection(Name.c_str(), false, GVKind); } } @@ -364,33 +364,20 @@ } -const Section *TargetAsmInfo::getNamedSection(const char *Name, - SectionKind::Kind Kind) const { +const Section *TargetAsmInfo::getOrCreateSection(const char *Name, + bool isDirective, + SectionKind::Kind Kind) const { Section &S = Sections[Name]; // This is newly-created section, set it up properly. if (S.Name.empty()) { - S.Kind = SectionKind::get(Kind, false /*weak*/, true /*Named*/); + S.Kind = SectionKind::get(Kind, false /*weak*/, !isDirective); S.Name = Name; } return &S; } -const Section* -TargetAsmInfo::getUnnamedSection(const char *Directive, - SectionKind::Kind Kind) const { - Section& S = Sections[Directive]; - - // This is newly-created section, set it up properly. - if (S.Name.empty()) { - S.Kind = SectionKind::get(Kind, false /*weak*/, false /*Named*/); - S.Name = Directive; - } - - return &S; -} - unsigned TargetAsmInfo::getULEB128Size(unsigned Value) { unsigned Size = 0; do { Modified: llvm/trunk/lib/Target/X86/X86TargetAsmInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86TargetAsmInfo.cpp?rev=77186&r1=77185&r2=77186&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86TargetAsmInfo.cpp (original) +++ llvm/trunk/lib/Target/X86/X86TargetAsmInfo.cpp Mon Jul 27 01:17:14 2009 @@ -57,8 +57,8 @@ ConstantPoolSection = "\t.const\n"; // FIXME: Why don't we always use this section? if (is64Bit) - SixteenByteConstantSection = getUnnamedSection("\t.literal16\n", - SectionKind::MergeableConst16); + SixteenByteConstantSection = + getOrCreateSection("\t.literal16\n", true, SectionKind::MergeableConst16); LCOMMDirective = "\t.lcomm\t"; // Leopard and above support aligned common symbols. @@ -100,23 +100,20 @@ bool Global) const { if (Reason == DwarfEncoding::Functions && Global) return (DW_EH_PE_pcrel | DW_EH_PE_indirect | DW_EH_PE_sdata4); - else if (Reason == DwarfEncoding::CodeLabels || !Global) + if (Reason == DwarfEncoding::CodeLabels || !Global) return DW_EH_PE_pcrel; - else - return DW_EH_PE_absptr; + return DW_EH_PE_absptr; } const char * -X86DarwinTargetAsmInfo::getEHGlobalPrefix() const -{ +X86DarwinTargetAsmInfo::getEHGlobalPrefix() const { const X86Subtarget* Subtarget = &TM.getSubtarget(); if (Subtarget->getDarwinVers() > 9) return PrivateGlobalPrefix; - else - return ""; + return ""; } -X86ELFTargetAsmInfo::X86ELFTargetAsmInfo(const X86TargetMachine &TM): +X86ELFTargetAsmInfo::X86ELFTargetAsmInfo(const X86TargetMachine &TM) : X86TargetAsmInfo(TM) { CStringSection = ".rodata.str"; @@ -128,7 +125,7 @@ // Set up DWARF directives HasLEB128 = true; // Target asm supports leb128 directives (little-endian) - BSSSection_ = getUnnamedSection("\t.bss", SectionKind::BSS); + BSSSection_ = getOrCreateSection("\t.bss", true, SectionKind::BSS); // Debug Information AbsoluteDebugSectionOffsets = true; @@ -314,8 +311,8 @@ AlignmentIsInBytes = true; - TextSection = getUnnamedSection("_text", SectionKind::Text); - DataSection = getUnnamedSection("_data", SectionKind::DataRel); + TextSection = getOrCreateSection("_text", true, SectionKind::Text); + DataSection = getOrCreateSection("_data", true, SectionKind::DataRel); JumpTableDataSection = NULL; SwitchToSectionDirective = ""; Modified: llvm/trunk/lib/Target/XCore/XCoreTargetAsmInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/XCore/XCoreTargetAsmInfo.cpp?rev=77186&r1=77185&r2=77186&view=diff ============================================================================== --- llvm/trunk/lib/Target/XCore/XCoreTargetAsmInfo.cpp (original) +++ llvm/trunk/lib/Target/XCore/XCoreTargetAsmInfo.cpp Mon Jul 27 01:17:14 2009 @@ -24,9 +24,9 @@ XCoreTargetAsmInfo::XCoreTargetAsmInfo(const XCoreTargetMachine &TM) : ELFTargetAsmInfo(TM) { SupportsDebugInformation = true; - TextSection = getUnnamedSection("\t.text", SectionKind::Text); - DataSection = getNamedSection("\t.dp.data", SectionKind::DataRel); - BSSSection_ = getNamedSection("\t.dp.bss", SectionKind::BSS); + TextSection = getOrCreateSection("\t.text", true, SectionKind::Text); + DataSection = getOrCreateSection("\t.dp.data", false, SectionKind::DataRel); + BSSSection_ = getOrCreateSection("\t.dp.bss", false, SectionKind::BSS); // TLS globals are lowered in the backend to arrays indexed by the current // thread id. After lowering they require no special handling by the linker @@ -36,9 +36,11 @@ if (TM.getSubtargetImpl()->isXS1A()) // FIXME: Why is this writable??? - ReadOnlySection = getNamedSection("\t.dp.rodata", SectionKind::DataRel); + ReadOnlySection = getOrCreateSection("\t.dp.rodata", false, + SectionKind::DataRel); else - ReadOnlySection = getNamedSection("\t.cp.rodata", SectionKind::ReadOnly); + ReadOnlySection = getOrCreateSection("\t.cp.rodata", false, + SectionKind::ReadOnly); Data16bitsDirective = "\t.short\t"; Data32bitsDirective = "\t.long\t"; Data64bitsDirective = 0; From benny.kra at googlemail.com Mon Jul 27 04:07:14 2009 From: benny.kra at googlemail.com (Benjamin Kramer) Date: Mon, 27 Jul 2009 09:07:14 -0000 Subject: [llvm-commits] [llvm] r77187 - /llvm/trunk/lib/AsmParser/LLParser.cpp Message-ID: <200907270907.n6R97JfW029846@zion.cs.uiuc.edu> Author: d0k Date: Mon Jul 27 04:06:52 2009 New Revision: 77187 URL: http://llvm.org/viewvc/llvm-project?rev=77187&view=rev Log: Test commit: fix typo Modified: llvm/trunk/lib/AsmParser/LLParser.cpp Modified: llvm/trunk/lib/AsmParser/LLParser.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/AsmParser/LLParser.cpp?rev=77187&r1=77186&r2=77187&view=diff ============================================================================== --- llvm/trunk/lib/AsmParser/LLParser.cpp (original) +++ llvm/trunk/lib/AsmParser/LLParser.cpp Mon Jul 27 04:06:52 2009 @@ -436,7 +436,7 @@ SmallVector Elts; if (ParseMDNodeVector(Elts) - || ParseToken(lltok::rbrace, "exected end of metadata node")) + || ParseToken(lltok::rbrace, "expected end of metadata node")) return true; MDNode *Init = Context.getMDNode(Elts.data(), Elts.size()); From benny.kra at googlemail.com Mon Jul 27 04:39:47 2009 From: benny.kra at googlemail.com (Benjamin Kramer) Date: Mon, 27 Jul 2009 09:39:47 -0000 Subject: [llvm-commits] [llvm] r77188 - in /llvm/trunk: unittests/Makefile utils/unittest/googletest/Makefile Message-ID: <200907270939.n6R9dpx8031057@zion.cs.uiuc.edu> Author: d0k Date: Mon Jul 27 04:39:18 2009 New Revision: 77188 URL: http://llvm.org/viewvc/llvm-project?rev=77188&view=rev Log: Remove trailing slashes from include paths. Some versions of mingw don't like them. Modified: llvm/trunk/unittests/Makefile llvm/trunk/utils/unittest/googletest/Makefile Modified: llvm/trunk/unittests/Makefile URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/Makefile?rev=77188&r1=77187&r2=77188&view=diff ============================================================================== --- llvm/trunk/unittests/Makefile (original) +++ llvm/trunk/unittests/Makefile Mon Jul 27 04:39:18 2009 @@ -13,7 +13,7 @@ LIBRARYNAME = UnitTestMain BUILD_ARCHIVE = 1 -CPP.Flags += -I$(LLVM_SRC_ROOT)/utils/unittest/googletest/include/ +CPP.Flags += -I$(LLVM_SRC_ROOT)/utils/unittest/googletest/include CPP.Flags += -Wno-variadic-macros PARALLEL_DIRS = ADT ExecutionEngine Support VMCore MC Modified: llvm/trunk/utils/unittest/googletest/Makefile URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/unittest/googletest/Makefile?rev=77188&r1=77187&r2=77188&view=diff ============================================================================== --- llvm/trunk/utils/unittest/googletest/Makefile (original) +++ llvm/trunk/utils/unittest/googletest/Makefile Mon Jul 27 04:39:18 2009 @@ -15,7 +15,7 @@ LIBRARYNAME = GoogleTest BUILD_ARCHIVE = 1 -CPP.Flags += -I$(LLVM_SRC_ROOT)/utils/unittest/googletest/include/ +CPP.Flags += -I$(LLVM_SRC_ROOT)/utils/unittest/googletest/include CPP.Flags += $(NO_MISSING_FIELD_INITIALIZERS) $(NO_VARIADIC_MACROS) ifeq ($(OS),MingW) From lattner at cs.uiuc.edu Mon Jul 27 10:16:44 2009 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Mon, 27 Jul 2009 10:16:44 -0500 Subject: [llvm-commits] CVS: llvm-www/Users.html Message-ID: <200907271516.n6RFGiBZ009812@zion.cs.uiuc.edu> Changes in directory llvm-www: Users.html updated: 1.54 -> 1.55 --- Log message: move open source projects above educational users. --- Diffs of the changes: (+59 -58) Users.html | 117 ++++++++++++++++++++++++++++++------------------------------- 1 files changed, 59 insertions(+), 58 deletions(-) Index: llvm-www/Users.html diff -u llvm-www/Users.html:1.54 llvm-www/Users.html:1.55 --- llvm-www/Users.html:1.54 Mon Jul 20 09:21:44 2009 +++ llvm-www/Users.html Mon Jul 27 10:13:15 2009 @@ -311,63 +311,6 @@
-
Educational Users
- - -
-
Open Source Projects
@@ -445,6 +388,64 @@
+ +
+ +
Educational Users
+ +
@@ -455,6 +456,6 @@ src="http://www.w3.org/Icons/valid-html401" alt="Valid HTML 4.01!">
LLVM Development List
- Last modified: $Date: 2009/07/20 14:21:44 $ + Last modified: $Date: 2009/07/27 15:13:15 $ From sabre at nondot.org Mon Jul 27 10:16:44 2009 From: sabre at nondot.org (Chris Lattner) Date: Mon, 27 Jul 2009 10:16:44 -0500 Subject: [llvm-commits] CVS: llvm-www/Users.html Message-ID: <200907271516.n6RFGiWl009811@zion.cs.uiuc.edu> Changes in directory llvm-www: Users.html updated: 1.55 -> 1.56 --- Log message: move open source projects above research groups --- Diffs of the changes: (+81 -80) Users.html | 161 ++++++++++++++++++++++++++++++------------------------------- 1 files changed, 81 insertions(+), 80 deletions(-) Index: llvm-www/Users.html diff -u llvm-www/Users.html:1.55 llvm-www/Users.html:1.56 --- llvm-www/Users.html:1.55 Mon Jul 27 10:13:15 2009 +++ llvm-www/Users.html Mon Jul 27 10:14:52 2009 @@ -152,6 +152,86 @@
+ +
Open Source Projects
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
ProjectDescription
+ IcedTea Version of Sun's OpenJDKUses LLVM as JIT on architectures other than x86 and Sparc.
PyPy ProjectPython interpreter written in Python. Targets LLVM and C.
Faust Signal Processing LanguageSignal processing language, uses the LLVM JIT for runtime codegen.
+ iPhone tool chainllvm-gcc Compiler for iPhone Dev Wiki toolchain.
IOQuake3IOQuake3 Raytracing Patch, uses LLVM for runtime shader compilation.
+ llvm-py: Python Bindings for LLVMBuild compilers and VMs in Python, using the LLVM Backend.
+ LLVM D CompilerD compiler with LLVM backend.
+ Unladen SwallowA faster implementation of Python.
+ MonoMono has an option to use LLVM for JIT compilation.
+
+ + + +
Academic Research Users
@@ -311,85 +391,6 @@
-
Open Source Projects
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
ProjectDescription
- IcedTea Version of Sun's OpenJDKUses LLVM as JIT on architectures other than x86 and Sparc.
PyPy ProjectPython interpreter written in Python. Targets LLVM and C.
Faust Signal Processing LanguageSignal processing language, uses the LLVM JIT for runtime codegen.
- iPhone tool chainllvm-gcc Compiler for iPhone Dev Wiki toolchain.
IOQuake3IOQuake3 Raytracing Patch, uses LLVM for runtime shader compilation.
- llvm-py: Python Bindings for LLVMBuild compilers and VMs in Python, using the LLVM Backend.
- LLVM D CompilerD compiler with LLVM backend.
- Unladen SwallowA faster implementation of Python.
- MonoMono has an option to use LLVM for JIT compilation.
-
- -
- -
Educational Users
@@ -456,6 +457,6 @@ src="http://www.w3.org/Icons/valid-html401" alt="Valid HTML 4.01!">
LLVM Development List
- Last modified: $Date: 2009/07/27 15:13:15 $ + Last modified: $Date: 2009/07/27 15:14:52 $ From sabre at nondot.org Mon Jul 27 10:17:24 2009 From: sabre at nondot.org (Chris Lattner) Date: Mon, 27 Jul 2009 10:17:24 -0500 Subject: [llvm-commits] CVS: llvm-www/Users.html Message-ID: <200907271517.n6RFHNpt009846@zion.cs.uiuc.edu> Changes in directory llvm-www: Users.html updated: 1.56 -> 1.57 --- Log message: fix validation problem --- Diffs of the changes: (+3 -3) Users.html | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) Index: llvm-www/Users.html diff -u llvm-www/Users.html:1.56 llvm-www/Users.html:1.57 --- llvm-www/Users.html:1.56 Mon Jul 27 10:14:52 2009 +++ llvm-www/Users.html Mon Jul 27 10:17:07 2009 @@ -113,7 +113,7 @@ NVIDIA OpenCL runtime compiler (Clang + LLVM) - + @@ -248,7 +248,7 @@ Åbo Akademi University Johan Lilius's Research Group, ES Lab NECST project - + @@ -457,6 +457,6 @@ src="http://www.w3.org/Icons/valid-html401" alt="Valid HTML 4.01!">
LLVM Development List
- Last modified: $Date: 2009/07/27 15:14:52 $ + Last modified: $Date: 2009/07/27 15:17:07 $ From sabre at nondot.org Mon Jul 27 10:18:57 2009 From: sabre at nondot.org (Chris Lattner) Date: Mon, 27 Jul 2009 10:18:57 -0500 Subject: [llvm-commits] CVS: llvm-www/Users.html Message-ID: <200907271518.n6RFIvZq009933@zion.cs.uiuc.edu> Changes in directory llvm-www: Users.html updated: 1.57 -> 1.58 --- Log message: mroe validation problems --- Diffs of the changes: (+3 -3) Users.html | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) Index: llvm-www/Users.html diff -u llvm-www/Users.html:1.57 llvm-www/Users.html:1.58 --- llvm-www/Users.html:1.57 Mon Jul 27 10:17:07 2009 +++ llvm-www/Users.html Mon Jul 27 10:18:40 2009 @@ -169,7 +169,7 @@ within IcedTea --> - IcedTea Version of Sun's OpenJDK + IcedTea Version of Sun's OpenJDK Uses LLVM as JIT on architectures other than x86 and Sparc. @@ -196,7 +196,7 @@ IOQuake3 - IOQuake3 Raytracing Patch, uses LLVM for runtime shader compilation. + IOQuake3 Raytracing Patch, uses LLVM for runtime shader compilation. @@ -457,6 +457,6 @@ src="http://www.w3.org/Icons/valid-html401" alt="Valid HTML 4.01!">
LLVM Development List
- Last modified: $Date: 2009/07/27 15:17:07 $ + Last modified: $Date: 2009/07/27 15:18:40 $ From edwintorok at gmail.com Mon Jul 27 10:19:45 2009 From: edwintorok at gmail.com (=?ISO-8859-1?Q?T=F6r=F6k_Edwin?=) Date: Mon, 27 Jul 2009 18:19:45 +0300 Subject: [llvm-commits] [llvm] r77162 - /llvm/tags/Apple/llvmCore-XXXX/ In-Reply-To: <3B4176C9-7E28-45EB-BB13-455DE5E6F7CC@gmail.com> References: <200907261840.n6QIeHnw025849@zion.cs.uiuc.edu> <5D9E9D3C-DEB3-45CE-A1F7-32CB43D937A5@gmail.com> <3B4176C9-7E28-45EB-BB13-455DE5E6F7CC@gmail.com> Message-ID: <4A6DC591.80108@gmail.com> On 2009-07-26 23:53, Bill Wendling wrote: > On Jul 26, 2009, at 1:25 PM, Jon Ziegler wrote: > >> As an aside, during execution of your script, it asked for this: >> Authentication realm: LLVM Subversion >> repository >> Password for 'root': >> a couple of times, which seems unlikely to be what is desired. >> >> > That's coming from SVN. I've had it happen to me too. It seems to go > away (for the next time) after entering the password. It comes back at > random, though... > Why root? Surely you are not committing as root ... Best regards, --Edwin From sabre at nondot.org Mon Jul 27 10:25:31 2009 From: sabre at nondot.org (Chris Lattner) Date: Mon, 27 Jul 2009 10:25:31 -0500 Subject: [llvm-commits] CVS: llvm-www/Users.html Message-ID: <200907271525.n6RFPV0p010174@zion.cs.uiuc.edu> Changes in directory llvm-www: Users.html updated: 1.58 -> 1.59 --- Log message: add Objective Modula-2, from Benjamin Kowarsch --- Diffs of the changes: (+6 -1) Users.html | 7 ++++++- 1 files changed, 6 insertions(+), 1 deletion(-) Index: llvm-www/Users.html diff -u llvm-www/Users.html:1.58 llvm-www/Users.html:1.59 --- llvm-www/Users.html:1.58 Mon Jul 27 10:18:40 2009 +++ llvm-www/Users.html Mon Jul 27 10:24:16 2009 @@ -163,6 +163,11 @@ Project Description + + + Objective Modula-2 Project + Modula-2 compiler w/ObjC runtime support. Targets Objective-C and LLVM. + From sabre at nondot.org Mon Jul 27 10:44:18 2009 From: sabre at nondot.org (Chris Lattner) Date: Mon, 27 Jul 2009 15:44:18 -0000 Subject: [llvm-commits] [llvm] r77191 - in /llvm/trunk/lib/Target: DarwinTargetAsmInfo.cpp X86/X86TargetAsmInfo.cpp Message-ID: <200907271544.n6RFiJHp010799@zion.cs.uiuc.edu> Author: lattner Date: Mon Jul 27 10:44:04 2009 New Revision: 77191 URL: http://llvm.org/viewvc/llvm-project?rev=77191&view=rev Log: 32-bit darwin targets support .literal16 too. Modified: llvm/trunk/lib/Target/DarwinTargetAsmInfo.cpp llvm/trunk/lib/Target/X86/X86TargetAsmInfo.cpp Modified: llvm/trunk/lib/Target/DarwinTargetAsmInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/DarwinTargetAsmInfo.cpp?rev=77191&r1=77190&r2=77191&view=diff ============================================================================== --- llvm/trunk/lib/Target/DarwinTargetAsmInfo.cpp (original) +++ llvm/trunk/lib/Target/DarwinTargetAsmInfo.cpp Mon Jul 27 10:44:04 2009 @@ -34,10 +34,8 @@ SectionKind::MergeableConst4); EightByteConstantSection = getOrCreateSection("\t.literal8\n", true, SectionKind::MergeableConst8); - - // Note: 16-byte constant section is subtarget specific and should be provided - // there, if needed. - SixteenByteConstantSection = 0; + SixteenByteConstantSection = + getOrCreateSection("\t.literal16\n", true, SectionKind::MergeableConst16); ReadOnlySection = getOrCreateSection("\t.const", true, SectionKind::ReadOnly); @@ -150,7 +148,7 @@ return FourByteConstantSection; if (Kind.isMergeableConst8()) return EightByteConstantSection; - if (Kind.isMergeableConst16() && SixteenByteConstantSection) + if (Kind.isMergeableConst16()) return SixteenByteConstantSection; return ReadOnlySection; // .const } @@ -196,7 +194,7 @@ return FourByteConstantSection; if (Kind.isMergeableConst8()) return EightByteConstantSection; - if (Kind.isMergeableConst16() && SixteenByteConstantSection) + if (Kind.isMergeableConst16()) return SixteenByteConstantSection; return ReadOnlySection; // .const } Modified: llvm/trunk/lib/Target/X86/X86TargetAsmInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86TargetAsmInfo.cpp?rev=77191&r1=77190&r2=77191&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86TargetAsmInfo.cpp (original) +++ llvm/trunk/lib/Target/X86/X86TargetAsmInfo.cpp Mon Jul 27 10:44:04 2009 @@ -55,10 +55,6 @@ ConstantPoolSection = "\t.const_data"; else ConstantPoolSection = "\t.const\n"; - // FIXME: Why don't we always use this section? - if (is64Bit) - SixteenByteConstantSection = - getOrCreateSection("\t.literal16\n", true, SectionKind::MergeableConst16); LCOMMDirective = "\t.lcomm\t"; // Leopard and above support aligned common symbols. From sabre at nondot.org Mon Jul 27 10:52:59 2009 From: sabre at nondot.org (Chris Lattner) Date: Mon, 27 Jul 2009 15:52:59 -0000 Subject: [llvm-commits] [llvm] r77192 - /llvm/trunk/test/CodeGen/X86/global-sections.ll Message-ID: <200907271552.n6RFqxPc011077@zion.cs.uiuc.edu> Author: lattner Date: Mon Jul 27 10:52:58 2009 New Revision: 77192 URL: http://llvm.org/viewvc/llvm-project?rev=77192&view=rev Log: update testcase. Modified: llvm/trunk/test/CodeGen/X86/global-sections.ll Modified: llvm/trunk/test/CodeGen/X86/global-sections.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/global-sections.ll?rev=77192&r1=77191&r2=77192&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/X86/global-sections.ll (original) +++ llvm/trunk/test/CodeGen/X86/global-sections.ll Mon Jul 27 10:52:58 2009 @@ -37,7 +37,7 @@ ; _Complex long long const G4 = 34; @G4 = constant {i64,i64} { i64 34, i64 0 } -; DARWIN: .const +; DARWIN: .literal16 ; DARWIN: _G4: ; DARWIN: .long 34 From gohman at apple.com Mon Jul 27 11:09:53 2009 From: gohman at apple.com (Dan Gohman) Date: Mon, 27 Jul 2009 16:09:53 -0000 Subject: [llvm-commits] [llvm] r77193 - in /llvm/trunk: include/llvm/Analysis/ScalarEvolution.h lib/Analysis/ScalarEvolution.cpp Message-ID: <200907271609.n6RG9tID011559@zion.cs.uiuc.edu> Author: djg Date: Mon Jul 27 11:09:48 2009 New Revision: 77193 URL: http://llvm.org/viewvc/llvm-project?rev=77193&view=rev Log: Fix wording in comments. Modified: llvm/trunk/include/llvm/Analysis/ScalarEvolution.h llvm/trunk/lib/Analysis/ScalarEvolution.cpp Modified: llvm/trunk/include/llvm/Analysis/ScalarEvolution.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/ScalarEvolution.h?rev=77193&r1=77192&r2=77193&view=diff ============================================================================== --- llvm/trunk/include/llvm/Analysis/ScalarEvolution.h (original) +++ llvm/trunk/include/llvm/Analysis/ScalarEvolution.h Mon Jul 27 11:09:48 2009 @@ -299,7 +299,7 @@ const Loop *L, ICmpInst::Predicate p); - /// ComputeBackedgeTakenCountExhaustively - If the trip is known to execute + /// ComputeBackedgeTakenCountExhaustively - If the loop is known to execute /// a constant number of times (the condition evolves only from constants), /// try to evaluate a few iterations of the loop until we get the exit /// condition gets a value of ExitWhen (true or false). If we cannot Modified: llvm/trunk/lib/Analysis/ScalarEvolution.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/ScalarEvolution.cpp?rev=77193&r1=77192&r2=77193&view=diff ============================================================================== --- llvm/trunk/lib/Analysis/ScalarEvolution.cpp (original) +++ llvm/trunk/lib/Analysis/ScalarEvolution.cpp Mon Jul 27 11:09:48 2009 @@ -3709,7 +3709,7 @@ } } -/// ComputeBackedgeTakenCountExhaustively - If the trip is known to execute a +/// ComputeBackedgeTakenCountExhaustively - If the loop is known to execute a /// constant number of times (the condition evolves only from constants), /// try to evaluate a few iterations of the loop until we get the exit /// condition gets a value of ExitWhen (true or false). If we cannot From gohman at apple.com Mon Jul 27 11:11:46 2009 From: gohman at apple.com (Dan Gohman) Date: Mon, 27 Jul 2009 16:11:46 -0000 Subject: [llvm-commits] [llvm] r77194 - in /llvm/trunk: lib/AsmParser/LLParser.cpp lib/VMCore/AsmWriter.cpp test/Analysis/ScalarEvolution/nsw.ll test/Assembler/flags-reversed.ll test/Assembler/flags-signed.ll test/Assembler/flags-unsigned.ll test/Assembler/flags.ll Message-ID: <200907271611.n6RGBlZ4011643@zion.cs.uiuc.edu> Author: djg Date: Mon Jul 27 11:11:46 2009 New Revision: 77194 URL: http://llvm.org/viewvc/llvm-project?rev=77194&view=rev Log: Change the assembly syntax for nsw, nuw, and exact, putting them after their associated opcodes rather than before. This makes them a little easier to read. Modified: llvm/trunk/lib/AsmParser/LLParser.cpp llvm/trunk/lib/VMCore/AsmWriter.cpp llvm/trunk/test/Analysis/ScalarEvolution/nsw.ll llvm/trunk/test/Assembler/flags-reversed.ll llvm/trunk/test/Assembler/flags-signed.ll llvm/trunk/test/Assembler/flags-unsigned.ll llvm/trunk/test/Assembler/flags.ll Modified: llvm/trunk/lib/AsmParser/LLParser.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/AsmParser/LLParser.cpp?rev=77194&r1=77193&r2=77194&view=diff ============================================================================== --- llvm/trunk/lib/AsmParser/LLParser.cpp (original) +++ llvm/trunk/lib/AsmParser/LLParser.cpp Mon Jul 27 11:11:46 2009 @@ -1954,9 +1954,27 @@ case lltok::kw_urem: case lltok::kw_srem: case lltok::kw_frem: { + bool NUW = false; + bool NSW = false; + bool Exact = false; unsigned Opc = Lex.getUIntVal(); Constant *Val0, *Val1; Lex.Lex(); + LocTy ModifierLoc = Lex.getLoc(); + if (Opc == Instruction::Add || + Opc == Instruction::Sub || + Opc == Instruction::Mul) { + if (EatIfPresent(lltok::kw_nuw)) + NUW = true; + if (EatIfPresent(lltok::kw_nsw)) { + NSW = true; + if (EatIfPresent(lltok::kw_nuw)) + NUW = true; + } + } else if (Opc == Instruction::SDiv) { + if (EatIfPresent(lltok::kw_exact)) + Exact = true; + } if (ParseToken(lltok::lparen, "expected '(' in binary constantexpr") || ParseGlobalTypeAndValue(Val0) || ParseToken(lltok::comma, "expected comma in binary constantexpr") || @@ -1965,10 +1983,25 @@ return true; if (Val0->getType() != Val1->getType()) return Error(ID.Loc, "operands of constexpr must have same type"); + if (!Val0->getType()->isIntOrIntVector()) { + if (NUW) + return Error(ModifierLoc, "nuw only applies to integer operations"); + if (NSW) + return Error(ModifierLoc, "nsw only applies to integer operations"); + } + // API compatibility: Accept either integer or floating-point types with + // add, sub, and mul. if (!Val0->getType()->isIntOrIntVector() && !Val0->getType()->isFPOrFPVector()) return Error(ID.Loc,"constexpr requires integer, fp, or vector operands"); - ID.ConstantVal = Context.getConstantExpr(Opc, Val0, Val1); + Constant *C = Context.getConstantExpr(Opc, Val0, Val1); + if (NUW) + cast(C)->setHasNoUnsignedOverflow(true); + if (NSW) + cast(C)->setHasNoSignedOverflow(true); + if (Exact) + cast(C)->setIsExact(true); + ID.ConstantVal = C; ID.Kind = ValID::t_Constant; return false; } @@ -2055,49 +2088,6 @@ ID.Kind = ValID::t_Constant; return false; } - case lltok::kw_nuw: { - Lex.Lex(); - bool AlsoSigned = EatIfPresent(lltok::kw_nsw); - if (Lex.getKind() != lltok::kw_add && - Lex.getKind() != lltok::kw_sub && - Lex.getKind() != lltok::kw_mul) - return TokError("expected 'add', 'sub', or 'mul'"); - bool Result = LLParser::ParseValID(ID); - if (!Result) { - cast(ID.ConstantVal) - ->setHasNoUnsignedOverflow(true); - if (AlsoSigned) - cast(ID.ConstantVal) - ->setHasNoSignedOverflow(true); - } - return Result; - } - case lltok::kw_nsw: { - Lex.Lex(); - bool AlsoUnsigned = EatIfPresent(lltok::kw_nuw); - if (Lex.getKind() != lltok::kw_add && - Lex.getKind() != lltok::kw_sub && - Lex.getKind() != lltok::kw_mul) - return TokError("expected 'add', 'sub', or 'mul'"); - bool Result = LLParser::ParseValID(ID); - if (!Result) { - cast(ID.ConstantVal) - ->setHasNoSignedOverflow(true); - if (AlsoUnsigned) - cast(ID.ConstantVal) - ->setHasNoUnsignedOverflow(true); - } - return Result; - } - case lltok::kw_exact: { - Lex.Lex(); - if (Lex.getKind() != lltok::kw_sdiv) - return TokError("expected 'sdiv'"); - bool Result = LLParser::ParseValID(ID); - if (!Result) - cast(ID.ConstantVal)->setIsExact(true); - return Result; - } } Lex.Lex(); @@ -2563,15 +2553,49 @@ // Binary Operators. case lltok::kw_add: case lltok::kw_sub: - case lltok::kw_mul: + case lltok::kw_mul: { + bool NUW = false; + bool NSW = false; + LocTy ModifierLoc = Lex.getLoc(); + if (EatIfPresent(lltok::kw_nuw)) + NUW = true; + if (EatIfPresent(lltok::kw_nsw)) { + NSW = true; + if (EatIfPresent(lltok::kw_nuw)) + NUW = true; + } // API compatibility: Accept either integer or floating-point types. - return ParseArithmetic(Inst, PFS, KeywordVal, 0); + bool Result = ParseArithmetic(Inst, PFS, KeywordVal, 0); + if (!Result) { + if (!Inst->getType()->isIntOrIntVector()) { + if (NUW) + return Error(ModifierLoc, "nuw only applies to integer operations"); + if (NSW) + return Error(ModifierLoc, "nsw only applies to integer operations"); + } + if (NUW) + cast(Inst)->setHasNoUnsignedOverflow(true); + if (NSW) + cast(Inst)->setHasNoSignedOverflow(true); + } + return Result; + } case lltok::kw_fadd: case lltok::kw_fsub: case lltok::kw_fmul: return ParseArithmetic(Inst, PFS, KeywordVal, 2); + case lltok::kw_sdiv: { + bool Exact = false; + if (EatIfPresent(lltok::kw_exact)) + Exact = true; + bool Result = ParseArithmetic(Inst, PFS, KeywordVal, 1); + if (!Result) + if (Exact) + cast(Inst)->setIsExact(true); + return Result; + } + case lltok::kw_udiv: - case lltok::kw_sdiv: case lltok::kw_urem: case lltok::kw_srem: return ParseArithmetic(Inst, PFS, KeywordVal, 1); case lltok::kw_fdiv: @@ -2619,50 +2643,6 @@ return ParseStore(Inst, PFS, true); else return TokError("expected 'load' or 'store'"); - case lltok::kw_nuw: { - bool AlsoSigned = EatIfPresent(lltok::kw_nsw); - if (Lex.getKind() == lltok::kw_add || - Lex.getKind() == lltok::kw_sub || - Lex.getKind() == lltok::kw_mul) { - Lex.Lex(); - KeywordVal = Lex.getUIntVal(); - bool Result = ParseArithmetic(Inst, PFS, KeywordVal, 0); - if (!Result) { - cast(Inst)->setHasNoUnsignedOverflow(true); - if (AlsoSigned) - cast(Inst)->setHasNoSignedOverflow(true); - } - return Result; - } - return TokError("expected 'add', 'sub', or 'mul'"); - } - case lltok::kw_nsw: { - bool AlsoUnsigned = EatIfPresent(lltok::kw_nuw); - if (Lex.getKind() == lltok::kw_add || - Lex.getKind() == lltok::kw_sub || - Lex.getKind() == lltok::kw_mul) { - Lex.Lex(); - KeywordVal = Lex.getUIntVal(); - bool Result = ParseArithmetic(Inst, PFS, KeywordVal, 1); - if (!Result) { - cast(Inst)->setHasNoSignedOverflow(true); - if (AlsoUnsigned) - cast(Inst)->setHasNoUnsignedOverflow(true); - } - return Result; - } - return TokError("expected 'add', 'sub', or 'mul'"); - } - case lltok::kw_exact: - if (Lex.getKind() == lltok::kw_sdiv) { - Lex.Lex(); - KeywordVal = Lex.getUIntVal(); - bool Result = ParseArithmetic(Inst, PFS, KeywordVal, 1); - if (!Result) - cast(Inst)->setIsExact(true); - return Result; - } - return TokError("expected 'udiv'"); case lltok::kw_getresult: return ParseGetResult(Inst, PFS); case lltok::kw_getelementptr: return ParseGetElementPtr(Inst, PFS); case lltok::kw_extractvalue: return ParseExtractValue(Inst, PFS); Modified: llvm/trunk/lib/VMCore/AsmWriter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/AsmWriter.cpp?rev=77194&r1=77193&r2=77194&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/AsmWriter.cpp (original) +++ llvm/trunk/lib/VMCore/AsmWriter.cpp Mon Jul 27 11:11:46 2009 @@ -848,12 +848,12 @@ if (const OverflowingBinaryOperator *OBO = dyn_cast(U)) { if (OBO->hasNoUnsignedOverflow()) - Out << "nuw "; + Out << " nuw"; if (OBO->hasNoSignedOverflow()) - Out << "nsw "; + Out << " nsw"; } else if (const SDivOperator *Div = dyn_cast(U)) { if (Div->isExact()) - Out << "exact "; + Out << " exact"; } } @@ -1061,8 +1061,8 @@ } if (const ConstantExpr *CE = dyn_cast(CV)) { - WriteOptimizationInfo(Out, CE); Out << CE->getOpcodeName(); + WriteOptimizationInfo(Out, CE); if (CE->isCompare()) Out << ' ' << getPredicateText(CE->getPredicate()); Out << " ("; @@ -1694,12 +1694,12 @@ Out << "tail "; } - // Print out optimization information. - WriteOptimizationInfo(Out, &I); - // Print out the opcode... Out << I.getOpcodeName(); + // Print out optimization information. + WriteOptimizationInfo(Out, &I); + // Print out the compare instruction predicates if (const CmpInst *CI = dyn_cast(&I)) Out << ' ' << getPredicateText(CI->getPredicate()); Modified: llvm/trunk/test/Analysis/ScalarEvolution/nsw.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Analysis/ScalarEvolution/nsw.ll?rev=77194&r1=77193&r2=77194&view=diff ============================================================================== --- llvm/trunk/test/Analysis/ScalarEvolution/nsw.ll (original) +++ llvm/trunk/test/Analysis/ScalarEvolution/nsw.ll Mon Jul 27 11:11:46 2009 @@ -22,7 +22,7 @@ %tmp6 = sext i32 %i.01 to i64 ; [#uses=1] %tmp7 = getelementptr double* %p, i64 %tmp6 ; [#uses=1] store double %tmp5, double* %tmp7, align 8 - %tmp8 = nsw add i32 %i.01, 1 ; [#uses=2] + %tmp8 = add nsw i32 %i.01, 1 ; [#uses=2] br label %bb1 bb1: ; preds = %bb Modified: llvm/trunk/test/Assembler/flags-reversed.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Assembler/flags-reversed.ll?rev=77194&r1=77193&r2=77194&view=diff ============================================================================== --- llvm/trunk/test/Assembler/flags-reversed.ll (original) +++ llvm/trunk/test/Assembler/flags-reversed.ll Mon Jul 27 11:11:46 2009 @@ -3,16 +3,16 @@ @addr = external global i64 define i64 @add_both_reversed_ce() { -; CHECK: ret i64 nuw nsw add (i64 ptrtoint (i64* @addr to i64), i64 91) - ret i64 nsw nuw add (i64 ptrtoint (i64* @addr to i64), i64 91) +; CHECK: ret i64 add nuw nsw (i64 ptrtoint (i64* @addr to i64), i64 91) + ret i64 add nsw nuw (i64 ptrtoint (i64* @addr to i64), i64 91) } define i64 @sub_both_reversed_ce() { -; CHECK: ret i64 nuw nsw sub (i64 ptrtoint (i64* @addr to i64), i64 91) - ret i64 nsw nuw sub (i64 ptrtoint (i64* @addr to i64), i64 91) +; CHECK: ret i64 sub nuw nsw (i64 ptrtoint (i64* @addr to i64), i64 91) + ret i64 sub nsw nuw (i64 ptrtoint (i64* @addr to i64), i64 91) } define i64 @mul_both_reversed_ce() { -; CHECK: ret i64 nuw nsw mul (i64 ptrtoint (i64* @addr to i64), i64 91) - ret i64 nsw nuw mul (i64 ptrtoint (i64* @addr to i64), i64 91) +; CHECK: ret i64 mul nuw nsw (i64 ptrtoint (i64* @addr to i64), i64 91) + ret i64 mul nsw nuw (i64 ptrtoint (i64* @addr to i64), i64 91) } Modified: llvm/trunk/test/Assembler/flags-signed.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Assembler/flags-signed.ll?rev=77194&r1=77193&r2=77194&view=diff ============================================================================== --- llvm/trunk/test/Assembler/flags-signed.ll (original) +++ llvm/trunk/test/Assembler/flags-signed.ll Mon Jul 27 11:11:46 2009 @@ -3,16 +3,16 @@ @addr = external global i64 define i64 @add_signed_ce() { -; CHECK: ret i64 nsw add (i64 ptrtoint (i64* @addr to i64), i64 91) - ret i64 nsw add (i64 ptrtoint (i64* @addr to i64), i64 91) +; CHECK: ret i64 add nsw (i64 ptrtoint (i64* @addr to i64), i64 91) + ret i64 add nsw (i64 ptrtoint (i64* @addr to i64), i64 91) } define i64 @sub_signed_ce() { -; CHECK: ret i64 nsw sub (i64 ptrtoint (i64* @addr to i64), i64 91) - ret i64 nsw sub (i64 ptrtoint (i64* @addr to i64), i64 91) +; CHECK: ret i64 sub nsw (i64 ptrtoint (i64* @addr to i64), i64 91) + ret i64 sub nsw (i64 ptrtoint (i64* @addr to i64), i64 91) } define i64 @mul_signed_ce() { -; CHECK: ret i64 nsw mul (i64 ptrtoint (i64* @addr to i64), i64 91) - ret i64 nsw mul (i64 ptrtoint (i64* @addr to i64), i64 91) +; CHECK: ret i64 mul nsw (i64 ptrtoint (i64* @addr to i64), i64 91) + ret i64 mul nsw (i64 ptrtoint (i64* @addr to i64), i64 91) } Modified: llvm/trunk/test/Assembler/flags-unsigned.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Assembler/flags-unsigned.ll?rev=77194&r1=77193&r2=77194&view=diff ============================================================================== --- llvm/trunk/test/Assembler/flags-unsigned.ll (original) +++ llvm/trunk/test/Assembler/flags-unsigned.ll Mon Jul 27 11:11:46 2009 @@ -3,16 +3,16 @@ @addr = external global i64 define i64 @add_unsigned_ce() { -; CHECK: ret i64 nuw add (i64 ptrtoint (i64* @addr to i64), i64 91) - ret i64 nuw add (i64 ptrtoint (i64* @addr to i64), i64 91) +; CHECK: ret i64 add nuw (i64 ptrtoint (i64* @addr to i64), i64 91) + ret i64 add nuw (i64 ptrtoint (i64* @addr to i64), i64 91) } define i64 @sub_unsigned_ce() { -; CHECK: ret i64 nuw sub (i64 ptrtoint (i64* @addr to i64), i64 91) - ret i64 nuw sub (i64 ptrtoint (i64* @addr to i64), i64 91) +; CHECK: ret i64 sub nuw (i64 ptrtoint (i64* @addr to i64), i64 91) + ret i64 sub nuw (i64 ptrtoint (i64* @addr to i64), i64 91) } define i64 @mul_unsigned_ce() { -; CHECK: ret i64 nuw mul (i64 ptrtoint (i64* @addr to i64), i64 91) - ret i64 nuw mul (i64 ptrtoint (i64* @addr to i64), i64 91) +; CHECK: ret i64 mul nuw (i64 ptrtoint (i64* @addr to i64), i64 91) + ret i64 mul nuw (i64 ptrtoint (i64* @addr to i64), i64 91) } Modified: llvm/trunk/test/Assembler/flags.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Assembler/flags.ll?rev=77194&r1=77193&r2=77194&view=diff ============================================================================== --- llvm/trunk/test/Assembler/flags.ll (original) +++ llvm/trunk/test/Assembler/flags.ll Mon Jul 27 11:11:46 2009 @@ -3,38 +3,38 @@ @addr = external global i64 define i64 @add_unsigned(i64 %x, i64 %y) { -; CHECK: %z = nuw add i64 %x, %y - %z = nuw add i64 %x, %y +; CHECK: %z = add nuw i64 %x, %y + %z = add nuw i64 %x, %y ret i64 %z } define i64 @sub_unsigned(i64 %x, i64 %y) { -; CHECK: %z = nuw sub i64 %x, %y - %z = nuw sub i64 %x, %y +; CHECK: %z = sub nuw i64 %x, %y + %z = sub nuw i64 %x, %y ret i64 %z } define i64 @mul_unsigned(i64 %x, i64 %y) { -; CHECK: %z = nuw mul i64 %x, %y - %z = nuw mul i64 %x, %y +; CHECK: %z = mul nuw i64 %x, %y + %z = mul nuw i64 %x, %y ret i64 %z } define i64 @add_signed(i64 %x, i64 %y) { -; CHECK: %z = nsw add i64 %x, %y - %z = nsw add i64 %x, %y +; CHECK: %z = add nsw i64 %x, %y + %z = add nsw i64 %x, %y ret i64 %z } define i64 @sub_signed(i64 %x, i64 %y) { -; CHECK: %z = nsw sub i64 %x, %y - %z = nsw sub i64 %x, %y +; CHECK: %z = sub nsw i64 %x, %y + %z = sub nsw i64 %x, %y ret i64 %z } define i64 @mul_signed(i64 %x, i64 %y) { -; CHECK: %z = nsw mul i64 %x, %y - %z = nsw mul i64 %x, %y +; CHECK: %z = mul nsw i64 %x, %y + %z = mul nsw i64 %x, %y ret i64 %z } @@ -57,44 +57,44 @@ } define i64 @add_both(i64 %x, i64 %y) { -; CHECK: %z = nuw nsw add i64 %x, %y - %z = nuw nsw add i64 %x, %y +; CHECK: %z = add nuw nsw i64 %x, %y + %z = add nuw nsw i64 %x, %y ret i64 %z } define i64 @sub_both(i64 %x, i64 %y) { -; CHECK: %z = nuw nsw sub i64 %x, %y - %z = nuw nsw sub i64 %x, %y +; CHECK: %z = sub nuw nsw i64 %x, %y + %z = sub nuw nsw i64 %x, %y ret i64 %z } define i64 @mul_both(i64 %x, i64 %y) { -; CHECK: %z = nuw nsw mul i64 %x, %y - %z = nuw nsw mul i64 %x, %y +; CHECK: %z = mul nuw nsw i64 %x, %y + %z = mul nuw nsw i64 %x, %y ret i64 %z } define i64 @add_both_reversed(i64 %x, i64 %y) { -; CHECK: %z = nuw nsw add i64 %x, %y - %z = nsw nuw add i64 %x, %y +; CHECK: %z = add nuw nsw i64 %x, %y + %z = add nsw nuw i64 %x, %y ret i64 %z } define i64 @sub_both_reversed(i64 %x, i64 %y) { -; CHECK: %z = nuw nsw sub i64 %x, %y - %z = nsw nuw sub i64 %x, %y +; CHECK: %z = sub nuw nsw i64 %x, %y + %z = sub nsw nuw i64 %x, %y ret i64 %z } define i64 @mul_both_reversed(i64 %x, i64 %y) { -; CHECK: %z = nuw nsw mul i64 %x, %y - %z = nsw nuw mul i64 %x, %y +; CHECK: %z = mul nuw nsw i64 %x, %y + %z = mul nsw nuw i64 %x, %y ret i64 %z } define i64 @sdiv_exact(i64 %x, i64 %y) { -; CHECK: %z = exact sdiv i64 %x, %y - %z = exact sdiv i64 %x, %y +; CHECK: %z = sdiv exact i64 %x, %y + %z = sdiv exact i64 %x, %y ret i64 %z } @@ -105,21 +105,21 @@ } define i64 @add_both_ce() { -; CHECK: ret i64 nuw nsw add (i64 ptrtoint (i64* @addr to i64), i64 91) - ret i64 nsw nuw add (i64 ptrtoint (i64* @addr to i64), i64 91) +; CHECK: ret i64 add nuw nsw (i64 ptrtoint (i64* @addr to i64), i64 91) + ret i64 add nsw nuw (i64 ptrtoint (i64* @addr to i64), i64 91) } define i64 @sub_both_ce() { -; CHECK: ret i64 nuw nsw sub (i64 ptrtoint (i64* @addr to i64), i64 91) - ret i64 nsw nuw sub (i64 ptrtoint (i64* @addr to i64), i64 91) +; CHECK: ret i64 sub nuw nsw (i64 ptrtoint (i64* @addr to i64), i64 91) + ret i64 sub nsw nuw (i64 ptrtoint (i64* @addr to i64), i64 91) } define i64 @mul_both_ce() { -; CHECK: ret i64 nuw nsw mul (i64 ptrtoint (i64* @addr to i64), i64 91) - ret i64 nuw nsw mul (i64 ptrtoint (i64* @addr to i64), i64 91) +; CHECK: ret i64 mul nuw nsw (i64 ptrtoint (i64* @addr to i64), i64 91) + ret i64 mul nuw nsw (i64 ptrtoint (i64* @addr to i64), i64 91) } define i64 @sdiv_exact_ce() { -; CHECK: ret i64 exact sdiv (i64 ptrtoint (i64* @addr to i64), i64 91) - ret i64 exact sdiv (i64 ptrtoint (i64* @addr to i64), i64 91) +; CHECK: ret i64 sdiv exact (i64 ptrtoint (i64* @addr to i64), i64 91) + ret i64 sdiv exact (i64 ptrtoint (i64* @addr to i64), i64 91) } From clattner at apple.com Mon Jul 27 11:14:38 2009 From: clattner at apple.com (Chris Lattner) Date: Mon, 27 Jul 2009 09:14:38 -0700 Subject: [llvm-commits] [llvm] r77194 - in /llvm/trunk: lib/AsmParser/LLParser.cpp lib/VMCore/AsmWriter.cpp test/Analysis/ScalarEvolution/nsw.ll test/Assembler/flags-reversed.ll test/Assembler/flags-signed.ll test/Assembler/flags-unsigned.ll test/Assembler/flags.ll In-Reply-To: <200907271611.n6RGBlZ4011643@zion.cs.uiuc.edu> References: <200907271611.n6RGBlZ4011643@zion.cs.uiuc.edu> Message-ID: On Jul 27, 2009, at 9:11 AM, Dan Gohman wrote: > Author: djg > Date: Mon Jul 27 11:11:46 2009 > New Revision: 77194 > > URL: http://llvm.org/viewvc/llvm-project?rev=77194&view=rev > Log: > Change the assembly syntax for nsw, nuw, and exact, putting them > after their associated opcodes rather than before. This makes them > a little easier to read. Thanks Dan! -Chris From sanjiv.gupta at microchip.com Mon Jul 27 11:20:54 2009 From: sanjiv.gupta at microchip.com (Sanjiv Gupta) Date: Mon, 27 Jul 2009 16:20:54 -0000 Subject: [llvm-commits] [llvm] r77195 - /llvm/trunk/test/CodeGen/PIC16/global-in-user-section.ll Message-ID: <200907271620.n6RGKti2011875@zion.cs.uiuc.edu> Author: sgupta Date: Mon Jul 27 11:20:41 2009 New Revision: 77195 URL: http://llvm.org/viewvc/llvm-project?rev=77195&view=rev Log: Test case to check that separate section is created for a global variable specified with section attribute. Added: llvm/trunk/test/CodeGen/PIC16/global-in-user-section.ll Added: llvm/trunk/test/CodeGen/PIC16/global-in-user-section.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/PIC16/global-in-user-section.ll?rev=77195&view=auto ============================================================================== --- llvm/trunk/test/CodeGen/PIC16/global-in-user-section.ll (added) +++ llvm/trunk/test/CodeGen/PIC16/global-in-user-section.ll Mon Jul 27 11:20:41 2009 @@ -0,0 +1,5 @@ +; RUN: llvm-as < %s | llc -march=pic16 | FileCheck %s + + at G1 = common global i16 0, section "usersection", align 1 +; CHECK: usersection UDATA +; CHECK: @G1 RES 2 From sabre at nondot.org Mon Jul 27 11:20:59 2009 From: sabre at nondot.org (Chris Lattner) Date: Mon, 27 Jul 2009 16:20:59 -0000 Subject: [llvm-commits] [llvm] r77196 - in /llvm/trunk/lib/Target: DarwinTargetAsmInfo.cpp ELFTargetAsmInfo.cpp Message-ID: <200907271620.n6RGKxcv011891@zion.cs.uiuc.edu> Author: lattner Date: Mon Jul 27 11:20:58 2009 New Revision: 77196 URL: http://llvm.org/viewvc/llvm-project?rev=77196&view=rev Log: sink text/data section creation down into the target-specific places that should know about them. PECoff doesn't share these, and I want all sections to be created by object-file-specific code. Modified: llvm/trunk/lib/Target/DarwinTargetAsmInfo.cpp llvm/trunk/lib/Target/ELFTargetAsmInfo.cpp Modified: llvm/trunk/lib/Target/DarwinTargetAsmInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/DarwinTargetAsmInfo.cpp?rev=77196&r1=77195&r2=77196&view=diff ============================================================================== --- llvm/trunk/lib/Target/DarwinTargetAsmInfo.cpp (original) +++ llvm/trunk/lib/Target/DarwinTargetAsmInfo.cpp Mon Jul 27 11:20:58 2009 @@ -27,6 +27,8 @@ DarwinTargetAsmInfo::DarwinTargetAsmInfo(const TargetMachine &TM) : TargetAsmInfo(TM) { + TextSection = getOrCreateSection("\t.text", true, SectionKind::Text); + DataSection = getOrCreateSection("\t.data", true, SectionKind::DataRel); CStringSection_ = getOrCreateSection("\t.cstring", true, SectionKind::MergeableCString); @@ -50,7 +52,6 @@ SectionKind::ReadOnlyWithRel); DataCoalSection = getOrCreateSection("\t__DATA,__datacoal_nt,coalesced", false, SectionKind::DataRel); - // Common settings for all Darwin targets. // Syntax: Modified: llvm/trunk/lib/Target/ELFTargetAsmInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ELFTargetAsmInfo.cpp?rev=77196&r1=77195&r2=77196&view=diff ============================================================================== --- llvm/trunk/lib/Target/ELFTargetAsmInfo.cpp (original) +++ llvm/trunk/lib/Target/ELFTargetAsmInfo.cpp Mon Jul 27 11:20:58 2009 @@ -26,6 +26,9 @@ ELFTargetAsmInfo::ELFTargetAsmInfo(const TargetMachine &TM) : TargetAsmInfo(TM) { + + TextSection = getOrCreateSection("\t.text", true, SectionKind::Text); + DataSection = getOrCreateSection("\t.data", true, SectionKind::DataRel); ReadOnlySection = getOrCreateSection("\t.rodata", false, SectionKind::ReadOnly); TLSDataSection = From sanjiv.gupta at microchip.com Mon Jul 27 11:22:12 2009 From: sanjiv.gupta at microchip.com (Sanjiv Gupta) Date: Mon, 27 Jul 2009 21:52:12 +0530 Subject: [llvm-commits] [llvm] r77153 - /llvm/trunk/lib/Target/PIC16/PIC16TargetAsmInfo.cpp In-Reply-To: <7E5C84F2-926B-413A-8044-C03EDD7079EA@apple.com> References: <200907261025.n6QAPSPr012172@zion.cs.uiuc.edu> <7E5C84F2-926B-413A-8044-C03EDD7079EA@apple.com> Message-ID: <4A6DD434.5020005@microchip.com> Chris Lattner wrote: > > On Jul 26, 2009, at 3:25 AM, Sanjiv Gupta wrote: > >> Author: sgupta >> Date: Sun Jul 26 05:25:01 2009 >> New Revision: 77153 >> >> URL: http://llvm.org/viewvc/llvm-project?rev=77153&view=rev >> Log: >> Fix the breakage caused by 76950. >> PIC16 has special naming conventions for variables having section >> names specified via section attribute. > > Testcase?? r77195. - Sanjiv From sabre at nondot.org Mon Jul 27 11:22:40 2009 From: sabre at nondot.org (Chris Lattner) Date: Mon, 27 Jul 2009 16:22:40 -0000 Subject: [llvm-commits] [llvm] r77197 - /llvm/trunk/lib/Target/X86/X86TargetAsmInfo.cpp Message-ID: <200907271622.n6RGMfhc011944@zion.cs.uiuc.edu> Author: lattner Date: Mon Jul 27 11:22:39 2009 New Revision: 77197 URL: http://llvm.org/viewvc/llvm-project?rev=77197&view=rev Log: apparently we have "windows" and "coff", which are different(?) Modified: llvm/trunk/lib/Target/X86/X86TargetAsmInfo.cpp Modified: llvm/trunk/lib/Target/X86/X86TargetAsmInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86TargetAsmInfo.cpp?rev=77197&r1=77196&r2=77197&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86TargetAsmInfo.cpp (original) +++ llvm/trunk/lib/Target/X86/X86TargetAsmInfo.cpp Mon Jul 27 11:22:39 2009 @@ -191,6 +191,9 @@ X86COFFTargetAsmInfo::X86COFFTargetAsmInfo(const X86TargetMachine &TM): X86GenericTargetAsmInfo(TM) { + TextSection = getOrCreateSection("_text", true, SectionKind::Text); + DataSection = getOrCreateSection("_data", true, SectionKind::DataRel); + GlobalPrefix = "_"; LCOMMDirective = "\t.lcomm\t"; COMMDirectiveTakesAlignment = false; From sabre at nondot.org Mon Jul 27 11:27:49 2009 From: sabre at nondot.org (Chris Lattner) Date: Mon, 27 Jul 2009 16:27:49 -0000 Subject: [llvm-commits] [llvm] r77198 - in /llvm/trunk: include/llvm/Target/ELFTargetAsmInfo.h lib/Target/ELFTargetAsmInfo.cpp Message-ID: <200907271627.n6RGRqWL012088@zion.cs.uiuc.edu> Author: lattner Date: Mon Jul 27 11:27:32 2009 New Revision: 77198 URL: http://llvm.org/viewvc/llvm-project?rev=77198&view=rev Log: inline a method. Modified: llvm/trunk/include/llvm/Target/ELFTargetAsmInfo.h llvm/trunk/lib/Target/ELFTargetAsmInfo.cpp Modified: llvm/trunk/include/llvm/Target/ELFTargetAsmInfo.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/ELFTargetAsmInfo.h?rev=77198&r1=77197&r2=77198&view=diff ============================================================================== --- llvm/trunk/include/llvm/Target/ELFTargetAsmInfo.h (original) +++ llvm/trunk/include/llvm/Target/ELFTargetAsmInfo.h Mon Jul 27 11:27:32 2009 @@ -19,10 +19,8 @@ namespace llvm { class GlobalValue; - class GlobalVariable; - class Type; - struct ELFTargetAsmInfo: public TargetAsmInfo { + struct ELFTargetAsmInfo : public TargetAsmInfo { ELFTargetAsmInfo(const TargetMachine &TM); /// getSectionForMergeableConstant - Given a mergeable constant with the @@ -49,9 +47,6 @@ const Section *MergeableConst4Section; const Section *MergeableConst8Section; const Section *MergeableConst16Section; - - private: - const Section *MergeableStringSection(const GlobalVariable *GV) const; }; } Modified: llvm/trunk/lib/Target/ELFTargetAsmInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ELFTargetAsmInfo.cpp?rev=77198&r1=77197&r2=77198&view=diff ============================================================================== --- llvm/trunk/lib/Target/ELFTargetAsmInfo.cpp (original) +++ llvm/trunk/lib/Target/ELFTargetAsmInfo.cpp Mon Jul 27 11:27:32 2009 @@ -58,8 +58,30 @@ ELFTargetAsmInfo::SelectSectionForGlobal(const GlobalValue *GV, SectionKind Kind) const { if (Kind.isText()) return TextSection; - if (Kind.isMergeableCString()) - return MergeableStringSection(cast(GV)); + if (Kind.isMergeableCString()) { + const TargetData *TD = TM.getTargetData(); + Constant *C = cast(GV)->getInitializer(); + const Type *Ty = cast(C->getType())->getElementType(); + + unsigned Size = TD->getTypeAllocSize(Ty); + if (Size <= 16) { + assert(getCStringSection() && "Should have string section prefix"); + + // We also need alignment here. + // FIXME: this is getting the alignment of the character, not the + // alignment of the string!! + unsigned Align = TD->getPrefTypeAlignment(Ty); + if (Align < Size) + Align = Size; + + std::string Name = getCStringSection() + utostr(Size) + '.' + + utostr(Align); + return getOrCreateSection(Name.c_str(), false, + SectionKind::MergeableCString); + } + + return getReadOnlySection(); + } if (Kind.isMergeableConst()) { if (Kind.isMergeableConst4()) @@ -145,32 +167,6 @@ } - -const Section* -ELFTargetAsmInfo::MergeableStringSection(const GlobalVariable *GV) const { - const TargetData *TD = TM.getTargetData(); - Constant *C = cast(GV)->getInitializer(); - const Type *Ty = cast(C->getType())->getElementType(); - - unsigned Size = TD->getTypeAllocSize(Ty); - if (Size <= 16) { - assert(getCStringSection() && "Should have string section prefix"); - - // We also need alignment here. - // FIXME: this is getting the alignment of the character, not the alignment - // of the string!! - unsigned Align = TD->getPrefTypeAlignment(Ty); - if (Align < Size) - Align = Size; - - std::string Name = getCStringSection() + utostr(Size) + '.' + utostr(Align); - return getOrCreateSection(Name.c_str(), false, - SectionKind::MergeableCString); - } - - return getReadOnlySection(); -} - void ELFTargetAsmInfo::getSectionFlagsAsString(SectionKind Kind, SmallVectorImpl &Str) const { Str.push_back(','); From david_goodwin at apple.com Mon Jul 27 11:32:07 2009 From: david_goodwin at apple.com (David Goodwin) Date: Mon, 27 Jul 2009 16:32:07 -0000 Subject: [llvm-commits] [llvm] r77199 - in /llvm/trunk: lib/Target/ARM/ test/CodeGen/Thumb2/ Message-ID: <200907271632.n6RGWHet012263@zion.cs.uiuc.edu> Author: david_goodwin Date: Mon Jul 27 11:31:55 2009 New Revision: 77199 URL: http://llvm.org/viewvc/llvm-project?rev=77199&view=rev Log: Add ".w" suffix for wide thumb-2 instructions. Modified: llvm/trunk/lib/Target/ARM/ARMInstrThumb2.td llvm/trunk/test/CodeGen/Thumb2/carry.ll llvm/trunk/test/CodeGen/Thumb2/load-global.ll llvm/trunk/test/CodeGen/Thumb2/mul_const.ll llvm/trunk/test/CodeGen/Thumb2/pic-load.ll llvm/trunk/test/CodeGen/Thumb2/thumb2-adc2.ll llvm/trunk/test/CodeGen/Thumb2/thumb2-add2.ll llvm/trunk/test/CodeGen/Thumb2/thumb2-add4.ll llvm/trunk/test/CodeGen/Thumb2/thumb2-add5.ll llvm/trunk/test/CodeGen/Thumb2/thumb2-add6.ll llvm/trunk/test/CodeGen/Thumb2/thumb2-and.ll llvm/trunk/test/CodeGen/Thumb2/thumb2-asr.ll llvm/trunk/test/CodeGen/Thumb2/thumb2-asr2.ll llvm/trunk/test/CodeGen/Thumb2/thumb2-bic.ll llvm/trunk/test/CodeGen/Thumb2/thumb2-cmn.ll llvm/trunk/test/CodeGen/Thumb2/thumb2-cmn2.ll llvm/trunk/test/CodeGen/Thumb2/thumb2-cmp.ll llvm/trunk/test/CodeGen/Thumb2/thumb2-cmp2.ll llvm/trunk/test/CodeGen/Thumb2/thumb2-eor.ll llvm/trunk/test/CodeGen/Thumb2/thumb2-jtbl.ll llvm/trunk/test/CodeGen/Thumb2/thumb2-ldr.ll llvm/trunk/test/CodeGen/Thumb2/thumb2-ldrb.ll llvm/trunk/test/CodeGen/Thumb2/thumb2-ldrh.ll llvm/trunk/test/CodeGen/Thumb2/thumb2-lsl.ll llvm/trunk/test/CodeGen/Thumb2/thumb2-lsl2.ll llvm/trunk/test/CodeGen/Thumb2/thumb2-lsr.ll llvm/trunk/test/CodeGen/Thumb2/thumb2-lsr2.ll llvm/trunk/test/CodeGen/Thumb2/thumb2-mov3.ll llvm/trunk/test/CodeGen/Thumb2/thumb2-mvn2.ll llvm/trunk/test/CodeGen/Thumb2/thumb2-neg.ll llvm/trunk/test/CodeGen/Thumb2/thumb2-orn.ll llvm/trunk/test/CodeGen/Thumb2/thumb2-orr.ll llvm/trunk/test/CodeGen/Thumb2/thumb2-rev.ll llvm/trunk/test/CodeGen/Thumb2/thumb2-ror.ll llvm/trunk/test/CodeGen/Thumb2/thumb2-ror2.ll llvm/trunk/test/CodeGen/Thumb2/thumb2-rsb2.ll llvm/trunk/test/CodeGen/Thumb2/thumb2-sbc2.ll llvm/trunk/test/CodeGen/Thumb2/thumb2-str.ll llvm/trunk/test/CodeGen/Thumb2/thumb2-strb.ll llvm/trunk/test/CodeGen/Thumb2/thumb2-strh.ll llvm/trunk/test/CodeGen/Thumb2/thumb2-sub.ll llvm/trunk/test/CodeGen/Thumb2/thumb2-sub4.ll llvm/trunk/test/CodeGen/Thumb2/thumb2-sub5.ll llvm/trunk/test/CodeGen/Thumb2/thumb2-teq.ll llvm/trunk/test/CodeGen/Thumb2/thumb2-teq2.ll llvm/trunk/test/CodeGen/Thumb2/thumb2-tst.ll llvm/trunk/test/CodeGen/Thumb2/thumb2-tst2.ll llvm/trunk/test/CodeGen/Thumb2/tls2.ll Modified: llvm/trunk/lib/Target/ARM/ARMInstrThumb2.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMInstrThumb2.td?rev=77199&r1=77198&r2=77199&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMInstrThumb2.td (original) +++ llvm/trunk/lib/Target/ARM/ARMInstrThumb2.td Mon Jul 27 11:31:55 2009 @@ -153,11 +153,11 @@ } // register def r : T2I<(outs GPR:$dst), (ins GPR:$src), - opc, " $dst, $src", + opc, ".w $dst, $src", [(set GPR:$dst, (opnode GPR:$src))]>; // shifted register def s : T2I<(outs GPR:$dst), (ins t2_so_reg:$src), - opc, " $dst, $src", + opc, ".w $dst, $src", [(set GPR:$dst, (opnode t2_so_reg:$src))]>; } @@ -171,13 +171,13 @@ [(set GPR:$dst, (opnode GPR:$lhs, t2_so_imm:$rhs))]>; // register def rr : T2sI<(outs GPR:$dst), (ins GPR:$lhs, GPR:$rhs), - opc, " $dst, $lhs, $rhs", + opc, ".w $dst, $lhs, $rhs", [(set GPR:$dst, (opnode GPR:$lhs, GPR:$rhs))]> { let isCommutable = Commutable; } // shifted register def rs : T2sI<(outs GPR:$dst), (ins GPR:$lhs, t2_so_reg:$rhs), - opc, " $dst, $lhs, $rhs", + opc, ".w $dst, $lhs, $rhs", [(set GPR:$dst, (opnode GPR:$lhs, t2_so_reg:$rhs))]>; } @@ -187,7 +187,7 @@ multiclass T2I_rbin_is { // shifted imm def ri : T2I<(outs GPR:$dst), (ins GPR:$rhs, t2_so_imm:$lhs), - opc, " $dst, $rhs, $lhs", + opc, ".w $dst, $rhs, $lhs", [(set GPR:$dst, (opnode t2_so_imm:$lhs, GPR:$rhs))]>; // shifted register def rs : T2I<(outs GPR:$dst), (ins GPR:$rhs, t2_so_reg:$lhs), @@ -201,17 +201,17 @@ multiclass T2I_bin_s_irs { // shifted imm def ri : T2I<(outs GPR:$dst), (ins GPR:$lhs, t2_so_imm:$rhs), - !strconcat(opc, "s"), " $dst, $lhs, $rhs", + !strconcat(opc, "s"), ".w $dst, $lhs, $rhs", [(set GPR:$dst, (opnode GPR:$lhs, t2_so_imm:$rhs))]>; // register def rr : T2I<(outs GPR:$dst), (ins GPR:$lhs, GPR:$rhs), - !strconcat(opc, "s"), " $dst, $lhs, $rhs", + !strconcat(opc, "s"), ".w $dst, $lhs, $rhs", [(set GPR:$dst, (opnode GPR:$lhs, GPR:$rhs))]> { let isCommutable = Commutable; } // shifted register def rs : T2I<(outs GPR:$dst), (ins GPR:$lhs, t2_so_reg:$rhs), - !strconcat(opc, "s"), " $dst, $lhs, $rhs", + !strconcat(opc, "s"), ".w $dst, $lhs, $rhs", [(set GPR:$dst, (opnode GPR:$lhs, t2_so_reg:$rhs))]>; } } @@ -221,7 +221,7 @@ multiclass T2I_bin_ii12rs { // shifted imm def ri : T2sI<(outs GPR:$dst), (ins GPR:$lhs, t2_so_imm:$rhs), - opc, " $dst, $lhs, $rhs", + opc, ".w $dst, $lhs, $rhs", [(set GPR:$dst, (opnode GPR:$lhs, t2_so_imm:$rhs))]>; // 12-bit imm def ri12 : T2sI<(outs GPR:$dst), (ins GPR:$lhs, i32imm:$rhs), @@ -229,13 +229,13 @@ [(set GPR:$dst, (opnode GPR:$lhs, imm0_4095:$rhs))]>; // register def rr : T2sI<(outs GPR:$dst), (ins GPR:$lhs, GPR:$rhs), - opc, " $dst, $lhs, $rhs", + opc, ".w $dst, $lhs, $rhs", [(set GPR:$dst, (opnode GPR:$lhs, GPR:$rhs))]> { let isCommutable = Commutable; } // shifted register def rs : T2sI<(outs GPR:$dst), (ins GPR:$lhs, t2_so_reg:$rhs), - opc, " $dst, $lhs, $rhs", + opc, ".w $dst, $lhs, $rhs", [(set GPR:$dst, (opnode GPR:$lhs, t2_so_reg:$rhs))]>; } @@ -251,14 +251,14 @@ Requires<[IsThumb2, CarryDefIsUnused]>; // register def rr : T2sI<(outs GPR:$dst), (ins GPR:$lhs, GPR:$rhs), - opc, " $dst, $lhs, $rhs", + opc, ".w $dst, $lhs, $rhs", [(set GPR:$dst, (opnode GPR:$lhs, GPR:$rhs))]>, Requires<[IsThumb2, CarryDefIsUnused]> { let isCommutable = Commutable; } // shifted register def rs : T2sI<(outs GPR:$dst), (ins GPR:$lhs, t2_so_reg:$rhs), - opc, " $dst, $lhs, $rhs", + opc, ".w $dst, $lhs, $rhs", [(set GPR:$dst, (opnode GPR:$lhs, t2_so_reg:$rhs))]>, Requires<[IsThumb2, CarryDefIsUnused]>; // Carry setting variants @@ -271,7 +271,7 @@ } // register def Srr : T2XI<(outs GPR:$dst), (ins GPR:$lhs, GPR:$rhs), - !strconcat(opc, "s $dst, $lhs, $rhs"), + !strconcat(opc, "s.w $dst, $lhs, $rhs"), [(set GPR:$dst, (opnode GPR:$lhs, GPR:$rhs))]>, Requires<[IsThumb2, CarryDefIsUsed]> { let Defs = [CPSR]; @@ -279,7 +279,7 @@ } // shifted register def Srs : T2XI<(outs GPR:$dst), (ins GPR:$lhs, t2_so_reg:$rhs), - !strconcat(opc, "s $dst, $lhs, $rhs"), + !strconcat(opc, "s.w $dst, $lhs, $rhs"), [(set GPR:$dst, (opnode GPR:$lhs, t2_so_reg:$rhs))]>, Requires<[IsThumb2, CarryDefIsUsed]> { let Defs = [CPSR]; @@ -319,14 +319,12 @@ } } -/// T2I_rbin_s_is - Same as T2I_bin_s_irs except the order of operands are -/// reversed. It doesn't define the 'rr' form since it's handled by its -/// T2I_bin_s_irs counterpart. +/// T2I_rbin_s_is - Same as T2I_rbin_is except sets 's' bit. let Defs = [CPSR] in { multiclass T2I_rbin_s_is { // shifted imm def ri : T2XI<(outs GPR:$dst), (ins GPR:$rhs, t2_so_imm:$lhs, cc_out:$s), - !strconcat(opc, "${s} $dst, $rhs, $lhs"), + !strconcat(opc, "${s}.w $dst, $rhs, $lhs"), [(set GPR:$dst, (opnode t2_so_imm:$lhs, GPR:$rhs))]>; // shifted register def rs : T2XI<(outs GPR:$dst), (ins GPR:$rhs, t2_so_reg:$lhs, cc_out:$s), @@ -340,11 +338,11 @@ multiclass T2I_sh_ir { // 5-bit imm def ri : T2sI<(outs GPR:$dst), (ins GPR:$lhs, i32imm:$rhs), - opc, " $dst, $lhs, $rhs", + opc, ".w $dst, $lhs, $rhs", [(set GPR:$dst, (opnode GPR:$lhs, imm1_31:$rhs))]>; // register def rr : T2sI<(outs GPR:$dst), (ins GPR:$lhs, GPR:$rhs), - opc, " $dst, $lhs, $rhs", + opc, ".w $dst, $lhs, $rhs", [(set GPR:$dst, (opnode GPR:$lhs, GPR:$rhs))]>; } @@ -355,15 +353,15 @@ multiclass T2I_cmp_is { // shifted imm def ri : T2I<(outs), (ins GPR:$lhs, t2_so_imm:$rhs), - opc, " $lhs, $rhs", + opc, ".w $lhs, $rhs", [(opnode GPR:$lhs, t2_so_imm:$rhs)]>; // register def rr : T2I<(outs), (ins GPR:$lhs, GPR:$rhs), - opc, " $lhs, $rhs", + opc, ".w $lhs, $rhs", [(opnode GPR:$lhs, GPR:$rhs)]>; // shifted register def rs : T2I<(outs), (ins GPR:$lhs, t2_so_reg:$rhs), - opc, " $lhs, $rhs", + opc, ".w $lhs, $rhs", [(opnode GPR:$lhs, t2_so_reg:$rhs)]>; } } @@ -371,29 +369,29 @@ /// T2I_ld - Defines a set of (op r, {imm12|imm8|so_reg}) load patterns. multiclass T2I_ld { def i12 : T2Ii12<(outs GPR:$dst), (ins t2addrmode_imm12:$addr), - opc, " $dst, $addr", + opc, ".w $dst, $addr", [(set GPR:$dst, (opnode t2addrmode_imm12:$addr))]>; def i8 : T2Ii8 <(outs GPR:$dst), (ins t2addrmode_imm8:$addr), opc, " $dst, $addr", [(set GPR:$dst, (opnode t2addrmode_imm8:$addr))]>; def s : T2Iso <(outs GPR:$dst), (ins t2addrmode_so_reg:$addr), - opc, " $dst, $addr", + opc, ".w $dst, $addr", [(set GPR:$dst, (opnode t2addrmode_so_reg:$addr))]>; def pci : T2Ipc <(outs GPR:$dst), (ins i32imm:$addr), - opc, " $dst, $addr", + opc, ".w $dst, $addr", [(set GPR:$dst, (opnode (ARMWrapper tconstpool:$addr)))]>; } /// T2I_st - Defines a set of (op r, {imm12|imm8|so_reg}) store patterns. multiclass T2I_st { def i12 : T2Ii12<(outs), (ins GPR:$src, t2addrmode_imm12:$addr), - opc, " $src, $addr", + opc, ".w $src, $addr", [(opnode GPR:$src, t2addrmode_imm12:$addr)]>; def i8 : T2Ii8 <(outs), (ins GPR:$src, t2addrmode_imm8:$addr), opc, " $src, $addr", [(opnode GPR:$src, t2addrmode_imm8:$addr)]>; def s : T2Iso <(outs), (ins GPR:$src, t2addrmode_so_reg:$addr), - opc, " $src, $addr", + opc, ".w $src, $addr", [(opnode GPR:$src, t2addrmode_so_reg:$addr)]>; } @@ -414,10 +412,10 @@ /// register and one whose operand is a register rotated by 8/16/24. multiclass T2I_unary_rrot { def r : T2I<(outs GPR:$dst), (ins GPR:$Src), - opc, " $dst, $Src", + opc, ".w $dst, $Src", [(set GPR:$dst, (opnode GPR:$Src))]>; def r_rot : T2I<(outs GPR:$dst), (ins GPR:$Src, i32imm:$rot), - opc, " $dst, $Src, ror $rot", + opc, ".w $dst, $Src, ror $rot", [(set GPR:$dst, (opnode (rotr GPR:$Src, rot_imm:$rot)))]>; } @@ -443,22 +441,22 @@ let isNotDuplicable = 1 in def t2PICADD : T2XI<(outs GPR:$dst), (ins GPR:$lhs, pclabel:$cp), - "$cp:\n\tadd $dst, $lhs, pc", + "$cp:\n\tadd.w $dst, $lhs, pc", [(set GPR:$dst, (ARMpic_add GPR:$lhs, imm:$cp))]>; // LEApcrel - Load a pc-relative address into a register without offending the // assembler. def t2LEApcrel : T2XI<(outs GPR:$dst), (ins i32imm:$label, pred:$p), - "adr$p $dst, #$label", []>; + "adr$p.w $dst, #$label", []>; def t2LEApcrelJT : T2XI<(outs GPR:$dst), (ins i32imm:$label, i32imm:$id, pred:$p), - "adr$p $dst, #${label}_${id:no_hash}", []>; + "adr$p.w $dst, #${label}_${id:no_hash}", []>; // ADD rd, sp, #so_imm def t2ADDrSPi : T2XI<(outs GPR:$dst), (ins GPR:$sp, t2_so_imm:$imm), - "add $dst, $sp, $imm", + "add.w $dst, $sp, $imm", []>; // ADD rd, sp, #imm12 @@ -657,12 +655,12 @@ let mayLoad = 1 in def t2LDM : T2XI<(outs), (ins addrmode4:$addr, pred:$p, reglist:$dst1, variable_ops), - "ldm${addr:submode}${p} $addr, $dst1", []>; + "ldm${addr:submode}${p}.w $addr, $dst1", []>; let mayStore = 1 in def t2STM : T2XI<(outs), (ins addrmode4:$addr, pred:$p, reglist:$src1, variable_ops), - "stm${addr:submode}${p} $addr, $src1", []>; + "stm${addr:submode}${p}.w $addr, $src1", []>; //===----------------------------------------------------------------------===// // Move Instructions. @@ -670,11 +668,11 @@ let neverHasSideEffects = 1 in def t2MOVr : T2sI<(outs GPR:$dst), (ins GPR:$src), - "mov", " $dst, $src", []>; + "mov", ".w $dst, $src", []>; let isReMaterializable = 1, isAsCheapAsAMove = 1 in def t2MOVi : T2sI<(outs GPR:$dst), (ins t2_so_imm:$src), - "mov", " $dst, $src", + "mov", ".w $dst, $src", [(set GPR:$dst, t2_so_imm:$src)]>; let isReMaterializable = 1, isAsCheapAsAMove = 1 in @@ -928,11 +926,11 @@ [(set GPR:$dst, (ctlz GPR:$src))]>; def t2REV : T2I<(outs GPR:$dst), (ins GPR:$src), - "rev", " $dst, $src", + "rev", ".w $dst, $src", [(set GPR:$dst, (bswap GPR:$src))]>; def t2REV16 : T2I<(outs GPR:$dst), (ins GPR:$src), - "rev16", " $dst, $src", + "rev16", ".w $dst, $src", [(set GPR:$dst, (or (and (srl GPR:$src, (i32 8)), 0xFF), (or (and (shl GPR:$src, (i32 8)), 0xFF00), @@ -940,7 +938,7 @@ (and (shl GPR:$src, (i32 8)), 0xFF000000)))))]>; def t2REVSH : T2I<(outs GPR:$dst), (ins GPR:$src), - "revsh", " $dst, $src", + "revsh", ".w $dst, $src", [(set GPR:$dst, (sext_inreg (or (srl (and GPR:$src, 0xFFFF), (i32 8)), @@ -1077,14 +1075,14 @@ let isBranch = 1, isTerminator = 1, isBarrier = 1 in { let isPredicable = 1 in def t2B : T2XI<(outs), (ins brtarget:$target), - "b $target", + "b.w $target", [(br bb:$target)]>; let isNotDuplicable = 1, isIndirectBranch = 1 in def t2BR_JT : T2JTI<(outs), (ins GPR:$base, GPR:$idx, jt2block_operand:$jt, i32imm:$id), - "add pc, $base, $idx, lsl #2\n$jt", + "add.w pc, $base, $idx, lsl #2\n$jt", [(ARMbr2jt GPR:$base, GPR:$idx, tjumptable:$jt, imm:$id)]>; } // isBranch, isTerminator, isBarrier @@ -1092,7 +1090,7 @@ // a two-value operand where a dag node expects two operands. :( let isBranch = 1, isTerminator = 1 in def t2Bcc : T2I<(outs), (ins brtarget:$target), - "b", " $target", + "b", ".w $target", [/*(ARMbrcond bb:$target, imm:$cc)*/]>; Modified: llvm/trunk/test/CodeGen/Thumb2/carry.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Thumb2/carry.ll?rev=77199&r1=77198&r2=77199&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/Thumb2/carry.ll (original) +++ llvm/trunk/test/CodeGen/Thumb2/carry.ll Mon Jul 27 11:31:55 2009 @@ -1,6 +1,6 @@ -; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep "subs r" | count 2 -; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep "adc r" -; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep "sbc r" | count 2 +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep "subs\\.w r" | count 2 +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep "adc\\.w r" +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep "sbc\\.w r" | count 2 define i64 @f1(i64 %a, i64 %b) { entry: Modified: llvm/trunk/test/CodeGen/Thumb2/load-global.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Thumb2/load-global.ll?rev=77199&r1=77198&r2=77199&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/Thumb2/load-global.ll (original) +++ llvm/trunk/test/CodeGen/Thumb2/load-global.ll Mon Jul 27 11:31:55 2009 @@ -17,7 +17,7 @@ ; DYNAMIC: .long L_G$non_lazy_ptr ; PIC: _test1 -; PIC: add r0, r0, pc +; PIC: add.w r0, r0, pc ; PIC: .long L_G$non_lazy_ptr-(LPC0+4) ; LINUX: test1 Modified: llvm/trunk/test/CodeGen/Thumb2/mul_const.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Thumb2/mul_const.ll?rev=77199&r1=77198&r2=77199&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/Thumb2/mul_const.ll (original) +++ llvm/trunk/test/CodeGen/Thumb2/mul_const.ll Mon Jul 27 11:31:55 2009 @@ -4,7 +4,7 @@ define i32 @t1(i32 %v) nounwind readnone { entry: ; CHECK: t1: -; CHECK: add r0, r0, r0, lsl #3 +; CHECK: add.w r0, r0, r0, lsl #3 %0 = mul i32 %v, 9 ret i32 %0 } Modified: llvm/trunk/test/CodeGen/Thumb2/pic-load.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Thumb2/pic-load.ll?rev=77199&r1=77198&r2=77199&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/Thumb2/pic-load.ll (original) +++ llvm/trunk/test/CodeGen/Thumb2/pic-load.ll Mon Jul 27 11:31:55 2009 @@ -8,7 +8,7 @@ define hidden arm_apcscc i32 @atexit(void ()* %func) nounwind { entry: ; CHECK: atexit: -; CHECK: add r1, r1, pc +; CHECK: add.w r1, r1, pc %r = alloca %struct.one_atexit_routine, align 4 ; <%struct.one_atexit_routine*> [#uses=3] %0 = getelementptr %struct.one_atexit_routine* %r, i32 0, i32 0, i32 0 ; [#uses=1] store void ()* %func, void ()** %0, align 4 Modified: llvm/trunk/test/CodeGen/Thumb2/thumb2-adc2.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Thumb2/thumb2-adc2.ll?rev=77199&r1=77198&r2=77199&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/Thumb2/thumb2-adc2.ll (original) +++ llvm/trunk/test/CodeGen/Thumb2/thumb2-adc2.ll Mon Jul 27 11:31:55 2009 @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {adc\\W*r\[0-9\],\\W*r\[0-9\],\\W*r\[0-9\]*} | count 1 +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {adc\\.w\\W*r\[0-9\],\\W*r\[0-9\],\\W*r\[0-9\]*} | count 1 define i64 @f1(i64 %a, i64 %b) { %tmp = add i64 %a, %b Modified: llvm/trunk/test/CodeGen/Thumb2/thumb2-add2.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Thumb2/thumb2-add2.ll?rev=77199&r1=77198&r2=77199&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/Thumb2/thumb2-add2.ll (original) +++ llvm/trunk/test/CodeGen/Thumb2/thumb2-add2.ll Mon Jul 27 11:31:55 2009 @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {add\\W*r\[0-9\],\\W*r\[0-9\],\\W*#\[0-9\]*} | grep {#171\\|#1179666\\|#872428544\\|#1448498774\\|#510} | count 5 +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {add\\.w\\W*r\[0-9\],\\W*r\[0-9\],\\W*#\[0-9\]*} | grep {#171\\|#1179666\\|#872428544\\|#1448498774\\|#510} | count 5 ; 171 = 0x000000ab define i32 @f1(i32 %a) { Modified: llvm/trunk/test/CodeGen/Thumb2/thumb2-add4.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Thumb2/thumb2-add4.ll?rev=77199&r1=77198&r2=77199&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/Thumb2/thumb2-add4.ll (original) +++ llvm/trunk/test/CodeGen/Thumb2/thumb2-add4.ll Mon Jul 27 11:31:55 2009 @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {adds\\W*r\[0-9\],\\W*r\[0-9\],\\W*#\[0-9\]*} | grep {#171\\|#1179666\\|#872428544\\|#1448498774\\|#66846720} | count 5 +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {adds\\.w\\W*r\[0-9\],\\W*r\[0-9\],\\W*#\[0-9\]*} | grep {#171\\|#1179666\\|#872428544\\|#1448498774\\|#66846720} | count 5 ; 171 = 0x000000ab define i64 @f1(i64 %a) { Modified: llvm/trunk/test/CodeGen/Thumb2/thumb2-add5.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Thumb2/thumb2-add5.ll?rev=77199&r1=77198&r2=77199&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/Thumb2/thumb2-add5.ll (original) +++ llvm/trunk/test/CodeGen/Thumb2/thumb2-add5.ll Mon Jul 27 11:31:55 2009 @@ -1,8 +1,8 @@ -; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {add\\W*r\[0-9\],\\W*r\[0-9\],\\W*r\[0-9\]$} | count 1 -; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {add\\W*r\[0-9\],\\W*r\[0-9\],\\W*r\[0-9\],\\W*lsl\\W*#5$} | count 1 -; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {add\\W*r\[0-9\],\\W*r\[0-9\],\\W*r\[0-9\],\\W*lsr\\W*#6$} | count 1 -; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {add\\W*r\[0-9\],\\W*r\[0-9\],\\W*r\[0-9\],\\W*asr\\W*#7$} | count 1 -; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {add\\W*r\[0-9\],\\W*r\[0-9\],\\W*r\[0-9\],\\W*ror\\W*#8$} | count 1 +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {add\\.w\\W*r\[0-9\],\\W*r\[0-9\],\\W*r\[0-9\]$} | count 1 +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {add\\.w\\W*r\[0-9\],\\W*r\[0-9\],\\W*r\[0-9\],\\W*lsl\\W*#5$} | count 1 +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {add\\.w\\W*r\[0-9\],\\W*r\[0-9\],\\W*r\[0-9\],\\W*lsr\\W*#6$} | count 1 +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {add\\.w\\W*r\[0-9\],\\W*r\[0-9\],\\W*r\[0-9\],\\W*asr\\W*#7$} | count 1 +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {add\\.w\\W*r\[0-9\],\\W*r\[0-9\],\\W*r\[0-9\],\\W*ror\\W*#8$} | count 1 define i32 @f1(i32 %a, i32 %b) { %tmp = add i32 %a, %b Modified: llvm/trunk/test/CodeGen/Thumb2/thumb2-add6.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Thumb2/thumb2-add6.ll?rev=77199&r1=77198&r2=77199&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/Thumb2/thumb2-add6.ll (original) +++ llvm/trunk/test/CodeGen/Thumb2/thumb2-add6.ll Mon Jul 27 11:31:55 2009 @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {adds\\W*r\[0-9\],\\W*r\[0-9\],\\W*r\[0-9\]} | count 1 +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {adds\\.w\\W*r\[0-9\],\\W*r\[0-9\],\\W*r\[0-9\]} | count 1 define i64 @f1(i64 %a, i64 %b) { %tmp = add i64 %a, %b Modified: llvm/trunk/test/CodeGen/Thumb2/thumb2-and.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Thumb2/thumb2-and.ll?rev=77199&r1=77198&r2=77199&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/Thumb2/thumb2-and.ll (original) +++ llvm/trunk/test/CodeGen/Thumb2/thumb2-and.ll Mon Jul 27 11:31:55 2009 @@ -1,8 +1,8 @@ -; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {and\\W*r\[0-9\],\\W*r\[0-9\],\\W*r\[0-9\]$} | count 1 -; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {and\\W*r\[0-9\],\\W*r\[0-9\],\\W*r\[0-9\],\\W*lsl\\W*#5$} | count 1 -; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {and\\W*r\[0-9\],\\W*r\[0-9\],\\W*r\[0-9\],\\W*lsr\\W*#6$} | count 1 -; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {and\\W*r\[0-9\],\\W*r\[0-9\],\\W*r\[0-9\],\\W*asr\\W*#7$} | count 1 -; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {and\\W*r\[0-9\],\\W*r\[0-9\],\\W*r\[0-9\],\\W*ror\\W*#8$} | count 1 +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {and\\.w\\W*r\[0-9\],\\W*r\[0-9\],\\W*r\[0-9\]$} | count 1 +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {and\\.w\\W*r\[0-9\],\\W*r\[0-9\],\\W*r\[0-9\],\\W*lsl\\W*#5$} | count 1 +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {and\\.w\\W*r\[0-9\],\\W*r\[0-9\],\\W*r\[0-9\],\\W*lsr\\W*#6$} | count 1 +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {and\\.w\\W*r\[0-9\],\\W*r\[0-9\],\\W*r\[0-9\],\\W*asr\\W*#7$} | count 1 +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {and\\.w\\W*r\[0-9\],\\W*r\[0-9\],\\W*r\[0-9\],\\W*ror\\W*#8$} | count 1 define i32 @f1(i32 %a, i32 %b) { %tmp = and i32 %a, %b Modified: llvm/trunk/test/CodeGen/Thumb2/thumb2-asr.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Thumb2/thumb2-asr.ll?rev=77199&r1=77198&r2=77199&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/Thumb2/thumb2-asr.ll (original) +++ llvm/trunk/test/CodeGen/Thumb2/thumb2-asr.ll Mon Jul 27 11:31:55 2009 @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {asr\\W*r\[0-9\],\\W*r\[0-9\],\\W*r\[0-9\]} | count 1 +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {asr\\.w\\W*r\[0-9\],\\W*r\[0-9\],\\W*r\[0-9\]} | count 1 define i32 @f1(i32 %a, i32 %b) { %tmp = ashr i32 %a, %b Modified: llvm/trunk/test/CodeGen/Thumb2/thumb2-asr2.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Thumb2/thumb2-asr2.ll?rev=77199&r1=77198&r2=77199&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/Thumb2/thumb2-asr2.ll (original) +++ llvm/trunk/test/CodeGen/Thumb2/thumb2-asr2.ll Mon Jul 27 11:31:55 2009 @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {asr\\W*r\[0-9\],\\W*r\[0-9\],\\W*#\[0-9\]*} | grep {#17} | count 1 +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {asr\\.w\\W*r\[0-9\],\\W*r\[0-9\],\\W*#\[0-9\]*} | grep {#17} | count 1 define i32 @f1(i32 %a) { %tmp = ashr i32 %a, 17 Modified: llvm/trunk/test/CodeGen/Thumb2/thumb2-bic.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Thumb2/thumb2-bic.ll?rev=77199&r1=77198&r2=77199&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/Thumb2/thumb2-bic.ll (original) +++ llvm/trunk/test/CodeGen/Thumb2/thumb2-bic.ll Mon Jul 27 11:31:55 2009 @@ -1,8 +1,8 @@ -; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {bic\\W*r\[0-9\]*,\\W*r\[0-9\]*,\\W*r\[0-9\]*$} | count 4 -; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {bic\\W*r\[0-9\],\\W*r\[0-9\],\\W*r\[0-9\],\\W*lsl\\W*#5$} | count 1 -; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {bic\\W*r\[0-9\],\\W*r\[0-9\],\\W*r\[0-9\],\\W*lsr\\W*#6$} | count 1 -; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {bic\\W*r\[0-9\],\\W*r\[0-9\],\\W*r\[0-9\],\\W*asr\\W*#7$} | count 1 -; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {bic\\W*r\[0-9\],\\W*r\[0-9\],\\W*r\[0-9\],\\W*ror\\W*#8$} | count 1 +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {bic\\.w\\W*r\[0-9\]*,\\W*r\[0-9\]*,\\W*r\[0-9\]*$} | count 4 +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {bic\\.w\\W*r\[0-9\],\\W*r\[0-9\],\\W*r\[0-9\],\\W*lsl\\W*#5$} | count 1 +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {bic\\.w\\W*r\[0-9\],\\W*r\[0-9\],\\W*r\[0-9\],\\W*lsr\\W*#6$} | count 1 +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {bic\\.w\\W*r\[0-9\],\\W*r\[0-9\],\\W*r\[0-9\],\\W*asr\\W*#7$} | count 1 +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {bic\\.w\\W*r\[0-9\],\\W*r\[0-9\],\\W*r\[0-9\],\\W*ror\\W*#8$} | count 1 define i32 @f1(i32 %a, i32 %b) { %tmp = xor i32 %b, 4294967295 Modified: llvm/trunk/test/CodeGen/Thumb2/thumb2-cmn.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Thumb2/thumb2-cmn.ll?rev=77199&r1=77198&r2=77199&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/Thumb2/thumb2-cmn.ll (original) +++ llvm/trunk/test/CodeGen/Thumb2/thumb2-cmn.ll Mon Jul 27 11:31:55 2009 @@ -1,8 +1,8 @@ -; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {cmn\\W*r\[0-9\],\\W*r\[0-9\]$} | count 4 -; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {cmn\\W*r\[0-9\],\\W*r\[0-9\],\\W*lsl\\W*#5$} | count 1 -; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {cmn\\W*r\[0-9\],\\W*r\[0-9\],\\W*lsr\\W*#6$} | count 1 -; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {cmn\\W*r\[0-9\],\\W*r\[0-9\],\\W*asr\\W*#7$} | count 1 -; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {cmn\\W*r\[0-9\],\\W*r\[0-9\],\\W*ror\\W*#8$} | count 1 +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {cmn\\.w\\W*r\[0-9\],\\W*r\[0-9\]$} | count 4 +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {cmn\\.w\\W*r\[0-9\],\\W*r\[0-9\],\\W*lsl\\W*#5$} | count 1 +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {cmn\\.w\\W*r\[0-9\],\\W*r\[0-9\],\\W*lsr\\W*#6$} | count 1 +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {cmn\\.w\\W*r\[0-9\],\\W*r\[0-9\],\\W*asr\\W*#7$} | count 1 +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {cmn\\.w\\W*r\[0-9\],\\W*r\[0-9\],\\W*ror\\W*#8$} | count 1 define i1 @f1(i32 %a, i32 %b) { %nb = sub i32 0, %b Modified: llvm/trunk/test/CodeGen/Thumb2/thumb2-cmn2.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Thumb2/thumb2-cmn2.ll?rev=77199&r1=77198&r2=77199&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/Thumb2/thumb2-cmn2.ll (original) +++ llvm/trunk/test/CodeGen/Thumb2/thumb2-cmn2.ll Mon Jul 27 11:31:55 2009 @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep "cmn " | grep {#187\\|#11141290\\|#3422604288\\|#1114112} | count 4 +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep "cmn\\.w " | grep {#187\\|#11141290\\|#3422604288\\|#1114112} | count 4 ; -0x000000bb = 4294967109 define i1 @f1(i32 %a) { Modified: llvm/trunk/test/CodeGen/Thumb2/thumb2-cmp.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Thumb2/thumb2-cmp.ll?rev=77199&r1=77198&r2=77199&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/Thumb2/thumb2-cmp.ll (original) +++ llvm/trunk/test/CodeGen/Thumb2/thumb2-cmp.ll Mon Jul 27 11:31:55 2009 @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {cmp\\W*r\[0-9\],\\W*#\[0-9\]*$} | grep {#187\\|#11141290\\|#3422604288\\|#1114112\\|#3722304989} | count 5 +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {cmp\\.w\\W*r\[0-9\],\\W*#\[0-9\]*$} | grep {#187\\|#11141290\\|#3422604288\\|#1114112\\|#3722304989} | count 5 ; 0x000000bb = 187 define i1 @f1(i32 %a) { Modified: llvm/trunk/test/CodeGen/Thumb2/thumb2-cmp2.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Thumb2/thumb2-cmp2.ll?rev=77199&r1=77198&r2=77199&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/Thumb2/thumb2-cmp2.ll (original) +++ llvm/trunk/test/CodeGen/Thumb2/thumb2-cmp2.ll Mon Jul 27 11:31:55 2009 @@ -1,8 +1,8 @@ -; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {cmp\\W*r\[0-9\],\\W*r\[0-9\]$} | count 2 -; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {cmp\\W*r\[0-9\],\\W*r\[0-9\],\\W*lsl\\W*#5$} | count 1 -; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {cmp\\W*r\[0-9\],\\W*r\[0-9\],\\W*lsr\\W*#6$} | count 1 -; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {cmp\\W*r\[0-9\],\\W*r\[0-9\],\\W*asr\\W*#7$} | count 1 -; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {cmp\\W*r\[0-9\],\\W*r\[0-9\],\\W*ror\\W*#8$} | count 1 +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {cmp\\.w\\W*r\[0-9\],\\W*r\[0-9\]$} | count 2 +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {cmp\\.w\\W*r\[0-9\],\\W*r\[0-9\],\\W*lsl\\W*#5$} | count 1 +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {cmp\\.w\\W*r\[0-9\],\\W*r\[0-9\],\\W*lsr\\W*#6$} | count 1 +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {cmp\\.w\\W*r\[0-9\],\\W*r\[0-9\],\\W*asr\\W*#7$} | count 1 +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {cmp\\.w\\W*r\[0-9\],\\W*r\[0-9\],\\W*ror\\W*#8$} | count 1 define i1 @f1(i32 %a, i32 %b) { %tmp = icmp ne i32 %a, %b Modified: llvm/trunk/test/CodeGen/Thumb2/thumb2-eor.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Thumb2/thumb2-eor.ll?rev=77199&r1=77198&r2=77199&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/Thumb2/thumb2-eor.ll (original) +++ llvm/trunk/test/CodeGen/Thumb2/thumb2-eor.ll Mon Jul 27 11:31:55 2009 @@ -1,8 +1,8 @@ -; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {eor\\W*r\[0-9\],\\W*r\[0-9\],\\W*r\[0-9\]$} | count 2 -; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {eor\\W*r\[0-9\],\\W*r\[0-9\],\\W*r\[0-9\],\\W*lsl\\W*#5$} | count 1 -; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {eor\\W*r\[0-9\],\\W*r\[0-9\],\\W*r\[0-9\],\\W*lsr\\W*#6$} | count 1 -; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {eor\\W*r\[0-9\],\\W*r\[0-9\],\\W*r\[0-9\],\\W*asr\\W*#7$} | count 1 -; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {eor\\W*r\[0-9\],\\W*r\[0-9\],\\W*r\[0-9\],\\W*ror\\W*#8$} | count 1 +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {eor\\.w\\W*r\[0-9\],\\W*r\[0-9\],\\W*r\[0-9\]$} | count 2 +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {eor\\.w\\W*r\[0-9\],\\W*r\[0-9\],\\W*r\[0-9\],\\W*lsl\\W*#5$} | count 1 +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {eor\\.w\\W*r\[0-9\],\\W*r\[0-9\],\\W*r\[0-9\],\\W*lsr\\W*#6$} | count 1 +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {eor\\.w\\W*r\[0-9\],\\W*r\[0-9\],\\W*r\[0-9\],\\W*asr\\W*#7$} | count 1 +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {eor\\.w\\W*r\[0-9\],\\W*r\[0-9\],\\W*r\[0-9\],\\W*ror\\W*#8$} | count 1 define i32 @f1(i32 %a, i32 %b) { %tmp = xor i32 %a, %b Modified: llvm/trunk/test/CodeGen/Thumb2/thumb2-jtbl.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Thumb2/thumb2-jtbl.ll?rev=77199&r1=77198&r2=77199&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/Thumb2/thumb2-jtbl.ll (original) +++ llvm/trunk/test/CodeGen/Thumb2/thumb2-jtbl.ll Mon Jul 27 11:31:55 2009 @@ -4,7 +4,7 @@ define void @bar(i32 %n.u) { entry: ; CHECK: bar: -; CHECK: add pc +; CHECK: add.w pc ; CHECK: b.w LBB1_2 switch i32 %n.u, label %bb12 [i32 1, label %bb i32 2, label %bb6 i32 4, label %bb7 i32 5, label %bb8 i32 6, label %bb10 i32 7, label %bb1 i32 8, label %bb3 i32 9, label %bb4 i32 10, label %bb9 i32 11, label %bb2 i32 12, label %bb5 i32 13, label %bb11 ] Modified: llvm/trunk/test/CodeGen/Thumb2/thumb2-ldr.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Thumb2/thumb2-ldr.ll?rev=77199&r1=77198&r2=77199&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/Thumb2/thumb2-ldr.ll (original) +++ llvm/trunk/test/CodeGen/Thumb2/thumb2-ldr.ll Mon Jul 27 11:31:55 2009 @@ -1,8 +1,9 @@ -; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {ldr r0} | count 7 -; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep mov | grep 1 -; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | not grep mvn -; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep ldr | grep lsl -; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep lsr | not grep ldr +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {ldr\\.w r0} | count 6 +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {ldr r0} | count 1 +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep mov\\.w | grep 1 +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | not grep mvn\\.w +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep ldr\\.w | grep lsl +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep lsr\\.w | not grep ldr define i32 @f1(i32* %v) { entry: Modified: llvm/trunk/test/CodeGen/Thumb2/thumb2-ldrb.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Thumb2/thumb2-ldrb.ll?rev=77199&r1=77198&r2=77199&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/Thumb2/thumb2-ldrb.ll (original) +++ llvm/trunk/test/CodeGen/Thumb2/thumb2-ldrb.ll Mon Jul 27 11:31:55 2009 @@ -1,8 +1,9 @@ -; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {ldrb r0} | count 7 -; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep mov | grep 1 -; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | not grep mvn -; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep ldrb | grep lsl -; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep lsr | not grep ldrb +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {ldrb\\.w r0} | count 5 +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {ldrb r0} | count 2 +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep mov\\.w | grep 1 +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | not grep mvn\\.w +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep ldrb\\.w | grep lsl +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep lsr\\.w | not grep ldrb define i8 @f1(i8* %v) { entry: Modified: llvm/trunk/test/CodeGen/Thumb2/thumb2-ldrh.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Thumb2/thumb2-ldrh.ll?rev=77199&r1=77198&r2=77199&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/Thumb2/thumb2-ldrh.ll (original) +++ llvm/trunk/test/CodeGen/Thumb2/thumb2-ldrh.ll Mon Jul 27 11:31:55 2009 @@ -1,8 +1,9 @@ -; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {ldrh r0} | count 7 -; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep mov | grep 1 -; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | not grep mvn -; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep ldrh | grep lsl -; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep lsr | not grep ldrh +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {ldrh\\.w r0} | count 6 +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {ldrh r0} | count 1 +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep mov\\.w | grep 1 +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | not grep mvn\\.w +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep ldrh\\.w | grep lsl +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep lsr\\.w | not grep ldrh define i16 @f1(i16* %v) { entry: Modified: llvm/trunk/test/CodeGen/Thumb2/thumb2-lsl.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Thumb2/thumb2-lsl.ll?rev=77199&r1=77198&r2=77199&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/Thumb2/thumb2-lsl.ll (original) +++ llvm/trunk/test/CodeGen/Thumb2/thumb2-lsl.ll Mon Jul 27 11:31:55 2009 @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {lsl\\W*r\[0-9\],\\W*r\[0-9\],\\W*\[0-9\]} | count 1 +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {lsl\\.w\\W*r\[0-9\],\\W*r\[0-9\],\\W*\[0-9\]} | count 1 define i32 @f1(i32 %a) { %tmp = shl i32 %a, 5 Modified: llvm/trunk/test/CodeGen/Thumb2/thumb2-lsl2.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Thumb2/thumb2-lsl2.ll?rev=77199&r1=77198&r2=77199&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/Thumb2/thumb2-lsl2.ll (original) +++ llvm/trunk/test/CodeGen/Thumb2/thumb2-lsl2.ll Mon Jul 27 11:31:55 2009 @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {lsl\\W*r\[0-9\],\\W*r\[0-9\],\\W*r\[0-9\]} | count 1 +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {lsl\\.w\\W*r\[0-9\],\\W*r\[0-9\],\\W*r\[0-9\]} | count 1 define i32 @f1(i32 %a, i32 %b) { %tmp = shl i32 %a, %b Modified: llvm/trunk/test/CodeGen/Thumb2/thumb2-lsr.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Thumb2/thumb2-lsr.ll?rev=77199&r1=77198&r2=77199&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/Thumb2/thumb2-lsr.ll (original) +++ llvm/trunk/test/CodeGen/Thumb2/thumb2-lsr.ll Mon Jul 27 11:31:55 2009 @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {lsr\\W*r\[0-9\],\\W*r\[0-9\],\\W*\[0-9\]} | count 1 +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {lsr\\.w\\W*r\[0-9\],\\W*r\[0-9\],\\W*\[0-9\]} | count 1 define i32 @f1(i32 %a) { %tmp = lshr i32 %a, 13 Modified: llvm/trunk/test/CodeGen/Thumb2/thumb2-lsr2.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Thumb2/thumb2-lsr2.ll?rev=77199&r1=77198&r2=77199&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/Thumb2/thumb2-lsr2.ll (original) +++ llvm/trunk/test/CodeGen/Thumb2/thumb2-lsr2.ll Mon Jul 27 11:31:55 2009 @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {lsr\\W*r\[0-9\],\\W*r\[0-9\],\\W*r\[0-9\]} | count 1 +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {lsr\\.w\\W*r\[0-9\],\\W*r\[0-9\],\\W*r\[0-9\]} | count 1 define i32 @f1(i32 %a, i32 %b) { %tmp = lshr i32 %a, %b Modified: llvm/trunk/test/CodeGen/Thumb2/thumb2-mov3.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Thumb2/thumb2-mov3.ll?rev=77199&r1=77198&r2=77199&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/Thumb2/thumb2-mov3.ll (original) +++ llvm/trunk/test/CodeGen/Thumb2/thumb2-mov3.ll Mon Jul 27 11:31:55 2009 @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {mov\\W*r\[0-9\],\\W*#\[0-9\]*} | grep {#171\\|#1179666\\|#872428544\\|#1448498774\\|#66846720} | count 5 +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {mov\\.w\\W*r\[0-9\],\\W*#\[0-9\]*} | grep {#171\\|#1179666\\|#872428544\\|#1448498774\\|#66846720} | count 5 ; 171 = 0x000000ab define i32 @f1(i32 %a) { Modified: llvm/trunk/test/CodeGen/Thumb2/thumb2-mvn2.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Thumb2/thumb2-mvn2.ll?rev=77199&r1=77198&r2=77199&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/Thumb2/thumb2-mvn2.ll (original) +++ llvm/trunk/test/CodeGen/Thumb2/thumb2-mvn2.ll Mon Jul 27 11:31:55 2009 @@ -1,8 +1,8 @@ -; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {mvn\\W*r\[0-9\]*,\\W*r\[0-9\]*$} | count 2 -; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {mvn\\W*r\[0-9\],\\W*r\[0-9\],\\W*lsl\\W*#5$} | count 1 -; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {mvn\\W*r\[0-9\],\\W*r\[0-9\],\\W*lsr\\W*#6$} | count 1 -; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {mvn\\W*r\[0-9\],\\W*r\[0-9\],\\W*asr\\W*#7$} | count 1 -; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {mvn\\W*r\[0-9\],\\W*r\[0-9\],\\W*ror\\W*#8$} | count 1 +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {mvn\\.w\\W*r\[0-9\]*,\\W*r\[0-9\]*$} | count 2 +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {mvn\\.w\\W*r\[0-9\],\\W*r\[0-9\],\\W*lsl\\W*#5$} | count 1 +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {mvn\\.w\\W*r\[0-9\],\\W*r\[0-9\],\\W*lsr\\W*#6$} | count 1 +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {mvn\\.w\\W*r\[0-9\],\\W*r\[0-9\],\\W*asr\\W*#7$} | count 1 +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {mvn\\.w\\W*r\[0-9\],\\W*r\[0-9\],\\W*ror\\W*#8$} | count 1 define i32 @f1(i32 %a) { %tmp = xor i32 4294967295, %a Modified: llvm/trunk/test/CodeGen/Thumb2/thumb2-neg.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Thumb2/thumb2-neg.ll?rev=77199&r1=77198&r2=77199&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/Thumb2/thumb2-neg.ll (original) +++ llvm/trunk/test/CodeGen/Thumb2/thumb2-neg.ll Mon Jul 27 11:31:55 2009 @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {rsb\\W*r\[0-9\],\\W*r\[0-9\],\\W*#0} | count 1 +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {rsb\\.w\\W*r\[0-9\],\\W*r\[0-9\],\\W*#0} | count 1 define i32 @f1(i32 %a) { %tmp = sub i32 0, %a Modified: llvm/trunk/test/CodeGen/Thumb2/thumb2-orn.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Thumb2/thumb2-orn.ll?rev=77199&r1=77198&r2=77199&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/Thumb2/thumb2-orn.ll (original) +++ llvm/trunk/test/CodeGen/Thumb2/thumb2-orn.ll Mon Jul 27 11:31:55 2009 @@ -1,8 +1,8 @@ -; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {orn\\W*r\[0-9\]*,\\W*r\[0-9\]*,\\W*r\[0-9\]*$} | count 4 -; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {orn\\W*r\[0-9\],\\W*r\[0-9\],\\W*r\[0-9\],\\W*lsl\\W*#5$} | count 1 -; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {orn\\W*r\[0-9\],\\W*r\[0-9\],\\W*r\[0-9\],\\W*lsr\\W*#6$} | count 1 -; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {orn\\W*r\[0-9\],\\W*r\[0-9\],\\W*r\[0-9\],\\W*asr\\W*#7$} | count 1 -; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {orn\\W*r\[0-9\],\\W*r\[0-9\],\\W*r\[0-9\],\\W*ror\\W*#8$} | count 1 +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {orn\\.w\\W*r\[0-9\]*,\\W*r\[0-9\]*,\\W*r\[0-9\]*$} | count 4 +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {orn\\.w\\W*r\[0-9\],\\W*r\[0-9\],\\W*r\[0-9\],\\W*lsl\\W*#5$} | count 1 +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {orn\\.w\\W*r\[0-9\],\\W*r\[0-9\],\\W*r\[0-9\],\\W*lsr\\W*#6$} | count 1 +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {orn\\.w\\W*r\[0-9\],\\W*r\[0-9\],\\W*r\[0-9\],\\W*asr\\W*#7$} | count 1 +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {orn\\.w\\W*r\[0-9\],\\W*r\[0-9\],\\W*r\[0-9\],\\W*ror\\W*#8$} | count 1 define i32 @f1(i32 %a, i32 %b) { %tmp = xor i32 %b, 4294967295 Modified: llvm/trunk/test/CodeGen/Thumb2/thumb2-orr.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Thumb2/thumb2-orr.ll?rev=77199&r1=77198&r2=77199&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/Thumb2/thumb2-orr.ll (original) +++ llvm/trunk/test/CodeGen/Thumb2/thumb2-orr.ll Mon Jul 27 11:31:55 2009 @@ -1,8 +1,8 @@ -; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {orr\\W*r\[0-9\]*,\\W*r\[0-9\]*,\\W*r\[0-9\]*$} | count 1 -; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {orr\\W*r\[0-9\],\\W*r\[0-9\],\\W*r\[0-9\],\\W*lsl\\W*#5$} | count 1 -; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {orr\\W*r\[0-9\],\\W*r\[0-9\],\\W*r\[0-9\],\\W*lsr\\W*#6$} | count 1 -; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {orr\\W*r\[0-9\],\\W*r\[0-9\],\\W*r\[0-9\],\\W*asr\\W*#7$} | count 1 -; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {orr\\W*r\[0-9\],\\W*r\[0-9\],\\W*r\[0-9\],\\W*ror\\W*#8$} | count 1 +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {orr\\.w\\W*r\[0-9\]*,\\W*r\[0-9\]*,\\W*r\[0-9\]*$} | count 1 +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {orr\\.w\\W*r\[0-9\],\\W*r\[0-9\],\\W*r\[0-9\],\\W*lsl\\W*#5$} | count 1 +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {orr\\.w\\W*r\[0-9\],\\W*r\[0-9\],\\W*r\[0-9\],\\W*lsr\\W*#6$} | count 1 +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {orr\\.w\\W*r\[0-9\],\\W*r\[0-9\],\\W*r\[0-9\],\\W*asr\\W*#7$} | count 1 +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {orr\\.w\\W*r\[0-9\],\\W*r\[0-9\],\\W*r\[0-9\],\\W*ror\\W*#8$} | count 1 define i32 @f1(i32 %a, i32 %b) { %tmp2 = or i32 %a, %b Modified: llvm/trunk/test/CodeGen/Thumb2/thumb2-rev.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Thumb2/thumb2-rev.ll?rev=77199&r1=77198&r2=77199&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/Thumb2/thumb2-rev.ll (original) +++ llvm/trunk/test/CodeGen/Thumb2/thumb2-rev.ll Mon Jul 27 11:31:55 2009 @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2,+v7a | grep {rev\\W*r\[0-9\]*,\\W*r\[0-9\]*} | count 1 +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2,+v7a | grep {rev\\.w\\W*r\[0-9\]*,\\W*r\[0-9\]*} | count 1 define i32 @f1(i32 %a) { %tmp = tail call i32 @llvm.bswap.i32(i32 %a) Modified: llvm/trunk/test/CodeGen/Thumb2/thumb2-ror.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Thumb2/thumb2-ror.ll?rev=77199&r1=77198&r2=77199&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/Thumb2/thumb2-ror.ll (original) +++ llvm/trunk/test/CodeGen/Thumb2/thumb2-ror.ll Mon Jul 27 11:31:55 2009 @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {ror\\W*r\[0-9\]*,\\W*r\[0-9\]*,\\W*#\[0-9\]*} | grep 22 | count 1 +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {ror\\.w\\W*r\[0-9\]*,\\W*r\[0-9\]*,\\W*#\[0-9\]*} | grep 22 | count 1 define i32 @f1(i32 %a) { %l8 = shl i32 %a, 10 Modified: llvm/trunk/test/CodeGen/Thumb2/thumb2-ror2.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Thumb2/thumb2-ror2.ll?rev=77199&r1=77198&r2=77199&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/Thumb2/thumb2-ror2.ll (original) +++ llvm/trunk/test/CodeGen/Thumb2/thumb2-ror2.ll Mon Jul 27 11:31:55 2009 @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {ror\\W*r\[0-9\]*,\\W*r\[0-9\]*,\\W*r\[0-9\]*} | count 1 +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {ror\\.w\\W*r\[0-9\]*,\\W*r\[0-9\]*,\\W*r\[0-9\]*} | count 1 define i32 @f1(i32 %a, i32 %b) { %db = sub i32 32, %b Modified: llvm/trunk/test/CodeGen/Thumb2/thumb2-rsb2.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Thumb2/thumb2-rsb2.ll?rev=77199&r1=77198&r2=77199&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/Thumb2/thumb2-rsb2.ll (original) +++ llvm/trunk/test/CodeGen/Thumb2/thumb2-rsb2.ll Mon Jul 27 11:31:55 2009 @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {rsb\\W*r\[0-9\],\\W*r\[0-9\],\\W*#\[0-9\]*} | grep {#171\\|#1179666\\|#872428544\\|#1448498774\\|#66846720} | count 5 +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {rsb\\.w\\W*r\[0-9\],\\W*r\[0-9\],\\W*#\[0-9\]*} | grep {#171\\|#1179666\\|#872428544\\|#1448498774\\|#66846720} | count 5 ; 171 = 0x000000ab define i32 @f1(i32 %a) { Modified: llvm/trunk/test/CodeGen/Thumb2/thumb2-sbc2.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Thumb2/thumb2-sbc2.ll?rev=77199&r1=77198&r2=77199&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/Thumb2/thumb2-sbc2.ll (original) +++ llvm/trunk/test/CodeGen/Thumb2/thumb2-sbc2.ll Mon Jul 27 11:31:55 2009 @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {sbc\\W*r\[0-9\],\\W*r\[0-9\],\\W*r\[0-9\]*} | count 1 +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {sbc\\.w\\W*r\[0-9\],\\W*r\[0-9\],\\W*r\[0-9\]*} | count 1 define i64 @f1(i64 %a, i64 %b) { %tmp = sub i64 %a, %b Modified: llvm/trunk/test/CodeGen/Thumb2/thumb2-str.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Thumb2/thumb2-str.ll?rev=77199&r1=77198&r2=77199&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/Thumb2/thumb2-str.ll (original) +++ llvm/trunk/test/CodeGen/Thumb2/thumb2-str.ll Mon Jul 27 11:31:55 2009 @@ -1,9 +1,9 @@ -; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {str\\W*r\[0-9\],\\W*\\\[r\[0-9\]*\\\]$} | count 1 -; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {str\\W*r\[0-9\],\\W*\\\[r\[0-9\]*,\\W*#+4092\\\]$} | count 1 +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {str\\.w\\W*r\[0-9\],\\W*\\\[r\[0-9\]*\\\]$} | count 1 +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {str\\.w\\W*r\[0-9\],\\W*\\\[r\[0-9\]*,\\W*#+4092\\\]$} | count 1 ; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {str\\W*r\[0-9\],\\W*\\\[r\[0-9\]*,\\W*#-128\\\]$} | count 2 -; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | not grep {str\\W*r\[0-9\],\\W*\\\[r\[0-9\]*,\\W*#+4096\\\]$} -; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {str\\W*r\[0-9\],\\W*\\\[r\[0-9\]*,\\W*+r\[0-9\]*\\\]$} | count 3 -; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {str\\W*r\[0-9\],\\W*\\\[r\[0-9\]*,\\W*+r\[0-9\]*,\\Wlsl #2\\\]$} | count 1 +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | not grep {str\\.w\\W*r\[0-9\],\\W*\\\[r\[0-9\]*,\\W*#+4096\\\]$} +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {str\\.w\\W*r\[0-9\],\\W*\\\[r\[0-9\]*,\\W*+r\[0-9\]*\\\]$} | count 3 +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {str\\.w\\W*r\[0-9\],\\W*\\\[r\[0-9\]*,\\W*+r\[0-9\]*,\\Wlsl #2\\\]$} | count 1 define i32 @f1(i32 %a, i32* %v) { store i32 %a, i32* %v Modified: llvm/trunk/test/CodeGen/Thumb2/thumb2-strb.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Thumb2/thumb2-strb.ll?rev=77199&r1=77198&r2=77199&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/Thumb2/thumb2-strb.ll (original) +++ llvm/trunk/test/CodeGen/Thumb2/thumb2-strb.ll Mon Jul 27 11:31:55 2009 @@ -1,9 +1,9 @@ -; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {strb\\W*r\[0-9\],\\W*\\\[r\[0-9\]*\\\]$} | count 1 -; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {strb\\W*r\[0-9\],\\W*\\\[r\[0-9\]*,\\W*#+4092\\\]$} | count 1 +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {strb\\.w\\W*r\[0-9\],\\W*\\\[r\[0-9\]*\\\]$} | count 1 +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {strb\\.w\\W*r\[0-9\],\\W*\\\[r\[0-9\]*,\\W*#+4092\\\]$} | count 1 ; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {strb\\W*r\[0-9\],\\W*\\\[r\[0-9\]*,\\W*#-128\\\]$} | count 2 -; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | not grep {strb\\W*r\[0-9\],\\W*\\\[r\[0-9\]*,\\W*#+4096\\\]$} -; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {strb\\W*r\[0-9\],\\W*\\\[r\[0-9\]*,\\W*+r\[0-9\]*\\\]$} | count 3 -; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {strb\\W*r\[0-9\],\\W*\\\[r\[0-9\]*,\\W*+r\[0-9\]*,\\Wlsl #2\\\]$} | count 1 +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | not grep {strb\\.w\\W*r\[0-9\],\\W*\\\[r\[0-9\]*,\\W*#+4096\\\]$} +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {strb\\.w\\W*r\[0-9\],\\W*\\\[r\[0-9\]*,\\W*+r\[0-9\]*\\\]$} | count 3 +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {strb\\.w\\W*r\[0-9\],\\W*\\\[r\[0-9\]*,\\W*+r\[0-9\]*,\\Wlsl #2\\\]$} | count 1 define i8 @f1(i8 %a, i8* %v) { store i8 %a, i8* %v Modified: llvm/trunk/test/CodeGen/Thumb2/thumb2-strh.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Thumb2/thumb2-strh.ll?rev=77199&r1=77198&r2=77199&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/Thumb2/thumb2-strh.ll (original) +++ llvm/trunk/test/CodeGen/Thumb2/thumb2-strh.ll Mon Jul 27 11:31:55 2009 @@ -1,9 +1,9 @@ -; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {strh\\W*r\[0-9\],\\W*\\\[r\[0-9\]*\\\]$} | count 1 -; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {strh\\W*r\[0-9\],\\W*\\\[r\[0-9\]*,\\W*#+4092\\\]$} | count 1 +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {strh\\.w\\W*r\[0-9\],\\W*\\\[r\[0-9\]*\\\]$} | count 1 +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {strh\\.w\\W*r\[0-9\],\\W*\\\[r\[0-9\]*,\\W*#+4092\\\]$} | count 1 ; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {strh\\W*r\[0-9\],\\W*\\\[r\[0-9\]*,\\W*#-128\\\]$} | count 2 -; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | not grep {strh\\W*r\[0-9\],\\W*\\\[r\[0-9\]*,\\W*#+4096\\\]$} -; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {strh\\W*r\[0-9\],\\W*\\\[r\[0-9\]*,\\W*+r\[0-9\]*\\\]$} | count 3 -; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {strh\\W*r\[0-9\],\\W*\\\[r\[0-9\]*,\\W*+r\[0-9\]*,\\Wlsl #2\\\]$} | count 1 +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | not grep {strh\\.w\\W*r\[0-9\],\\W*\\\[r\[0-9\]*,\\W*#+4096\\\]$} +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {strh\\.w\\W*r\[0-9\],\\W*\\\[r\[0-9\]*,\\W*+r\[0-9\]*\\\]$} | count 3 +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {strh\\.w\\W*r\[0-9\],\\W*\\\[r\[0-9\]*,\\W*+r\[0-9\]*,\\Wlsl #2\\\]$} | count 1 define i16 @f1(i16 %a, i16* %v) { store i16 %a, i16* %v Modified: llvm/trunk/test/CodeGen/Thumb2/thumb2-sub.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Thumb2/thumb2-sub.ll?rev=77199&r1=77198&r2=77199&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/Thumb2/thumb2-sub.ll (original) +++ llvm/trunk/test/CodeGen/Thumb2/thumb2-sub.ll Mon Jul 27 11:31:55 2009 @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {sub\[w\]\\?\\W*r\[0-9\],\\W*r\[0-9\],\\W*#\[0-9\]*} | grep {#171\\|#1179666\\|#872428544\\|#1448498774\\|#510} | count 5 +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {sub\\.w\\W*r\[0-9\],\\W*r\[0-9\],\\W*#\[0-9\]*} | grep {#171\\|#1179666\\|#872428544\\|#1448498774\\|#510} | count 5 ; 171 = 0x000000ab define i32 @f1(i32 %a) { Modified: llvm/trunk/test/CodeGen/Thumb2/thumb2-sub4.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Thumb2/thumb2-sub4.ll?rev=77199&r1=77198&r2=77199&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/Thumb2/thumb2-sub4.ll (original) +++ llvm/trunk/test/CodeGen/Thumb2/thumb2-sub4.ll Mon Jul 27 11:31:55 2009 @@ -1,8 +1,8 @@ -; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {sub\\W*r\[0-9\],\\W*r\[0-9\],\\W*r\[0-9\]$} | count 1 -; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {sub\\W*r\[0-9\],\\W*r\[0-9\],\\W*r\[0-9\],\\W*lsl\\W*#5$} | count 1 -; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {sub\\W*r\[0-9\],\\W*r\[0-9\],\\W*r\[0-9\],\\W*lsr\\W*#6$} | count 1 -; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {sub\\W*r\[0-9\],\\W*r\[0-9\],\\W*r\[0-9\],\\W*asr\\W*#7$} | count 1 -; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {sub\\W*r\[0-9\],\\W*r\[0-9\],\\W*r\[0-9\],\\W*ror\\W*#8$} | count 1 +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {sub\\.w\\W*r\[0-9\],\\W*r\[0-9\],\\W*r\[0-9\]$} | count 1 +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {sub\\.w\\W*r\[0-9\],\\W*r\[0-9\],\\W*r\[0-9\],\\W*lsl\\W*#5$} | count 1 +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {sub\\.w\\W*r\[0-9\],\\W*r\[0-9\],\\W*r\[0-9\],\\W*lsr\\W*#6$} | count 1 +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {sub\\.w\\W*r\[0-9\],\\W*r\[0-9\],\\W*r\[0-9\],\\W*asr\\W*#7$} | count 1 +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {sub\\.w\\W*r\[0-9\],\\W*r\[0-9\],\\W*r\[0-9\],\\W*ror\\W*#8$} | count 1 define i32 @f1(i32 %a, i32 %b) { %tmp = sub i32 %a, %b Modified: llvm/trunk/test/CodeGen/Thumb2/thumb2-sub5.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Thumb2/thumb2-sub5.ll?rev=77199&r1=77198&r2=77199&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/Thumb2/thumb2-sub5.ll (original) +++ llvm/trunk/test/CodeGen/Thumb2/thumb2-sub5.ll Mon Jul 27 11:31:55 2009 @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {subs\\W*r\[0-9\],\\W*r\[0-9\],\\W*r\[0-9\]} | count 1 +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {subs\\.w\\W*r\[0-9\],\\W*r\[0-9\],\\W*r\[0-9\]} | count 1 define i64 @f1(i64 %a, i64 %b) { %tmp = sub i64 %a, %b Modified: llvm/trunk/test/CodeGen/Thumb2/thumb2-teq.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Thumb2/thumb2-teq.ll?rev=77199&r1=77198&r2=77199&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/Thumb2/thumb2-teq.ll (original) +++ llvm/trunk/test/CodeGen/Thumb2/thumb2-teq.ll Mon Jul 27 11:31:55 2009 @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {teq\\W*r\[0-9\],\\W*#\[0-9\]*} | grep {#187\\|#11141290\\|#3422604288\\|#1114112\\|#3722304989} | count 10 +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {teq\\.w\\W*r\[0-9\],\\W*#\[0-9\]*} | grep {#187\\|#11141290\\|#3422604288\\|#1114112\\|#3722304989} | count 10 ; 0x000000bb = 187 define i1 @f1(i32 %a) { Modified: llvm/trunk/test/CodeGen/Thumb2/thumb2-teq2.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Thumb2/thumb2-teq2.ll?rev=77199&r1=77198&r2=77199&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/Thumb2/thumb2-teq2.ll (original) +++ llvm/trunk/test/CodeGen/Thumb2/thumb2-teq2.ll Mon Jul 27 11:31:55 2009 @@ -1,8 +1,8 @@ -; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {teq\\W*r\[0-9\],\\W*r\[0-9\]$} | count 4 -; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {teq\\W*r\[0-9\],\\W*r\[0-9\],\\W*lsl\\W*#5$} | count 1 -; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {teq\\W*r\[0-9\],\\W*r\[0-9\],\\W*lsr\\W*#6$} | count 1 -; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {teq\\W*r\[0-9\],\\W*r\[0-9\],\\W*asr\\W*#7$} | count 1 -; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {teq\\W*r\[0-9\],\\W*r\[0-9\],\\W*ror\\W*#8$} | count 1 +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {teq\\.w\\W*r\[0-9\],\\W*r\[0-9\]$} | count 4 +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {teq\\.w\\W*r\[0-9\],\\W*r\[0-9\],\\W*lsl\\W*#5$} | count 1 +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {teq\\.w\\W*r\[0-9\],\\W*r\[0-9\],\\W*lsr\\W*#6$} | count 1 +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {teq\\.w\\W*r\[0-9\],\\W*r\[0-9\],\\W*asr\\W*#7$} | count 1 +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {teq\\.w\\W*r\[0-9\],\\W*r\[0-9\],\\W*ror\\W*#8$} | count 1 define i1 @f1(i32 %a, i32 %b) { %tmp = xor i32 %a, %b Modified: llvm/trunk/test/CodeGen/Thumb2/thumb2-tst.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Thumb2/thumb2-tst.ll?rev=77199&r1=77198&r2=77199&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/Thumb2/thumb2-tst.ll (original) +++ llvm/trunk/test/CodeGen/Thumb2/thumb2-tst.ll Mon Jul 27 11:31:55 2009 @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {tst\\W*r\[0-9\],\\W*#\[0-9\]*} | grep {#187\\|#11141290\\|#3422604288\\|#1114112\\|#3722304989} | count 10 +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {tst\\.w\\W*r\[0-9\],\\W*#\[0-9\]*} | grep {#187\\|#11141290\\|#3422604288\\|#1114112\\|#3722304989} | count 10 ; 0x000000bb = 187 define i1 @f1(i32 %a) { Modified: llvm/trunk/test/CodeGen/Thumb2/thumb2-tst2.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Thumb2/thumb2-tst2.ll?rev=77199&r1=77198&r2=77199&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/Thumb2/thumb2-tst2.ll (original) +++ llvm/trunk/test/CodeGen/Thumb2/thumb2-tst2.ll Mon Jul 27 11:31:55 2009 @@ -1,8 +1,8 @@ -; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {tst\\W*r\[0-9\],\\W*r\[0-9\]$} | count 4 -; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {tst\\W*r\[0-9\],\\W*r\[0-9\],\\W*lsl\\W*#5$} | count 1 -; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {tst\\W*r\[0-9\],\\W*r\[0-9\],\\W*lsr\\W*#6$} | count 1 -; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {tst\\W*r\[0-9\],\\W*r\[0-9\],\\W*asr\\W*#7$} | count 1 -; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {tst\\W*r\[0-9\],\\W*r\[0-9\],\\W*ror\\W*#8$} | count 1 +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {tst\\.w\\W*r\[0-9\],\\W*r\[0-9\]$} | count 4 +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {tst\\.w\\W*r\[0-9\],\\W*r\[0-9\],\\W*lsl\\W*#5$} | count 1 +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {tst\\.w\\W*r\[0-9\],\\W*r\[0-9\],\\W*lsr\\W*#6$} | count 1 +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {tst\\.w\\W*r\[0-9\],\\W*r\[0-9\],\\W*asr\\W*#7$} | count 1 +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {tst\\.w\\W*r\[0-9\],\\W*r\[0-9\],\\W*ror\\W*#8$} | count 1 define i1 @f1(i32 %a, i32 %b) { %tmp = and i32 %a, %b Modified: llvm/trunk/test/CodeGen/Thumb2/tls2.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Thumb2/tls2.ll?rev=77199&r1=77198&r2=77199&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/Thumb2/tls2.ll (original) +++ llvm/trunk/test/CodeGen/Thumb2/tls2.ll Mon Jul 27 11:31:55 2009 @@ -1,7 +1,7 @@ ; RUN: llvm-as < %s | llc -mtriple=thumbv7-linux-gnueabi | \ ; RUN: grep {i(gottpoff)} ; RUN: llvm-as < %s | llc -mtriple=thumbv7-linux-gnueabi | \ -; RUN: grep {ldr r., \[pc, r.\]} +; RUN: grep {ldr.w r., \[pc, r.\]} ; RUN: llvm-as < %s | llc -mtriple=thumbv7-linux-gnueabi \ ; RUN: -relocation-model=pic | grep {__tls_get_addr} From bob.wilson at apple.com Mon Jul 27 11:35:49 2009 From: bob.wilson at apple.com (Bob Wilson) Date: Mon, 27 Jul 2009 16:35:49 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r77200 - /llvm-gcc-4.2/trunk/gcc/config/arm/arm.c Message-ID: <200907271635.n6RGZoL0012377@zion.cs.uiuc.edu> Author: bwilson Date: Mon Jul 27 11:35:42 2009 New Revision: 77200 URL: http://llvm.org/viewvc/llvm-project?rev=77200&view=rev Log: Use macros from now that is no longer included. Modified: llvm-gcc-4.2/trunk/gcc/config/arm/arm.c Modified: llvm-gcc-4.2/trunk/gcc/config/arm/arm.c URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/arm/arm.c?rev=77200&r1=77199&r2=77200&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/config/arm/arm.c (original) +++ llvm-gcc-4.2/trunk/gcc/config/arm/arm.c Mon Jul 27 11:35:42 2009 @@ -23821,8 +23821,8 @@ { const char *clobber_name; clobber_name = TREE_STRING_POINTER (TREE_VALUE (tail)); - if (tolower (clobber_name[0]) == 'q' && isdigit (clobber_name[1]) - && (isdigit (clobber_name[2]) || clobber_name[2] == '\0')) + if (TOLOWER (clobber_name[0]) == 'q' && ISDIGIT (clobber_name[1]) + && (ISDIGIT (clobber_name[2]) || clobber_name[2] == '\0')) { char regname[4] = "dXX"; /* found a Q register in the clobber list, so add the D reference From clattner at apple.com Mon Jul 27 11:36:32 2009 From: clattner at apple.com (Chris Lattner) Date: Mon, 27 Jul 2009 09:36:32 -0700 Subject: [llvm-commits] [llvm] r77153 - /llvm/trunk/lib/Target/PIC16/PIC16TargetAsmInfo.cpp In-Reply-To: <4A6DD434.5020005@microchip.com> References: <200907261025.n6QAPSPr012172@zion.cs.uiuc.edu> <7E5C84F2-926B-413A-8044-C03EDD7079EA@apple.com> <4A6DD434.5020005@microchip.com> Message-ID: <0ED2FC70-3DF8-4B12-82ED-3D1920C0C63C@apple.com> On Jul 27, 2009, at 9:22 AM, Sanjiv Gupta wrote: > Chris Lattner wrote: >> >> On Jul 26, 2009, at 3:25 AM, Sanjiv Gupta wrote: >> >>> Author: sgupta >>> Date: Sun Jul 26 05:25:01 2009 >>> New Revision: 77153 >>> >>> URL: http://llvm.org/viewvc/llvm-project?rev=77153&view=rev >>> Log: >>> Fix the breakage caused by 76950. >>> PIC16 has special naming conventions for variables having section >>> names specified via section attribute. >> >> Testcase?? > r77195. Thanks! -Chris From david_goodwin at apple.com Mon Jul 27 11:39:15 2009 From: david_goodwin at apple.com (David Goodwin) Date: Mon, 27 Jul 2009 16:39:15 -0000 Subject: [llvm-commits] [llvm] r77201 - /llvm/trunk/lib/Target/ARM/ARMInstrThumb2.td Message-ID: <200907271639.n6RGdHgL012485@zion.cs.uiuc.edu> Author: david_goodwin Date: Mon Jul 27 11:39:05 2009 New Revision: 77201 URL: http://llvm.org/viewvc/llvm-project?rev=77201&view=rev Log: Thumb-2 does not have RSC. Modified: llvm/trunk/lib/Target/ARM/ARMInstrThumb2.td Modified: llvm/trunk/lib/Target/ARM/ARMInstrThumb2.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMInstrThumb2.td?rev=77201&r1=77200&r2=77201&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMInstrThumb2.td (original) +++ llvm/trunk/lib/Target/ARM/ARMInstrThumb2.td Mon Jul 27 11:39:05 2009 @@ -287,38 +287,6 @@ } } -/// T2I_rsc_is - Same as T2I_adde_sube_irs except the order of operands are -/// reversed. It doesn't define the 'rr' form since it's handled by its -/// T2I_adde_sube_irs counterpart. -let Defs = [CPSR], Uses = [CPSR] in { -multiclass T2I_rsc_is { - // shifted imm - def ri : T2sI<(outs GPR:$dst), (ins GPR:$rhs, t2_so_imm:$lhs), - opc, " $dst, $rhs, $lhs", - [(set GPR:$dst, (opnode t2_so_imm:$lhs, GPR:$rhs))]>, - Requires<[IsThumb2, CarryDefIsUnused]>; - // shifted register - def rs : T2sI<(outs GPR:$dst), (ins GPR:$rhs, t2_so_reg:$lhs), - opc, " $dst, $rhs, $lhs", - [(set GPR:$dst, (opnode t2_so_reg:$lhs, GPR:$rhs))]>, - Requires<[IsThumb2, CarryDefIsUnused]>; - // shifted imm - def Sri : T2XI<(outs GPR:$dst), (ins GPR:$rhs, t2_so_imm:$lhs), - !strconcat(opc, "s $dst, $rhs, $lhs"), - [(set GPR:$dst, (opnode t2_so_imm:$lhs, GPR:$rhs))]>, - Requires<[IsThumb2, CarryDefIsUsed]> { - let Defs = [CPSR]; - } - // shifted register - def Srs : T2XI<(outs GPR:$dst), (ins GPR:$rhs, t2_so_reg:$lhs), - !strconcat(opc, "s $dst, $rhs, $lhs"), - [(set GPR:$dst, (opnode t2_so_reg:$lhs, GPR:$rhs))]>, - Requires<[IsThumb2, CarryDefIsUsed]> { - let Defs = [CPSR]; - } -} -} - /// T2I_rbin_s_is - Same as T2I_rbin_is except sets 's' bit. let Defs = [CPSR] in { multiclass T2I_rbin_s_is { @@ -735,10 +703,9 @@ defm t2ADC : T2I_adde_sube_irs<"adc",BinOpFrag<(adde node:$LHS, node:$RHS)>,1>; defm t2SBC : T2I_adde_sube_irs<"sbc",BinOpFrag<(sube node:$LHS, node:$RHS)>>; -// RSB, RSC +// RSB defm t2RSB : T2I_rbin_is <"rsb", BinOpFrag<(sub node:$LHS, node:$RHS)>>; defm t2RSBS : T2I_rbin_s_is <"rsb", BinOpFrag<(subc node:$LHS, node:$RHS)>>; -defm t2RSC : T2I_rsc_is <"rsc", BinOpFrag<(sube node:$LHS, node:$RHS)>>; // (sub X, imm) gets canonicalized to (add X, -imm). Match this form. def : T2Pat<(add GPR:$src, t2_so_imm_neg:$imm), From sabre at nondot.org Mon Jul 27 11:42:24 2009 From: sabre at nondot.org (Chris Lattner) Date: Mon, 27 Jul 2009 16:42:24 -0000 Subject: [llvm-commits] [llvm] r77202 - /llvm/trunk/lib/Target/Alpha/AlphaTargetAsmInfo.cpp Message-ID: <200907271642.n6RGgOi2012602@zion.cs.uiuc.edu> Author: lattner Date: Mon Jul 27 11:42:14 2009 New Revision: 77202 URL: http://llvm.org/viewvc/llvm-project?rev=77202&view=rev Log: Apparently alpha doesn't use ElfTargetAsmInfo (?) Modified: llvm/trunk/lib/Target/Alpha/AlphaTargetAsmInfo.cpp Modified: llvm/trunk/lib/Target/Alpha/AlphaTargetAsmInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Alpha/AlphaTargetAsmInfo.cpp?rev=77202&r1=77201&r2=77202&view=diff ============================================================================== --- llvm/trunk/lib/Target/Alpha/AlphaTargetAsmInfo.cpp (original) +++ llvm/trunk/lib/Target/Alpha/AlphaTargetAsmInfo.cpp Mon Jul 27 11:42:14 2009 @@ -23,4 +23,7 @@ JumpTableDirective = ".gprel32"; JumpTableDataSection = "\t.section .rodata\n"; WeakRefDirective = "\t.weak\t"; + + TextSection = getOrCreateSection("_text", true, SectionKind::Text); + DataSection = getOrCreateSection("_data", true, SectionKind::DataRel); } From sabre at nondot.org Mon Jul 27 11:44:16 2009 From: sabre at nondot.org (Chris Lattner) Date: Mon, 27 Jul 2009 16:44:16 -0000 Subject: [llvm-commits] [llvm] r77203 - /llvm/trunk/lib/Target/TargetAsmInfo.cpp Message-ID: <200907271644.n6RGiHXo012656@zion.cs.uiuc.edu> Author: lattner Date: Mon Jul 27 11:44:04 2009 New Revision: 77203 URL: http://llvm.org/viewvc/llvm-project?rev=77203&view=rev Log: don't create default text/data sections for all targets. Modified: llvm/trunk/lib/Target/TargetAsmInfo.cpp Modified: llvm/trunk/lib/Target/TargetAsmInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/TargetAsmInfo.cpp?rev=77203&r1=77202&r2=77203&view=diff ============================================================================== --- llvm/trunk/lib/Target/TargetAsmInfo.cpp (original) +++ llvm/trunk/lib/Target/TargetAsmInfo.cpp Mon Jul 27 11:44:04 2009 @@ -122,8 +122,6 @@ DwarfEHFrameSection = ".eh_frame"; DwarfExceptionSection = ".gcc_except_table"; AsmTransCBE = 0; - TextSection = getOrCreateSection("\t.text", true, SectionKind::Text); - DataSection = getOrCreateSection("\t.data", true, SectionKind::DataRel); } TargetAsmInfo::~TargetAsmInfo() { From sabre at nondot.org Mon Jul 27 11:46:00 2009 From: sabre at nondot.org (Chris Lattner) Date: Mon, 27 Jul 2009 16:46:00 -0000 Subject: [llvm-commits] [llvm] r77204 - in /llvm/trunk: include/llvm/Target/COFFTargetAsmInfo.h include/llvm/Target/ELFTargetAsmInfo.h lib/Target/COFFTargetAsmInfo.cpp lib/Target/X86/X86TargetAsmInfo.cpp lib/Target/X86/X86TargetAsmInfo.h Message-ID: <200907271646.n6RGk16h012710@zion.cs.uiuc.edu> Author: lattner Date: Mon Jul 27 11:45:59 2009 New Revision: 77204 URL: http://llvm.org/viewvc/llvm-project?rev=77204&view=rev Log: make COFF work like ELF and macho, by splitting out into its own header even though there is only one COFF target. Added: llvm/trunk/include/llvm/Target/COFFTargetAsmInfo.h llvm/trunk/lib/Target/COFFTargetAsmInfo.cpp Modified: llvm/trunk/include/llvm/Target/ELFTargetAsmInfo.h llvm/trunk/lib/Target/X86/X86TargetAsmInfo.cpp llvm/trunk/lib/Target/X86/X86TargetAsmInfo.h Added: llvm/trunk/include/llvm/Target/COFFTargetAsmInfo.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/COFFTargetAsmInfo.h?rev=77204&view=auto ============================================================================== --- llvm/trunk/include/llvm/Target/COFFTargetAsmInfo.h (added) +++ llvm/trunk/include/llvm/Target/COFFTargetAsmInfo.h Mon Jul 27 11:45:59 2009 @@ -0,0 +1,30 @@ +//===-- COFFTargetAsmInfo.h - COFF asm properties ---------------*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#ifndef LLVM_COFF_TARGET_ASM_INFO_H +#define LLVM_COFF_TARGET_ASM_INFO_H + +#include "llvm/Target/TargetAsmInfo.h" + +namespace llvm { + class COFFTargetAsmInfo : public TargetAsmInfo { + protected: + explicit COFFTargetAsmInfo(const TargetMachine &TM); + public: + + virtual const char * + getSectionPrefixForUniqueGlobal(SectionKind kind) const; + + virtual void getSectionFlagsAsString(SectionKind Kind, + SmallVectorImpl &Str) const; + }; +} + + +#endif // LLVM_ELF_TARGET_ASM_INFO_H Modified: llvm/trunk/include/llvm/Target/ELFTargetAsmInfo.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/ELFTargetAsmInfo.h?rev=77204&r1=77203&r2=77204&view=diff ============================================================================== --- llvm/trunk/include/llvm/Target/ELFTargetAsmInfo.h (original) +++ llvm/trunk/include/llvm/Target/ELFTargetAsmInfo.h Mon Jul 27 11:45:59 2009 @@ -18,7 +18,6 @@ #include "llvm/Target/TargetAsmInfo.h" namespace llvm { - class GlobalValue; struct ELFTargetAsmInfo : public TargetAsmInfo { ELFTargetAsmInfo(const TargetMachine &TM); Added: llvm/trunk/lib/Target/COFFTargetAsmInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/COFFTargetAsmInfo.cpp?rev=77204&view=auto ============================================================================== --- llvm/trunk/lib/Target/COFFTargetAsmInfo.cpp (added) +++ llvm/trunk/lib/Target/COFFTargetAsmInfo.cpp Mon Jul 27 11:45:59 2009 @@ -0,0 +1,76 @@ +//===-- COFFTargetAsmInfo.cpp - COFF asm properties -------------*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// This file defines target asm properties related what form asm statements +// should take in general on COFF-based targets +// +//===----------------------------------------------------------------------===// + +#include "llvm/Target/COFFTargetAsmInfo.h" +#include "llvm/ADT/SmallVector.h" +using namespace llvm; + +COFFTargetAsmInfo::COFFTargetAsmInfo(const TargetMachine &TM) + : TargetAsmInfo(TM) { + + TextSection = getOrCreateSection("_text", true, SectionKind::Text); + DataSection = getOrCreateSection("_data", true, SectionKind::DataRel); + + GlobalPrefix = "_"; + LCOMMDirective = "\t.lcomm\t"; + COMMDirectiveTakesAlignment = false; + HasDotTypeDotSizeDirective = false; + HasSingleParameterDotFile = false; + StaticCtorsSection = "\t.section .ctors,\"aw\""; + StaticDtorsSection = "\t.section .dtors,\"aw\""; + HiddenDirective = NULL; + PrivateGlobalPrefix = "L"; // Prefix for private global symbols + WeakRefDirective = "\t.weak\t"; + SetDirective = "\t.set\t"; + + // Set up DWARF directives + HasLEB128 = true; // Target asm supports leb128 directives (little-endian) + AbsoluteDebugSectionOffsets = true; + AbsoluteEHSectionOffsets = false; + SupportsDebugInformation = true; + DwarfSectionOffsetDirective = "\t.secrel32\t"; + DwarfAbbrevSection = "\t.section\t.debug_abbrev,\"dr\""; + DwarfInfoSection = "\t.section\t.debug_info,\"dr\""; + DwarfLineSection = "\t.section\t.debug_line,\"dr\""; + DwarfFrameSection = "\t.section\t.debug_frame,\"dr\""; + DwarfPubNamesSection ="\t.section\t.debug_pubnames,\"dr\""; + DwarfPubTypesSection ="\t.section\t.debug_pubtypes,\"dr\""; + DwarfStrSection = "\t.section\t.debug_str,\"dr\""; + DwarfLocSection = "\t.section\t.debug_loc,\"dr\""; + DwarfARangesSection = "\t.section\t.debug_aranges,\"dr\""; + DwarfRangesSection = "\t.section\t.debug_ranges,\"dr\""; + DwarfMacroInfoSection = "\t.section\t.debug_macinfo,\"dr\""; +} + +const char *COFFTargetAsmInfo:: +getSectionPrefixForUniqueGlobal(SectionKind Kind) const { + if (Kind.isText()) + return ".text$linkonce"; + if (Kind.isWriteable()) + return ".data$linkonce"; + return ".rdata$linkonce"; +} + +void COFFTargetAsmInfo::getSectionFlagsAsString(SectionKind Kind, + SmallVectorImpl &Str) const { + // FIXME: Inefficient. + std::string Res = ",\""; + if (Kind.isText()) + Res += 'x'; + if (Kind.isWriteable()) + Res += 'w'; + Res += "\""; + + Str.append(Res.begin(), Res.end()); +} Modified: llvm/trunk/lib/Target/X86/X86TargetAsmInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86TargetAsmInfo.cpp?rev=77204&r1=77203&r2=77204&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86TargetAsmInfo.cpp (original) +++ llvm/trunk/lib/Target/X86/X86TargetAsmInfo.cpp Mon Jul 27 11:45:59 2009 @@ -188,42 +188,6 @@ } } -X86COFFTargetAsmInfo::X86COFFTargetAsmInfo(const X86TargetMachine &TM): - X86GenericTargetAsmInfo(TM) { - - TextSection = getOrCreateSection("_text", true, SectionKind::Text); - DataSection = getOrCreateSection("_data", true, SectionKind::DataRel); - - GlobalPrefix = "_"; - LCOMMDirective = "\t.lcomm\t"; - COMMDirectiveTakesAlignment = false; - HasDotTypeDotSizeDirective = false; - HasSingleParameterDotFile = false; - StaticCtorsSection = "\t.section .ctors,\"aw\""; - StaticDtorsSection = "\t.section .dtors,\"aw\""; - HiddenDirective = NULL; - PrivateGlobalPrefix = "L"; // Prefix for private global symbols - WeakRefDirective = "\t.weak\t"; - SetDirective = "\t.set\t"; - - // Set up DWARF directives - HasLEB128 = true; // Target asm supports leb128 directives (little-endian) - AbsoluteDebugSectionOffsets = true; - AbsoluteEHSectionOffsets = false; - SupportsDebugInformation = true; - DwarfSectionOffsetDirective = "\t.secrel32\t"; - DwarfAbbrevSection = "\t.section\t.debug_abbrev,\"dr\""; - DwarfInfoSection = "\t.section\t.debug_info,\"dr\""; - DwarfLineSection = "\t.section\t.debug_line,\"dr\""; - DwarfFrameSection = "\t.section\t.debug_frame,\"dr\""; - DwarfPubNamesSection ="\t.section\t.debug_pubnames,\"dr\""; - DwarfPubTypesSection ="\t.section\t.debug_pubtypes,\"dr\""; - DwarfStrSection = "\t.section\t.debug_str,\"dr\""; - DwarfLocSection = "\t.section\t.debug_loc,\"dr\""; - DwarfARangesSection = "\t.section\t.debug_aranges,\"dr\""; - DwarfRangesSection = "\t.section\t.debug_ranges,\"dr\""; - DwarfMacroInfoSection = "\t.section\t.debug_macinfo,\"dr\""; -} unsigned X86COFFTargetAsmInfo::PreferredEHDataFormat(DwarfEncoding::Target Reason, @@ -263,32 +227,10 @@ return DW_EH_PE_absptr; } -const char *X86COFFTargetAsmInfo:: -getSectionPrefixForUniqueGlobal(SectionKind Kind) const { - if (Kind.isText()) - return ".text$linkonce"; - if (Kind.isWriteable()) - return ".data$linkonce"; - return ".rdata$linkonce"; -} - -void X86COFFTargetAsmInfo::getSectionFlagsAsString(SectionKind Kind, - SmallVectorImpl &Str) const { - // FIXME: Inefficient. - std::string Res = ",\""; - if (Kind.isText()) - Res += 'x'; - if (Kind.isWriteable()) - Res += 'w'; - Res += "\""; - - Str.append(Res.begin(), Res.end()); -} - X86WinTargetAsmInfo::X86WinTargetAsmInfo(const X86TargetMachine &TM): - X86GenericTargetAsmInfo(TM) { + X86TargetAsmInfo(TM) { GlobalPrefix = "_"; CommentString = ";"; Modified: llvm/trunk/lib/Target/X86/X86TargetAsmInfo.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86TargetAsmInfo.h?rev=77204&r1=77203&r2=77204&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86TargetAsmInfo.h (original) +++ llvm/trunk/lib/Target/X86/X86TargetAsmInfo.h Mon Jul 27 11:45:59 2009 @@ -16,8 +16,9 @@ #include "X86TargetMachine.h" #include "llvm/Target/TargetAsmInfo.h" -#include "llvm/Target/ELFTargetAsmInfo.h" +#include "llvm/Target/COFFTargetAsmInfo.h" #include "llvm/Target/DarwinTargetAsmInfo.h" +#include "llvm/Target/ELFTargetAsmInfo.h" #include "llvm/Support/Compiler.h" namespace llvm { @@ -49,16 +50,13 @@ bool Global) const; }; - struct X86COFFTargetAsmInfo : public X86GenericTargetAsmInfo { - explicit X86COFFTargetAsmInfo(const X86TargetMachine &TM); + struct X86COFFTargetAsmInfo : public X86TargetAsmInfo { + explicit X86COFFTargetAsmInfo(const X86TargetMachine &TM) : + X86TargetAsmInfo(TM) {} virtual unsigned PreferredEHDataFormat(DwarfEncoding::Target Reason, bool Global) const; - virtual const char * - getSectionPrefixForUniqueGlobal(SectionKind kind) const; - - virtual void getSectionFlagsAsString(SectionKind Kind, - SmallVectorImpl &Str) const; }; + struct X86WinTargetAsmInfo : public X86GenericTargetAsmInfo { explicit X86WinTargetAsmInfo(const X86TargetMachine &TM); From devang.patel at gmail.com Mon Jul 27 11:59:29 2009 From: devang.patel at gmail.com (Devang Patel) Date: Mon, 27 Jul 2009 09:59:29 -0700 Subject: [llvm-commits] [llvm] r76841 - in /llvm/trunk: include/llvm/LLVMContext.h include/llvm/MDNode.h lib/AsmParser/LLParser.cpp lib/Bitcode/Reader/BitcodeReader.cpp lib/Bitcode/Writer/BitcodeWriter.cpp lib/VMCore/AsmWriter.cpp lib/VMCore/LLVMContext.c In-Reply-To: <6a8523d60907231116v4799b0e1x7768fe118e11add9@mail.gmail.com> References: <6a8523d60907231116v4799b0e1x7768fe118e11add9@mail.gmail.com> Message-ID: <352a1fb20907270959k3bc9c8e0u35ba939e59fc0c79@mail.gmail.com> On Thu, Jul 23, 2009 at 11:16 AM, Daniel Dunbar wrote: > On Wed, Jul 22, 2009 at 7:01 PM, Devang Patel wrote: >> Author: dpatel >> Date: Wed Jul 22 21:00:51 2009 >> New Revision: 76841 >> >> URL: http://llvm.org/viewvc/llvm-project?rev=76841&view=rev >> Log: >> MDString >> - Rename member function size(). New name is length(). > > Was this in response to feedback? Yes > size() is slightly more consistent, I think? > >> - Store string beginning and length. Earlier it used to store string end. > > Can you change this to use a StringRef instead? It should simplify the API. sure. > > MDNode is also inconsistent in its use of accessors, StrBegin is > accessed directly but length is a method. I think this problem gets > cleaned up with the move to StringRef, however. > > ?- Daniel > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits > -- - Devang From dpatel at apple.com Mon Jul 27 12:17:05 2009 From: dpatel at apple.com (Devang Patel) Date: Mon, 27 Jul 2009 17:17:05 -0000 Subject: [llvm-commits] [llvm] r77208 - /llvm/trunk/lib/Transforms/Utils/ValueMapper.cpp Message-ID: <200907271717.n6RHH5bu013539@zion.cs.uiuc.edu> Author: dpatel Date: Mon Jul 27 12:17:04 2009 New Revision: 77208 URL: http://llvm.org/viewvc/llvm-project?rev=77208&view=rev Log: Do not seed mstadata into the value map. Modified: llvm/trunk/lib/Transforms/Utils/ValueMapper.cpp Modified: llvm/trunk/lib/Transforms/Utils/ValueMapper.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/ValueMapper.cpp?rev=77208&r1=77207&r2=77208&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Utils/ValueMapper.cpp (original) +++ llvm/trunk/lib/Transforms/Utils/ValueMapper.cpp Mon Jul 27 12:17:04 2009 @@ -14,6 +14,7 @@ #include "llvm/Transforms/Utils/ValueMapper.h" #include "llvm/BasicBlock.h" +#include "llvm/DerivedTypes.h" // For getNullValue(Type::Int32Ty) #include "llvm/Constants.h" #include "llvm/GlobalValue.h" #include "llvm/Instruction.h" @@ -30,9 +31,9 @@ // NOTE: VMSlot can be invalidated by any reference to VM, which can grow the // DenseMap. This includes any recursive calls to MapValue. - // Global values do not need to be seeded into the ValueMap if they are using - // the identity mapping. - if (isa(V) || isa(V)) + // Global values and metadata do not need to be seeded into the ValueMap if + // they are using the identity mapping. + if (isa(V) || isa(V) || isa(V)) return VMSlot = const_cast(V); if (Constant *C = const_cast(dyn_cast(V))) { @@ -105,32 +106,10 @@ } return VM[V] = C; - } else if (MDNode *N = dyn_cast(C)) { - for (MDNode::const_elem_iterator b = N->elem_begin(), i = b, - e = N->elem_end(); i != e; ++i) { - if (!*i) continue; - - Value *MV = MapValue(*i, VM, Context); - if (MV != *i) { - // This MDNode must contain a reference to a global, make a new MDNode - // and return it. - SmallVector Values; - Values.reserve(N->getNumElements()); - for (MDNode::const_elem_iterator j = b; j != i; ++j) - Values.push_back(*j); - Values.push_back(MV); - for (++i; i != e; ++i) - Values.push_back(MapValue(*i, VM, Context)); - return VM[V] = Context.getMDNode(Values.data(), Values.size()); - } - } - return VM[V] = C; - } else { llvm_unreachable("Unknown type of constant!"); } } - return 0; } From sabre at nondot.org Mon Jul 27 12:39:49 2009 From: sabre at nondot.org (Chris Lattner) Date: Mon, 27 Jul 2009 17:39:49 -0000 Subject: [llvm-commits] [llvm] r77210 - /llvm/trunk/lib/Target/TargetAsmInfo.cpp Message-ID: <200907271739.n6RHdn06014205@zion.cs.uiuc.edu> Author: lattner Date: Mon Jul 27 12:39:40 2009 New Revision: 77210 URL: http://llvm.org/viewvc/llvm-project?rev=77210&view=rev Log: add an explanatory comment about why we drop these in readonly and not in mergable Modified: llvm/trunk/lib/Target/TargetAsmInfo.cpp Modified: llvm/trunk/lib/Target/TargetAsmInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/TargetAsmInfo.cpp?rev=77210&r1=77209&r2=77210&view=diff ============================================================================== --- llvm/trunk/lib/Target/TargetAsmInfo.cpp (original) +++ llvm/trunk/lib/Target/TargetAsmInfo.cpp Mon Jul 27 12:39:40 2009 @@ -247,7 +247,9 @@ case Constant::LocalRelocation: // In static relocation model, the linker will resolve all addresses, so // the relocation entries will actually be constants by the time the app - // starts up. + // starts up. However, we can't put this into a mergable section, because + // the linker doesn't take relocations into consideration when it tries to + // merge entries in the section. if (ReloModel == Reloc::Static) return SectionKind::ReadOnly; @@ -258,7 +260,9 @@ case Constant::GlobalRelocations: // In static relocation model, the linker will resolve all addresses, so // the relocation entries will actually be constants by the time the app - // starts up. + // starts up. However, we can't put this into a mergable section, because + // the linker doesn't take relocations into consideration when it tries to + // merge entries in the section. if (ReloModel == Reloc::Static) return SectionKind::ReadOnly; From isanbard at gmail.com Mon Jul 27 12:46:21 2009 From: isanbard at gmail.com (Bill Wendling) Date: Mon, 27 Jul 2009 10:46:21 -0700 Subject: [llvm-commits] [llvm] r77162 - /llvm/tags/Apple/llvmCore-XXXX/ In-Reply-To: <4A6DC591.80108@gmail.com> References: <200907261840.n6QIeHnw025849@zion.cs.uiuc.edu> <5D9E9D3C-DEB3-45CE-A1F7-32CB43D937A5@gmail.com> <3B4176C9-7E28-45EB-BB13-455DE5E6F7CC@gmail.com> <4A6DC591.80108@gmail.com> Message-ID: <16e5fdf90907271046k4af6fcb4tbc30a6f8e697ee51@mail.gmail.com> 2009/7/27 T?r?k Edwin : > On 2009-07-26 23:53, Bill Wendling wrote: >> On Jul 26, 2009, at 1:25 PM, Jon Ziegler wrote: >> >>> As an aside, during execution of your script, it asked for this: >>> Authentication realm: LLVM Subversion >>> repository >>> Password for 'root': >>> a couple of times, which seems unlikely to be what is desired. >>> >>> >> That's coming from SVN. I've had it happen to me too. It seems to go >> away (for the next time) after entering the password. It comes back at >> random, though... >> > > Why root? Surely you are not committing as root ... > No. It's just some SVN weirdness on our side. I'm not an SVN expert, so I don't *really* know what's going on... -bw From dgregor at apple.com Mon Jul 27 12:55:55 2009 From: dgregor at apple.com (Douglas Gregor) Date: Mon, 27 Jul 2009 17:55:55 -0000 Subject: [llvm-commits] [llvm] r77213 - /llvm/trunk/lib/System/CMakeLists.txt Message-ID: <200907271755.n6RHtuKH014724@zion.cs.uiuc.edu> Author: dgregor Date: Mon Jul 27 12:55:55 2009 New Revision: 77213 URL: http://llvm.org/viewvc/llvm-project?rev=77213&view=rev Log: CMake: make sure that the *.inc files for libSystem show up in the resulting project. Modified: llvm/trunk/lib/System/CMakeLists.txt Modified: llvm/trunk/lib/System/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/System/CMakeLists.txt?rev=77213&r1=77212&r2=77213&view=diff ============================================================================== --- llvm/trunk/lib/System/CMakeLists.txt (original) +++ llvm/trunk/lib/System/CMakeLists.txt Mon Jul 27 12:55:55 2009 @@ -16,6 +16,29 @@ ThreadLocal.cpp Threading.cpp TimeValue.cpp + Unix/Alarm.inc + Unix/Host.inc + Unix/Memory.inc + Unix/Mutex.inc + Unix/Path.inc + Unix/Process.inc + Unix/Program.inc + Unix/RWMutex.inc + Unix/Signals.inc + Unix/ThreadLocal.inc + Unix/TimeValue.inc + Win32/Alarm.inc + Win32/DynamicLibrary.inc + Win32/Host.inc + Win32/Memory.inc + Win32/Mutex.inc + Win32/Path.inc + Win32/Process.inc + Win32/Program.inc + Win32/RWMutex.inc + Win32/Signals.inc + Win32/ThreadLocal.inc + Win32/TimeValue.inc ) if( BUILD_SHARED_LIBS AND NOT WIN32 ) From sanjiv.gupta at microchip.com Mon Jul 27 13:04:36 2009 From: sanjiv.gupta at microchip.com (Sanjiv Gupta) Date: Mon, 27 Jul 2009 18:04:36 -0000 Subject: [llvm-commits] [llvm] r77215 - /llvm/trunk/lib/Target/PIC16/PIC16AsmPrinter.cpp Message-ID: <200907271804.n6RI4aJj015142@zion.cs.uiuc.edu> Author: sgupta Date: Mon Jul 27 13:04:34 2009 New Revision: 77215 URL: http://llvm.org/viewvc/llvm-project?rev=77215&view=rev Log: Remove duplicate entries while printing decls for external symbols. Some libcall names are same, so they were getting printed twice. Modified: llvm/trunk/lib/Target/PIC16/PIC16AsmPrinter.cpp Modified: llvm/trunk/lib/Target/PIC16/PIC16AsmPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PIC16/PIC16AsmPrinter.cpp?rev=77215&r1=77214&r2=77215&view=diff ============================================================================== --- llvm/trunk/lib/Target/PIC16/PIC16AsmPrinter.cpp (original) +++ llvm/trunk/lib/Target/PIC16/PIC16AsmPrinter.cpp Mon Jul 27 13:04:34 2009 @@ -156,6 +156,26 @@ O << PIC16CondCodeToString((PIC16CC::CondCodes)CC); } +// This function is used to sort the decls list. +// should return true if s1 should come before s2. +static bool is_before(const char *s1, const char *s2) { + std::string str1 = s1; + std::string str2 = s2; + int i = str1.compare(str2); + // Return true if s1 is smaller or equal. + if (i <= 0) return true; + // false if s1 should come after s2. + return false; +} + +// This is used by list::unique below. +// unique will filter out duplicates if it knows them. +static bool is_duplicate(const char *s1, const char *s2) { + std::string str1 = s1; + std::string str2 = s2; + return str1 == str2; +} + /// printLibcallDecls - print the extern declarations for compiler /// intrinsics. /// @@ -165,8 +185,9 @@ O << TAI->getCommentString() << "External decls for libcalls - BEGIN." <<"\n"; // Remove duplicate entries. - LibcallDecls.sort(); - LibcallDecls.unique(); + LibcallDecls.sort(is_before); + LibcallDecls.unique(is_duplicate); + for (std::list::const_iterator I = LibcallDecls.begin(); I != LibcallDecls.end(); I++) { O << TAI->getExternDirective() << *I << "\n"; From gohman at apple.com Mon Jul 27 13:07:56 2009 From: gohman at apple.com (Dan Gohman) Date: Mon, 27 Jul 2009 18:07:56 -0000 Subject: [llvm-commits] [llvm] r77216 - /llvm/trunk/docs/LangRef.html Message-ID: <200907271807.n6RI7urV015433@zion.cs.uiuc.edu> Author: djg Date: Mon Jul 27 13:07:55 2009 New Revision: 77216 URL: http://llvm.org/viewvc/llvm-project?rev=77216&view=rev Log: Following discussion on llvm-dev ("proposed new rule for getelementptr"), add a new "Pointer Aliasing Rules" section. Modified: llvm/trunk/docs/LangRef.html Modified: llvm/trunk/docs/LangRef.html URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/LangRef.html?rev=77216&r1=77215&r2=77216&view=diff ============================================================================== --- llvm/trunk/docs/LangRef.html (original) +++ llvm/trunk/docs/LangRef.html Mon Jul 27 13:07:55 2009 @@ -48,6 +48,7 @@
  • Garbage Collector Names
  • Module-Level Inline Assembly
  • Data Layout
  • +
  • Pointer Aliasing Rules
  • Type System @@ -1243,6 +1244,54 @@
  • + + + +
    + +

    Any memory access must be done though a pointer value associated +with with address range of the memory access, otherwise the behavior +is undefined. Pointer values are associated with address ranges +according to the following rules:

    + +
      +
    • A pointer value formed from a getelementptr instruction is + associated with the addresses associated with the first operand of + the getelementptr.
    • +
    • An addresses of a global variable is associated with the address + range of the variable's storage.
    • +
    • The result value of an allocation instruction is associated with + the address range of the allocated storage.
    • +
    • A null pointer in the default address-space is associated with + no addresses.
    • +
    • A pointer value formed by an inttoptr is associated with + all address ranges of all pointer values that contribute (directly + or indirectly) to the computation of the pointer's value.
    • +
    • The result value of a bitcast is associated with all + addresses associated with the operand of the bitcast.
    • +
    • An integer constant other than zero or a pointer value returned + from a function not defined within LLVM may be associated with address + ranges allocated through mechanisms other than those provided by + LLVM. Such ranges shall not overlap with any ranges of address + allocated by mechanisms provided by LLVM.
    • +
    + +

    LLVM IR does not associate types with memory. The result type of a +load merely indicates the size and alignment of the memory from +which to load, as well as the interpretation of the value. The first +operand of a store similarly only indicates the size and +alignment of the store.

    + +

    Consequently, type-based alias analysis, aka TBAA, aka +-fstrict-aliasing, is not applicable to general unadorned +LLVM IR. Metadata may be used to encode +additional information which specialized optimization passes may use +to implement type-based alias analysis.

    + +
    + From scallanan at apple.com Mon Jul 27 13:07:50 2009 From: scallanan at apple.com (Sean Callanan) Date: Mon, 27 Jul 2009 11:07:50 -0700 Subject: [llvm-commits] [llvm] r77023 - /llvm/trunk/include/llvm/Support/MemoryObject.h In-Reply-To: <6a8523d60907242159m2b1f345cqf19cb795236f695f@mail.gmail.com> References: <200907250030.n6P0UqhX005432@zion.cs.uiuc.edu> <6a8523d60907242159m2b1f345cqf19cb795236f695f@mail.gmail.com> Message-ID: Wow, that logic error escaped me completely (that was essentially untested code because the subclasses always extended it). Anyway, I'll fix that and the other problems you saw. Thanks, Daniel! Sean On 2009/07/24, at 21:59, Daniel Dunbar wrote: > Hi Sean, > > Cool! A few minor comments: > > On Fri, Jul 24, 2009 at 5:30 PM, Sean Callanan > wrote: >> +/// MemoryObject - Abstract base class for contiguous addressable >> memory. >> +/// Necessary for cases in which the memory is in another >> process, in a >> +/// file, or on a remote machine. >> +class MemoryObject { >> +public: >> + /// Constructor - Override as necessary. >> + MemoryObject() { >> + } > > Since the class is abstract, we generally either make the constructor > protected or just leave it off if it is unnecessary. A virtual > destructor is needed, however. > >> + >> + /// getBase - Returns the lowest valid address in the >> region. >> + /// >> + /// @result - The lowest valid address. >> + virtual uint64_t getBase() const = 0; > > Should this be uintptr_t instead of uint64_t? > >> + /// getExtent - Returns the size of the region in bytes. >> (The region is >> + /// contiguous, so the highest valid address >> of the region >> + /// is getBase() + getExtent() - 1). >> + /// >> + /// @result - The size of the region. >> + virtual uint64_t getExtent() const = 0; >> + >> + /// readByte - Tries to read a single byte from the region. >> + /// >> + /// @param address - The address of the byte, in the same space >> as getBase(). >> + /// @param ptr - A pointer to a byte to be filled in. Must >> be non-NULL. >> + /// @result - 0 if successful; -1 if not. Failure may >> be due to a >> + /// bounds violation or an implementation- >> specific error. >> + virtual int readByte(uint64_t address, uint8_t* ptr) const = 0; > > Is there a particular reason to provide this? It seems like clients > could just pass size=1 if they only want a byte. And it seems like > most implementations will want to override readBytes anyway? > >> + /// readByte - Tries to read a contiguous range of bytes >> from the >> + /// region, up to the end of the region. >> + /// You should override this function if there >> is a quicker >> + /// way than going back and forth with >> individual bytes. >> + /// >> + /// @param address - The address of the first byte, in the same >> space as >> + /// getBase(). >> + /// @param size - The maximum number of bytes to copy. > > Is it true that address + size should never overflow? > >> + /// @param buf - A pointer to a buffer to be filled in. >> Must be non-NULL >> + /// and large enough to hold size bytes. >> + /// @result - The number of bytes copied if successful; >> (uint64_t)-1 >> + /// if not. >> + /// Failure may be due to a bounds violation >> or an >> + /// implementation-specific error. > > Is there a reason to return the number of bytes copied, it is always > the size. Then it could just return true/false on success. > >> + virtual uint64_t readBytes(uint64_t address, >> + uint64_t size, >> + uint8_t* buf) const { >> + uint64_t current = address; >> + uint64_t limit = getBase() + getExtent(); >> + uint64_t ret = 0; >> + >> + while(current - address < size && current < limit) { >> + if(readByte(current, &buf[(current - address)])) >> + return (uint64_t)-1; >> + >> + ret++; >> + } >> + >> + return ret; >> + } > > This isn't quite right (current never changes). If most > implementations will override this it might be nicer to have this just > be a pure abstract base class. But if not, > -- > for (uint64_t i = 0; i != size; ++i) > if (readByte(address + i, buf + i)) > return (uint64_t)-1; > return size; > -- > is simpler. > > - Daniel > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From mrs at apple.com Mon Jul 27 13:18:51 2009 From: mrs at apple.com (Mike Stump) Date: Mon, 27 Jul 2009 18:18:51 -0000 Subject: [llvm-commits] [llvm] r77217 - /llvm/trunk/lib/Target/CMakeLists.txt Message-ID: <200907271818.n6RIIrNQ015845@zion.cs.uiuc.edu> Author: mrs Date: Mon Jul 27 13:18:30 2009 New Revision: 77217 URL: http://llvm.org/viewvc/llvm-project?rev=77217&view=rev Log: Fix build. Modified: llvm/trunk/lib/Target/CMakeLists.txt Modified: llvm/trunk/lib/Target/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/CMakeLists.txt?rev=77217&r1=77216&r2=77217&view=diff ============================================================================== --- llvm/trunk/lib/Target/CMakeLists.txt (original) +++ llvm/trunk/lib/Target/CMakeLists.txt Mon Jul 27 13:18:30 2009 @@ -1,4 +1,5 @@ add_llvm_library(LLVMTarget + COFFTargetAsmInfo.cpp DarwinTargetAsmInfo.cpp ELFTargetAsmInfo.cpp SubtargetFeature.cpp From evan.cheng at apple.com Mon Jul 27 13:20:07 2009 From: evan.cheng at apple.com (Evan Cheng) Date: Mon, 27 Jul 2009 18:20:07 -0000 Subject: [llvm-commits] [llvm] r77218 - in /llvm/trunk/lib/Target/ARM: ARMBaseInstrInfo.cpp ARMBaseInstrInfo.h ARMBaseRegisterInfo.cpp ARMInstrInfo.cpp Thumb1InstrInfo.cpp Thumb2InstrInfo.cpp Message-ID: <200907271820.n6RIK85O015906@zion.cs.uiuc.edu> Author: evancheng Date: Mon Jul 27 13:20:05 2009 New Revision: 77218 URL: http://llvm.org/viewvc/llvm-project?rev=77218&view=rev Log: Get rid of some more getOpcode calls. This also fixes potential problems in ARMBaseInstrInfo routines not recognizing thumb1 instructions when 32-bit and 16-bit instructions mix. Modified: llvm/trunk/lib/Target/ARM/ARMBaseInstrInfo.cpp llvm/trunk/lib/Target/ARM/ARMBaseInstrInfo.h llvm/trunk/lib/Target/ARM/ARMBaseRegisterInfo.cpp llvm/trunk/lib/Target/ARM/ARMInstrInfo.cpp llvm/trunk/lib/Target/ARM/Thumb1InstrInfo.cpp llvm/trunk/lib/Target/ARM/Thumb2InstrInfo.cpp Modified: llvm/trunk/lib/Target/ARM/ARMBaseInstrInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMBaseInstrInfo.cpp?rev=77218&r1=77217&r2=77218&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMBaseInstrInfo.cpp (original) +++ llvm/trunk/lib/Target/ARM/ARMBaseInstrInfo.cpp Mon Jul 27 13:20:05 2009 @@ -30,8 +30,9 @@ EnableARM3Addr("enable-arm-3-addr-conv", cl::Hidden, cl::desc("Enable ARM 2-addr to 3-addr conv")); -ARMBaseInstrInfo::ARMBaseInstrInfo(const ARMSubtarget &STI) - : TargetInstrInfoImpl(ARMInsts, array_lengthof(ARMInsts)) { +ARMBaseInstrInfo::ARMBaseInstrInfo(const ARMSubtarget &sti) + : TargetInstrInfoImpl(ARMInsts, array_lengthof(ARMInsts)), + STI(sti) { } MachineInstr * @@ -206,11 +207,11 @@ // If there is only one terminator instruction, process it. unsigned LastOpc = LastInst->getOpcode(); if (I == MBB.begin() || !isUnpredicatedTerminator(--I)) { - if (LastOpc == getOpcode(ARMII::B)) { + if (isUncondBranchOpcode(LastOpc)) { TBB = LastInst->getOperand(0).getMBB(); return false; } - if (LastOpc == getOpcode(ARMII::Bcc)) { + if (isCondBranchOpcode(LastOpc)) { // Block ends with fall-through condbranch. TBB = LastInst->getOperand(0).getMBB(); Cond.push_back(LastInst->getOperand(1)); @@ -227,10 +228,9 @@ if (SecondLastInst && I != MBB.begin() && isUnpredicatedTerminator(--I)) return true; - // If the block ends with ARMII::B and a ARMII::Bcc, handle it. + // If the block ends with a B and a Bcc, handle it. unsigned SecondLastOpc = SecondLastInst->getOpcode(); - if ((SecondLastOpc == getOpcode(ARMII::Bcc)) && - (LastOpc == getOpcode(ARMII::B))) { + if (isCondBranchOpcode(SecondLastOpc) && isUncondBranchOpcode(LastOpc)) { TBB = SecondLastInst->getOperand(0).getMBB(); Cond.push_back(SecondLastInst->getOperand(1)); Cond.push_back(SecondLastInst->getOperand(2)); @@ -240,8 +240,7 @@ // If the block ends with two unconditional branches, handle it. The second // one is not executed, so remove it. - if ((SecondLastOpc == getOpcode(ARMII::B)) && - (LastOpc == getOpcode(ARMII::B))) { + if (isUncondBranchOpcode(SecondLastOpc) && isUncondBranchOpcode(LastOpc)) { TBB = SecondLastInst->getOperand(0).getMBB(); I = LastInst; if (AllowModify) @@ -257,7 +256,7 @@ SecondLastOpc == ARM::BR_JTadd || SecondLastOpc == ARM::tBR_JTr || SecondLastOpc == ARM::t2BR_JT) && - (LastOpc == getOpcode(ARMII::B))) { + isUncondBranchOpcode(LastOpc)) { I = LastInst; if (AllowModify) I->eraseFromParent(); @@ -270,13 +269,11 @@ unsigned ARMBaseInstrInfo::RemoveBranch(MachineBasicBlock &MBB) const { - int BOpc = getOpcode(ARMII::B); - int BccOpc = getOpcode(ARMII::Bcc); - MachineBasicBlock::iterator I = MBB.end(); if (I == MBB.begin()) return 0; --I; - if (I->getOpcode() != BOpc && I->getOpcode() != BccOpc) + if (!isUncondBranchOpcode(I->getOpcode()) && + !isCondBranchOpcode(I->getOpcode())) return 0; // Remove the branch. @@ -286,7 +283,7 @@ if (I == MBB.begin()) return 1; --I; - if (I->getOpcode() != BccOpc) + if (!isCondBranchOpcode(I->getOpcode())) return 1; // Remove the branch. @@ -300,8 +297,10 @@ const SmallVectorImpl &Cond) const { // FIXME this should probably have a DebugLoc argument DebugLoc dl = DebugLoc::getUnknownLoc(); - int BOpc = getOpcode(ARMII::B); - int BccOpc = getOpcode(ARMII::Bcc); + int BOpc = !STI.isThumb() + ? ARM::B : (STI.isThumb2() ? ARM::t2B : ARM::tB); + int BccOpc = !STI.isThumb() + ? ARM::Bcc : (STI.isThumb2() ? ARM::t2Bcc : ARM::tBcc); // Shouldn't be a fall through. assert(TBB && "InsertBranch must not be told to insert a fallthrough"); @@ -335,8 +334,8 @@ PredicateInstruction(MachineInstr *MI, const SmallVectorImpl &Pred) const { unsigned Opc = MI->getOpcode(); - if (Opc == getOpcode(ARMII::B)) { - MI->setDesc(get(getOpcode(ARMII::Bcc))); + if (isUncondBranchOpcode(Opc)) { + MI->setDesc(get(getMatchingCondBranchOpcode(Opc))); MI->addOperand(MachineOperand::CreateImm(Pred[0].getImm())); MI->addOperand(MachineOperand::CreateReg(Pred[1].getReg(), false)); return true; @@ -792,3 +791,16 @@ return false; } + +int ARMBaseInstrInfo::getMatchingCondBranchOpcode(int Opc) const { + if (Opc == ARM::B) + return ARM::Bcc; + else if (Opc == ARM::tB) + return ARM::tBcc; + else if (Opc == ARM::t2B) + return ARM::t2Bcc; + + llvm_unreachable("Unknown unconditional branch opcode!"); + return 0; +} + Modified: llvm/trunk/lib/Target/ARM/ARMBaseInstrInfo.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMBaseInstrInfo.h?rev=77218&r1=77217&r2=77218&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMBaseInstrInfo.h (original) +++ llvm/trunk/lib/Target/ARM/ARMBaseInstrInfo.h Mon Jul 27 13:20:05 2009 @@ -165,9 +165,6 @@ ADDri, ADDrs, ADDrr, - B, - Bcc, - BX_RET, LDRri, MOVr, STRri, @@ -193,9 +190,11 @@ } class ARMBaseInstrInfo : public TargetInstrInfoImpl { + const ARMSubtarget &STI; + protected: // Can be only subclassed. - explicit ARMBaseInstrInfo(const ARMSubtarget &STI); + explicit ARMBaseInstrInfo(const ARMSubtarget &sti); public: // Return the non-pre/post incrementing version of 'Opc'. Return 0 // if there is not such an opcode. @@ -292,6 +291,17 @@ MachineInstr* MI, const SmallVectorImpl &Ops, MachineInstr* LoadMI) const; + +private: + bool isUncondBranchOpcode(int Opc) const { + return Opc == ARM::B || Opc == ARM::tB || Opc == ARM::t2B; + } + + bool isCondBranchOpcode(int Opc) const { + return Opc == ARM::Bcc || Opc == ARM::tBcc || Opc == ARM::t2Bcc; + } + + int getMatchingCondBranchOpcode(int Opc) const; }; } Modified: llvm/trunk/lib/Target/ARM/ARMBaseRegisterInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMBaseRegisterInfo.cpp?rev=77218&r1=77217&r2=77218&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMBaseRegisterInfo.cpp (original) +++ llvm/trunk/lib/Target/ARM/ARMBaseRegisterInfo.cpp Mon Jul 27 13:20:05 2009 @@ -1370,7 +1370,7 @@ emitEpilogue(MachineFunction &MF, MachineBasicBlock &MBB) const { MachineBasicBlock::iterator MBBI = prior(MBB.end()); - assert(MBBI->getOpcode() == (int)getOpcode(ARMII::BX_RET) && + assert(MBBI->getDesc().isReturn() && "Can only insert epilog into returning blocks"); DebugLoc dl = MBBI->getDebugLoc(); MachineFrameInfo *MFI = MF.getFrameInfo(); Modified: llvm/trunk/lib/Target/ARM/ARMInstrInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMInstrInfo.cpp?rev=77218&r1=77217&r2=77218&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMInstrInfo.cpp (original) +++ llvm/trunk/lib/Target/ARM/ARMInstrInfo.cpp Mon Jul 27 13:20:05 2009 @@ -68,9 +68,6 @@ case ARMII::ADDri: return ARM::ADDri; case ARMII::ADDrs: return ARM::ADDrs; case ARMII::ADDrr: return ARM::ADDrr; - case ARMII::B: return ARM::B; - case ARMII::Bcc: return ARM::Bcc; - case ARMII::BX_RET: return ARM::BX_RET; case ARMII::LDRri: return 0; case ARMII::MOVr: return ARM::MOVr; case ARMII::STRri: return 0; Modified: llvm/trunk/lib/Target/ARM/Thumb1InstrInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/Thumb1InstrInfo.cpp?rev=77218&r1=77217&r2=77218&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/Thumb1InstrInfo.cpp (original) +++ llvm/trunk/lib/Target/ARM/Thumb1InstrInfo.cpp Mon Jul 27 13:20:05 2009 @@ -35,9 +35,6 @@ case ARMII::ADDri: return ARM::tADDi8; case ARMII::ADDrs: return 0; case ARMII::ADDrr: return ARM::tADDrr; - case ARMII::B: return ARM::tB; - case ARMII::Bcc: return ARM::tBcc; - case ARMII::BX_RET: return ARM::tBX_RET; case ARMII::LDRri: return 0; case ARMII::MOVr: return ARM::tMOVr; case ARMII::STRri: return 0; Modified: llvm/trunk/lib/Target/ARM/Thumb2InstrInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/Thumb2InstrInfo.cpp?rev=77218&r1=77217&r2=77218&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/Thumb2InstrInfo.cpp (original) +++ llvm/trunk/lib/Target/ARM/Thumb2InstrInfo.cpp Mon Jul 27 13:20:05 2009 @@ -36,9 +36,6 @@ case ARMII::ADDri: return ARM::t2ADDri; case ARMII::ADDrs: return ARM::t2ADDrs; case ARMII::ADDrr: return ARM::t2ADDrr; - case ARMII::B: return ARM::t2B; - case ARMII::Bcc: return ARM::t2Bcc; - case ARMII::BX_RET: return ARM::tBX_RET; case ARMII::LDRri: return ARM::t2LDRi12; case ARMII::MOVr: return ARM::t2MOVr; case ARMII::STRri: return ARM::t2STRi12; From dgregor at apple.com Mon Jul 27 13:23:47 2009 From: dgregor at apple.com (Douglas Gregor) Date: Mon, 27 Jul 2009 18:23:47 -0000 Subject: [llvm-commits] [llvm] r77219 - in /llvm/trunk: cmake/config-ix.cmake include/llvm/Config/config.h.cmake Message-ID: <200907271823.n6RINmXt016034@zion.cs.uiuc.edu> Author: dgregor Date: Mon Jul 27 13:23:41 2009 New Revision: 77219 URL: http://llvm.org/viewvc/llvm-project?rev=77219&view=rev Log: CMake configuration: find mkdtemp, mkstemp, mktemp. Modified: llvm/trunk/cmake/config-ix.cmake llvm/trunk/include/llvm/Config/config.h.cmake Modified: llvm/trunk/cmake/config-ix.cmake URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/cmake/config-ix.cmake?rev=77219&r1=77218&r2=77219&view=diff ============================================================================== --- llvm/trunk/cmake/config-ix.cmake (original) +++ llvm/trunk/cmake/config-ix.cmake Mon Jul 27 13:23:41 2009 @@ -65,6 +65,9 @@ check_symbol_exists(mallinfo malloc.h HAVE_MALLINFO) check_symbol_exists(malloc_zone_statistics malloc/malloc.h HAVE_MALLOC_ZONE_STATISTICS) +check_symbol_exists(mkdtemp unistd.h HAVE_MKDTEMP) +check_symbol_exists(mkstemp unistd.h HAVE_MKSTEMP) +check_symbol_exists(mktemp unistd.h HAVE_MKTEMP) check_symbol_exists(pthread_mutex_lock pthread.h HAVE_PTHREAD_MUTEX_LOCK) check_symbol_exists(strtoll stdlib.h HAVE_STRTOLL) check_symbol_exists(strerror string.h HAVE_STRERROR) Modified: llvm/trunk/include/llvm/Config/config.h.cmake URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Config/config.h.cmake?rev=77219&r1=77218&r2=77219&view=diff ============================================================================== --- llvm/trunk/include/llvm/Config/config.h.cmake (original) +++ llvm/trunk/include/llvm/Config/config.h.cmake Mon Jul 27 13:23:41 2009 @@ -237,13 +237,13 @@ #cmakedefine HAVE_MEMORY_H ${HAVE_MEMORY_H} /* Define to 1 if you have the `mkdtemp' function. */ -#undef HAVE_MKDTEMP +#cmakedefine HAVE_MKDTEMP ${HAVE_MKDTEMP} /* Define to 1 if you have the `mkstemp' function. */ -#undef HAVE_MKSTEMP +#cmakedefine HAVE_MKSTEMP ${HAVE_MKSTEMP} /* Define to 1 if you have the `mktemp' function. */ -#undef HAVE_MKTEMP +#cmakedefine HAVE_MKTEMP ${HAVE_MKTEMP} /* Define to 1 if you have a working `mmap' system call. */ #undef HAVE_MMAP From isanbard at gmail.com Mon Jul 27 13:24:10 2009 From: isanbard at gmail.com (Bill Wendling) Date: Mon, 27 Jul 2009 18:24:10 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r77220 - /llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp Message-ID: <200907271824.n6RIOA9w016058@zion.cs.uiuc.edu> Author: void Date: Mon Jul 27 13:24:10 2009 New Revision: 77220 URL: http://llvm.org/viewvc/llvm-project?rev=77220&view=rev Log: Fix comments and some whitespaces. Modified: llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp Modified: llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp?rev=77220&r1=77219&r2=77220&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp (original) +++ llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp Mon Jul 27 13:24:10 2009 @@ -136,7 +136,7 @@ /// function-local decls to be recycled after the function is done. static std::vector LocalLLVMValueIDs; -// Remember the LLVM value for GCC tree node. +/// llvm_set_decl - Remember the LLVM value for GCC tree node. void llvm_set_decl(tree Tr, Value *V) { // If there is not any value then do not add new LLVMValues entry. @@ -164,7 +164,8 @@ LocalLLVMValueIDs.push_back(Index); } -// Return TRUE if there is a LLVM Value associate with GCC tree node. +/// llvm_set_decl_p - Return TRUE if there is a LLVM Value associate with GCC +/// tree node. bool llvm_set_decl_p(tree Tr) { unsigned Index = GET_DECL_LLVM_INDEX(Tr); if (Index == 0) @@ -173,10 +174,10 @@ return LLVMValues[Index - 1] != 0; } -// Get LLVM Value for the GCC tree node based on LLVMValues vector index. -// If there is not any value associated then use make_decl_llvm() to -// make LLVM value. When GCC tree node is initialized, it has 0 as the -// index value. This is why all recorded indices are offset by 1. +/// llvm_get_decl - Get LLVM Value for the GCC tree node based on LLVMValues +/// vector index. If there is not any value associated then use +/// make_decl_llvm() to make LLVM value. When GCC tree node is initialized, it +/// has 0 as the index value. This is why all recorded indices are offset by 1. Value *llvm_get_decl(tree Tr) { unsigned Index = GET_DECL_LLVM_INDEX(Tr); @@ -235,7 +236,7 @@ LLVMValuesMap[New] = Idx+1; } -// Read LLVM Types string table +/// readLLVMValues - Read LLVM Types string table void readLLVMValues() { GlobalValue *V = TheModule->getNamedGlobal("llvm.pch.values"); if (!V) @@ -264,9 +265,9 @@ GV->eraseFromParent(); } -// GCC tree's uses LLVMValues vector's index to reach LLVM Values. -// Create a string table to hold these LLVM Values' names. This string -// table will be used to recreate LTypes vector after loading PCH. +/// writeLLVMValues - GCC tree's uses LLVMValues vector's index to reach LLVM +/// Values. Create a string table to hold these LLVM Values' names. This string +/// table will be used to recreate LTypes vector after loading PCH. void writeLLVMValues() { if (LLVMValues.empty()) return; @@ -313,8 +314,7 @@ } } - -// Forward decl visibility style to global. +/// handleVisibility - Forward decl visibility style to global. void handleVisibility(tree decl, GlobalValue *GV) { // If decl has visibility specified explicitely (via attribute) - honour // it. Otherwise (e.g. visibility specified via -fvisibility=hidden) honour @@ -489,7 +489,8 @@ TheDebugInfo = new DebugInfo(TheModule); } -/// Set backend options that may only be known at codegen time. +/// performLateBackendInitialization - Set backend options that may only be +/// known at codegen time. void performLateBackendInitialization(void) { // The Ada front-end sets flag_exceptions only after processing the file. ExceptionHandling = flag_exceptions; @@ -514,7 +515,7 @@ static formatted_raw_ostream *AsmOutRawStream = 0; oFILEstream *AsmIntermediateOutStream = 0; -/// Read bytecode from PCH file. Initialize TheModule and setup +/// llvm_pch_read - Read bytecode from PCH file. Initialize TheModule and setup /// LTypes vector. void llvm_pch_read(const unsigned char *Buffer, unsigned Size) { std::string ModuleName = TheModule->getModuleIdentifier(); @@ -558,7 +559,7 @@ flag_llvm_pch_read = 1; } -// Initialize PCH writing. +/// llvm_pch_write_init - Initialize PCH writing. void llvm_pch_write_init(void) { timevar_push(TV_LLVM_INIT); AsmOutStream = new oFILEstream(asm_out_file); @@ -765,7 +766,7 @@ } } -// llvm_asm_file_start - Start the .s file. +/// llvm_asm_file_start - Start the .s file. void llvm_asm_file_start(void) { timevar_push(TV_LLVM_INIT); AsmOutStream = new oFILEstream(asm_out_file); @@ -819,7 +820,7 @@ Array, Name); } -// llvm_asm_file_end - Finish the .s file. +/// llvm_asm_file_end - Finish the .s file. void llvm_asm_file_end(void) { timevar_push(TV_LLVM_PERFILE); LLVMContext &Context = getGlobalContext(); @@ -851,8 +852,8 @@ ArrayType *AT = Context.getArrayType(SBP, AUGs.size()); Constant *Init = Context.getConstantArray(AT, AUGs); GlobalValue *gv = new GlobalVariable(*TheModule, AT, false, - GlobalValue::AppendingLinkage, Init, - "llvm.used"); + GlobalValue::AppendingLinkage, Init, + "llvm.used"); gv->setSection("llvm.metadata"); AttributeUsedGlobals.clear(); } @@ -936,8 +937,8 @@ llvm_shutdown(); } -// llvm_emit_code_for_current_function - Top level interface for emitting a -// function to the .s file. +/// llvm_emit_code_for_current_function - Top level interface for emitting a +/// function to the .s file. void llvm_emit_code_for_current_function(tree fndecl) { if (cfun->nonlocal_goto_save_area) sorry("%Jnon-local gotos not supported by LLVM", fndecl); @@ -988,7 +989,7 @@ timevar_pop(TV_LLVM_FUNCS); } -// emit_alias_to_llvm - Given decl and target emit alias to target. +/// emit_alias_to_llvm - Given decl and target emit alias to target. void emit_alias_to_llvm(tree decl, tree target, tree target_decl) { if (errorcount || sorrycount) { TREE_ASM_WRITTEN(decl) = 1; @@ -1088,7 +1089,8 @@ return; } -// Convert string to global value. Use existing global if possible. +/// ConvertMetadataStringToGV - Convert string to global value. Use existing +/// global if possible. Constant* ConvertMetadataStringToGV(const char *str) { Constant *Init = getGlobalContext().getConstantArray(std::string(str)); @@ -1108,8 +1110,8 @@ } -/// AddAnnotateAttrsToGlobal - Adds decls that have a -/// annotate attribute to a vector to be emitted later. +/// AddAnnotateAttrsToGlobal - Adds decls that have a annotate attribute to a +/// vector to be emitted later. void AddAnnotateAttrsToGlobal(GlobalValue *GV, tree decl) { LLVMContext &Context = getGlobalContext(); @@ -1310,7 +1312,8 @@ GV->setThreadLocal(true); // Set the linkage. - GlobalValue::LinkageTypes Linkage = GV->getLinkage(); + GlobalValue::LinkageTypes Linkage; + if (CODE_CONTAINS_STRUCT (TREE_CODE (decl), TS_DECL_WITH_VIS) && DECL_LLVM_PRIVATE(decl)) { Linkage = GlobalValue::PrivateLinkage; @@ -1327,6 +1330,8 @@ Linkage = GlobalValue::CommonLinkage; } else if (DECL_COMDAT(decl)) { Linkage = GlobalValue::getLinkOnceLinkage(flag_odr); + } else { + Linkage = GV->getLinkage(); } // Allow loads from constants to be folded even if the constant has weak @@ -1451,16 +1456,15 @@ } -// make_decl_llvm - Create the DECL_RTL for a VAR_DECL or FUNCTION_DECL. DECL -// should have static storage duration. In other words, it should not be an -// automatic variable, including PARM_DECLs. -// -// There is, however, one exception: this function handles variables explicitly -// placed in a particular register by the user. -// -// This function corresponds to make_decl_rtl in varasm.c, and is implicitly -// called by DECL_LLVM if a decl doesn't have an LLVM set. -// +/// make_decl_llvm - Create the DECL_RTL for a VAR_DECL or FUNCTION_DECL. DECL +/// should have static storage duration. In other words, it should not be an +/// automatic variable, including PARM_DECLs. +/// +/// There is, however, one exception: this function handles variables explicitly +/// placed in a particular register by the user. +/// +/// This function corresponds to make_decl_rtl in varasm.c, and is implicitly +/// called by DECL_LLVM if a decl doesn't have an LLVM set. void make_decl_llvm(tree decl) { #ifdef ENABLE_CHECKING // Check that we are not being given an automatic variable. @@ -1681,9 +1685,9 @@ return ""; } -// llvm_mark_decl_weak - Used by varasm.c, called when a decl is found to be -// weak, but it already had an llvm object created for it. This marks the LLVM -// object weak as well. +/// llvm_mark_decl_weak - Used by varasm.c, called when a decl is found to be +/// weak, but it already had an llvm object created for it. This marks the LLVM +/// object weak as well. void llvm_mark_decl_weak(tree decl) { assert(DECL_LLVM_SET_P(decl) && DECL_WEAK(decl) && isa(DECL_LLVM(decl)) && "Decl isn't marked weak!"); @@ -1710,10 +1714,9 @@ } } -// llvm_emit_ctor_dtor - Called to emit static ctors/dtors to LLVM code. fndecl -// is a 'void()' FUNCTION_DECL for the code, initprio is the init priority, and -// isCtor indicates whether this is a ctor or dtor. -// +/// llvm_emit_ctor_dtor - Called to emit static ctors/dtors to LLVM code. +/// fndecl is a 'void()' FUNCTION_DECL for the code, initprio is the init +/// priority, and isCtor indicates whether this is a ctor or dtor. void llvm_emit_ctor_dtor(tree FnDecl, int InitPrio, int isCtor) { mark_decl_referenced(FnDecl); // Inform cgraph that we used the global. @@ -1728,9 +1731,8 @@ return; } -// llvm_emit_file_scope_asm - Emit the specified string as a file-scope inline -// asm block. -// +/// llvm_emit_file_scope_asm - Emit the specified string as a file-scope inline +/// asm block. void llvm_emit_file_scope_asm(const char *string) { if (TheModule->getModuleInlineAsm().empty()) TheModule->setModuleInlineAsm(string); @@ -1739,19 +1741,16 @@ string); } - -// print_llvm - Print the specified LLVM chunk like an operand, called by -// print-tree.c for tree dumps. -// +/// print_llvm - Print the specified LLVM chunk like an operand, called by +/// print-tree.c for tree dumps. void print_llvm(FILE *file, void *LLVM) { oFILEstream FS(file); FS << "LLVM: "; WriteAsOperand(FS, (Value*)LLVM, true, TheModule); } -// print_llvm_type - Print the specified LLVM type symbolically, called by -// print-tree.c for tree dumps. -// +/// print_llvm_type - Print the specified LLVM type symbolically, called by +/// print-tree.c for tree dumps. void print_llvm_type(FILE *file, void *LLVM) { oFILEstream FS(file); FS << "LLVM: "; @@ -1763,12 +1762,11 @@ WriteTypeSymbolic(RO, (const Type*)LLVM, TheModule); } -// Get a register name given its decl. In 4.2 unlike 4.0 these names -// have been run through set_user_assembler_name which means they may -// have a leading \1 at this point; compensate. - +/// extractRegisterName - Get a register name given its decl. In 4.2 unlike 4.0 +/// these names have been run through set_user_assembler_name which means they +/// may have a leading \1 at this point; compensate. const char* extractRegisterName(tree decl) { const char* Name = IDENTIFIER_POINTER(DECL_ASSEMBLER_NAME(decl)); - return (*Name==1) ? Name+1 : Name; + return (*Name == 1) ? Name + 1 : Name; } /* LLVM LOCAL end (ENTIRE FILE!) */ From evan.cheng at apple.com Mon Jul 27 13:25:24 2009 From: evan.cheng at apple.com (Evan Cheng) Date: Mon, 27 Jul 2009 18:25:24 -0000 Subject: [llvm-commits] [llvm] r77221 - in /llvm/trunk/lib/Target/ARM: ARMBaseInstrInfo.cpp ARMBaseInstrInfo.h Message-ID: <200907271825.n6RIPOID016105@zion.cs.uiuc.edu> Author: evancheng Date: Mon Jul 27 13:25:24 2009 New Revision: 77221 URL: http://llvm.org/viewvc/llvm-project?rev=77221&view=rev Log: Clean up. Modified: llvm/trunk/lib/Target/ARM/ARMBaseInstrInfo.cpp llvm/trunk/lib/Target/ARM/ARMBaseInstrInfo.h Modified: llvm/trunk/lib/Target/ARM/ARMBaseInstrInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMBaseInstrInfo.cpp?rev=77221&r1=77220&r2=77221&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMBaseInstrInfo.cpp (original) +++ llvm/trunk/lib/Target/ARM/ARMBaseInstrInfo.cpp Mon Jul 27 13:25:24 2009 @@ -251,11 +251,7 @@ // ...likewise if it ends with a branch table followed by an unconditional // branch. The branch folder can create these, and we must get rid of them for // correctness of Thumb constant islands. - if ((SecondLastOpc == ARM::BR_JTr || - SecondLastOpc == ARM::BR_JTm || - SecondLastOpc == ARM::BR_JTadd || - SecondLastOpc == ARM::tBR_JTr || - SecondLastOpc == ARM::t2BR_JT) && + if (isJumpTableBranchOpcode(SecondLastOpc) && isUncondBranchOpcode(LastOpc)) { I = LastInst; if (AllowModify) Modified: llvm/trunk/lib/Target/ARM/ARMBaseInstrInfo.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMBaseInstrInfo.h?rev=77221&r1=77220&r2=77221&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMBaseInstrInfo.h (original) +++ llvm/trunk/lib/Target/ARM/ARMBaseInstrInfo.h Mon Jul 27 13:25:24 2009 @@ -301,6 +301,11 @@ return Opc == ARM::Bcc || Opc == ARM::tBcc || Opc == ARM::t2Bcc; } + bool isJumpTableBranchOpcode(int Opc) const { + return Opc == ARM::BR_JTr || Opc == ARM::BR_JTm || Opc == ARM::BR_JTadd || + Opc == ARM::tBR_JTr || Opc == ARM::t2BR_JT; + } + int getMatchingCondBranchOpcode(int Opc) const; }; } From evan.cheng at apple.com Mon Jul 27 13:31:45 2009 From: evan.cheng at apple.com (Evan Cheng) Date: Mon, 27 Jul 2009 18:31:45 -0000 Subject: [llvm-commits] [llvm] r77222 - /llvm/trunk/lib/Target/ARM/ARMBaseRegisterInfo.cpp Message-ID: <200907271831.n6RIVjgK016305@zion.cs.uiuc.edu> Author: evancheng Date: Mon Jul 27 13:31:40 2009 New Revision: 77222 URL: http://llvm.org/viewvc/llvm-project?rev=77222&view=rev Log: Cosmetic change. Modified: llvm/trunk/lib/Target/ARM/ARMBaseRegisterInfo.cpp Modified: llvm/trunk/lib/Target/ARM/ARMBaseRegisterInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMBaseRegisterInfo.cpp?rev=77222&r1=77221&r2=77222&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMBaseRegisterInfo.cpp (original) +++ llvm/trunk/lib/Target/ARM/ARMBaseRegisterInfo.cpp Mon Jul 27 13:31:40 2009 @@ -1367,8 +1367,10 @@ } void ARMBaseRegisterInfo:: -emitEpilogue(MachineFunction &MF, - MachineBasicBlock &MBB) const { +emitEpilogue(MachineFunction &MF, MachineBasicBlock &MBB) const { + assert(!STI.isThumb1Only && + "This emitEpilogue should not be executed for Thumb1!"); + MachineBasicBlock::iterator MBBI = prior(MBB.end()); assert(MBBI->getDesc().isReturn() && "Can only insert epilog into returning blocks"); From scallanan at apple.com Mon Jul 27 13:33:25 2009 From: scallanan at apple.com (Sean Callanan) Date: Mon, 27 Jul 2009 18:33:25 -0000 Subject: [llvm-commits] [llvm] r77225 - /llvm/trunk/include/llvm/Support/MemoryObject.h Message-ID: <200907271833.n6RIXPL3016383@zion.cs.uiuc.edu> Author: spyffe Date: Mon Jul 27 13:33:24 2009 New Revision: 77225 URL: http://llvm.org/viewvc/llvm-project?rev=77225&view=rev Log: Many of Daniel's fixes. I'm returning the number of bytes actually copied so that the client has some warning when it reads past the end of the buffer. I'm keeping the distinction between getByte() and getBytes() for now for subclasses that use functions like ptrace() on Linux and only have a restricted interface. This makes their implementation easier, and subclasses can always write a one-line implementation of readByte() that uses their custom readBytes(). Modified: llvm/trunk/include/llvm/Support/MemoryObject.h Modified: llvm/trunk/include/llvm/Support/MemoryObject.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/MemoryObject.h?rev=77225&r1=77224&r2=77225&view=diff ============================================================================== --- llvm/trunk/include/llvm/Support/MemoryObject.h (original) +++ llvm/trunk/include/llvm/Support/MemoryObject.h Mon Jul 27 13:33:24 2009 @@ -19,21 +19,21 @@ /// file, or on a remote machine. class MemoryObject { public: - /// Constructor - Override as necessary. - MemoryObject() { + /// Destructor - Override as necessary. + ~MemoryObject() { } /// getBase - Returns the lowest valid address in the region. /// /// @result - The lowest valid address. - virtual uint64_t getBase() const = 0; + virtual uintptr_t getBase() const = 0; /// getExtent - Returns the size of the region in bytes. (The region is /// contiguous, so the highest valid address of the region /// is getBase() + getExtent() - 1). /// /// @result - The size of the region. - virtual uint64_t getExtent() const = 0; + virtual uintptr_t getExtent() const = 0; /// readByte - Tries to read a single byte from the region. /// @@ -41,7 +41,7 @@ /// @param ptr - A pointer to a byte to be filled in. Must be non-NULL. /// @result - 0 if successful; -1 if not. Failure may be due to a /// bounds violation or an implementation-specific error. - virtual int readByte(uint64_t address, uint8_t* ptr) const = 0; + virtual int readByte(uintptr_t address, uint8_t* ptr) const = 0; /// readByte - Tries to read a contiguous range of bytes from the /// region, up to the end of the region. @@ -53,25 +53,24 @@ /// @param size - The maximum number of bytes to copy. /// @param buf - A pointer to a buffer to be filled in. Must be non-NULL /// and large enough to hold size bytes. - /// @result - The number of bytes copied if successful; (uint64_t)-1 + /// @result - The number of bytes copied if successful; (uintptr_t)-1 /// if not. /// Failure may be due to a bounds violation or an /// implementation-specific error. - virtual uint64_t readBytes(uint64_t address, - uint64_t size, - uint8_t* buf) const { - uint64_t current = address; - uint64_t limit = getBase() + getExtent(); - uint64_t ret = 0; + virtual uintptr_t readBytes(uintptr_t address, + uintptr_t size, + uint8_t* buf) const { + uintptr_t current = address; + uintptr_t limit = getBase() + getExtent(); while(current - address < size && current < limit) { if(readByte(current, &buf[(current - address)])) - return (uint64_t)-1; + return (uintptr_t)-1; - ret++; + current++; } - return ret; + return current - address; } }; From isanbard at gmail.com Mon Jul 27 13:37:14 2009 From: isanbard at gmail.com (Bill Wendling) Date: Mon, 27 Jul 2009 11:37:14 -0700 Subject: [llvm-commits] [llvm] r77225 - /llvm/trunk/include/llvm/Support/MemoryObject.h In-Reply-To: <200907271833.n6RIXPL3016383@zion.cs.uiuc.edu> References: <200907271833.n6RIXPL3016383@zion.cs.uiuc.edu> Message-ID: <16e5fdf90907271137o736de19cod6a73e961d55ddc0@mail.gmail.com> On Mon, Jul 27, 2009 at 11:33 AM, Sean Callanan wrote: > Author: spyffe > Date: Mon Jul 27 13:33:24 2009 > New Revision: 77225 > > URL: http://llvm.org/viewvc/llvm-project?rev=77225&view=rev > Log: > Many of Daniel's fixes. > > I'm returning the number of bytes actually copied so that the client has some > warning when it reads past the end of the buffer. > > I'm keeping the distinction between getByte() and getBytes() for now for > subclasses that use functions like ptrace() on Linux and only have a restricted > interface. ?This makes their implementation easier, and subclasses can always > write a one-line implementation of readByte() that uses their custom > readBytes(). > > Modified: > ? ?llvm/trunk/include/llvm/Support/MemoryObject.h > > Modified: llvm/trunk/include/llvm/Support/MemoryObject.h > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/MemoryObject.h?rev=77225&r1=77224&r2=77225&view=diff > > ============================================================================== > --- llvm/trunk/include/llvm/Support/MemoryObject.h (original) > +++ llvm/trunk/include/llvm/Support/MemoryObject.h Mon Jul 27 13:33:24 2009 > @@ -19,21 +19,21 @@ > ?/// ? file, or on a remote machine. > ?class MemoryObject { > ?public: > - ?/// Constructor ? ? - Override as necessary. > - ?MemoryObject() { > + ?/// Destructor ? ? ?- Override as necessary. > + ?~MemoryObject() { > ? } > If it's meant to be overridden, it should be marked "virtual". -bw From bob.wilson at apple.com Mon Jul 27 13:38:20 2009 From: bob.wilson at apple.com (Bob Wilson) Date: Mon, 27 Jul 2009 18:38:20 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r77226 - in /llvm-gcc-4.2/trunk/gcc: c-common.c c-common.h c-opts.c config/arm/arm.h optabs.c tree.c Message-ID: <200907271838.n6RIcLcK016552@zion.cs.uiuc.edu> Author: bwilson Date: Mon Jul 27 13:38:17 2009 New Revision: 77226 URL: http://llvm.org/viewvc/llvm-project?rev=77226&view=rev Log: Adjust some ENABLE_LLVM ifdefs to allow building for gcc instead of llvm-gcc. Modified: llvm-gcc-4.2/trunk/gcc/c-common.c llvm-gcc-4.2/trunk/gcc/c-common.h llvm-gcc-4.2/trunk/gcc/c-opts.c llvm-gcc-4.2/trunk/gcc/config/arm/arm.h llvm-gcc-4.2/trunk/gcc/optabs.c llvm-gcc-4.2/trunk/gcc/tree.c Modified: llvm-gcc-4.2/trunk/gcc/c-common.c URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/c-common.c?rev=77226&r1=77225&r2=77226&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/c-common.c (original) +++ llvm-gcc-4.2/trunk/gcc/c-common.c Mon Jul 27 13:38:17 2009 @@ -303,7 +303,6 @@ /* APPLE LOCAL begin default to Wformat-security 5764921 */ /* LLVM LOCAL begin initialize via config/darwin.h */ -#ifdef ENABLE_LLVM #ifndef WARN_FORMAT_INIT #define WARN_FORMAT_INIT 0 #endif @@ -312,9 +311,6 @@ #endif int warn_format = WARN_FORMAT_INIT; int warn_format_security = WARN_FORMAT_SECURITY_INIT; -#else -int warn_format = 1; -#endif /* LLVM LOCAL end initialize via config/darwin.h */ /* APPLE LOCAL end default to Wformat-security 5764921 */ Modified: llvm-gcc-4.2/trunk/gcc/c-common.h URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/c-common.h?rev=77226&r1=77225&r2=77226&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/c-common.h (original) +++ llvm-gcc-4.2/trunk/gcc/c-common.h Mon Jul 27 13:38:17 2009 @@ -467,11 +467,9 @@ extern int warn_format; /* LLVM LOCAL begin */ -#ifdef ENABLE_LLVM /* Warn about possible security problems with format functions */ extern int warn_format_security; -#endif /* LLVM LOCAL end */ /* APPLE LOCAL begin disable_typechecking_for_spec_flag */ Modified: llvm-gcc-4.2/trunk/gcc/c-opts.c URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/c-opts.c?rev=77226&r1=77225&r2=77226&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/c-opts.c (original) +++ llvm-gcc-4.2/trunk/gcc/c-opts.c Mon Jul 27 13:38:17 2009 @@ -1193,9 +1193,7 @@ warning (OPT_Wformat_nonliteral, "-Wformat-nonliteral ignored without -Wformat"); /* LLVM LOCAL begin */ -#ifdef ENABLE_LLVM if (warn_format_security) -#endif warning (OPT_Wformat_security, "-Wformat-security ignored without -Wformat"); /* LLVM LOCAL end */ Modified: llvm-gcc-4.2/trunk/gcc/config/arm/arm.h URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/arm/arm.h?rev=77226&r1=77225&r2=77226&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/config/arm/arm.h (original) +++ llvm-gcc-4.2/trunk/gcc/config/arm/arm.h Mon Jul 27 13:38:17 2009 @@ -3231,8 +3231,6 @@ }; /* LLVM LOCAL begin */ -#ifdef ENABLE_LLVM - /* Define a static enumeration of the NEON builtins to be used when converting to LLVM intrinsics. These names are derived from the neon_builtin_data table in arm.c and should be kept in sync with that. */ @@ -3391,6 +3389,7 @@ NEON_BUILTIN_MAX }; +#ifdef ENABLE_LLVM #define LLVM_TARGET_INTRINSIC_PREFIX "arm" /* LLVM_TARGET_NAME - This specifies the name of the target, which correlates to Modified: llvm-gcc-4.2/trunk/gcc/optabs.c URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/optabs.c?rev=77226&r1=77225&r2=77226&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/optabs.c (original) +++ llvm-gcc-4.2/trunk/gcc/optabs.c Mon Jul 27 13:38:17 2009 @@ -59,11 +59,9 @@ rtx libfunc_table[LTI_MAX]; /* LLVM LOCAL begin */ -#ifdef ENABLE_LLVM /* This needs to be defined even when not building for LLVM because the garbage collector logic ignores preprocessor directives. */ tree llvm_libfunc_table[LTI_MAX]; -#endif /* LLVM LOCAL end */ /* Tables of patterns for converting one mode to another. */ Modified: llvm-gcc-4.2/trunk/gcc/tree.c URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/tree.c?rev=77226&r1=77225&r2=77226&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/tree.c (original) +++ llvm-gcc-4.2/trunk/gcc/tree.c Mon Jul 27 13:38:17 2009 @@ -7948,7 +7948,7 @@ /* APPLE LOCAL end CW asm blocks */ /* LLVM LOCAL begin */ -#ifdef ENABLE_LLVM +/* Do not conditionalize this on ENABLE_LLVM. The GTY gets used regardless. */ /* This data structure keeps gcc's garbage collector from deleting types created by the llvm virtual base class handling stuff in llvm-types.cpp. */ @@ -7959,7 +7959,6 @@ { VEC_safe_push(tree, gc, llvm_types_used, type); } -#endif /* LLVM LOCAL end */ /* APPLE LOCAL begin weak_import on property 6676828 */ From evan.cheng at apple.com Mon Jul 27 13:38:55 2009 From: evan.cheng at apple.com (Evan Cheng) Date: Mon, 27 Jul 2009 18:38:55 -0000 Subject: [llvm-commits] [llvm] r77227 - in /llvm/trunk/lib/Target/ARM: ARMBaseInstrInfo.h ARMBaseRegisterInfo.cpp ARMInstrInfo.cpp Thumb1InstrInfo.cpp Thumb2InstrInfo.cpp Message-ID: <200907271838.n6RIctBB016579@zion.cs.uiuc.edu> Author: evancheng Date: Mon Jul 27 13:38:54 2009 New Revision: 77227 URL: http://llvm.org/viewvc/llvm-project?rev=77227&view=rev Log: Get rid of more dead code. Modified: llvm/trunk/lib/Target/ARM/ARMBaseInstrInfo.h llvm/trunk/lib/Target/ARM/ARMBaseRegisterInfo.cpp llvm/trunk/lib/Target/ARM/ARMInstrInfo.cpp llvm/trunk/lib/Target/ARM/Thumb1InstrInfo.cpp llvm/trunk/lib/Target/ARM/Thumb2InstrInfo.cpp Modified: llvm/trunk/lib/Target/ARM/ARMBaseInstrInfo.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMBaseInstrInfo.h?rev=77227&r1=77226&r2=77227&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMBaseInstrInfo.h (original) +++ llvm/trunk/lib/Target/ARM/ARMBaseInstrInfo.h Mon Jul 27 13:38:54 2009 @@ -165,9 +165,7 @@ ADDri, ADDrs, ADDrr, - LDRri, MOVr, - STRri, SUBri, SUBrs, SUBrr Modified: llvm/trunk/lib/Target/ARM/ARMBaseRegisterInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMBaseRegisterInfo.cpp?rev=77227&r1=77226&r2=77227&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMBaseRegisterInfo.cpp (original) +++ llvm/trunk/lib/Target/ARM/ARMBaseRegisterInfo.cpp Mon Jul 27 13:38:54 2009 @@ -1368,7 +1368,7 @@ void ARMBaseRegisterInfo:: emitEpilogue(MachineFunction &MF, MachineBasicBlock &MBB) const { - assert(!STI.isThumb1Only && + assert(!STI.isThumb1Only() && "This emitEpilogue should not be executed for Thumb1!"); MachineBasicBlock::iterator MBBI = prior(MBB.end()); Modified: llvm/trunk/lib/Target/ARM/ARMInstrInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMInstrInfo.cpp?rev=77227&r1=77226&r2=77227&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMInstrInfo.cpp (original) +++ llvm/trunk/lib/Target/ARM/ARMInstrInfo.cpp Mon Jul 27 13:38:54 2009 @@ -68,9 +68,7 @@ case ARMII::ADDri: return ARM::ADDri; case ARMII::ADDrs: return ARM::ADDrs; case ARMII::ADDrr: return ARM::ADDrr; - case ARMII::LDRri: return 0; case ARMII::MOVr: return ARM::MOVr; - case ARMII::STRri: return 0; case ARMII::SUBri: return ARM::SUBri; case ARMII::SUBrs: return ARM::SUBrs; case ARMII::SUBrr: return ARM::SUBrr; Modified: llvm/trunk/lib/Target/ARM/Thumb1InstrInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/Thumb1InstrInfo.cpp?rev=77227&r1=77226&r2=77227&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/Thumb1InstrInfo.cpp (original) +++ llvm/trunk/lib/Target/ARM/Thumb1InstrInfo.cpp Mon Jul 27 13:38:54 2009 @@ -35,9 +35,7 @@ case ARMII::ADDri: return ARM::tADDi8; case ARMII::ADDrs: return 0; case ARMII::ADDrr: return ARM::tADDrr; - case ARMII::LDRri: return 0; case ARMII::MOVr: return ARM::tMOVr; - case ARMII::STRri: return 0; case ARMII::SUBri: return ARM::tSUBi8; case ARMII::SUBrs: return 0; case ARMII::SUBrr: return ARM::tSUBrr; Modified: llvm/trunk/lib/Target/ARM/Thumb2InstrInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/Thumb2InstrInfo.cpp?rev=77227&r1=77226&r2=77227&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/Thumb2InstrInfo.cpp (original) +++ llvm/trunk/lib/Target/ARM/Thumb2InstrInfo.cpp Mon Jul 27 13:38:54 2009 @@ -36,9 +36,7 @@ case ARMII::ADDri: return ARM::t2ADDri; case ARMII::ADDrs: return ARM::t2ADDrs; case ARMII::ADDrr: return ARM::t2ADDrr; - case ARMII::LDRri: return ARM::t2LDRi12; case ARMII::MOVr: return ARM::t2MOVr; - case ARMII::STRri: return ARM::t2STRi12; case ARMII::SUBri: return ARM::t2SUBri; case ARMII::SUBrs: return ARM::t2SUBrs; case ARMII::SUBrr: return ARM::t2SUBrr; From clattner at apple.com Mon Jul 27 13:40:15 2009 From: clattner at apple.com (Chris Lattner) Date: Mon, 27 Jul 2009 11:40:15 -0700 Subject: [llvm-commits] [llvm] r77215 - /llvm/trunk/lib/Target/PIC16/PIC16AsmPrinter.cpp In-Reply-To: <200907271804.n6RI4aJj015142@zion.cs.uiuc.edu> References: <200907271804.n6RI4aJj015142@zion.cs.uiuc.edu> Message-ID: <3DCBE4E8-E4D3-41D2-A38B-3E0E2B635AA4@apple.com> On Jul 27, 2009, at 11:04 AM, Sanjiv Gupta wrote: > URL: http://llvm.org/viewvc/llvm-project?rev=77215&view=rev > Log: > Remove duplicate entries while printing decls for external symbols. > Some libcall names are same, so they were getting printed twice. Sanjiv, these are both really expensive. They create temporary string objects. Why not just use strcmp? -Chris > > Modified: > llvm/trunk/lib/Target/PIC16/PIC16AsmPrinter.cpp > > Modified: llvm/trunk/lib/Target/PIC16/PIC16AsmPrinter.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PIC16/PIC16AsmPrinter.cpp?rev=77215&r1=77214&r2=77215&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/lib/Target/PIC16/PIC16AsmPrinter.cpp (original) > +++ llvm/trunk/lib/Target/PIC16/PIC16AsmPrinter.cpp Mon Jul 27 > 13:04:34 2009 > @@ -156,6 +156,26 @@ > O << PIC16CondCodeToString((PIC16CC::CondCodes)CC); > } > > +// This function is used to sort the decls list. > +// should return true if s1 should come before s2. > +static bool is_before(const char *s1, const char *s2) { > + std::string str1 = s1; > + std::string str2 = s2; > + int i = str1.compare(str2); > + // Return true if s1 is smaller or equal. > + if (i <= 0) return true; > + // false if s1 should come after s2. > + return false; > +} > + > +// This is used by list::unique below. > +// unique will filter out duplicates if it knows them. > +static bool is_duplicate(const char *s1, const char *s2) { > + std::string str1 = s1; > + std::string str2 = s2; > + return str1 == str2; > +} > + > /// printLibcallDecls - print the extern declarations for compiler > /// intrinsics. > /// > @@ -165,8 +185,9 @@ > > O << TAI->getCommentString() << "External decls for libcalls - > BEGIN." <<"\n"; > // Remove duplicate entries. > - LibcallDecls.sort(); > - LibcallDecls.unique(); > + LibcallDecls.sort(is_before); > + LibcallDecls.unique(is_duplicate); > + > for (std::list::const_iterator I = > LibcallDecls.begin(); > I != LibcallDecls.end(); I++) { > O << TAI->getExternDirective() << *I << "\n"; > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From dpatel at apple.com Mon Jul 27 13:42:56 2009 From: dpatel at apple.com (Devang Patel) Date: Mon, 27 Jul 2009 18:42:56 -0000 Subject: [llvm-commits] [llvm] r77229 - /llvm/trunk/lib/VMCore/AsmWriter.cpp Message-ID: <200907271842.n6RIguEe016734@zion.cs.uiuc.edu> Author: dpatel Date: Mon Jul 27 13:42:56 2009 New Revision: 77229 URL: http://llvm.org/viewvc/llvm-project?rev=77229&view=rev Log: Initialize mdnNext. Modified: llvm/trunk/lib/VMCore/AsmWriter.cpp Modified: llvm/trunk/lib/VMCore/AsmWriter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/AsmWriter.cpp?rev=77229&r1=77228&r2=77229&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/AsmWriter.cpp (original) +++ llvm/trunk/lib/VMCore/AsmWriter.cpp Mon Jul 27 13:42:56 2009 @@ -585,7 +585,7 @@ // function provided to be added to the slot table. SlotTracker::SlotTracker(const Function *F) : TheModule(F ? F->getParent() : 0), TheFunction(F), FunctionProcessed(false), - TheMDNode(0), mNext(0), fNext(0) { + TheMDNode(0), mNext(0), fNext(0), mdnNext(0) { } // Constructor to handle single MDNode. From evan.cheng at apple.com Mon Jul 27 13:44:00 2009 From: evan.cheng at apple.com (Evan Cheng) Date: Mon, 27 Jul 2009 18:44:00 -0000 Subject: [llvm-commits] [llvm] r77230 - /llvm/trunk/lib/Target/ARM/ARMBaseInstrInfo.cpp Message-ID: <200907271844.n6RIi0FA016783@zion.cs.uiuc.edu> Author: evancheng Date: Mon Jul 27 13:44:00 2009 New Revision: 77230 URL: http://llvm.org/viewvc/llvm-project?rev=77230&view=rev Log: convertToThreeAddress can't handle Thumb2 instructions (which don't have same address mode as ARM instructions). Modified: llvm/trunk/lib/Target/ARM/ARMBaseInstrInfo.cpp Modified: llvm/trunk/lib/Target/ARM/ARMBaseInstrInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMBaseInstrInfo.cpp?rev=77230&r1=77229&r2=77230&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMBaseInstrInfo.cpp (original) +++ llvm/trunk/lib/Target/ARM/ARMBaseInstrInfo.cpp Mon Jul 27 13:44:00 2009 @@ -39,6 +39,8 @@ ARMBaseInstrInfo::convertToThreeAddress(MachineFunction::iterator &MFI, MachineBasicBlock::iterator &MBBI, LiveVariables *LV) const { + // FIXME: Thumb2 support. + if (!EnableARM3Addr) return NULL; @@ -88,22 +90,19 @@ // add more than 1 instruction. Abandon! return NULL; UpdateMI = BuildMI(MF, MI->getDebugLoc(), - get(isSub ? getOpcode(ARMII::SUBri) : - getOpcode(ARMII::ADDri)), WBReg) + get(isSub ? ARM::SUBri : ARM::ADDri), WBReg) .addReg(BaseReg).addImm(Amt) .addImm(Pred).addReg(0).addReg(0); } else if (Amt != 0) { ARM_AM::ShiftOpc ShOpc = ARM_AM::getAM2ShiftOpc(OffImm); unsigned SOOpc = ARM_AM::getSORegOpc(ShOpc, Amt); UpdateMI = BuildMI(MF, MI->getDebugLoc(), - get(isSub ? getOpcode(ARMII::SUBrs) : - getOpcode(ARMII::ADDrs)), WBReg) + get(isSub ? ARM::SUBrs : ARM::ADDrs), WBReg) .addReg(BaseReg).addReg(OffReg).addReg(0).addImm(SOOpc) .addImm(Pred).addReg(0).addReg(0); } else UpdateMI = BuildMI(MF, MI->getDebugLoc(), - get(isSub ? getOpcode(ARMII::SUBrr) : - getOpcode(ARMII::ADDrr)), WBReg) + get(isSub ? ARM::SUBrr : ARM::ADDrr), WBReg) .addReg(BaseReg).addReg(OffReg) .addImm(Pred).addReg(0).addReg(0); break; @@ -114,14 +113,12 @@ if (OffReg == 0) // Immediate is 8-bits. It's guaranteed to fit in a so_imm operand. UpdateMI = BuildMI(MF, MI->getDebugLoc(), - get(isSub ? getOpcode(ARMII::SUBri) : - getOpcode(ARMII::ADDri)), WBReg) + get(isSub ? ARM::SUBri : ARM::ADDri), WBReg) .addReg(BaseReg).addImm(Amt) .addImm(Pred).addReg(0).addReg(0); else UpdateMI = BuildMI(MF, MI->getDebugLoc(), - get(isSub ? getOpcode(ARMII::SUBrr) : - getOpcode(ARMII::ADDrr)), WBReg) + get(isSub ? ARM::SUBrr : ARM::ADDrr), WBReg) .addReg(BaseReg).addReg(OffReg) .addImm(Pred).addReg(0).addReg(0); break; From evan.cheng at apple.com Mon Jul 27 13:48:47 2009 From: evan.cheng at apple.com (Evan Cheng) Date: Mon, 27 Jul 2009 18:48:47 -0000 Subject: [llvm-commits] [llvm] r77231 - in /llvm/trunk/lib/Target/ARM: ARMBaseInstrInfo.h ARMInstrInfo.cpp Thumb1InstrInfo.cpp Thumb2InstrInfo.cpp Message-ID: <200907271848.n6RImnkV016950@zion.cs.uiuc.edu> Author: evancheng Date: Mon Jul 27 13:48:45 2009 New Revision: 77231 URL: http://llvm.org/viewvc/llvm-project?rev=77231&view=rev Log: More DCE. Modified: llvm/trunk/lib/Target/ARM/ARMBaseInstrInfo.h llvm/trunk/lib/Target/ARM/ARMInstrInfo.cpp llvm/trunk/lib/Target/ARM/Thumb1InstrInfo.cpp llvm/trunk/lib/Target/ARM/Thumb2InstrInfo.cpp Modified: llvm/trunk/lib/Target/ARM/ARMBaseInstrInfo.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMBaseInstrInfo.h?rev=77231&r1=77230&r2=77231&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMBaseInstrInfo.h (original) +++ llvm/trunk/lib/Target/ARM/ARMBaseInstrInfo.h Mon Jul 27 13:48:45 2009 @@ -163,12 +163,8 @@ /// enum Op { ADDri, - ADDrs, - ADDrr, MOVr, - SUBri, - SUBrs, - SUBrr + SUBri }; } Modified: llvm/trunk/lib/Target/ARM/ARMInstrInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMInstrInfo.cpp?rev=77231&r1=77230&r2=77231&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMInstrInfo.cpp (original) +++ llvm/trunk/lib/Target/ARM/ARMInstrInfo.cpp Mon Jul 27 13:48:45 2009 @@ -66,12 +66,8 @@ getOpcode(ARMII::Op Op) const { switch (Op) { case ARMII::ADDri: return ARM::ADDri; - case ARMII::ADDrs: return ARM::ADDrs; - case ARMII::ADDrr: return ARM::ADDrr; case ARMII::MOVr: return ARM::MOVr; case ARMII::SUBri: return ARM::SUBri; - case ARMII::SUBrs: return ARM::SUBrs; - case ARMII::SUBrr: return ARM::SUBrr; default: break; } Modified: llvm/trunk/lib/Target/ARM/Thumb1InstrInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/Thumb1InstrInfo.cpp?rev=77231&r1=77230&r2=77231&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/Thumb1InstrInfo.cpp (original) +++ llvm/trunk/lib/Target/ARM/Thumb1InstrInfo.cpp Mon Jul 27 13:48:45 2009 @@ -33,12 +33,8 @@ unsigned Thumb1InstrInfo::getOpcode(ARMII::Op Op) const { switch (Op) { case ARMII::ADDri: return ARM::tADDi8; - case ARMII::ADDrs: return 0; - case ARMII::ADDrr: return ARM::tADDrr; case ARMII::MOVr: return ARM::tMOVr; case ARMII::SUBri: return ARM::tSUBi8; - case ARMII::SUBrs: return 0; - case ARMII::SUBrr: return ARM::tSUBrr; default: break; } Modified: llvm/trunk/lib/Target/ARM/Thumb2InstrInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/Thumb2InstrInfo.cpp?rev=77231&r1=77230&r2=77231&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/Thumb2InstrInfo.cpp (original) +++ llvm/trunk/lib/Target/ARM/Thumb2InstrInfo.cpp Mon Jul 27 13:48:45 2009 @@ -34,12 +34,8 @@ unsigned Thumb2InstrInfo::getOpcode(ARMII::Op Op) const { switch (Op) { case ARMII::ADDri: return ARM::t2ADDri; - case ARMII::ADDrs: return ARM::t2ADDrs; - case ARMII::ADDrr: return ARM::t2ADDrr; case ARMII::MOVr: return ARM::t2MOVr; case ARMII::SUBri: return ARM::t2SUBri; - case ARMII::SUBrs: return ARM::t2SUBrs; - case ARMII::SUBrr: return ARM::t2SUBrr; default: break; } From bruno.cardoso at gmail.com Mon Jul 27 13:54:47 2009 From: bruno.cardoso at gmail.com (Bruno Cardoso Lopes) Date: Mon, 27 Jul 2009 18:54:47 -0000 Subject: [llvm-commits] [llvm] r77232 - in /llvm/trunk/lib/CodeGen: ELF.h ELFCodeEmitter.cpp ELFWriter.cpp ELFWriter.h Message-ID: <200907271854.n6RIsmLw017108@zion.cs.uiuc.edu> Author: bruno Date: Mon Jul 27 13:54:47 2009 New Revision: 77232 URL: http://llvm.org/viewvc/llvm-project?rev=77232&view=rev Log: Handle external symbols for ELF and add some static methods to ELFSym Modified: llvm/trunk/lib/CodeGen/ELF.h llvm/trunk/lib/CodeGen/ELFCodeEmitter.cpp llvm/trunk/lib/CodeGen/ELFWriter.cpp llvm/trunk/lib/CodeGen/ELFWriter.h Modified: llvm/trunk/lib/CodeGen/ELF.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/ELF.h?rev=77232&r1=77231&r2=77232&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/ELF.h (original) +++ llvm/trunk/lib/CodeGen/ELF.h Mon Jul 27 13:54:47 2009 @@ -56,9 +56,74 @@ /// added to logical symbol table for the module. This is eventually /// turned into a real symbol table in the file. struct ELFSym { - // The global value this symbol matches. This should be null if the symbol - // is not a global value. - const GlobalValue *GV; + + // ELF symbols are related to llvm ones by being one of the two llvm + // types, for the other ones (section, file, func) a null pointer is + // assumed. + union { + const GlobalValue *GV; // If this is a pointer to a GV + const char *Ext; // If this is a pointer to a named symbol + } Source; + + // Describes from which source type this ELF symbol comes from, + // they can be GlobalValue, ExternalSymbol or neither. + enum { + isGV, // The Source.GV field is valid. + isExtSym, // The Source.ExtSym field is valid. + isOther // Not a GlobalValue or External Symbol + }; + unsigned SourceType; + + bool isGlobalValue() { return SourceType == isGV; } + bool isExternalSym() { return SourceType == isExtSym; } + + // getGlobalValue - If this is a global value which originated the + // elf symbol, return a reference to it. + const GlobalValue *getGlobalValue() { + assert(SourceType == isGV && "This is not a global value"); + return Source.GV; + }; + + // getExternalSym - If this is an external symbol which originated the + // elf symbol, return a reference to it. + const char *getExternalSymbol() { + assert(SourceType == isExtSym && "This is not an external symbol"); + return Source.Ext; + }; + + // getGV - From a global value return a elf symbol to represent it + static ELFSym *getGV(const GlobalValue *GV, unsigned Bind, + unsigned Type, unsigned Visibility) { + ELFSym *Sym = new ELFSym(); + Sym->Source.GV = GV; + Sym->setBind(Bind); + Sym->setType(Type); + Sym->setVisibility(Visibility); + Sym->SourceType = isGV; + return Sym; + } + + // getExtSym - Create and return an elf symbol to represent an + // external symbol + static ELFSym *getExtSym(const char *Ext) { + ELFSym *Sym = new ELFSym(); + Sym->Source.Ext = Ext; + Sym->setBind(STB_GLOBAL); + Sym->setType(STT_NOTYPE); + Sym->setVisibility(STV_DEFAULT); + Sym->SourceType = isExtSym; + return Sym; + } + + // getSectionSym - Returns a elf symbol to represent an elf section + static ELFSym *getSectionSym() { + ELFSym *Sym = new ELFSym(); + Sym->setBind(ELFSym::STB_LOCAL); + Sym->setType(ELFSym::STT_SECTION); + Sym->setVisibility(ELFSym::STV_DEFAULT); + Sym->SourceType = isOther; + return Sym; + } // ELF specific fields unsigned NameIdx; // Index in .strtab of name, once emitted. @@ -92,9 +157,9 @@ STV_PROTECTED = 3 // Visible in other components but not preemptable }; - ELFSym(const GlobalValue *gv) : GV(gv), NameIdx(0), Value(0), - Size(0), Info(0), Other(STV_DEFAULT), - SectionIdx(0), SymTabIdx(0) {} + ELFSym() : SourceType(isOther), NameIdx(0), Value(0), + Size(0), Info(0), Other(STV_DEFAULT), SectionIdx(0), + SymTabIdx(0) {} unsigned getBind() const { return (Info >> 4) & 0xf; } unsigned getType() const { return Info & 0xf; } Modified: llvm/trunk/lib/CodeGen/ELFCodeEmitter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/ELFCodeEmitter.cpp?rev=77232&r1=77231&r2=77232&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/ELFCodeEmitter.cpp (original) +++ llvm/trunk/lib/CodeGen/ELFCodeEmitter.cpp Mon Jul 27 13:54:47 2009 @@ -69,16 +69,11 @@ bool ELFCodeEmitter::finishFunction(MachineFunction &MF) { // Add a symbol to represent the function. const Function *F = MF.getFunction(); - ELFSym *FnSym = new ELFSym(F); - FnSym->setType(ELFSym::STT_FUNC); - FnSym->setBind(EW.getGlobalELFBinding(F)); - FnSym->setVisibility(EW.getGlobalELFVisibility(F)); + ELFSym *FnSym = ELFSym::getGV(F, EW.getGlobalELFBinding(F), ELFSym::STT_FUNC, + EW.getGlobalELFVisibility(F)); FnSym->SectionIdx = ES->SectionIdx; FnSym->Size = ES->getCurrentPCOffset()-FnStartOff; - - // keep track of the emitted function leaving its symbol index as zero - // to be patched up later when emitting the symbol table - EW.setGlobalSymLookup(F, 0); + EW.addGlobalSymbol(F); // Offset from start of Section FnSym->Value = FnStartOff; @@ -108,7 +103,9 @@ MachineRelocation &MR = Relocations[i]; intptr_t Addr; if (MR.isGlobalValue()) { - EW.PendingGlobals.insert(MR.getGlobalValue()); + EW.addGlobalSymbol(MR.getGlobalValue()); + } else if (MR.isExternalSymbol()) { + EW.addExternalSymbol(MR.getExternalSymbol()); } else if (MR.isBasicBlock()) { Addr = getMachineBasicBlockAddress(MR.getBasicBlock()); MR.setConstantVal(ES->SectionIdx); Modified: llvm/trunk/lib/CodeGen/ELFWriter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/ELFWriter.cpp?rev=77232&r1=77231&r2=77232&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/ELFWriter.cpp (original) +++ llvm/trunk/lib/CodeGen/ELFWriter.cpp Mon Jul 27 13:54:47 2009 @@ -144,6 +144,21 @@ return false; } +// addGlobalSymbol - Add a global to be processed and to the +// global symbol lookup, use a zero index for non private symbols +// because the table index will be determined later. +void ELFWriter::addGlobalSymbol(const GlobalValue *GV) { + PendingGlobals.insert(GV); +} + +// addExternalSymbol - Add the external to be processed and to the +// external symbol lookup, use a zero index because the symbol +// table index will be determined later +void ELFWriter::addExternalSymbol(const char *External) { + PendingExternals.insert(External); + ExtSymLookup[External] = 0; +} + // Get jump table section on the section name returned by TAI ELFSection &ELFWriter::getJumpTableSection() { unsigned Align = TM.getTargetData()->getPointerABIAlignment(); @@ -169,7 +184,7 @@ default: Kind = SectionKind::get(SectionKind::MergeableConst,false); break; } } - + return getSection(TAI->getSectionForMergeableConstant(Kind)->getName(), ELFSection::SHT_PROGBITS, ELFSection::SHF_MERGE | ELFSection::SHF_ALLOC, @@ -278,12 +293,18 @@ if (GblSymLookup.find(GV) != GblSymLookup.end()) return; + // If the global is a function already emited in the text section + // just add it to the global symbol lookup with a zero index to be + // patched up later. + if (isa(GV) && !GV->isDeclaration()) { + GblSymLookup[GV] = 0; + return; + } + // Handle ELF Bind, Visibility and Type for the current symbol unsigned SymBind = getGlobalELFBinding(GV); - ELFSym *GblSym = new ELFSym(GV); - GblSym->setBind(SymBind); - GblSym->setVisibility(getGlobalELFVisibility(GV)); - GblSym->setType(getGlobalELFType(GV)); + ELFSym *GblSym = ELFSym::getGV(GV, SymBind, getGlobalELFType(GV), + getGlobalELFVisibility(GV)); if (isELFUndefSym(GV)) { GblSym->SectionIdx = ELFSection::SHN_UNDEF; @@ -341,16 +362,18 @@ } } - // Private symbols must never go to the symbol table. - unsigned SymIdx = 0; if (GV->hasPrivateLinkage()) { + // For a private symbols, keep track of the index inside the + // private list since it will never go to the symbol table and + // won't be patched up later. PrivateSyms.push_back(GblSym); - SymIdx = PrivateSyms.size()-1; + GblSymLookup[GV] = PrivateSyms.size()-1; } else { + // Non private symbol are left with zero indices until they are patched + // up during the symbol table emition (where the indicies are created). SymbolList.push_back(GblSym); + GblSymLookup[GV] = 0; } - - setGlobalSymLookup(GV, SymIdx); } void ELFWriter::EmitGlobalConstantStruct(const ConstantStruct *CVS, @@ -478,10 +501,15 @@ EmitGlobal(I); // Emit all pending globals - for (SetVector::const_iterator I = PendingGlobals.begin(), - E = PendingGlobals.end(); I != E; ++I) + for (PendingGblsIter I = PendingGlobals.begin(), E = PendingGlobals.end(); + I != E; ++I) EmitGlobal(*I); + // Emit all pending externals + for (PendingExtsIter I = PendingExternals.begin(), E = PendingExternals.end(); + I != E; ++I) + SymbolList.push_back(ELFSym::getExtSym(*I)); + // Emit non-executable stack note if (TAI->getNonexecutableStackDirective()) getNonExecStackSection(); @@ -489,12 +517,8 @@ // Emit a symbol for each section created until now, skip null section for (unsigned i = 1, e = SectionList.size(); i < e; ++i) { ELFSection &ES = *SectionList[i]; - ELFSym *SectionSym = new ELFSym(0); + ELFSym *SectionSym = ELFSym::getSectionSym(); SectionSym->SectionIdx = ES.SectionIdx; - SectionSym->Size = 0; - SectionSym->setBind(ELFSym::STB_LOCAL); - SectionSym->setType(ELFSym::STT_SECTION); - SectionSym->setVisibility(ELFSym::STV_DEFAULT); SymbolList.push_back(SectionSym); ES.Sym = SymbolList.back(); } @@ -589,6 +613,10 @@ } else { Addend = TEW->getDefaultAddendForRelTy(RelType); } + } else if (MR.isExternalSymbol()) { + const char *ExtSym = MR.getExternalSymbol(); + SymIdx = ExtSymLookup[ExtSym]; + Addend = TEW->getDefaultAddendForRelTy(RelType); } else { // Get the symbol index for the section symbol unsigned SectionIdx = MR.getConstantVal(); @@ -695,7 +723,10 @@ // Use the name mangler to uniquify the LLVM symbol. std::string Name; - if (Sym.GV) Name.append(Mang->getMangledName(Sym.GV)); + if (Sym.isGlobalValue()) + Name.append(Mang->getMangledName(Sym.getGlobalValue())); + else if (Sym.isExternalSym()) + Name.append(Sym.getExternalSymbol()); if (Name.empty()) { Sym.NameIdx = 0; @@ -755,7 +786,7 @@ SymTab.EntSize = TEW->getSymTabEntrySize(); // The first entry in the symtab is the null symbol - SymbolList.insert(SymbolList.begin(), new ELFSym(0)); + SymbolList.insert(SymbolList.begin(), new ELFSym()); // Reorder the symbol table with local symbols first! unsigned FirstNonLocalSymbol = SortSymbols(); @@ -767,8 +798,11 @@ // Emit symbol to the symbol table EmitSymbol(SymTab, Sym); - // Record the symbol table index for each global value - if (Sym.GV) setGlobalSymLookup(Sym.GV, i); + // Record the symbol table index for each symbol + if (Sym.isGlobalValue()) + GblSymLookup[Sym.getGlobalValue()] = i; + else if (Sym.isExternalSym()) + ExtSymLookup[Sym.getExternalSymbol()] = i; // Keep track on the symbol index into the symbol table Sym.SymTabIdx = i; Modified: llvm/trunk/lib/CodeGen/ELFWriter.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/ELFWriter.h?rev=77232&r1=77231&r2=77232&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/ELFWriter.h (original) +++ llvm/trunk/lib/CodeGen/ELFWriter.h Mon Jul 27 13:54:47 2009 @@ -38,6 +38,8 @@ typedef std::vector::iterator ELFSymIter; typedef std::vector::iterator ELFSectionIter; + typedef SetVector::const_iterator PendingGblsIter; + typedef SetVector::const_iterator PendingExtsIter; /// ELFWriter - This class implements the common target-independent code for /// writing ELF files. Targets should derive a class from this to @@ -108,11 +110,22 @@ /// the SectionList. Used to quickly gather the Section Index from TAI names std::map SectionLookup; + /// PendingGlobals - Globals not processed as symbols yet. + SetVector PendingGlobals; + /// GblSymLookup - This is a mapping from global value to a symbol index /// in the symbol table or private symbols list. This is useful since reloc - /// symbol references must be quickly mapped to their indices on the lists + /// symbol references must be quickly mapped to their indices on the lists. std::map GblSymLookup; + /// PendingExternals - Externals not processed as symbols yet. + SetVector PendingExternals; + + /// ExtSymLookup - This is a mapping from externals to a symbol index + /// in the symbol table list. This is useful since reloc symbol references + /// must be quickly mapped to their symbol table indices. + std::map ExtSymLookup; + /// SymbolList - This is the list of symbols emitted to the symbol table. /// When the SymbolList is finally built, local symbols must be placed in /// the beginning while non-locals at the end. @@ -122,11 +135,6 @@ /// present in the SymbolList. std::vector PrivateSyms; - /// PendingGlobals - List of externally defined symbols that we have been - /// asked to emit, but have not seen a reference to. When a reference - /// is seen, the symbol will move from this list to the SymbolList. - SetVector PendingGlobals; - // Remove tab from section name prefix. This is necessary becase TAI // sometimes return a section name prefixed with elf unused chars. This is // a little bit dirty. FIXME: find a better approach, maybe add more @@ -212,10 +220,15 @@ unsigned getGlobalELFVisibility(const GlobalValue *GV); unsigned getElfSectionFlags(SectionKind Kind); - // setGlobalSymLookup - Set global value 'GV' with 'Index' in the lookup map - void setGlobalSymLookup(const GlobalValue *GV, unsigned Index) { - GblSymLookup[GV] = Index; - } + // addGlobalSymbol - Add a global to be processed and to the + // global symbol lookup, use a zero index for non private symbols + // because the table index will be determined later. + void addGlobalSymbol(const GlobalValue *GV); + + // addExternalSymbol - Add the external to be processed and to the + // external symbol lookup, use a zero index because the symbol + // table index will be determined later + void addExternalSymbol(const char *External); // As we complete the ELF file, we need to update fields in the ELF header // (e.g. the location of the section table). These members keep track of From sabre at nondot.org Mon Jul 27 14:00:33 2009 From: sabre at nondot.org (Chris Lattner) Date: Mon, 27 Jul 2009 19:00:33 -0000 Subject: [llvm-commits] [llvm] r77233 - in /llvm/trunk/lib/Target/ARM: ARMTargetAsmInfo.h ARMTargetMachine.cpp Message-ID: <200907271900.n6RJ0XN6017345@zion.cs.uiuc.edu> Author: lattner Date: Mon Jul 27 14:00:33 2009 New Revision: 77233 URL: http://llvm.org/viewvc/llvm-project?rev=77233&view=rev Log: remove dead code. Modified: llvm/trunk/lib/Target/ARM/ARMTargetAsmInfo.h llvm/trunk/lib/Target/ARM/ARMTargetMachine.cpp Modified: llvm/trunk/lib/Target/ARM/ARMTargetAsmInfo.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMTargetAsmInfo.h?rev=77233&r1=77232&r2=77233&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMTargetAsmInfo.h (original) +++ llvm/trunk/lib/Target/ARM/ARMTargetAsmInfo.h Mon Jul 27 14:00:33 2009 @@ -46,8 +46,6 @@ unsigned countString(const char *p) const; }; - typedef ARMTargetAsmInfo ARMGenericTargetAsmInfo; - EXTERN_TEMPLATE_INSTANTIATION(class ARMTargetAsmInfo); struct ARMDarwinTargetAsmInfo : public ARMTargetAsmInfo { Modified: llvm/trunk/lib/Target/ARM/ARMTargetMachine.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMTargetMachine.cpp?rev=77233&r1=77232&r2=77233&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMTargetMachine.cpp (original) +++ llvm/trunk/lib/Target/ARM/ARMTargetMachine.cpp Mon Jul 27 14:00:33 2009 @@ -76,12 +76,11 @@ const TargetAsmInfo *ARMBaseTargetMachine::createTargetAsmInfo() const { switch (Subtarget.TargetType) { - case ARMSubtarget::isDarwin: + default: llvm_unreachable("Unknown ARM subtarget kind"); + case ARMSubtarget::isDarwin: return new ARMDarwinTargetAsmInfo(*this); - case ARMSubtarget::isELF: + case ARMSubtarget::isELF: return new ARMELFTargetAsmInfo(*this); - default: - return new ARMGenericTargetAsmInfo(*this); } } From sabre at nondot.org Mon Jul 27 14:14:15 2009 From: sabre at nondot.org (Chris Lattner) Date: Mon, 27 Jul 2009 19:14:15 -0000 Subject: [llvm-commits] [llvm] r77236 - in /llvm/trunk: include/llvm/Target/COFFTargetAsmInfo.h include/llvm/Target/ELFTargetAsmInfo.h include/llvm/Target/TargetAsmInfo.h lib/Target/COFFTargetAsmInfo.cpp lib/Target/ELFTargetAsmInfo.cpp lib/Target/TargetAsmInfo.cpp Message-ID: <200907271914.n6RJEFBJ017873@zion.cs.uiuc.edu> Author: lattner Date: Mon Jul 27 14:14:14 2009 New Revision: 77236 URL: http://llvm.org/viewvc/llvm-project?rev=77236&view=rev Log: Sink getSectionPrefixForUniqueGlobal down into the TAI implementations that need it, rearrange ELFTAI. Modified: llvm/trunk/include/llvm/Target/COFFTargetAsmInfo.h llvm/trunk/include/llvm/Target/ELFTargetAsmInfo.h llvm/trunk/include/llvm/Target/TargetAsmInfo.h llvm/trunk/lib/Target/COFFTargetAsmInfo.cpp llvm/trunk/lib/Target/ELFTargetAsmInfo.cpp llvm/trunk/lib/Target/TargetAsmInfo.cpp Modified: llvm/trunk/include/llvm/Target/COFFTargetAsmInfo.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/COFFTargetAsmInfo.h?rev=77236&r1=77235&r2=77236&view=diff ============================================================================== --- llvm/trunk/include/llvm/Target/COFFTargetAsmInfo.h (original) +++ llvm/trunk/include/llvm/Target/COFFTargetAsmInfo.h Mon Jul 27 14:14:14 2009 @@ -17,12 +17,12 @@ protected: explicit COFFTargetAsmInfo(const TargetMachine &TM); public: - - virtual const char * - getSectionPrefixForUniqueGlobal(SectionKind kind) const; - virtual void getSectionFlagsAsString(SectionKind Kind, SmallVectorImpl &Str) const; + + virtual const Section * + SelectSectionForGlobal(const GlobalValue *GV, SectionKind Kind) const; + }; } Modified: llvm/trunk/include/llvm/Target/ELFTargetAsmInfo.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/ELFTargetAsmInfo.h?rev=77236&r1=77235&r2=77236&view=diff ============================================================================== --- llvm/trunk/include/llvm/Target/ELFTargetAsmInfo.h (original) +++ llvm/trunk/include/llvm/Target/ELFTargetAsmInfo.h Mon Jul 27 14:14:14 2009 @@ -33,8 +33,6 @@ void getSectionFlagsAsString(SectionKind Kind, SmallVectorImpl &Str) const; - const char *getSectionPrefixForUniqueGlobal(SectionKind Kind) const; - virtual const Section* SelectSectionForGlobal(const GlobalValue *GV, SectionKind Kind) const; Modified: llvm/trunk/include/llvm/Target/TargetAsmInfo.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetAsmInfo.h?rev=77236&r1=77235&r2=77236&view=diff ============================================================================== --- llvm/trunk/include/llvm/Target/TargetAsmInfo.h (original) +++ llvm/trunk/include/llvm/Target/TargetAsmInfo.h Mon Jul 27 14:14:14 2009 @@ -144,6 +144,9 @@ bool ExplicitSection : 1; public: + // FIXME: REMOVE. + Kind getKind() const { return K; } + bool isWeak() const { return Weak; } bool hasExplicitSection() const { return ExplicitSection; } @@ -669,15 +672,6 @@ virtual const Section *getSectionForMergeableConstant(SectionKind Kind)const; - /// getSectionPrefixForUniqueGlobal - Return a string that we should prepend - /// onto a global's name in order to get the unique section name for the - /// global. This is important for globals that need to be merged across - /// translation units. - virtual const char * - getSectionPrefixForUniqueGlobal(SectionKind Kind) const { - return 0; - } - /// getKindForNamedSection - If this target wants to be able to override /// section flags based on the name of the section specified for a global /// variable, it can implement this. This is used on ELF systems so that Modified: llvm/trunk/lib/Target/COFFTargetAsmInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/COFFTargetAsmInfo.cpp?rev=77236&r1=77235&r2=77236&view=diff ============================================================================== --- llvm/trunk/lib/Target/COFFTargetAsmInfo.cpp (original) +++ llvm/trunk/lib/Target/COFFTargetAsmInfo.cpp Mon Jul 27 14:14:14 2009 @@ -53,15 +53,6 @@ DwarfMacroInfoSection = "\t.section\t.debug_macinfo,\"dr\""; } -const char *COFFTargetAsmInfo:: -getSectionPrefixForUniqueGlobal(SectionKind Kind) const { - if (Kind.isText()) - return ".text$linkonce"; - if (Kind.isWriteable()) - return ".data$linkonce"; - return ".rdata$linkonce"; -} - void COFFTargetAsmInfo::getSectionFlagsAsString(SectionKind Kind, SmallVectorImpl &Str) const { // FIXME: Inefficient. @@ -74,3 +65,45 @@ Str.append(Res.begin(), Res.end()); } + +//===----------------------------------------------------------------------===// +// Move to AsmPrinter (mangler access). +//===----------------------------------------------------------------------===// + +#include "llvm/GlobalVariable.h" + +static const char *getSectionPrefixForUniqueGlobal(SectionKind Kind) { + if (Kind.isText()) + return ".text$linkonce"; + if (Kind.isWriteable()) + return ".data$linkonce"; + return ".rdata$linkonce"; +} + +const Section * +COFFTargetAsmInfo::SelectSectionForGlobal(const GlobalValue *GV, + SectionKind Kind) const { + assert(!Kind.isThreadLocal() && "Doesn't support TLS"); + + // If this global is linkonce/weak and the target handles this by emitting it + // into a 'uniqued' section name, create and return the section now. + if (Kind.isWeak()) { + const char *Prefix = getSectionPrefixForUniqueGlobal(Kind); + // FIXME: Use mangler interface (PR4584). + std::string Name = Prefix+GV->getNameStr(); + return getOrCreateSection(Name.c_str(), false, Kind.getKind()); + } + + if (Kind.isText()) + return getTextSection(); + + if (Kind.isBSS()) + if (const Section *S = getBSSSection_()) + return S; + + if (Kind.isReadOnly()) + if (const Section *S = getReadOnlySection()) + return S; + + return getDataSection(); +} Modified: llvm/trunk/lib/Target/ELFTargetAsmInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ELFTargetAsmInfo.cpp?rev=77236&r1=77235&r2=77236&view=diff ============================================================================== --- llvm/trunk/lib/Target/ELFTargetAsmInfo.cpp (original) +++ llvm/trunk/lib/Target/ELFTargetAsmInfo.cpp Mon Jul 27 14:14:14 2009 @@ -12,16 +12,8 @@ // //===----------------------------------------------------------------------===// -#include "llvm/Constants.h" -#include "llvm/DerivedTypes.h" -#include "llvm/Function.h" -#include "llvm/GlobalVariable.h" -#include "llvm/ADT/StringExtras.h" -#include "llvm/CodeGen/MachineConstantPool.h" -#include "llvm/Support/ErrorHandling.h" #include "llvm/Target/ELFTargetAsmInfo.h" -#include "llvm/Target/TargetMachine.h" -#include "llvm/Target/TargetData.h" +#include "llvm/ADT/SmallVector.h" using namespace llvm; ELFTargetAsmInfo::ELFTargetAsmInfo(const TargetMachine &TM) @@ -53,72 +45,6 @@ SectionKind::MergeableConst16); } - -const Section* -ELFTargetAsmInfo::SelectSectionForGlobal(const GlobalValue *GV, - SectionKind Kind) const { - if (Kind.isText()) return TextSection; - if (Kind.isMergeableCString()) { - const TargetData *TD = TM.getTargetData(); - Constant *C = cast(GV)->getInitializer(); - const Type *Ty = cast(C->getType())->getElementType(); - - unsigned Size = TD->getTypeAllocSize(Ty); - if (Size <= 16) { - assert(getCStringSection() && "Should have string section prefix"); - - // We also need alignment here. - // FIXME: this is getting the alignment of the character, not the - // alignment of the string!! - unsigned Align = TD->getPrefTypeAlignment(Ty); - if (Align < Size) - Align = Size; - - std::string Name = getCStringSection() + utostr(Size) + '.' + - utostr(Align); - return getOrCreateSection(Name.c_str(), false, - SectionKind::MergeableCString); - } - - return getReadOnlySection(); - } - - if (Kind.isMergeableConst()) { - if (Kind.isMergeableConst4()) - return MergeableConst4Section; - if (Kind.isMergeableConst8()) - return MergeableConst8Section; - if (Kind.isMergeableConst16()) - return MergeableConst16Section; - return ReadOnlySection; // .const - } - - if (Kind.isReadOnly()) return getReadOnlySection(); - - - if (Kind.isThreadData()) return TLSDataSection; - if (Kind.isThreadBSS()) return TLSBSSSection; - - if (Kind.isBSS()) return getBSSSection_(); - - - if (Kind.isDataNoRel()) return DataSection; - if (Kind.isDataRelLocal()) return DataRelLocalSection; - if (Kind.isDataRel()) return DataRelSection; - if (Kind.isReadOnlyWithRelLocal()) return DataRelROLocalSection; - - assert(Kind.isReadOnlyWithRel() && "Unknown section kind"); - return DataRelROSection; -} - -/// getSectionForMergeableConstant - Given a Mergeable constant with the -/// specified size and relocation information, return a section that it -/// should be placed in. -const Section * -ELFTargetAsmInfo::getSectionForMergeableConstant(SectionKind Kind) const { - return SelectSectionForGlobal(0, Kind); -} - /// getFlagsForNamedSection - If this target wants to be able to infer /// section flags based on the name of the section specified for a global /// variable, it can implement this. @@ -148,24 +74,6 @@ return K; } -const char * -ELFTargetAsmInfo::getSectionPrefixForUniqueGlobal(SectionKind Kind) const{ - if (Kind.isText()) return ".gnu.linkonce.t."; - if (Kind.isReadOnly()) return ".gnu.linkonce.r."; - - if (Kind.isThreadData()) return ".gnu.linkonce.td."; - if (Kind.isThreadBSS()) return ".gnu.linkonce.tb."; - - if (Kind.isBSS()) return ".gnu.linkonce.b."; - if (Kind.isDataNoRel()) return ".gnu.linkonce.d."; - if (Kind.isDataRelLocal()) return ".gnu.linkonce.d.rel.local."; - if (Kind.isDataRel()) return ".gnu.linkonce.d.rel."; - if (Kind.isReadOnlyWithRelLocal()) return ".gnu.linkonce.d.rel.ro.local."; - - assert(Kind.isReadOnlyWithRel() && "Unknown section kind"); - return ".gnu.linkonce.d.rel.ro."; -} - void ELFTargetAsmInfo::getSectionFlagsAsString(SectionKind Kind, SmallVectorImpl &Str) const { @@ -219,3 +127,108 @@ Str.push_back('6'); } } + + + +//===----------------------------------------------------------------------===// +// Move to AsmPrinter (mangler access). +//===----------------------------------------------------------------------===// + +#include "llvm/DerivedTypes.h" +#include "llvm/GlobalVariable.h" +#include "llvm/Target/TargetData.h" +#include "llvm/Target/TargetMachine.h" +#include "llvm/ADT/StringExtras.h" + +static const char *getSectionPrefixForUniqueGlobal(SectionKind Kind) { + if (Kind.isText()) return ".gnu.linkonce.t."; + if (Kind.isReadOnly()) return ".gnu.linkonce.r."; + + if (Kind.isThreadData()) return ".gnu.linkonce.td."; + if (Kind.isThreadBSS()) return ".gnu.linkonce.tb."; + + if (Kind.isBSS()) return ".gnu.linkonce.b."; + if (Kind.isDataNoRel()) return ".gnu.linkonce.d."; + if (Kind.isDataRelLocal()) return ".gnu.linkonce.d.rel.local."; + if (Kind.isDataRel()) return ".gnu.linkonce.d.rel."; + if (Kind.isReadOnlyWithRelLocal()) return ".gnu.linkonce.d.rel.ro.local."; + + assert(Kind.isReadOnlyWithRel() && "Unknown section kind"); + return ".gnu.linkonce.d.rel.ro."; +} + +const Section* +ELFTargetAsmInfo::SelectSectionForGlobal(const GlobalValue *GV, + SectionKind Kind) const { + + // If this global is linkonce/weak and the target handles this by emitting it + // into a 'uniqued' section name, create and return the section now. + if (Kind.isWeak()) { + const char *Prefix = getSectionPrefixForUniqueGlobal(Kind); + // FIXME: Use mangler interface (PR4584). + std::string Name = Prefix+GV->getNameStr(); + return getOrCreateSection(Name.c_str(), false, Kind.getKind()); + } + + if (Kind.isText()) return TextSection; + if (Kind.isMergeableCString()) { + const TargetData *TD = TM.getTargetData(); + Constant *C = cast(GV)->getInitializer(); + const Type *Ty = cast(C->getType())->getElementType(); + + unsigned Size = TD->getTypeAllocSize(Ty); + if (Size <= 16) { + assert(getCStringSection() && "Should have string section prefix"); + + // We also need alignment here. + // FIXME: this is getting the alignment of the character, not the + // alignment of the string!! + unsigned Align = TD->getPrefTypeAlignment(Ty); + if (Align < Size) + Align = Size; + + std::string Name = getCStringSection() + utostr(Size) + '.' + + utostr(Align); + return getOrCreateSection(Name.c_str(), false, + SectionKind::MergeableCString); + } + + return getReadOnlySection(); + } + + if (Kind.isMergeableConst()) { + if (Kind.isMergeableConst4()) + return MergeableConst4Section; + if (Kind.isMergeableConst8()) + return MergeableConst8Section; + if (Kind.isMergeableConst16()) + return MergeableConst16Section; + return ReadOnlySection; // .const + } + + if (Kind.isReadOnly()) return getReadOnlySection(); + + + if (Kind.isThreadData()) return TLSDataSection; + if (Kind.isThreadBSS()) return TLSBSSSection; + + if (Kind.isBSS()) return getBSSSection_(); + + + if (Kind.isDataNoRel()) return DataSection; + if (Kind.isDataRelLocal()) return DataRelLocalSection; + if (Kind.isDataRel()) return DataRelSection; + if (Kind.isReadOnlyWithRelLocal()) return DataRelROLocalSection; + + assert(Kind.isReadOnlyWithRel() && "Unknown section kind"); + return DataRelROSection; +} + +/// getSectionForMergeableConstant - Given a Mergeable constant with the +/// specified size and relocation information, return a section that it +/// should be placed in. +const Section * +ELFTargetAsmInfo::getSectionForMergeableConstant(SectionKind Kind) const { + return SelectSectionForGlobal(0, Kind); +} + Modified: llvm/trunk/lib/Target/TargetAsmInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/TargetAsmInfo.cpp?rev=77236&r1=77235&r2=77236&view=diff ============================================================================== --- llvm/trunk/lib/Target/TargetAsmInfo.cpp (original) +++ llvm/trunk/lib/Target/TargetAsmInfo.cpp Mon Jul 27 14:14:14 2009 @@ -319,15 +319,6 @@ return getOrCreateSection(GV->getSection().c_str(), false, GVKind); } - // If this global is linkonce/weak and the target handles this by emitting it - // into a 'uniqued' section name, create and return the section now. - if (Kind.isWeak()) { - if (const char *Prefix = getSectionPrefixForUniqueGlobal(Kind)) { - // FIXME: Use mangler interface (PR4584). - std::string Name = Prefix+GV->getNameStr(); - return getOrCreateSection(Name.c_str(), false, GVKind); - } - } // Use default section depending on the 'type' of global return SelectSectionForGlobal(GV, Kind); From bruno.cardoso at gmail.com Mon Jul 27 14:32:57 2009 From: bruno.cardoso at gmail.com (Bruno Cardoso Lopes) Date: Mon, 27 Jul 2009 19:32:57 -0000 Subject: [llvm-commits] [llvm] r77238 - in /llvm/trunk/lib/CodeGen: ELF.h ELFWriter.cpp ELFWriter.h Message-ID: <200907271932.n6RJWvBU018431@zion.cs.uiuc.edu> Author: bruno Date: Mon Jul 27 14:32:57 2009 New Revision: 77238 URL: http://llvm.org/viewvc/llvm-project?rev=77238&view=rev Log: add module identifier to the elf object file Modified: llvm/trunk/lib/CodeGen/ELF.h llvm/trunk/lib/CodeGen/ELFWriter.cpp llvm/trunk/lib/CodeGen/ELFWriter.h Modified: llvm/trunk/lib/CodeGen/ELF.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/ELF.h?rev=77238&r1=77237&r2=77238&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/ELF.h (original) +++ llvm/trunk/lib/CodeGen/ELF.h Mon Jul 27 14:32:57 2009 @@ -59,10 +59,10 @@ // ELF symbols are related to llvm ones by being one of the two llvm // types, for the other ones (section, file, func) a null pointer is - // assumed. + // assumed by default. union { const GlobalValue *GV; // If this is a pointer to a GV - const char *Ext; // If this is a pointer to a named symbol + const char *Ext; // If this is a pointer to a named symbol } Source; // Describes from which source type this ELF symbol comes from, @@ -118,9 +118,20 @@ // getSectionSym - Returns a elf symbol to represent an elf section static ELFSym *getSectionSym() { ELFSym *Sym = new ELFSym(); - Sym->setBind(ELFSym::STB_LOCAL); - Sym->setType(ELFSym::STT_SECTION); - Sym->setVisibility(ELFSym::STV_DEFAULT); + Sym->setBind(STB_LOCAL); + Sym->setType(STT_SECTION); + Sym->setVisibility(STV_DEFAULT); + Sym->SourceType = isOther; + return Sym; + } + + // getSectionSym - Returns a elf symbol to represent an elf section + static ELFSym *getFileSym() { + ELFSym *Sym = new ELFSym(); + Sym->setBind(STB_LOCAL); + Sym->setType(STT_FILE); + Sym->setVisibility(STV_DEFAULT); + Sym->SectionIdx = 0xfff1; // ELFSection::SHN_ABS; Sym->SourceType = isOther; return Sym; } @@ -164,6 +175,7 @@ unsigned getBind() const { return (Info >> 4) & 0xf; } unsigned getType() const { return Info & 0xf; } bool isLocalBind() const { return getBind() == STB_LOCAL; } + bool isFileType() const { return getType() == STT_FILE; } void setBind(unsigned X) { assert(X == (X & 0xF) && "Bind value out of range!"); Modified: llvm/trunk/lib/CodeGen/ELFWriter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/ELFWriter.cpp?rev=77238&r1=77237&r2=77238&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/ELFWriter.cpp (original) +++ llvm/trunk/lib/CodeGen/ELFWriter.cpp Mon Jul 27 14:32:57 2009 @@ -514,6 +514,9 @@ if (TAI->getNonexecutableStackDirective()) getNonExecStackSection(); + // Emit module name + SymbolList.push_back(ELFSym::getFileSym()); + // Emit a symbol for each section created until now, skip null section for (unsigned i = 1, e = SectionList.size(); i < e; ++i) { ELFSection &ES = *SectionList[i]; @@ -524,7 +527,7 @@ } // Emit string table - EmitStringTable(); + EmitStringTable(M.getModuleIdentifier()); // Emit the symbol table now, if non-empty. EmitSymbolTable(); @@ -709,7 +712,7 @@ /// EmitStringTable - If the current symbol table is non-empty, emit the string /// table for it -void ELFWriter::EmitStringTable() { +void ELFWriter::EmitStringTable(const std::string &ModuleName) { if (!SymbolList.size()) return; // Empty symbol table. ELFSection &StrTab = getStringTableSection(); @@ -721,12 +724,14 @@ for (ELFSymIter I=SymbolList.begin(), E=SymbolList.end(); I != E; ++I) { ELFSym &Sym = *(*I); - // Use the name mangler to uniquify the LLVM symbol. std::string Name; if (Sym.isGlobalValue()) + // Use the name mangler to uniquify the LLVM symbol. Name.append(Mang->getMangledName(Sym.getGlobalValue())); else if (Sym.isExternalSym()) Name.append(Sym.getExternalSymbol()); + else if (Sym.isFileType()) + Name.append(ModuleName); if (Name.empty()) { Sym.NameIdx = 0; Modified: llvm/trunk/lib/CodeGen/ELFWriter.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/ELFWriter.h?rev=77238&r1=77237&r2=77238&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/ELFWriter.h (original) +++ llvm/trunk/lib/CodeGen/ELFWriter.h Mon Jul 27 14:32:57 2009 @@ -250,7 +250,7 @@ void EmitSectionTableStringTable(); void EmitSymbol(BinaryObject &SymbolTable, ELFSym &Sym); void EmitSymbolTable(); - void EmitStringTable(); + void EmitStringTable(const std::string &ModuleName); void OutputSectionsAndSectionTable(); void RelocateField(BinaryObject &BO, uint32_t Offset, int64_t Value, unsigned Size); From bruno.cardoso at gmail.com Mon Jul 27 14:38:39 2009 From: bruno.cardoso at gmail.com (Bruno Cardoso Lopes) Date: Mon, 27 Jul 2009 19:38:39 -0000 Subject: [llvm-commits] [llvm] r77239 - /llvm/trunk/lib/CodeGen/ELF.h Message-ID: <200907271938.n6RJcdVO018592@zion.cs.uiuc.edu> Author: bruno Date: Mon Jul 27 14:38:38 2009 New Revision: 77239 URL: http://llvm.org/viewvc/llvm-project?rev=77239&view=rev Log: fix comment Modified: llvm/trunk/lib/CodeGen/ELF.h Modified: llvm/trunk/lib/CodeGen/ELF.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/ELF.h?rev=77239&r1=77238&r2=77239&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/ELF.h (original) +++ llvm/trunk/lib/CodeGen/ELF.h Mon Jul 27 14:38:38 2009 @@ -125,7 +125,7 @@ return Sym; } - // getSectionSym - Returns a elf symbol to represent an elf section + // getFileSym - Returns a elf symbol to represent the module identifier static ELFSym *getFileSym() { ELFSym *Sym = new ELFSym(); Sym->setBind(STB_LOCAL); From pawel.worach at gmail.com Mon Jul 27 14:44:47 2009 From: pawel.worach at gmail.com (Pawel Worach) Date: Mon, 27 Jul 2009 21:44:47 +0200 Subject: [llvm-commits] [patch] make Program::FindProgramByName not look in "." unless it's in $PATH Message-ID: Hi, This patch fixes the FIXME regarding looking in "." for ld, as, clang-cc and friends unconditionally. If "." is in $PATH it will pick up the program in "." correctly. Tested on Unix only. Solution suggested by edwin on #llvm. Regards -- Pawel -------------- next part -------------- A non-text attachment was scrubbed... Name: program-path.diff Type: application/octet-stream Size: 1141 bytes Desc: not available Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20090727/6d5e4646/attachment.obj From scallanan at apple.com Mon Jul 27 14:45:29 2009 From: scallanan at apple.com (Sean Callanan) Date: Mon, 27 Jul 2009 19:45:29 -0000 Subject: [llvm-commits] [llvm] r77240 - /llvm/trunk/include/llvm/Support/MemoryObject.h Message-ID: <200907271945.n6RJjTLR018790@zion.cs.uiuc.edu> Author: spyffe Date: Mon Jul 27 14:45:28 2009 New Revision: 77240 URL: http://llvm.org/viewvc/llvm-project?rev=77240&view=rev Log: Thanks, Bill! Modified: llvm/trunk/include/llvm/Support/MemoryObject.h Modified: llvm/trunk/include/llvm/Support/MemoryObject.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/MemoryObject.h?rev=77240&r1=77239&r2=77240&view=diff ============================================================================== --- llvm/trunk/include/llvm/Support/MemoryObject.h (original) +++ llvm/trunk/include/llvm/Support/MemoryObject.h Mon Jul 27 14:45:28 2009 @@ -20,7 +20,7 @@ class MemoryObject { public: /// Destructor - Override as necessary. - ~MemoryObject() { + virtual ~MemoryObject() { } /// getBase - Returns the lowest valid address in the region. From david_goodwin at apple.com Mon Jul 27 14:59:26 2009 From: david_goodwin at apple.com (David Goodwin) Date: Mon, 27 Jul 2009 19:59:26 -0000 Subject: [llvm-commits] [llvm] r77242 - in /llvm/trunk/lib/Target/ARM: ARMInstrFormats.td ARMInstrThumb.td Message-ID: <200907271959.n6RJxQfE019336@zion.cs.uiuc.edu> Author: david_goodwin Date: Mon Jul 27 14:59:26 2009 New Revision: 77242 URL: http://llvm.org/viewvc/llvm-project?rev=77242&view=rev Log: Remove TPat. No patterns depend on just isThumb(). Must use either T1Pat (isThumb1Only()) or T2Pat (is Thumb2). Modified: llvm/trunk/lib/Target/ARM/ARMInstrFormats.td llvm/trunk/lib/Target/ARM/ARMInstrThumb.td Modified: llvm/trunk/lib/Target/ARM/ARMInstrFormats.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMInstrFormats.td?rev=77242&r1=77241&r2=77242&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMInstrFormats.td (original) +++ llvm/trunk/lib/Target/ARM/ARMInstrFormats.td Mon Jul 27 14:59:26 2009 @@ -816,15 +816,6 @@ class TJTI pattern> : ThumbI; -// TPat - Same as Pat<>, but requires that the compiler be in Thumb mode. -class TPat : Pat { - list Predicates = [IsThumb]; -} - -class Tv5Pat : Pat { - list Predicates = [IsThumb, HasV5T]; -} - // Thumb1 only class Thumb1I pattern> @@ -894,10 +885,6 @@ class T1pIs pattern> : Thumb1pI; -class T1Pat : Pat { - list Predicates = [IsThumb1Only]; -} - // Thumb2I - Thumb2 instruction. Almost all Thumb2 instructions are predicable. class Thumb2I pattern> @@ -967,6 +954,15 @@ list Predicates = [IsThumb2]; } +// Tv5Pat - Same as Pat<>, but requires V5T Thumb mode. +class Tv5Pat : Pat { + list Predicates = [IsThumb1Only, HasV5T]; +} + +// T1Pat - Same as Pat<>, but requires that the compiler be in Thumb1 mode. +class T1Pat : Pat { + list Predicates = [IsThumb1Only]; +} // T2Pat - Same as Pat<>, but requires that the compiler be in Thumb2 mode. class T2Pat : Pat { Modified: llvm/trunk/lib/Target/ARM/ARMInstrThumb.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMInstrThumb.td?rev=77242&r1=77241&r2=77242&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMInstrThumb.td (original) +++ llvm/trunk/lib/Target/ARM/ARMInstrThumb.td Mon Jul 27 14:59:26 2009 @@ -575,31 +575,31 @@ // // Add with carry -def : TPat<(addc tGPR:$lhs, imm0_7:$rhs), - (tADDi3 tGPR:$lhs, imm0_7:$rhs)>; -def : TPat<(addc tGPR:$lhs, imm8_255:$rhs), - (tADDi3 tGPR:$lhs, imm8_255:$rhs)>; -def : TPat<(addc tGPR:$lhs, tGPR:$rhs), - (tADDrr tGPR:$lhs, tGPR:$rhs)>; +def : T1Pat<(addc tGPR:$lhs, imm0_7:$rhs), + (tADDi3 tGPR:$lhs, imm0_7:$rhs)>; +def : T1Pat<(addc tGPR:$lhs, imm8_255:$rhs), + (tADDi3 tGPR:$lhs, imm8_255:$rhs)>; +def : T1Pat<(addc tGPR:$lhs, tGPR:$rhs), + (tADDrr tGPR:$lhs, tGPR:$rhs)>; // Subtract with carry -def : TPat<(addc tGPR:$lhs, imm0_7_neg:$rhs), - (tSUBi3 tGPR:$lhs, imm0_7_neg:$rhs)>; -def : TPat<(addc tGPR:$lhs, imm8_255_neg:$rhs), - (tSUBi8 tGPR:$lhs, imm8_255_neg:$rhs)>; -def : TPat<(subc tGPR:$lhs, tGPR:$rhs), - (tSUBrr tGPR:$lhs, tGPR:$rhs)>; +def : T1Pat<(addc tGPR:$lhs, imm0_7_neg:$rhs), + (tSUBi3 tGPR:$lhs, imm0_7_neg:$rhs)>; +def : T1Pat<(addc tGPR:$lhs, imm8_255_neg:$rhs), + (tSUBi8 tGPR:$lhs, imm8_255_neg:$rhs)>; +def : T1Pat<(subc tGPR:$lhs, tGPR:$rhs), + (tSUBrr tGPR:$lhs, tGPR:$rhs)>; // ConstantPool, GlobalAddress -def : TPat<(ARMWrapper tglobaladdr :$dst), (tLEApcrel tglobaladdr :$dst)>; -def : TPat<(ARMWrapper tconstpool :$dst), (tLEApcrel tconstpool :$dst)>; +def : T1Pat<(ARMWrapper tglobaladdr :$dst), (tLEApcrel tglobaladdr :$dst)>; +def : T1Pat<(ARMWrapper tconstpool :$dst), (tLEApcrel tconstpool :$dst)>; // JumpTable -def : TPat<(ARMWrapperJT tjumptable:$dst, imm:$id), - (tLEApcrelJT tjumptable:$dst, imm:$id)>; +def : T1Pat<(ARMWrapperJT tjumptable:$dst, imm:$id), + (tLEApcrelJT tjumptable:$dst, imm:$id)>; // Direct calls -def : TPat<(ARMtcall texternalsym:$func), (tBL texternalsym:$func)>; +def : T1Pat<(ARMtcall texternalsym:$func), (tBL texternalsym:$func)>; def : Tv5Pat<(ARMcall texternalsym:$func), (tBLXi texternalsym:$func)>; // Indirect calls to ARM routines From gohman at apple.com Mon Jul 27 15:20:24 2009 From: gohman at apple.com (Dan Gohman) Date: Mon, 27 Jul 2009 13:20:24 -0700 Subject: [llvm-commits] [patch] make Program::FindProgramByName not look in "." unless it's in $PATH In-Reply-To: References: Message-ID: On Jul 27, 2009, at 12:44 PM, Pawel Worach wrote: > Hi, > > This patch fixes the FIXME regarding looking in "." for ld, as, > clang-cc and friends unconditionally. > If "." is in $PATH it will pick up the program in "." correctly. > Tested on Unix only. > > Solution suggested by edwin on #llvm. Hello, The traditional behavior of sh(1) and friends is to use the given path verbatim if it contains any slashes, not just if it's absolute. Dan From sabre at nondot.org Mon Jul 27 15:28:54 2009 From: sabre at nondot.org (Chris Lattner) Date: Mon, 27 Jul 2009 15:28:54 -0500 Subject: [llvm-commits] CVS: llvm-www/devmtg/2008-08/index.html Message-ID: <200907272028.n6RKSs4H020342@zion.cs.uiuc.edu> Changes in directory llvm-www/devmtg/2008-08: index.html updated: 1.27 -> 1.28 --- Log message: add youtube video link --- Diffs of the changes: (+3 -1) index.html | 4 +++- 1 files changed, 3 insertions(+), 1 deletion(-) Index: llvm-www/devmtg/2008-08/index.html diff -u llvm-www/devmtg/2008-08/index.html:1.27 llvm-www/devmtg/2008-08/index.html:1.28 --- llvm-www/devmtg/2008-08/index.html:1.27 Tue Aug 5 12:13:10 2008 +++ llvm-www/devmtg/2008-08/index.html Mon Jul 27 15:27:50 2009 @@ -31,6 +31,8 @@ major LLVM subsystems, followed by talks on applications of LLVM for various specific projects.

    +

    In addition to being available here, the videos are also available on youtube.

    @@ -371,7 +373,7 @@ src="http://jigsaw.w3.org/css-validator/images/vcss" alt="Valid CSS!">Valid HTML 4.01! -
    Last modified: $Date: 2008/08/05 17:13:10 $ +
    Last modified: $Date: 2009/07/27 20:27:50 $ From dpatel at apple.com Mon Jul 27 15:30:06 2009 From: dpatel at apple.com (Devang Patel) Date: Mon, 27 Jul 2009 20:30:06 -0000 Subject: [llvm-commits] [llvm] r77243 - /llvm/trunk/include/llvm/Analysis/DebugInfo.h Message-ID: <200907272030.n6RKU6ZK020400@zion.cs.uiuc.edu> Author: dpatel Date: Mon Jul 27 15:30:05 2009 New Revision: 77243 URL: http://llvm.org/viewvc/llvm-project?rev=77243&view=rev Log: 80 columns! Modified: llvm/trunk/include/llvm/Analysis/DebugInfo.h Modified: llvm/trunk/include/llvm/Analysis/DebugInfo.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/DebugInfo.h?rev=77243&r1=77242&r2=77243&view=diff ============================================================================== --- llvm/trunk/include/llvm/Analysis/DebugInfo.h (original) +++ llvm/trunk/include/llvm/Analysis/DebugInfo.h Mon Jul 27 15:30:05 2009 @@ -213,9 +213,15 @@ // carry this is just plain insane. uint64_t getOffsetInBits() const { return getUInt64Field(7); } unsigned getFlags() const { return getUnsignedField(8); } - bool isPrivate() const { return (getFlags() & FlagPrivate) != 0; } - bool isProtected() const { return (getFlags() & FlagProtected) != 0; } - bool isForwardDecl() const { return (getFlags() & FlagFwdDecl) != 0; } + bool isPrivate() const { return + (getFlags() & FlagPrivate) != 0; + } + bool isProtected() const { + return (getFlags() & FlagProtected) != 0; + } + bool isForwardDecl() const { + return (getFlags() & FlagFwdDecl) != 0; + } /// dump - print type. void dump() const; @@ -552,8 +558,9 @@ /// Find the debug info descriptor corresponding to this global variable. Value *findDbgGlobalDeclare(GlobalVariable *V); - bool getLocationInfo(const Value *V, std::string &DisplayName, std::string &Type, - unsigned &LineNo, std::string &File, std::string &Dir); + bool getLocationInfo(const Value *V, std::string &DisplayName, + std::string &Type, unsigned &LineNo, std::string &File, + std::string &Dir); /// CollectDebugInfoAnchors - Collect debugging information anchors. void CollectDebugInfoAnchors(Module &M, From a at bolka.at Mon Jul 27 15:37:11 2009 From: a at bolka.at (Andreas Bolka) Date: Mon, 27 Jul 2009 20:37:11 -0000 Subject: [llvm-commits] [llvm] r77244 - /llvm/trunk/docs/LangRef.html Message-ID: <200907272037.n6RKbBlU020662@zion.cs.uiuc.edu> Author: abolka Date: Mon Jul 27 15:37:10 2009 New Revision: 77244 URL: http://llvm.org/viewvc/llvm-project?rev=77244&view=rev Log: Fix typo. Modified: llvm/trunk/docs/LangRef.html Modified: llvm/trunk/docs/LangRef.html URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/LangRef.html?rev=77244&r1=77243&r2=77244&view=diff ============================================================================== --- llvm/trunk/docs/LangRef.html (original) +++ llvm/trunk/docs/LangRef.html Mon Jul 27 15:37:10 2009 @@ -1252,7 +1252,7 @@

    Any memory access must be done though a pointer value associated -with with address range of the memory access, otherwise the behavior +with an address range of the memory access, otherwise the behavior is undefined. Pointer values are associated with address ranges according to the following rules:

    From gohman at apple.com Mon Jul 27 15:49:45 2009 From: gohman at apple.com (Dan Gohman) Date: Mon, 27 Jul 2009 20:49:45 -0000 Subject: [llvm-commits] [llvm] r77245 - /llvm/trunk/lib/Support/raw_ostream.cpp Message-ID: <200907272049.n6RKnj5q021011@zion.cs.uiuc.edu> Author: djg Date: Mon Jul 27 15:49:44 2009 New Revision: 77245 URL: http://llvm.org/viewvc/llvm-project?rev=77245&view=rev Log: Add an assertion check to raw_ostream's destructor to verify that the subclass hasn't left any pending data in the buffer. Modified: llvm/trunk/lib/Support/raw_ostream.cpp Modified: llvm/trunk/lib/Support/raw_ostream.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/raw_ostream.cpp?rev=77245&r1=77244&r2=77245&view=diff ============================================================================== --- llvm/trunk/lib/Support/raw_ostream.cpp (original) +++ llvm/trunk/lib/Support/raw_ostream.cpp Mon Jul 27 15:49:44 2009 @@ -45,6 +45,11 @@ using namespace llvm; raw_ostream::~raw_ostream() { + // raw_ostream's subclasses should take care to flush the buffer + // in their destructors. + assert(OutBufCur == OutBufStart && + "raw_ostream destructor called with non-empty buffer!"); + delete [] OutBufStart; // If there are any pending errors, report them now. Clients wishing From gohman at apple.com Mon Jul 27 15:50:43 2009 From: gohman at apple.com (Dan Gohman) Date: Mon, 27 Jul 2009 13:50:43 -0700 Subject: [llvm-commits] [llvm] r77170 - in /llvm/trunk/tools/lto: LTOCodeGenerator.cpp LTOModule.cpp In-Reply-To: <200907262216.n6QMGfTB032208@zion.cs.uiuc.edu> References: <200907262216.n6QMGfTB032208@zion.cs.uiuc.edu> Message-ID: <9B684429-0A62-4A8F-A3FF-67B9DC926544@apple.com> On Jul 26, 2009, at 3:16 PM, Nick Lewycky wrote: > * flush the formatted_raw_ostream& or else not all of the assembly > will make > it to the .s file. (It doesn't do this in its destructor?!) Hi Nick, this sounds like a bug. raw_ostream's subclasses should flush the buffer in their destructors. Or is the raw_ostream destructor not getting called? Dan From resistor at mac.com Mon Jul 27 15:59:44 2009 From: resistor at mac.com (Owen Anderson) Date: Mon, 27 Jul 2009 20:59:44 -0000 Subject: [llvm-commits] [llvm] r77247 - in /llvm/trunk: docs/tutorial/ examples/Kaleidoscope/ include/llvm/ include/llvm/Support/ lib/Analysis/ lib/AsmParser/ lib/Bitcode/Reader/ lib/CodeGen/SelectionDAG/ lib/ExecutionEngine/JIT/ lib/Target/X86/ lib/Transforms/Scalar/ lib/VMCore/ Message-ID: <200907272059.n6RKxjTC021335@zion.cs.uiuc.edu> Author: resistor Date: Mon Jul 27 15:59:43 2009 New Revision: 77247 URL: http://llvm.org/viewvc/llvm-project?rev=77247&view=rev Log: Move ConstantFP construction back to the 2.5-ish API. Modified: llvm/trunk/docs/tutorial/LangImpl3.html llvm/trunk/docs/tutorial/LangImpl4.html llvm/trunk/docs/tutorial/LangImpl5.html llvm/trunk/docs/tutorial/LangImpl6.html llvm/trunk/docs/tutorial/LangImpl7.html llvm/trunk/examples/Kaleidoscope/toy.cpp llvm/trunk/include/llvm/Constants.h llvm/trunk/include/llvm/LLVMContext.h llvm/trunk/include/llvm/Support/PatternMatch.h llvm/trunk/lib/Analysis/ConstantFolding.cpp llvm/trunk/lib/AsmParser/LLParser.cpp llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp llvm/trunk/lib/ExecutionEngine/JIT/JIT.cpp llvm/trunk/lib/Target/X86/X86ISelLowering.cpp llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp llvm/trunk/lib/Transforms/Scalar/SimplifyLibCalls.cpp llvm/trunk/lib/VMCore/ConstantFold.cpp llvm/trunk/lib/VMCore/Constants.cpp llvm/trunk/lib/VMCore/Core.cpp llvm/trunk/lib/VMCore/Instructions.cpp llvm/trunk/lib/VMCore/LLVMContext.cpp llvm/trunk/lib/VMCore/LLVMContextImpl.cpp llvm/trunk/lib/VMCore/LLVMContextImpl.h Modified: llvm/trunk/docs/tutorial/LangImpl3.html URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/tutorial/LangImpl3.html?rev=77247&r1=77246&r2=77247&view=diff ============================================================================== --- llvm/trunk/docs/tutorial/LangImpl3.html (original) +++ llvm/trunk/docs/tutorial/LangImpl3.html Mon Jul 27 15:59:43 2009 @@ -159,7 +159,7 @@
     Value *NumberExprAST::Codegen() {
    -  return getGlobalContext().getConstantFP(APFloat(Val));
    +  return ConstantFP::get(getGlobalContext(), APFloat(Val));
     }
     
    @@ -1034,7 +1034,7 @@ Value *ErrorV(const char *Str) { Error(Str); return 0; } Value *NumberExprAST::Codegen() { - return getGlobalContext().getConstantFP(APFloat(Val)); + return ConstantFP::get(getGlobalContext(), APFloat(Val)); } Value *VariableExprAST::Codegen() { Modified: llvm/trunk/docs/tutorial/LangImpl4.html URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/tutorial/LangImpl4.html?rev=77247&r1=77246&r2=77247&view=diff ============================================================================== --- llvm/trunk/docs/tutorial/LangImpl4.html (original) +++ llvm/trunk/docs/tutorial/LangImpl4.html Mon Jul 27 15:59:43 2009 @@ -869,7 +869,7 @@ Value *ErrorV(const char *Str) { Error(Str); return 0; } Value *NumberExprAST::Codegen() { - return getGlobalContext().getConstantFP(APFloat(Val)); + return ConstantFP::get(getGlobalContext(), APFloat(Val)); } Value *VariableExprAST::Codegen() { Modified: llvm/trunk/docs/tutorial/LangImpl5.html URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/tutorial/LangImpl5.html?rev=77247&r1=77246&r2=77247&view=diff ============================================================================== --- llvm/trunk/docs/tutorial/LangImpl5.html (original) +++ llvm/trunk/docs/tutorial/LangImpl5.html Mon Jul 27 15:59:43 2009 @@ -364,7 +364,7 @@ // Convert condition to a bool by comparing equal to 0.0. CondV = Builder.CreateFCmpONE(CondV, - getGlobalContext().getConstantFP(APFloat(0.0)), + ConstantFP::get(getGlobalContext(), APFloat(0.0)), "ifcond");
    @@ -796,7 +796,7 @@ if (StepVal == 0) return 0; } else { // If not specified, use 1.0. - StepVal = getGlobalContext().getConstantFP(APFloat(1.0)); + StepVal = ConstantFP::get(getGlobalContext(), APFloat(1.0)); } Value *NextVar = Builder.CreateAdd(Variable, StepVal, "nextvar"); @@ -815,7 +815,7 @@ // Convert condition to a bool by comparing equal to 0.0. EndCond = Builder.CreateFCmpONE(EndCond, - getGlobalContext().getConstantFP(APFloat(0.0)), + ConstantFP::get(getGlobalContext(), APFloat(0.0)), "loopcond"); @@ -1360,7 +1360,7 @@ Value *ErrorV(const char *Str) { Error(Str); return 0; } Value *NumberExprAST::Codegen() { - return getGlobalContext().getConstantFP(APFloat(Val)); + return ConstantFP::get(getGlobalContext(), APFloat(Val)); } Value *VariableExprAST::Codegen() { @@ -1411,7 +1411,7 @@ // Convert condition to a bool by comparing equal to 0.0. CondV = Builder.CreateFCmpONE(CondV, - getGlobalContext().getConstantFP(APFloat(0.0)), + ConstantFP::get(getGlobalContext(), APFloat(0.0)), "ifcond"); Function *TheFunction = Builder.GetInsertBlock()->getParent(); @@ -1510,7 +1510,7 @@ if (StepVal == 0) return 0; } else { // If not specified, use 1.0. - StepVal = getGlobalContext().getConstantFP(APFloat(1.0)); + StepVal = ConstantFP::get(getGlobalContext(), APFloat(1.0)); } Value *NextVar = Builder.CreateAdd(Variable, StepVal, "nextvar"); @@ -1521,7 +1521,7 @@ // Convert condition to a bool by comparing equal to 0.0. EndCond = Builder.CreateFCmpONE(EndCond, - getGlobalContext().getConstantFP(APFloat(0.0)), + ConstantFP::get(getGlobalContext(), APFloat(0.0)), "loopcond"); // Create the "after loop" block and insert it. Modified: llvm/trunk/docs/tutorial/LangImpl6.html URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/tutorial/LangImpl6.html?rev=77247&r1=77246&r2=77247&view=diff ============================================================================== --- llvm/trunk/docs/tutorial/LangImpl6.html (original) +++ llvm/trunk/docs/tutorial/LangImpl6.html Mon Jul 27 15:59:43 2009 @@ -1365,7 +1365,7 @@ Value *ErrorV(const char *Str) { Error(Str); return 0; } Value *NumberExprAST::Codegen() { - return getGlobalContext().getConstantFP(APFloat(Val)); + return ConstantFP::get(getGlobalContext(), APFloat(Val)); } Value *VariableExprAST::Codegen() { @@ -1436,7 +1436,7 @@ // Convert condition to a bool by comparing equal to 0.0. CondV = Builder.CreateFCmpONE(CondV, - getGlobalContext().getConstantFP(APFloat(0.0)), + ConstantFP::get(getGlobalContext(), APFloat(0.0)), "ifcond"); Function *TheFunction = Builder.GetInsertBlock()->getParent(); @@ -1535,7 +1535,7 @@ if (StepVal == 0) return 0; } else { // If not specified, use 1.0. - StepVal = getGlobalContext().getConstantFP(APFloat(1.0)); + StepVal = ConstantFP::get(getGlobalContext(), APFloat(1.0)); } Value *NextVar = Builder.CreateAdd(Variable, StepVal, "nextvar"); @@ -1546,7 +1546,7 @@ // Convert condition to a bool by comparing equal to 0.0. EndCond = Builder.CreateFCmpONE(EndCond, - getGlobalContext().getConstantFP(APFloat(0.0)), + ConstantFP::get(getGlobalContext(), APFloat(0.0)), "loopcond"); // Create the "after loop" block and insert it. Modified: llvm/trunk/docs/tutorial/LangImpl7.html URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/tutorial/LangImpl7.html?rev=77247&r1=77246&r2=77247&view=diff ============================================================================== --- llvm/trunk/docs/tutorial/LangImpl7.html (original) +++ llvm/trunk/docs/tutorial/LangImpl7.html Mon Jul 27 15:59:43 2009 @@ -923,7 +923,7 @@ InitVal = Init->Codegen(); if (InitVal == 0) return 0; } else { // If not specified, use 0.0. - InitVal = getGlobalContext().getConstantFP(APFloat(0.0)); + InitVal = ConstantFP::get(getGlobalContext(), APFloat(0.0)); } AllocaInst *Alloca = CreateEntryBlockAlloca(TheFunction, VarName); @@ -1623,7 +1623,7 @@ Value *NumberExprAST::Codegen() { - return getGlobalContext().getConstantFP(APFloat(Val)); + return ConstantFP::get(getGlobalContext(), APFloat(Val)); } Value *VariableExprAST::Codegen() { @@ -1716,7 +1716,7 @@ // Convert condition to a bool by comparing equal to 0.0. CondV = Builder.CreateFCmpONE(CondV, - getGlobalContext().getConstantFP(APFloat(0.0)), + ConstantFP::get(getGlobalContext(), APFloat(0.0)), "ifcond"); Function *TheFunction = Builder.GetInsertBlock()->getParent(); @@ -1822,7 +1822,7 @@ if (StepVal == 0) return 0; } else { // If not specified, use 1.0. - StepVal = getGlobalContext().getConstantFP(APFloat(1.0)); + StepVal = ConstantFP::get(getGlobalContext(), APFloat(1.0)); } // Compute the end condition. @@ -1837,7 +1837,7 @@ // Convert condition to a bool by comparing equal to 0.0. EndCond = Builder.CreateFCmpONE(EndCond, - getGlobalContext().getConstantFP(APFloat(0.0)), + ConstantFP::get(getGlobalContext(), APFloat(0.0)), "loopcond"); // Create the "after loop" block and insert it. @@ -1881,7 +1881,7 @@ InitVal = Init->Codegen(); if (InitVal == 0) return 0; } else { // If not specified, use 0.0. - InitVal = getGlobalContext().getConstantFP(APFloat(0.0)); + InitVal = ConstantFP::get(getGlobalContext(), APFloat(0.0)); } AllocaInst *Alloca = CreateEntryBlockAlloca(TheFunction, VarName); Modified: llvm/trunk/examples/Kaleidoscope/toy.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/examples/Kaleidoscope/toy.cpp?rev=77247&r1=77246&r2=77247&view=diff ============================================================================== --- llvm/trunk/examples/Kaleidoscope/toy.cpp (original) +++ llvm/trunk/examples/Kaleidoscope/toy.cpp Mon Jul 27 15:59:43 2009 @@ -623,7 +623,7 @@ Value *NumberExprAST::Codegen() { - return getGlobalContext().getConstantFP(APFloat(Val)); + return ConstantFP::get(getGlobalContext(), APFloat(Val)); } Value *VariableExprAST::Codegen() { @@ -716,7 +716,7 @@ // Convert condition to a bool by comparing equal to 0.0. CondV = Builder.CreateFCmpONE(CondV, - getGlobalContext().getConstantFP(APFloat(0.0)), + ConstantFP::get(getGlobalContext(), APFloat(0.0)), "ifcond"); Function *TheFunction = Builder.GetInsertBlock()->getParent(); @@ -821,7 +821,7 @@ if (StepVal == 0) return 0; } else { // If not specified, use 1.0. - StepVal = getGlobalContext().getConstantFP(APFloat(1.0)); + StepVal = ConstantFP::get(getGlobalContext(), APFloat(1.0)); } // Compute the end condition. @@ -836,7 +836,7 @@ // Convert condition to a bool by comparing equal to 0.0. EndCond = Builder.CreateFCmpONE(EndCond, - getGlobalContext().getConstantFP(APFloat(0.0)), + ConstantFP::get(getGlobalContext(), APFloat(0.0)), "loopcond"); // Create the "after loop" block and insert it. @@ -879,7 +879,7 @@ InitVal = Init->Codegen(); if (InitVal == 0) return 0; } else { // If not specified, use 0.0. - InitVal = getGlobalContext().getConstantFP(APFloat(0.0)); + InitVal = ConstantFP::get(getGlobalContext(), APFloat(0.0)); } AllocaInst *Alloca = CreateEntryBlockAlloca(TheFunction, VarName); Modified: llvm/trunk/include/llvm/Constants.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Constants.h?rev=77247&r1=77246&r2=77247&view=diff ============================================================================== --- llvm/trunk/include/llvm/Constants.h (original) +++ llvm/trunk/include/llvm/Constants.h Mon Jul 27 15:59:43 2009 @@ -50,7 +50,6 @@ ConstantInt(const ConstantInt &); // DO NOT IMPLEMENT ConstantInt(const IntegerType *Ty, const APInt& V); APInt Val; - friend class LLVMContextImpl; protected: // allocate space for exactly zero operands void *operator new(size_t s) { @@ -238,6 +237,19 @@ return User::operator new(s, 0); } public: + /// Floating point negation must be implemented with f(x) = -0.0 - x. This + /// method returns the negative zero constant for floating point or vector + /// floating point types; for all other types, it returns the null value. + static Constant* getZeroValueForNegation(const Type* Ty); + + /// get() - This returns a ConstantFP, or a vector containing a splat of a + /// ConstantFP, for the specified value in the specified type. This should + /// only be used for simple constant values like 2.0/1.0 etc, that are + /// known-valid both as host double and as the target format. + static Constant* get(const Type* Ty, double V); + static ConstantFP* get(LLVMContext &Context, const APFloat& V); + static ConstantFP* getNegativeZero(const Type* Ty); + /// isValueValidForType - return true if Ty is big enough to represent V. static bool isValueValidForType(const Type *Ty, const APFloat& V); inline const APFloat& getValueAPF() const { return Val; } Modified: llvm/trunk/include/llvm/LLVMContext.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/LLVMContext.h?rev=77247&r1=77246&r2=77247&view=diff ============================================================================== --- llvm/trunk/include/llvm/LLVMContext.h (original) +++ llvm/trunk/include/llvm/LLVMContext.h Mon Jul 27 15:59:43 2009 @@ -56,6 +56,7 @@ LLVMContextImpl* pImpl; friend class ConstantInt; + friend class ConstantFP; public: LLVMContext(); ~LLVMContext(); @@ -180,21 +181,6 @@ /// Constant* getConstantExprSizeOf(const Type* Ty); - /// Floating point negation must be implemented with f(x) = -0.0 - x. This - /// method returns the negative zero constant for floating point or vector - /// floating point types; for all other types, it returns the null value. - Constant* getZeroValueForNegation(const Type* Ty); - - // ConstantFP accessors - ConstantFP* getConstantFP(const APFloat& V); - - /// get() - This returns a ConstantFP, or a vector containing a splat of a - /// ConstantFP, for the specified value in the specified type. This should - /// only be used for simple constant values like 2.0/1.0 etc, that are - /// known-valid both as host double and as the target format. - Constant* getConstantFP(const Type* Ty, double V); - ConstantFP* getConstantFPNegativeZero(const Type* Ty); - // ConstantVector accessors Constant* getConstantVector(const VectorType* T, const std::vector& V); Modified: llvm/trunk/include/llvm/Support/PatternMatch.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/PatternMatch.h?rev=77247&r1=77246&r2=77247&view=diff ============================================================================== --- llvm/trunk/include/llvm/Support/PatternMatch.h (original) +++ llvm/trunk/include/llvm/Support/PatternMatch.h Mon Jul 27 15:59:43 2009 @@ -506,7 +506,7 @@ } private: bool matchIfNeg(Value *LHS, Value *RHS, LLVMContext &Context) { - return LHS == Context.getZeroValueForNegation(LHS->getType()) && + return LHS == ConstantFP::getZeroValueForNegation(LHS->getType()) && L.match(RHS, Context); } }; @@ -535,7 +535,7 @@ } private: bool matchIfFNeg(Value *LHS, Value *RHS, LLVMContext &Context) { - return LHS == Context.getZeroValueForNegation(LHS->getType()) && + return LHS == ConstantFP::getZeroValueForNegation(LHS->getType()) && L.match(RHS, Context); } }; Modified: llvm/trunk/lib/Analysis/ConstantFolding.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/ConstantFolding.cpp?rev=77247&r1=77246&r2=77247&view=diff ============================================================================== --- llvm/trunk/lib/Analysis/ConstantFolding.cpp (original) +++ llvm/trunk/lib/Analysis/ConstantFolding.cpp Mon Jul 27 15:59:43 2009 @@ -655,9 +655,9 @@ } if (Ty == Type::FloatTy) - return Context.getConstantFP(APFloat((float)V)); + return ConstantFP::get(Context, APFloat((float)V)); if (Ty == Type::DoubleTy) - return Context.getConstantFP(APFloat(V)); + return ConstantFP::get(Context, APFloat(V)); llvm_unreachable("Can only constant fold float/double"); return 0; // dummy return to suppress warning } @@ -674,9 +674,9 @@ } if (Ty == Type::FloatTy) - return Context.getConstantFP(APFloat((float)V)); + return ConstantFP::get(Context, APFloat((float)V)); if (Ty == Type::DoubleTy) - return Context.getConstantFP(APFloat(V)); + return ConstantFP::get(Context, APFloat(V)); llvm_unreachable("Can only constant fold float/double"); return 0; // dummy return to suppress warning } @@ -796,10 +796,10 @@ } } else if (ConstantInt *Op2C = dyn_cast(Operands[1])) { if (Name == "llvm.powi.f32") { - return Context.getConstantFP(APFloat((float)std::pow((float)Op1V, + return ConstantFP::get(Context, APFloat((float)std::pow((float)Op1V, (int)Op2C->getZExtValue()))); } else if (Name == "llvm.powi.f64") { - return Context.getConstantFP(APFloat((double)std::pow((double)Op1V, + return ConstantFP::get(Context, APFloat((double)std::pow((double)Op1V, (int)Op2C->getZExtValue()))); } } Modified: llvm/trunk/lib/AsmParser/LLParser.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/AsmParser/LLParser.cpp?rev=77247&r1=77246&r2=77247&view=diff ============================================================================== --- llvm/trunk/lib/AsmParser/LLParser.cpp (original) +++ llvm/trunk/lib/AsmParser/LLParser.cpp Mon Jul 27 15:59:43 2009 @@ -2143,7 +2143,7 @@ ID.APFloatVal.convert(APFloat::IEEEsingle, APFloat::rmNearestTiesToEven, &Ignored); } - V = Context.getConstantFP(ID.APFloatVal); + V = ConstantFP::get(Context, ID.APFloatVal); if (V->getType() != Ty) return Error(ID.Loc, "floating point constant does not have type '" + Modified: llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp?rev=77247&r1=77246&r2=77247&view=diff ============================================================================== --- llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp (original) +++ llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp Mon Jul 27 15:59:43 2009 @@ -896,19 +896,19 @@ if (Record.empty()) return Error("Invalid FLOAT record"); if (CurTy == Type::FloatTy) - V = Context.getConstantFP(APFloat(APInt(32, (uint32_t)Record[0]))); + V = ConstantFP::get(Context, APFloat(APInt(32, (uint32_t)Record[0]))); else if (CurTy == Type::DoubleTy) - V = Context.getConstantFP(APFloat(APInt(64, Record[0]))); + V = ConstantFP::get(Context, APFloat(APInt(64, Record[0]))); else if (CurTy == Type::X86_FP80Ty) { // Bits are not stored the same way as a normal i80 APInt, compensate. uint64_t Rearrange[2]; Rearrange[0] = (Record[1] & 0xffffLL) | (Record[0] << 16); Rearrange[1] = Record[0] >> 48; - V = Context.getConstantFP(APFloat(APInt(80, 2, Rearrange))); + V = ConstantFP::get(Context, APFloat(APInt(80, 2, Rearrange))); } else if (CurTy == Type::FP128Ty) - V = Context.getConstantFP(APFloat(APInt(128, 2, &Record[0]), true)); + V = ConstantFP::get(Context, APFloat(APInt(128, 2, &Record[0]), true)); else if (CurTy == Type::PPC_FP128Ty) - V = Context.getConstantFP(APFloat(APInt(128, 2, &Record[0]))); + V = ConstantFP::get(Context, APFloat(APInt(128, 2, &Record[0]))); else V = Context.getUndef(CurTy); break; Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp?rev=77247&r1=77246&r2=77247&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Mon Jul 27 15:59:43 2009 @@ -916,7 +916,7 @@ SDValue SelectionDAG::getConstantFP(const APFloat& V, MVT VT, bool isTarget) { - return getConstantFP(*Context->getConstantFP(V), VT, isTarget); + return getConstantFP(*ConstantFP::get(*getContext(), V), VT, isTarget); } SDValue SelectionDAG::getConstantFP(const ConstantFP& V, MVT VT, bool isTarget){ Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp?rev=77247&r1=77246&r2=77247&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp Mon Jul 27 15:59:43 2009 @@ -2148,8 +2148,7 @@ const VectorType *DestTy = cast(I.getType()); const Type *ElTy = DestTy->getElementType(); unsigned VL = DestTy->getNumElements(); - std::vector NZ(VL, - DAG.getContext()->getConstantFPNegativeZero(ElTy)); + std::vector NZ(VL, ConstantFP::getNegativeZero(ElTy)); Constant *CNZ = DAG.getContext()->getConstantVector(&NZ[0], NZ.size()); if (CV == CNZ) { SDValue Op2 = getValue(I.getOperand(1)); @@ -2160,8 +2159,7 @@ } } if (ConstantFP *CFP = dyn_cast(I.getOperand(0))) - if (CFP->isExactlyValue( - DAG.getContext()->getConstantFPNegativeZero(Ty)->getValueAPF())) { + if (CFP->isExactlyValue(ConstantFP::getNegativeZero(Ty)->getValueAPF())) { SDValue Op2 = getValue(I.getOperand(1)); setValue(&I, DAG.getNode(ISD::FNEG, getCurDebugLoc(), Op2.getValueType(), Op2)); Modified: llvm/trunk/lib/ExecutionEngine/JIT/JIT.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/JIT/JIT.cpp?rev=77247&r1=77246&r2=77247&view=diff ============================================================================== --- llvm/trunk/lib/ExecutionEngine/JIT/JIT.cpp (original) +++ llvm/trunk/lib/ExecutionEngine/JIT/JIT.cpp Mon Jul 27 15:59:43 2009 @@ -490,15 +490,15 @@ C = ConstantInt::get(F->getContext(), AV.IntVal); break; case Type::FloatTyID: - C = Context.getConstantFP(APFloat(AV.FloatVal)); + C = ConstantFP::get(F->getContext(), APFloat(AV.FloatVal)); break; case Type::DoubleTyID: - C = Context.getConstantFP(APFloat(AV.DoubleVal)); + C = ConstantFP::get(F->getContext(), APFloat(AV.DoubleVal)); break; case Type::PPC_FP128TyID: case Type::X86_FP80TyID: case Type::FP128TyID: - C = Context.getConstantFP(APFloat(AV.IntVal)); + C = ConstantFP::get(F->getContext(), APFloat(AV.IntVal)); break; case Type::PointerTyID: void *ArgPtr = GVTOP(AV); Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.cpp?rev=77247&r1=77246&r2=77247&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original) +++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Mon Jul 27 15:59:43 2009 @@ -4898,9 +4898,9 @@ std::vector CV1; CV1.push_back( - Context->getConstantFP(APFloat(APInt(64, 0x4530000000000000ULL)))); + ConstantFP::get(*Context, APFloat(APInt(64, 0x4530000000000000ULL)))); CV1.push_back( - Context->getConstantFP(APFloat(APInt(64, 0x4330000000000000ULL)))); + ConstantFP::get(*Context, APFloat(APInt(64, 0x4330000000000000ULL)))); Constant *C1 = Context->getConstantVector(CV1); SDValue CPIdx1 = DAG.getConstantPool(C1, getPointerTy(), 16); @@ -5113,11 +5113,11 @@ EltVT = VT.getVectorElementType(); std::vector CV; if (EltVT == MVT::f64) { - Constant *C = Context->getConstantFP(APFloat(APInt(64, ~(1ULL << 63)))); + Constant *C = ConstantFP::get(*Context, APFloat(APInt(64, ~(1ULL << 63)))); CV.push_back(C); CV.push_back(C); } else { - Constant *C = Context->getConstantFP(APFloat(APInt(32, ~(1U << 31)))); + Constant *C = ConstantFP::get(*Context, APFloat(APInt(32, ~(1U << 31)))); CV.push_back(C); CV.push_back(C); CV.push_back(C); @@ -5143,11 +5143,11 @@ } std::vector CV; if (EltVT == MVT::f64) { - Constant *C = Context->getConstantFP(APFloat(APInt(64, 1ULL << 63))); + Constant *C = ConstantFP::get(*Context, APFloat(APInt(64, 1ULL << 63))); CV.push_back(C); CV.push_back(C); } else { - Constant *C = Context->getConstantFP(APFloat(APInt(32, 1U << 31))); + Constant *C = ConstantFP::get(*Context, APFloat(APInt(32, 1U << 31))); CV.push_back(C); CV.push_back(C); CV.push_back(C); @@ -5194,13 +5194,13 @@ // First get the sign bit of second operand. std::vector CV; if (SrcVT == MVT::f64) { - CV.push_back(Context->getConstantFP(APFloat(APInt(64, 1ULL << 63)))); - CV.push_back(Context->getConstantFP(APFloat(APInt(64, 0)))); + CV.push_back(ConstantFP::get(*Context, APFloat(APInt(64, 1ULL << 63)))); + CV.push_back(ConstantFP::get(*Context, APFloat(APInt(64, 0)))); } else { - CV.push_back(Context->getConstantFP(APFloat(APInt(32, 1U << 31)))); - CV.push_back(Context->getConstantFP(APFloat(APInt(32, 0)))); - CV.push_back(Context->getConstantFP(APFloat(APInt(32, 0)))); - CV.push_back(Context->getConstantFP(APFloat(APInt(32, 0)))); + CV.push_back(ConstantFP::get(*Context, APFloat(APInt(32, 1U << 31)))); + CV.push_back(ConstantFP::get(*Context, APFloat(APInt(32, 0)))); + CV.push_back(ConstantFP::get(*Context, APFloat(APInt(32, 0)))); + CV.push_back(ConstantFP::get(*Context, APFloat(APInt(32, 0)))); } Constant *C = Context->getConstantVector(CV); SDValue CPIdx = DAG.getConstantPool(C, getPointerTy(), 16); @@ -5223,13 +5223,13 @@ // Clear first operand sign bit. CV.clear(); if (VT == MVT::f64) { - CV.push_back(Context->getConstantFP(APFloat(APInt(64, ~(1ULL << 63))))); - CV.push_back(Context->getConstantFP(APFloat(APInt(64, 0)))); + CV.push_back(ConstantFP::get(*Context, APFloat(APInt(64, ~(1ULL << 63))))); + CV.push_back(ConstantFP::get(*Context, APFloat(APInt(64, 0)))); } else { - CV.push_back(Context->getConstantFP(APFloat(APInt(32, ~(1U << 31))))); - CV.push_back(Context->getConstantFP(APFloat(APInt(32, 0)))); - CV.push_back(Context->getConstantFP(APFloat(APInt(32, 0)))); - CV.push_back(Context->getConstantFP(APFloat(APInt(32, 0)))); + CV.push_back(ConstantFP::get(*Context, APFloat(APInt(32, ~(1U << 31))))); + CV.push_back(ConstantFP::get(*Context, APFloat(APInt(32, 0)))); + CV.push_back(ConstantFP::get(*Context, APFloat(APInt(32, 0)))); + CV.push_back(ConstantFP::get(*Context, APFloat(APInt(32, 0)))); } C = Context->getConstantVector(CV); CPIdx = DAG.getConstantPool(C, getPointerTy(), 16); Modified: llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp?rev=77247&r1=77246&r2=77247&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp Mon Jul 27 15:59:43 2009 @@ -2354,7 +2354,7 @@ if (Constant *RHSC = dyn_cast(RHS)) { // X + 0 --> X if (ConstantFP *CFP = dyn_cast(RHSC)) { - if (CFP->isExactlyValue(Context->getConstantFPNegativeZero + if (CFP->isExactlyValue(ConstantFP::getNegativeZero (I.getType())->getValueAPF())) return ReplaceInstUsesWith(I, LHS); } @@ -8779,7 +8779,7 @@ APFloat F = CFP->getValueAPF(); (void)F.convert(Sem, APFloat::rmNearestTiesToEven, &losesInfo); if (!losesInfo) - return Context->getConstantFP(F); + return ConstantFP::get(*Context, F); return 0; } Modified: llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp?rev=77247&r1=77246&r2=77247&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp Mon Jul 27 15:59:43 2009 @@ -2177,8 +2177,6 @@ if (isa(BackedgeTakenCount)) return; - LLVMContext &Context = L->getHeader()->getContext(); - for (unsigned Stride = 0, e = IU->StrideOrder.size(); Stride != e; ++Stride) { std::map::iterator SI = @@ -2240,7 +2238,7 @@ ConstantInt *Init = dyn_cast(PH->getIncomingValue(Entry)); if (!Init) continue; - Constant *NewInit = Context.getConstantFP(DestTy, Init->getZExtValue()); + Constant *NewInit = ConstantFP::get(DestTy, Init->getZExtValue()); BinaryOperator *Incr = dyn_cast(PH->getIncomingValue(Latch)); @@ -2264,7 +2262,7 @@ PHINode *NewPH = PHINode::Create(DestTy, "IV.S.", PH); /* create new increment. '++d' in above example. */ - Constant *CFP = Context.getConstantFP(DestTy, C->getZExtValue()); + Constant *CFP = ConstantFP::get(DestTy, C->getZExtValue()); BinaryOperator *NewIncr = BinaryOperator::Create(Incr->getOpcode() == Instruction::Add ? Instruction::FAdd : Instruction::FSub, Modified: llvm/trunk/lib/Transforms/Scalar/SimplifyLibCalls.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/SimplifyLibCalls.cpp?rev=77247&r1=77246&r2=77247&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/SimplifyLibCalls.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/SimplifyLibCalls.cpp Mon Jul 27 15:59:43 2009 @@ -1035,7 +1035,7 @@ if (Op2C == 0) return 0; if (Op2C->getValueAPF().isZero()) // pow(x, 0.0) -> 1.0 - return Context->getConstantFP(CI->getType(), 1.0); + return ConstantFP::get(CI->getType(), 1.0); if (Op2C->isExactlyValue(0.5)) { // FIXME: This is not safe for -0.0 and -inf. This can only be done when @@ -1055,7 +1055,7 @@ if (Op2C->isExactlyValue(2.0)) // pow(x, 2.0) -> x*x return B.CreateFMul(Op1, Op1, "pow2"); if (Op2C->isExactlyValue(-1.0)) // pow(x, -1.0) -> 1.0/x - return B.CreateFDiv(Context->getConstantFP(CI->getType(), 1.0), + return B.CreateFDiv(ConstantFP::get(CI->getType(), 1.0), Op1, "powrecip"); return 0; } @@ -1094,7 +1094,7 @@ else Name = "ldexpl"; - Constant *One = Context->getConstantFP(APFloat(1.0f)); + Constant *One = ConstantFP::get(*Context, APFloat(1.0f)); if (Op->getType() != Type::FloatTy) One = Context->getConstantExprFPExtend(One, Op->getType()); Modified: llvm/trunk/lib/VMCore/ConstantFold.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/ConstantFold.cpp?rev=77247&r1=77246&r2=77247&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/ConstantFold.cpp (original) +++ llvm/trunk/lib/VMCore/ConstantFold.cpp Mon Jul 27 15:59:43 2009 @@ -161,7 +161,7 @@ return V; if (DestTy->isFloatingPoint()) - return Context.getConstantFP(APFloat(CI->getValue(), + return ConstantFP::get(Context, APFloat(CI->getValue(), DestTy != Type::PPC_FP128Ty)); // Otherwise, can't fold this (vector?) @@ -245,7 +245,7 @@ DestTy == Type::FP128Ty ? APFloat::IEEEquad : APFloat::Bogus, APFloat::rmNearestTiesToEven, &ignored); - return Context.getConstantFP(Val); + return ConstantFP::get(Context, Val); } return 0; // Can't fold. case Instruction::FPToUI: @@ -279,7 +279,7 @@ (void)apf.convertFromAPInt(api, opc==Instruction::SIToFP, APFloat::rmNearestTiesToEven); - return Context.getConstantFP(apf); + return ConstantFP::get(Context, apf); } return 0; case Instruction::ZExt: @@ -795,19 +795,19 @@ break; case Instruction::FAdd: (void)C3V.add(C2V, APFloat::rmNearestTiesToEven); - return Context.getConstantFP(C3V); + return ConstantFP::get(Context, C3V); case Instruction::FSub: (void)C3V.subtract(C2V, APFloat::rmNearestTiesToEven); - return Context.getConstantFP(C3V); + return ConstantFP::get(Context, C3V); case Instruction::FMul: (void)C3V.multiply(C2V, APFloat::rmNearestTiesToEven); - return Context.getConstantFP(C3V); + return ConstantFP::get(Context, C3V); case Instruction::FDiv: (void)C3V.divide(C2V, APFloat::rmNearestTiesToEven); - return Context.getConstantFP(C3V); + return ConstantFP::get(Context, C3V); case Instruction::FRem: (void)C3V.mod(C2V, APFloat::rmNearestTiesToEven); - return Context.getConstantFP(C3V); + return ConstantFP::get(Context, C3V); } } } else if (const VectorType *VTy = dyn_cast(C1->getType())) { Modified: llvm/trunk/lib/VMCore/Constants.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Constants.cpp?rev=77247&r1=77246&r2=77247&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/Constants.cpp (original) +++ llvm/trunk/lib/VMCore/Constants.cpp Mon Jul 27 15:59:43 2009 @@ -258,6 +258,87 @@ } #endif +/// get() - This returns a constant fp for the specified value in the +/// specified type. This should only be used for simple constant values like +/// 2.0/1.0 etc, that are known-valid both as double and as the target format. +Constant* ConstantFP::get(const Type* Ty, double V) { + LLVMContext &Context = Ty->getContext(); + + APFloat FV(V); + bool ignored; + FV.convert(*TypeToFloatSemantics(Ty->getScalarType()), + APFloat::rmNearestTiesToEven, &ignored); + Constant *C = get(Context, FV); + + // For vectors, broadcast the value. + if (const VectorType *VTy = dyn_cast(Ty)) + return Context.getConstantVector( + std::vector(VTy->getNumElements(), C)); + + return C; +} + +ConstantFP* ConstantFP::getNegativeZero(const Type* Ty) { + LLVMContext &Context = Ty->getContext(); + APFloat apf = cast (Context.getNullValue(Ty))->getValueAPF(); + apf.changeSign(); + return get(Context, apf); +} + + +Constant* ConstantFP::getZeroValueForNegation(const Type* Ty) { + LLVMContext &Context = Ty->getContext(); + if (const VectorType *PTy = dyn_cast(Ty)) + if (PTy->getElementType()->isFloatingPoint()) { + std::vector zeros(PTy->getNumElements(), + getNegativeZero(PTy->getElementType())); + return Context.getConstantVector(PTy, zeros); + } + + if (Ty->isFloatingPoint()) + return getNegativeZero(Ty); + + return Context.getNullValue(Ty); +} + + +// ConstantFP accessors. +ConstantFP* ConstantFP::get(LLVMContext &Context, const APFloat& V) { + DenseMapAPFloatKeyInfo::KeyTy Key(V); + + LLVMContextImpl* pImpl = Context.pImpl; + + pImpl->ConstantsLock.reader_acquire(); + ConstantFP *&Slot = pImpl->FPConstants[Key]; + pImpl->ConstantsLock.reader_release(); + + if (!Slot) { + sys::SmartScopedWriter Writer(pImpl->ConstantsLock); + ConstantFP *&NewSlot = pImpl->FPConstants[Key]; + if (!NewSlot) { + const Type *Ty; + if (&V.getSemantics() == &APFloat::IEEEsingle) + Ty = Type::FloatTy; + else if (&V.getSemantics() == &APFloat::IEEEdouble) + Ty = Type::DoubleTy; + else if (&V.getSemantics() == &APFloat::x87DoubleExtended) + Ty = Type::X86_FP80Ty; + else if (&V.getSemantics() == &APFloat::IEEEquad) + Ty = Type::FP128Ty; + else { + assert(&V.getSemantics() == &APFloat::PPCDoubleDouble && + "Unknown FP format"); + Ty = Type::PPC_FP128Ty; + } + NewSlot = new ConstantFP(Ty, V); + } + + return NewSlot; + } + + return Slot; +} + ConstantFP::ConstantFP(const Type *Ty, const APFloat& V) : Constant(Ty, ConstantFPVal, 0, 0), Val(V) { assert(&V.getSemantics() == TypeToFloatSemantics(Ty) && Modified: llvm/trunk/lib/VMCore/Core.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Core.cpp?rev=77247&r1=77246&r2=77247&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/Core.cpp (original) +++ llvm/trunk/lib/VMCore/Core.cpp Mon Jul 27 15:59:43 2009 @@ -388,11 +388,11 @@ bool ignored; APN.convert(SemanticsForType(unwrap(RealTy)), APFloat::rmNearestTiesToEven, &ignored); - return wrap(getGlobalContext().getConstantFP(APN)); + return wrap(ConstantFP::get(getGlobalContext(), APN)); } LLVMValueRef LLVMConstRealOfString(LLVMTypeRef RealTy, const char *Text) { - return wrap(getGlobalContext().getConstantFP( + return wrap(ConstantFP::get(getGlobalContext(), APFloat(SemanticsForType(unwrap(RealTy)), Text))); } Modified: llvm/trunk/lib/VMCore/Instructions.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Instructions.cpp?rev=77247&r1=77246&r2=77247&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/Instructions.cpp (original) +++ llvm/trunk/lib/VMCore/Instructions.cpp Mon Jul 27 15:59:43 2009 @@ -1577,7 +1577,7 @@ BinaryOperator *BinaryOperator::CreateNeg(LLVMContext &Context, Value *Op, const Twine &Name, Instruction *InsertBefore) { - Value *zero = Context.getZeroValueForNegation(Op->getType()); + Value *zero = ConstantFP::getZeroValueForNegation(Op->getType()); return new BinaryOperator(Instruction::Sub, zero, Op, Op->getType(), Name, InsertBefore); @@ -1586,7 +1586,7 @@ BinaryOperator *BinaryOperator::CreateNeg(LLVMContext &Context, Value *Op, const Twine &Name, BasicBlock *InsertAtEnd) { - Value *zero = Context.getZeroValueForNegation(Op->getType()); + Value *zero = ConstantFP::getZeroValueForNegation(Op->getType()); return new BinaryOperator(Instruction::Sub, zero, Op, Op->getType(), Name, InsertAtEnd); @@ -1595,7 +1595,7 @@ BinaryOperator *BinaryOperator::CreateFNeg(LLVMContext &Context, Value *Op, const Twine &Name, Instruction *InsertBefore) { - Value *zero = Context.getZeroValueForNegation(Op->getType()); + Value *zero = ConstantFP::getZeroValueForNegation(Op->getType()); return new BinaryOperator(Instruction::FSub, zero, Op, Op->getType(), Name, InsertBefore); @@ -1604,7 +1604,7 @@ BinaryOperator *BinaryOperator::CreateFNeg(LLVMContext &Context, Value *Op, const Twine &Name, BasicBlock *InsertAtEnd) { - Value *zero = Context.getZeroValueForNegation(Op->getType()); + Value *zero = ConstantFP::getZeroValueForNegation(Op->getType()); return new BinaryOperator(Instruction::FSub, zero, Op, Op->getType(), Name, InsertAtEnd); Modified: llvm/trunk/lib/VMCore/LLVMContext.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/LLVMContext.cpp?rev=77247&r1=77246&r2=77247&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/LLVMContext.cpp (original) +++ llvm/trunk/lib/VMCore/LLVMContext.cpp Mon Jul 27 15:59:43 2009 @@ -41,15 +41,16 @@ case Type::IntegerTyID: return ConstantInt::get(Ty, 0); case Type::FloatTyID: - return getConstantFP(APFloat(APInt(32, 0))); + return ConstantFP::get(Ty->getContext(), APFloat(APInt(32, 0))); case Type::DoubleTyID: - return getConstantFP(APFloat(APInt(64, 0))); + return ConstantFP::get(Ty->getContext(), APFloat(APInt(64, 0))); case Type::X86_FP80TyID: - return getConstantFP(APFloat(APInt(80, 2, zero))); + return ConstantFP::get(Ty->getContext(), APFloat(APInt(80, 2, zero))); case Type::FP128TyID: - return getConstantFP(APFloat(APInt(128, 2, zero), true)); + return ConstantFP::get(Ty->getContext(), + APFloat(APInt(128, 2, zero), true)); case Type::PPC_FP128TyID: - return getConstantFP(APFloat(APInt(128, 2, zero))); + return ConstantFP::get(Ty->getContext(), APFloat(APInt(128, 2, zero))); case Type::PointerTyID: return getConstantPointerNull(cast(Ty)); case Type::StructTyID: @@ -276,7 +277,7 @@ assert(C->getType()->isIntOrIntVector() && "Cannot NEG a nonintegral value!"); return getConstantExpr(Instruction::Sub, - getZeroValueForNegation(C->getType()), + ConstantFP::getZeroValueForNegation(C->getType()), C); } @@ -284,7 +285,7 @@ assert(C->getType()->isFPOrFPVector() && "Cannot FNEG a non-floating-point value!"); return getConstantExpr(Instruction::FSub, - getZeroValueForNegation(C->getType()), + ConstantFP::getZeroValueForNegation(C->getType()), C); } @@ -424,65 +425,6 @@ return getConstantExprCast(Instruction::PtrToInt, GEP, Type::Int64Ty); } -Constant* LLVMContext::getZeroValueForNegation(const Type* Ty) { - if (const VectorType *PTy = dyn_cast(Ty)) - if (PTy->getElementType()->isFloatingPoint()) { - std::vector zeros(PTy->getNumElements(), - getConstantFPNegativeZero(PTy->getElementType())); - return getConstantVector(PTy, zeros); - } - - if (Ty->isFloatingPoint()) - return getConstantFPNegativeZero(Ty); - - return getNullValue(Ty); -} - - -// ConstantFP accessors. -ConstantFP* LLVMContext::getConstantFP(const APFloat& V) { - return pImpl->getConstantFP(V); -} - -static const fltSemantics *TypeToFloatSemantics(const Type *Ty) { - if (Ty == Type::FloatTy) - return &APFloat::IEEEsingle; - if (Ty == Type::DoubleTy) - return &APFloat::IEEEdouble; - if (Ty == Type::X86_FP80Ty) - return &APFloat::x87DoubleExtended; - else if (Ty == Type::FP128Ty) - return &APFloat::IEEEquad; - - assert(Ty == Type::PPC_FP128Ty && "Unknown FP format"); - return &APFloat::PPCDoubleDouble; -} - -/// get() - This returns a constant fp for the specified value in the -/// specified type. This should only be used for simple constant values like -/// 2.0/1.0 etc, that are known-valid both as double and as the target format. -Constant* LLVMContext::getConstantFP(const Type* Ty, double V) { - APFloat FV(V); - bool ignored; - FV.convert(*TypeToFloatSemantics(Ty->getScalarType()), - APFloat::rmNearestTiesToEven, &ignored); - Constant *C = getConstantFP(FV); - - // For vectors, broadcast the value. - if (const VectorType *VTy = dyn_cast(Ty)) - return - getConstantVector(std::vector(VTy->getNumElements(), C)); - - return C; -} - -ConstantFP* LLVMContext::getConstantFPNegativeZero(const Type* Ty) { - APFloat apf = cast (getNullValue(Ty))->getValueAPF(); - apf.changeSign(); - return getConstantFP(apf); -} - - // ConstantVector accessors. Constant* LLVMContext::getConstantVector(const VectorType* T, const std::vector& V) { Modified: llvm/trunk/lib/VMCore/LLVMContextImpl.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/LLVMContextImpl.cpp?rev=77247&r1=77246&r2=77247&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/LLVMContextImpl.cpp (original) +++ llvm/trunk/lib/VMCore/LLVMContextImpl.cpp Mon Jul 27 15:59:43 2009 @@ -49,41 +49,6 @@ LLVMContextImpl::LLVMContextImpl(LLVMContext &C) : Context(C), TheTrueVal(0), TheFalseVal(0) { } - -ConstantFP *LLVMContextImpl::getConstantFP(const APFloat &V) { - DenseMapAPFloatKeyInfo::KeyTy Key(V); - - ConstantsLock.reader_acquire(); - ConstantFP *&Slot = FPConstants[Key]; - ConstantsLock.reader_release(); - - if (!Slot) { - sys::SmartScopedWriter Writer(ConstantsLock); - ConstantFP *&NewSlot = FPConstants[Key]; - if (!NewSlot) { - const Type *Ty; - if (&V.getSemantics() == &APFloat::IEEEsingle) - Ty = Type::FloatTy; - else if (&V.getSemantics() == &APFloat::IEEEdouble) - Ty = Type::DoubleTy; - else if (&V.getSemantics() == &APFloat::x87DoubleExtended) - Ty = Type::X86_FP80Ty; - else if (&V.getSemantics() == &APFloat::IEEEquad) - Ty = Type::FP128Ty; - else { - assert(&V.getSemantics() == &APFloat::PPCDoubleDouble && - "Unknown FP format"); - Ty = Type::PPC_FP128Ty; - } - NewSlot = new ConstantFP(Ty, V); - } - - return NewSlot; - } - - return Slot; -} - MDString *LLVMContextImpl::getMDString(const char *StrBegin, unsigned StrLength) { sys::SmartScopedWriter Writer(ConstantsLock); Modified: llvm/trunk/lib/VMCore/LLVMContextImpl.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/LLVMContextImpl.h?rev=77247&r1=77246&r2=77247&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/LLVMContextImpl.h (original) +++ llvm/trunk/lib/VMCore/LLVMContextImpl.h Mon Jul 27 15:59:43 2009 @@ -457,11 +457,10 @@ LLVMContextImpl(const LLVMContextImpl&); friend class ConstantInt; + friend class ConstantFP; public: LLVMContextImpl(LLVMContext &C); - ConstantFP *getConstantFP(const APFloat &V); - MDString *getMDString(const char *StrBegin, unsigned StrLength); MDNode *getMDNode(Value*const* Vals, unsigned NumVals); From resistor at mac.com Mon Jul 27 16:00:36 2009 From: resistor at mac.com (Owen Anderson) Date: Mon, 27 Jul 2009 21:00:36 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r77248 - in /llvm-gcc-4.2/trunk: boehm-gc/cord/de_win.h gcc/llvm-convert.cpp Message-ID: <200907272100.n6RL0aVM021385@zion.cs.uiuc.edu> Author: resistor Date: Mon Jul 27 16:00:35 2009 New Revision: 77248 URL: http://llvm.org/viewvc/llvm-project?rev=77248&view=rev Log: Update for LLVM API change. Modified: llvm-gcc-4.2/trunk/boehm-gc/cord/de_win.h llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp Modified: llvm-gcc-4.2/trunk/boehm-gc/cord/de_win.h URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/boehm-gc/cord/de_win.h?rev=77248&r1=77247&r2=77248&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/boehm-gc/cord/de_win.h (original) +++ llvm-gcc-4.2/trunk/boehm-gc/cord/de_win.h Mon Jul 27 16:00:35 2009 @@ -100,4 +100,4 @@ /* Invalidate line i on the screen. */ void de_error(char *s); - /* Display error message. */ \ No newline at end of file + /* Display error message. */ Modified: llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp?rev=77248&r1=77247&r2=77248&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp (original) +++ llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp Mon Jul 27 16:00:35 2009 @@ -7013,7 +7013,8 @@ std::swap(UArr[0], UArr[1]); return - Context.getConstantFP(Ty==Type::FloatTy ? APFloat((float)V) : APFloat(V)); + ConstantFP::get(Context, Ty==Type::FloatTy ? + APFloat((float)V) : APFloat(V)); } else if (Ty==Type::X86_FP80Ty) { long RealArr[4]; uint64_t UArr[2]; @@ -7021,7 +7022,7 @@ UArr[0] = ((uint64_t)((uint32_t)RealArr[0])) | ((uint64_t)((uint32_t)RealArr[1]) << 32); UArr[1] = (uint16_t)RealArr[2]; - return Context.getConstantFP(APFloat(APInt(80, 2, UArr))); + return ConstantFP::get(Context, APFloat(APInt(80, 2, UArr))); } else if (Ty==Type::PPC_FP128Ty) { long RealArr[4]; uint64_t UArr[2]; @@ -7031,7 +7032,7 @@ ((uint64_t)((uint32_t)RealArr[1])); UArr[1] = ((uint64_t)((uint32_t)RealArr[2]) << 32) | ((uint64_t)((uint32_t)RealArr[3])); - return Context.getConstantFP(APFloat(APInt(128, 2, UArr))); + return ConstantFP::get(Context, APFloat(APInt(128, 2, UArr))); } assert(0 && "Floating point type not handled yet"); return 0; // outwit compiler warning From gohman at apple.com Mon Jul 27 16:07:16 2009 From: gohman at apple.com (Dan Gohman) Date: Mon, 27 Jul 2009 14:07:16 -0700 Subject: [llvm-commits] [llvm] r77149 - /llvm/trunk/lib/VMCore/Value.cpp In-Reply-To: <200907260922.n6Q9MMQX020945@zion.cs.uiuc.edu> References: <200907260922.n6Q9MMQX020945@zion.cs.uiuc.edu> Message-ID: <1531E511-8F9B-49B7-98A1-6C46B17930B5@apple.com> On Jul 26, 2009, at 2:22 AM, Daniel Dunbar wrote: > Author: ddunbar > Date: Sun Jul 26 04:22:02 2009 > New Revision: 77149 > > URL: http://llvm.org/viewvc/llvm-project?rev=77149&view=rev > Log: > Make sure getName().data() is always null terminated. Hi Daniel, The doxygen comment for StringRef::data() says it may not be null terminated. This is also consistent with std::string. If there are clients that need a nul-terminated string, shouldn't there be a c_str() method? Dan From sabre at nondot.org Mon Jul 27 16:13:35 2009 From: sabre at nondot.org (Chris Lattner) Date: Mon, 27 Jul 2009 21:13:35 -0000 Subject: [llvm-commits] [llvm] r77250 - /llvm/trunk/include/llvm/CodeGen/AsmPrinter.h Message-ID: <200907272113.n6RLDZVY021731@zion.cs.uiuc.edu> Author: lattner Date: Mon Jul 27 16:13:35 2009 New Revision: 77250 URL: http://llvm.org/viewvc/llvm-project?rev=77250&view=rev Log: simplify #includes. Modified: llvm/trunk/include/llvm/CodeGen/AsmPrinter.h Modified: llvm/trunk/include/llvm/CodeGen/AsmPrinter.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/AsmPrinter.h?rev=77250&r1=77249&r2=77250&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/AsmPrinter.h (original) +++ llvm/trunk/include/llvm/CodeGen/AsmPrinter.h Mon Jul 27 16:13:35 2009 @@ -16,11 +16,9 @@ #ifndef LLVM_CODEGEN_ASMPRINTER_H #define LLVM_CODEGEN_ASMPRINTER_H -#include "llvm/ADT/DenseMap.h" #include "llvm/CodeGen/MachineFunctionPass.h" -#include "llvm/Support/DataTypes.h" #include "llvm/Target/TargetMachine.h" -#include +#include "llvm/ADT/DenseMap.h" namespace llvm { class GCStrategy; From daniel at zuster.org Mon Jul 27 16:22:31 2009 From: daniel at zuster.org (Daniel Dunbar) Date: Mon, 27 Jul 2009 21:22:31 -0000 Subject: [llvm-commits] [llvm] r77251 - in /llvm/trunk: include/llvm/MC/MCContext.h include/llvm/MC/MCSection.h include/llvm/MC/MCSymbol.h lib/MC/MCContext.cpp Message-ID: <200907272122.n6RLMVQo022007@zion.cs.uiuc.edu> Author: ddunbar Date: Mon Jul 27 16:22:30 2009 New Revision: 77251 URL: http://llvm.org/viewvc/llvm-project?rev=77251&view=rev Log: Move MCContext and friends to StringRef based APIs. Modified: llvm/trunk/include/llvm/MC/MCContext.h llvm/trunk/include/llvm/MC/MCSection.h llvm/trunk/include/llvm/MC/MCSymbol.h llvm/trunk/lib/MC/MCContext.cpp Modified: llvm/trunk/include/llvm/MC/MCContext.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCContext.h?rev=77251&r1=77250&r2=77251&view=diff ============================================================================== --- llvm/trunk/include/llvm/MC/MCContext.h (original) +++ llvm/trunk/include/llvm/MC/MCContext.h Mon Jul 27 16:22:30 2009 @@ -18,6 +18,7 @@ class MCValue; class MCSection; class MCSymbol; + class StringRef; /// MCContext - Context object for machine code objects. class MCContext { @@ -46,19 +47,19 @@ ~MCContext(); /// GetSection - Get or create a new section with the given @param Name. - MCSection *GetSection(const char *Name); + MCSection *GetSection(const StringRef &Name); /// CreateSymbol - Create a new symbol with the specified @param Name. /// /// @param Name - The symbol name, which must be unique across all symbols. - MCSymbol *CreateSymbol(const char *Name); + MCSymbol *CreateSymbol(const StringRef &Name); /// GetOrCreateSymbol - Lookup the symbol inside with the specified /// @param Name. If it exists, return it. If not, create a forward /// reference and return it. /// /// @param Name - The symbol name, which must be unique across all symbols. - MCSymbol *GetOrCreateSymbol(const char *Name); + MCSymbol *GetOrCreateSymbol(const StringRef &Name); /// CreateTemporarySymbol - Create a new temporary symbol with the specified /// @param Name. @@ -66,10 +67,10 @@ /// @param Name - The symbol name, for debugging purposes only, temporary /// symbols do not surive assembly. If non-empty the name must be unique /// across all symbols. - MCSymbol *CreateTemporarySymbol(const char *Name = ""); + MCSymbol *CreateTemporarySymbol(const StringRef &Name = ""); /// LookupSymbol - Get the symbol for @param Name, or null. - MCSymbol *LookupSymbol(const char *Name) const; + MCSymbol *LookupSymbol(const StringRef &Name) const; /// ClearSymbolValue - Erase a value binding for @param Symbol, if one /// exists. Modified: llvm/trunk/include/llvm/MC/MCSection.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCSection.h?rev=77251&r1=77250&r2=77251&view=diff ============================================================================== --- llvm/trunk/include/llvm/MC/MCSection.h (original) +++ llvm/trunk/include/llvm/MC/MCSection.h Mon Jul 27 16:22:30 2009 @@ -15,6 +15,7 @@ #define LLVM_MC_MCSECTION_H #include +#include "llvm/ADT/StringRef.h" namespace llvm { @@ -25,7 +26,7 @@ std::string Name; private: friend class MCContext; - MCSection(const char *_Name) : Name(_Name) {} + MCSection(const StringRef &_Name) : Name(_Name) {} MCSection(const MCSection&); // DO NOT IMPLEMENT void operator=(const MCSection&); // DO NOT IMPLEMENT Modified: llvm/trunk/include/llvm/MC/MCSymbol.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCSymbol.h?rev=77251&r1=77250&r2=77251&view=diff ============================================================================== --- llvm/trunk/include/llvm/MC/MCSymbol.h (original) +++ llvm/trunk/include/llvm/MC/MCSymbol.h Mon Jul 27 16:22:30 2009 @@ -15,6 +15,7 @@ #define LLVM_MC_MCSYMBOL_H #include +#include "llvm/ADT/StringRef.h" namespace llvm { class MCSection; @@ -46,7 +47,7 @@ private: // MCContext creates and uniques these. friend class MCContext; - MCSymbol(const char *_Name, bool _IsTemporary) + MCSymbol(const StringRef &_Name, bool _IsTemporary) : Name(_Name), Section(0), IsTemporary(_IsTemporary), IsExternal(false) {} MCSymbol(const MCSymbol&); // DO NOT IMPLEMENT Modified: llvm/trunk/lib/MC/MCContext.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCContext.cpp?rev=77251&r1=77250&r2=77251&view=diff ============================================================================== --- llvm/trunk/lib/MC/MCContext.cpp (original) +++ llvm/trunk/lib/MC/MCContext.cpp Mon Jul 27 16:22:30 2009 @@ -21,7 +21,7 @@ MCContext::~MCContext() { } -MCSection *MCContext::GetSection(const char *Name) { +MCSection *MCContext::GetSection(const StringRef &Name) { MCSection *&Entry = Sections[Name]; if (!Entry) @@ -30,7 +30,7 @@ return Entry; } -MCSymbol *MCContext::CreateSymbol(const char *Name) { +MCSymbol *MCContext::CreateSymbol(const StringRef &Name) { assert(Name[0] != '\0' && "Normal symbols cannot be unnamed!"); // Create and bind the symbol, and ensure that names are unique. @@ -39,7 +39,7 @@ return Entry = new (*this) MCSymbol(Name, false); } -MCSymbol *MCContext::GetOrCreateSymbol(const char *Name) { +MCSymbol *MCContext::GetOrCreateSymbol(const StringRef &Name) { MCSymbol *&Entry = Symbols[Name]; if (Entry) return Entry; @@ -47,9 +47,9 @@ } -MCSymbol *MCContext::CreateTemporarySymbol(const char *Name) { +MCSymbol *MCContext::CreateTemporarySymbol(const StringRef &Name) { // If unnamed, just create a symbol. - if (Name[0] == '\0') + if (Name.empty()) new (*this) MCSymbol("", true); // Otherwise create as usual. @@ -58,7 +58,7 @@ return Entry = new (*this) MCSymbol(Name, true); } -MCSymbol *MCContext::LookupSymbol(const char *Name) const { +MCSymbol *MCContext::LookupSymbol(const StringRef &Name) const { return Symbols.lookup(Name); } From sabre at nondot.org Mon Jul 27 16:28:04 2009 From: sabre at nondot.org (Chris Lattner) Date: Mon, 27 Jul 2009 21:28:04 -0000 Subject: [llvm-commits] [llvm] r77252 - in /llvm/trunk: include/llvm/CodeGen/AsmPrinter.h lib/CodeGen/AsmPrinter/AsmPrinter.cpp lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.h Message-ID: <200907272128.n6RLS4Ow022173@zion.cs.uiuc.edu> Author: lattner Date: Mon Jul 27 16:28:04 2009 New Revision: 77252 URL: http://llvm.org/viewvc/llvm-project?rev=77252&view=rev Log: hoist MCContext/MCStreamer up to AsmPrinter since we're going to start creating MCSections soon instead of Section for all targets, and we need something to own them. Modified: llvm/trunk/include/llvm/CodeGen/AsmPrinter.h llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.h Modified: llvm/trunk/include/llvm/CodeGen/AsmPrinter.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/AsmPrinter.h?rev=77252&r1=77251&r2=77252&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/AsmPrinter.h (original) +++ llvm/trunk/include/llvm/CodeGen/AsmPrinter.h Mon Jul 27 16:28:04 2009 @@ -33,6 +33,8 @@ class MachineConstantPoolValue; class MachineModuleInfo; class MCInst; + class MCContext; + class MCStreamer; class DwarfWriter; class Mangler; class Section; @@ -81,6 +83,17 @@ /// const TargetRegisterInfo *TRI; + /// OutContext - This is the context for the output file that we are + /// streaming. This owns all of the global MC-related objects for the + /// generated translation unit. + MCContext &OutContext; + + /// OutStreamer - This is the MCStreamer object for the file we are + /// generating. This contains the transient state for the current + /// translation unit that we are generating (such as the current section + /// etc). + MCStreamer &OutStreamer; + /// The current machine function. const MachineFunction *MF; Modified: llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp?rev=77252&r1=77251&r2=77252&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp (original) +++ llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp Mon Jul 27 16:28:04 2009 @@ -22,6 +22,8 @@ #include "llvm/CodeGen/MachineModuleInfo.h" #include "llvm/CodeGen/DwarfWriter.h" #include "llvm/Analysis/DebugInfo.h" +#include "llvm/MC/MCContext.h" +#include "llvm/MC/MCStreamer.h" #include "llvm/MC/MCInst.h" #include "llvm/Support/CommandLine.h" #include "llvm/Support/ErrorHandling.h" @@ -47,6 +49,10 @@ const TargetAsmInfo *T, bool VDef) : MachineFunctionPass(&ID), FunctionNumber(0), O(o), TM(tm), TAI(T), TRI(tm.getRegisterInfo()), + + OutContext(*new MCContext()), + OutStreamer(*createAsmStreamer(OutContext, O)), + IsInTextSection(false), LastMI(0), LastFn(0), Counter(~0U), PrevDLT(0, ~0U, ~0U) { DW = 0; MMI = 0; @@ -61,6 +67,9 @@ for (gcp_iterator I = GCMetadataPrinters.begin(), E = GCMetadataPrinters.end(); I != E; ++I) delete I->second; + + delete &OutStreamer; + delete &OutContext; } /// SwitchToTextSection - Switch to the specified text section of the executable @@ -270,6 +279,8 @@ delete Mang; Mang = 0; DW = 0; MMI = 0; + + OutStreamer.Finish(); return false; } Modified: llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp?rev=77252&r1=77251&r2=77252&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp (original) +++ llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp Mon Jul 27 16:28:04 2009 @@ -751,18 +751,6 @@ printInstruction(MI); } -/// doInitialization -bool X86ATTAsmPrinter::doInitialization(Module &M) { - if (NewAsmPrinter) { - Context = new MCContext(); - // FIXME: Send this to "O" instead of outs(). For now, we force it to - // stdout to make it easy to compare. - Streamer = createAsmStreamer(*Context, outs()); - } - - return AsmPrinter::doInitialization(M); -} - void X86ATTAsmPrinter::PrintGlobalVariable(const GlobalVariable* GVar) { const TargetData *TD = TM.getTargetData(); @@ -988,18 +976,7 @@ } // Do common shutdown. - bool Changed = AsmPrinter::doFinalization(M); - - if (NewAsmPrinter) { - Streamer->Finish(); - - delete Streamer; - delete Context; - Streamer = 0; - Context = 0; - } - - return Changed; + return AsmPrinter::doFinalization(M); } // Include the auto-generated portion of the assembly writer. Modified: llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.h?rev=77252&r1=77251&r2=77252&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.h (original) +++ llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.h Mon Jul 27 16:28:04 2009 @@ -33,16 +33,11 @@ class VISIBILITY_HIDDEN X86ATTAsmPrinter : public AsmPrinter { const X86Subtarget *Subtarget; - - MCContext *Context; - MCStreamer *Streamer; public: explicit X86ATTAsmPrinter(formatted_raw_ostream &O, TargetMachine &TM, const TargetAsmInfo *T, bool V) : AsmPrinter(O, TM, T, V) { Subtarget = &TM.getSubtarget(); - Context = 0; - Streamer = 0; } virtual const char *getPassName() const { @@ -60,7 +55,6 @@ AsmPrinter::getAnalysisUsage(AU); } - bool doInitialization(Module &M); bool doFinalization(Module &M); /// printInstruction - This method is automatically generated by tablegen From gohman at apple.com Mon Jul 27 16:46:02 2009 From: gohman at apple.com (Dan Gohman) Date: Mon, 27 Jul 2009 21:46:02 -0000 Subject: [llvm-commits] [llvm] r77255 - in /llvm/trunk: include/llvm/Support/raw_ostream.h lib/Support/raw_ostream.cpp Message-ID: <200907272146.n6RLk2mV022803@zion.cs.uiuc.edu> Author: djg Date: Mon Jul 27 16:46:02 2009 New Revision: 77255 URL: http://llvm.org/viewvc/llvm-project?rev=77255&view=rev Log: Make raw_null_ostream flush its buffer in its destructor, so that it conforms to the assertion added in r77245. This fixes a failure in qa_override.c in clang's testsuite. Modified: llvm/trunk/include/llvm/Support/raw_ostream.h llvm/trunk/lib/Support/raw_ostream.cpp Modified: llvm/trunk/include/llvm/Support/raw_ostream.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/raw_ostream.h?rev=77255&r1=77254&r2=77255&view=diff ============================================================================== --- llvm/trunk/include/llvm/Support/raw_ostream.h (original) +++ llvm/trunk/include/llvm/Support/raw_ostream.h Mon Jul 27 16:46:02 2009 @@ -420,6 +420,7 @@ public: explicit raw_null_ostream() {} + ~raw_null_ostream(); }; } // end llvm namespace Modified: llvm/trunk/lib/Support/raw_ostream.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/raw_ostream.cpp?rev=77255&r1=77254&r2=77255&view=diff ============================================================================== --- llvm/trunk/lib/Support/raw_ostream.cpp (original) +++ llvm/trunk/lib/Support/raw_ostream.cpp Mon Jul 27 16:46:02 2009 @@ -438,6 +438,15 @@ // raw_null_ostream //===----------------------------------------------------------------------===// +raw_null_ostream::~raw_null_ostream() { +#ifndef NDEBUG + // ~raw_ostream asserts that the buffer is empty. This isn't necessary + // with raw_null_ostream, but it's better to have raw_null_ostream follow + // the rules than to change the rules just for raw_null_ostream. + flush(); +#endif +} + void raw_null_ostream::write_impl(const char *Ptr, size_t Size) { } From daniel at zuster.org Mon Jul 27 16:47:07 2009 From: daniel at zuster.org (Daniel Dunbar) Date: Mon, 27 Jul 2009 21:47:07 -0000 Subject: [llvm-commits] [llvm] r77256 - /llvm/trunk/lib/VMCore/Constants.cpp Message-ID: <200907272147.n6RLl7JC022842@zion.cs.uiuc.edu> Author: ddunbar Date: Mon Jul 27 16:47:07 2009 New Revision: 77256 URL: http://llvm.org/viewvc/llvm-project?rev=77256&view=rev Log: Unbreak build. Modified: llvm/trunk/lib/VMCore/Constants.cpp Modified: llvm/trunk/lib/VMCore/Constants.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Constants.cpp?rev=77256&r1=77255&r2=77256&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/Constants.cpp (original) +++ llvm/trunk/lib/VMCore/Constants.cpp Mon Jul 27 16:47:07 2009 @@ -242,7 +242,6 @@ // ConstantFP //===----------------------------------------------------------------------===// -#ifndef NDEBUG static const fltSemantics *TypeToFloatSemantics(const Type *Ty) { if (Ty == Type::FloatTy) return &APFloat::IEEEsingle; @@ -256,7 +255,6 @@ assert(Ty == Type::PPC_FP128Ty && "Unknown FP format"); return &APFloat::PPCDoubleDouble; } -#endif /// get() - This returns a constant fp for the specified value in the /// specified type. This should only be used for simple constant values like From gohman at apple.com Mon Jul 27 16:49:34 2009 From: gohman at apple.com (Dan Gohman) Date: Mon, 27 Jul 2009 21:49:34 -0000 Subject: [llvm-commits] [llvm] r77257 - /llvm/trunk/include/llvm/Operator.h Message-ID: <200907272149.n6RLnZ41022923@zion.cs.uiuc.edu> Author: djg Date: Mon Jul 27 16:49:34 2009 New Revision: 77257 URL: http://llvm.org/viewvc/llvm-project?rev=77257&view=rev Log: Order unsigned before signed, for consistency. Modified: llvm/trunk/include/llvm/Operator.h Modified: llvm/trunk/include/llvm/Operator.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Operator.h?rev=77257&r1=77256&r2=77257&view=diff ============================================================================== --- llvm/trunk/include/llvm/Operator.h (original) +++ llvm/trunk/include/llvm/Operator.h Mon Jul 27 16:49:34 2009 @@ -66,21 +66,21 @@ /// class OverflowingBinaryOperator : public Operator { public: - /// hasNoSignedOverflow - Test whether this operation is known to never - /// undergo signed overflow. - bool hasNoSignedOverflow() const { + /// hasNoUnsignedOverflow - Test whether this operation is known to never + /// undergo unsigned overflow. + bool hasNoUnsignedOverflow() const { return SubclassOptionalData & (1 << 0); } - void setHasNoSignedOverflow(bool B) { + void setHasNoUnsignedOverflow(bool B) { SubclassOptionalData = (SubclassOptionalData & ~(1 << 0)) | (B << 0); } - /// hasNoUnsignedOverflow - Test whether this operation is known to never - /// undergo unsigned overflow. - bool hasNoUnsignedOverflow() const { + /// hasNoSignedOverflow - Test whether this operation is known to never + /// undergo signed overflow. + bool hasNoSignedOverflow() const { return SubclassOptionalData & (1 << 1); } - void setHasNoUnsignedOverflow(bool B) { + void setHasNoSignedOverflow(bool B) { SubclassOptionalData = (SubclassOptionalData & ~(1 << 1)) | (B << 1); } From daniel at zuster.org Mon Jul 27 16:49:56 2009 From: daniel at zuster.org (Daniel Dunbar) Date: Mon, 27 Jul 2009 21:49:56 -0000 Subject: [llvm-commits] [llvm] r77258 - in /llvm/trunk: include/llvm/MC/MCStreamer.h include/llvm/Target/TargetAsmParser.h lib/MC/MCAsmStreamer.cpp lib/Target/X86/AsmParser/X86AsmParser.cpp tools/llvm-mc/AsmLexer.h tools/llvm-mc/AsmParser.cpp tools/llvm-mc/AsmParser.h tools/llvm-mc/MC-X86Specific.cpp Message-ID: <200907272149.n6RLnvuP022948@zion.cs.uiuc.edu> Author: ddunbar Date: Mon Jul 27 16:49:56 2009 New Revision: 77258 URL: http://llvm.org/viewvc/llvm-project?rev=77258&view=rev Log: llvm-mc: Move AsmLexer::getCurStrVal to StringRef based API. - My DFS traversal of LLVM is, at least for now, nearly complete! :) Modified: llvm/trunk/include/llvm/MC/MCStreamer.h llvm/trunk/include/llvm/Target/TargetAsmParser.h llvm/trunk/lib/MC/MCAsmStreamer.cpp llvm/trunk/lib/Target/X86/AsmParser/X86AsmParser.cpp llvm/trunk/tools/llvm-mc/AsmLexer.h llvm/trunk/tools/llvm-mc/AsmParser.cpp llvm/trunk/tools/llvm-mc/AsmParser.h llvm/trunk/tools/llvm-mc/MC-X86Specific.cpp Modified: llvm/trunk/include/llvm/MC/MCStreamer.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCStreamer.h?rev=77258&r1=77257&r2=77258&view=diff ============================================================================== --- llvm/trunk/include/llvm/MC/MCStreamer.h (original) +++ llvm/trunk/include/llvm/MC/MCStreamer.h Mon Jul 27 16:49:56 2009 @@ -22,6 +22,7 @@ class MCInst; class MCSection; class MCSymbol; + class StringRef; class raw_ostream; /// MCStreamer - Streaming machine code generation interface. This interface @@ -166,12 +167,11 @@ /// @name Generating Data /// @{ - /// EmitBytes - Emit @param Length bytes starting at @param Data into the - /// output. + /// EmitBytes - Emit the bytes in @param Data into the output. /// /// This is used to implement assembler directives such as .byte, .ascii, /// etc. - virtual void EmitBytes(const char *Data, unsigned Length) = 0; + virtual void EmitBytes(const StringRef &Data) = 0; /// EmitValue - Emit the expression @param Value into the output as a native /// integer of the given @param Size bytes. Modified: llvm/trunk/include/llvm/Target/TargetAsmParser.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetAsmParser.h?rev=77258&r1=77257&r2=77258&view=diff ============================================================================== --- llvm/trunk/include/llvm/Target/TargetAsmParser.h (original) +++ llvm/trunk/include/llvm/Target/TargetAsmParser.h Mon Jul 27 16:49:56 2009 @@ -13,6 +13,7 @@ namespace llvm { class MCAsmParser; class MCInst; +class StringRef; class Target; /// TargetAsmParser - Generic interface to target specific assembly parsers. @@ -42,7 +43,7 @@ /// \param Name - The instruction name. /// \param Inst [out] - On success, the parsed instruction. /// \return True on failure. - virtual bool ParseInstruction(MCAsmParser &AP, const char *Name, + virtual bool ParseInstruction(MCAsmParser &AP, const StringRef &Name, MCInst &Inst) = 0; }; Modified: llvm/trunk/lib/MC/MCAsmStreamer.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCAsmStreamer.cpp?rev=77258&r1=77257&r2=77258&view=diff ============================================================================== --- llvm/trunk/lib/MC/MCAsmStreamer.cpp (original) +++ llvm/trunk/lib/MC/MCAsmStreamer.cpp Mon Jul 27 16:49:56 2009 @@ -57,7 +57,7 @@ virtual void AbortAssembly(const char *AbortReason = NULL); - virtual void EmitBytes(const char *Data, unsigned Length); + virtual void EmitBytes(const StringRef &Data); virtual void EmitValue(const MCValue &Value, unsigned Size); @@ -208,9 +208,9 @@ OS << '\n'; } -void MCAsmStreamer::EmitBytes(const char *Data, unsigned Length) { +void MCAsmStreamer::EmitBytes(const StringRef &Data) { assert(CurSection && "Cannot emit contents before setting section!"); - for (unsigned i = 0; i != Length; ++i) + for (unsigned i = 0, e = Data.size(); i != e; ++i) OS << ".byte " << (unsigned) Data[i] << '\n'; } 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=77258&r1=77257&r2=77258&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/AsmParser/X86AsmParser.cpp (original) +++ llvm/trunk/lib/Target/X86/AsmParser/X86AsmParser.cpp Mon Jul 27 16:49:56 2009 @@ -21,14 +21,14 @@ class X86ATTAsmParser : public TargetAsmParser { bool ParseOperand(X86Operand &Op); - bool MatchInstruction(const char *Name, + bool MatchInstruction(const StringRef &Name, llvm::SmallVector &Operands, MCInst &Inst); public: explicit X86ATTAsmParser(const Target &); - virtual bool ParseInstruction(MCAsmParser &AP, const char *Name, + virtual bool ParseInstruction(MCAsmParser &AP, const StringRef &Name, MCInst &Inst); }; } @@ -43,13 +43,13 @@ } bool -X86ATTAsmParser::MatchInstruction(const char *Name, +X86ATTAsmParser::MatchInstruction(const StringRef &Name, llvm::SmallVector &Operands, MCInst &Inst) { return false; } -bool X86ATTAsmParser::ParseInstruction(MCAsmParser &AP, const char *Name, +bool X86ATTAsmParser::ParseInstruction(MCAsmParser &AP, const StringRef &Name, MCInst &Inst) { llvm::SmallVector Operands; Modified: llvm/trunk/tools/llvm-mc/AsmLexer.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-mc/AsmLexer.h?rev=77258&r1=77257&r2=77258&view=diff ============================================================================== --- llvm/trunk/tools/llvm-mc/AsmLexer.h (original) +++ llvm/trunk/tools/llvm-mc/AsmLexer.h Mon Jul 27 16:49:56 2009 @@ -14,6 +14,7 @@ #ifndef ASMLEXER_H #define ASMLEXER_H +#include "llvm/ADT/StringRef.h" #include "llvm/MC/MCAsmLexer.h" #include "llvm/Support/DataTypes.h" #include @@ -84,8 +85,13 @@ asmtok::TokKind getKind() const { return CurKind; } bool is(asmtok::TokKind K) const { return CurKind == K; } bool isNot(asmtok::TokKind K) const { return CurKind != K; } - - const char *getCurStrVal() const { + + /// getCurStrVal - Get the string for the current token, this includes all + /// characters (for example, the quotes on strings) in the token. + /// + /// The returned StringRef points into the source manager's memory buffer, and + /// is safe to store across calls to Lex(). + StringRef getCurStrVal() const { assert((CurKind == asmtok::Identifier || CurKind == asmtok::Register || CurKind == asmtok::String) && "This token doesn't have a string value"); Modified: llvm/trunk/tools/llvm-mc/AsmParser.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-mc/AsmParser.cpp?rev=77258&r1=77257&r2=77258&view=diff ============================================================================== --- llvm/trunk/tools/llvm-mc/AsmParser.cpp (original) +++ llvm/trunk/tools/llvm-mc/AsmParser.cpp Mon Jul 27 16:49:56 2009 @@ -313,7 +313,7 @@ // If we have an identifier, handle it as the key symbol. SMLoc IDLoc = Lexer.getLoc(); - const char *IDVal = Lexer.getCurStrVal(); + StringRef IDVal = Lexer.getCurStrVal(); // Consume the identifier, see what is after it. switch (Lexer.Lex()) { @@ -353,194 +353,194 @@ // Otherwise, we have a normal instruction or directive. if (IDVal[0] == '.') { // FIXME: This should be driven based on a hash lookup and callback. - if (!strcmp(IDVal, ".section")) + if (IDVal == ".section") return ParseDirectiveDarwinSection(); - if (!strcmp(IDVal, ".text")) + if (IDVal == ".text") // FIXME: This changes behavior based on the -static flag to the // assembler. return ParseDirectiveSectionSwitch("__TEXT,__text", "regular,pure_instructions"); - if (!strcmp(IDVal, ".const")) + if (IDVal == ".const") return ParseDirectiveSectionSwitch("__TEXT,__const"); - if (!strcmp(IDVal, ".static_const")) + if (IDVal == ".static_const") return ParseDirectiveSectionSwitch("__TEXT,__static_const"); - if (!strcmp(IDVal, ".cstring")) + if (IDVal == ".cstring") return ParseDirectiveSectionSwitch("__TEXT,__cstring", "cstring_literals"); - if (!strcmp(IDVal, ".literal4")) + if (IDVal == ".literal4") return ParseDirectiveSectionSwitch("__TEXT,__literal4", "4byte_literals"); - if (!strcmp(IDVal, ".literal8")) + if (IDVal == ".literal8") return ParseDirectiveSectionSwitch("__TEXT,__literal8", "8byte_literals"); - if (!strcmp(IDVal, ".literal16")) + if (IDVal == ".literal16") return ParseDirectiveSectionSwitch("__TEXT,__literal16", "16byte_literals"); - if (!strcmp(IDVal, ".constructor")) + if (IDVal == ".constructor") return ParseDirectiveSectionSwitch("__TEXT,__constructor"); - if (!strcmp(IDVal, ".destructor")) + if (IDVal == ".destructor") return ParseDirectiveSectionSwitch("__TEXT,__destructor"); - if (!strcmp(IDVal, ".fvmlib_init0")) + if (IDVal == ".fvmlib_init0") return ParseDirectiveSectionSwitch("__TEXT,__fvmlib_init0"); - if (!strcmp(IDVal, ".fvmlib_init1")) + if (IDVal == ".fvmlib_init1") return ParseDirectiveSectionSwitch("__TEXT,__fvmlib_init1"); - if (!strcmp(IDVal, ".symbol_stub")) // FIXME: Different on PPC. + if (IDVal == ".symbol_stub") // FIXME: Different on PPC. return ParseDirectiveSectionSwitch("__IMPORT,__jump_table,symbol_stubs", "self_modifying_code+pure_instructions,5"); // FIXME: .picsymbol_stub on PPC. - if (!strcmp(IDVal, ".data")) + if (IDVal == ".data") return ParseDirectiveSectionSwitch("__DATA,__data"); - if (!strcmp(IDVal, ".static_data")) + if (IDVal == ".static_data") return ParseDirectiveSectionSwitch("__DATA,__static_data"); - if (!strcmp(IDVal, ".non_lazy_symbol_pointer")) + if (IDVal == ".non_lazy_symbol_pointer") return ParseDirectiveSectionSwitch("__DATA,__nl_symbol_pointer", "non_lazy_symbol_pointers"); - if (!strcmp(IDVal, ".lazy_symbol_pointer")) + if (IDVal == ".lazy_symbol_pointer") return ParseDirectiveSectionSwitch("__DATA,__la_symbol_pointer", "lazy_symbol_pointers"); - if (!strcmp(IDVal, ".dyld")) + if (IDVal == ".dyld") return ParseDirectiveSectionSwitch("__DATA,__dyld"); - if (!strcmp(IDVal, ".mod_init_func")) + if (IDVal == ".mod_init_func") return ParseDirectiveSectionSwitch("__DATA,__mod_init_func", "mod_init_funcs"); - if (!strcmp(IDVal, ".mod_term_func")) + if (IDVal == ".mod_term_func") return ParseDirectiveSectionSwitch("__DATA,__mod_term_func", "mod_term_funcs"); - if (!strcmp(IDVal, ".const_data")) + if (IDVal == ".const_data") return ParseDirectiveSectionSwitch("__DATA,__const", "regular"); // FIXME: Verify attributes on sections. - if (!strcmp(IDVal, ".objc_class")) + if (IDVal == ".objc_class") return ParseDirectiveSectionSwitch("__OBJC,__class"); - if (!strcmp(IDVal, ".objc_meta_class")) + if (IDVal == ".objc_meta_class") return ParseDirectiveSectionSwitch("__OBJC,__meta_class"); - if (!strcmp(IDVal, ".objc_cat_cls_meth")) + if (IDVal == ".objc_cat_cls_meth") return ParseDirectiveSectionSwitch("__OBJC,__cat_cls_meth"); - if (!strcmp(IDVal, ".objc_cat_inst_meth")) + if (IDVal == ".objc_cat_inst_meth") return ParseDirectiveSectionSwitch("__OBJC,__cat_inst_meth"); - if (!strcmp(IDVal, ".objc_protocol")) + if (IDVal == ".objc_protocol") return ParseDirectiveSectionSwitch("__OBJC,__protocol"); - if (!strcmp(IDVal, ".objc_string_object")) + if (IDVal == ".objc_string_object") return ParseDirectiveSectionSwitch("__OBJC,__string_object"); - if (!strcmp(IDVal, ".objc_cls_meth")) + if (IDVal == ".objc_cls_meth") return ParseDirectiveSectionSwitch("__OBJC,__cls_meth"); - if (!strcmp(IDVal, ".objc_inst_meth")) + if (IDVal == ".objc_inst_meth") return ParseDirectiveSectionSwitch("__OBJC,__inst_meth"); - if (!strcmp(IDVal, ".objc_cls_refs")) + if (IDVal == ".objc_cls_refs") return ParseDirectiveSectionSwitch("__OBJC,__cls_refs"); - if (!strcmp(IDVal, ".objc_message_refs")) + if (IDVal == ".objc_message_refs") return ParseDirectiveSectionSwitch("__OBJC,__message_refs"); - if (!strcmp(IDVal, ".objc_symbols")) + if (IDVal == ".objc_symbols") return ParseDirectiveSectionSwitch("__OBJC,__symbols"); - if (!strcmp(IDVal, ".objc_category")) + if (IDVal == ".objc_category") return ParseDirectiveSectionSwitch("__OBJC,__category"); - if (!strcmp(IDVal, ".objc_class_vars")) + if (IDVal == ".objc_class_vars") return ParseDirectiveSectionSwitch("__OBJC,__class_vars"); - if (!strcmp(IDVal, ".objc_instance_vars")) + if (IDVal == ".objc_instance_vars") return ParseDirectiveSectionSwitch("__OBJC,__instance_vars"); - if (!strcmp(IDVal, ".objc_module_info")) + if (IDVal == ".objc_module_info") return ParseDirectiveSectionSwitch("__OBJC,__module_info"); - if (!strcmp(IDVal, ".objc_class_names")) + if (IDVal == ".objc_class_names") return ParseDirectiveSectionSwitch("__TEXT,__cstring","cstring_literals"); - if (!strcmp(IDVal, ".objc_meth_var_types")) + if (IDVal == ".objc_meth_var_types") return ParseDirectiveSectionSwitch("__TEXT,__cstring","cstring_literals"); - if (!strcmp(IDVal, ".objc_meth_var_names")) + if (IDVal == ".objc_meth_var_names") return ParseDirectiveSectionSwitch("__TEXT,__cstring","cstring_literals"); - if (!strcmp(IDVal, ".objc_selector_strs")) + if (IDVal == ".objc_selector_strs") return ParseDirectiveSectionSwitch("__OBJC,__selector_strs"); // Assembler features - if (!strcmp(IDVal, ".set")) + if (IDVal == ".set") return ParseDirectiveSet(); // Data directives - if (!strcmp(IDVal, ".ascii")) + if (IDVal == ".ascii") return ParseDirectiveAscii(false); - if (!strcmp(IDVal, ".asciz")) + if (IDVal == ".asciz") return ParseDirectiveAscii(true); // FIXME: Target hooks for size? Also for "word", "hword". - if (!strcmp(IDVal, ".byte")) + if (IDVal == ".byte") return ParseDirectiveValue(1); - if (!strcmp(IDVal, ".short")) + if (IDVal == ".short") return ParseDirectiveValue(2); - if (!strcmp(IDVal, ".long")) + if (IDVal == ".long") return ParseDirectiveValue(4); - if (!strcmp(IDVal, ".quad")) + if (IDVal == ".quad") return ParseDirectiveValue(8); // FIXME: Target hooks for IsPow2. - if (!strcmp(IDVal, ".align")) + if (IDVal == ".align") return ParseDirectiveAlign(/*IsPow2=*/true, /*ExprSize=*/1); - if (!strcmp(IDVal, ".align32")) + if (IDVal == ".align32") return ParseDirectiveAlign(/*IsPow2=*/true, /*ExprSize=*/4); - if (!strcmp(IDVal, ".balign")) + if (IDVal == ".balign") return ParseDirectiveAlign(/*IsPow2=*/false, /*ExprSize=*/1); - if (!strcmp(IDVal, ".balignw")) + if (IDVal == ".balignw") return ParseDirectiveAlign(/*IsPow2=*/false, /*ExprSize=*/2); - if (!strcmp(IDVal, ".balignl")) + if (IDVal == ".balignl") return ParseDirectiveAlign(/*IsPow2=*/false, /*ExprSize=*/4); - if (!strcmp(IDVal, ".p2align")) + if (IDVal == ".p2align") return ParseDirectiveAlign(/*IsPow2=*/true, /*ExprSize=*/1); - if (!strcmp(IDVal, ".p2alignw")) + if (IDVal == ".p2alignw") return ParseDirectiveAlign(/*IsPow2=*/true, /*ExprSize=*/2); - if (!strcmp(IDVal, ".p2alignl")) + if (IDVal == ".p2alignl") return ParseDirectiveAlign(/*IsPow2=*/true, /*ExprSize=*/4); - if (!strcmp(IDVal, ".org")) + if (IDVal == ".org") return ParseDirectiveOrg(); - if (!strcmp(IDVal, ".fill")) + if (IDVal == ".fill") return ParseDirectiveFill(); - if (!strcmp(IDVal, ".space")) + if (IDVal == ".space") return ParseDirectiveSpace(); // Symbol attribute directives - if (!strcmp(IDVal, ".globl") || !strcmp(IDVal, ".global")) + if (IDVal == ".globl" || IDVal == ".global") return ParseDirectiveSymbolAttribute(MCStreamer::Global); - if (!strcmp(IDVal, ".hidden")) + if (IDVal == ".hidden") return ParseDirectiveSymbolAttribute(MCStreamer::Hidden); - if (!strcmp(IDVal, ".indirect_symbol")) + if (IDVal == ".indirect_symbol") return ParseDirectiveSymbolAttribute(MCStreamer::IndirectSymbol); - if (!strcmp(IDVal, ".internal")) + if (IDVal == ".internal") return ParseDirectiveSymbolAttribute(MCStreamer::Internal); - if (!strcmp(IDVal, ".lazy_reference")) + if (IDVal == ".lazy_reference") return ParseDirectiveSymbolAttribute(MCStreamer::LazyReference); - if (!strcmp(IDVal, ".no_dead_strip")) + if (IDVal == ".no_dead_strip") return ParseDirectiveSymbolAttribute(MCStreamer::NoDeadStrip); - if (!strcmp(IDVal, ".private_extern")) + if (IDVal == ".private_extern") return ParseDirectiveSymbolAttribute(MCStreamer::PrivateExtern); - if (!strcmp(IDVal, ".protected")) + if (IDVal == ".protected") return ParseDirectiveSymbolAttribute(MCStreamer::Protected); - if (!strcmp(IDVal, ".reference")) + if (IDVal == ".reference") return ParseDirectiveSymbolAttribute(MCStreamer::Reference); - if (!strcmp(IDVal, ".weak")) + if (IDVal == ".weak") return ParseDirectiveSymbolAttribute(MCStreamer::Weak); - if (!strcmp(IDVal, ".weak_definition")) + if (IDVal == ".weak_definition") return ParseDirectiveSymbolAttribute(MCStreamer::WeakDefinition); - if (!strcmp(IDVal, ".weak_reference")) + if (IDVal == ".weak_reference") return ParseDirectiveSymbolAttribute(MCStreamer::WeakReference); - if (!strcmp(IDVal, ".comm")) + if (IDVal == ".comm") return ParseDirectiveComm(/*IsLocal=*/false); - if (!strcmp(IDVal, ".lcomm")) + if (IDVal == ".lcomm") return ParseDirectiveComm(/*IsLocal=*/true); - if (!strcmp(IDVal, ".zerofill")) + if (IDVal == ".zerofill") return ParseDirectiveDarwinZerofill(); - if (!strcmp(IDVal, ".desc")) + if (IDVal == ".desc") return ParseDirectiveDarwinSymbolDesc(); - if (!strcmp(IDVal, ".lsym")) + if (IDVal == ".lsym") return ParseDirectiveDarwinLsym(); - if (!strcmp(IDVal, ".subsections_via_symbols")) + if (IDVal == ".subsections_via_symbols") return ParseDirectiveDarwinSubsectionsViaSymbols(); - if (!strcmp(IDVal, ".abort")) + if (IDVal == ".abort") return ParseDirectiveAbort(); - if (!strcmp(IDVal, ".include")) + if (IDVal == ".include") return ParseDirectiveInclude(); - if (!strcmp(IDVal, ".dump")) + if (IDVal == ".dump") return ParseDirectiveDarwinDumpOrLoad(IDLoc, /*IsDump=*/true); - if (!strcmp(IDVal, ".load")) + if (IDVal == ".load") return ParseDirectiveDarwinDumpOrLoad(IDLoc, /*IsLoad=*/false); Warning(IDLoc, "ignoring directive for now"); @@ -566,7 +566,7 @@ return false; } -bool AsmParser::ParseAssignment(const char *Name, bool IsDotSet) { +bool AsmParser::ParseAssignment(const StringRef &Name, bool IsDotSet) { // FIXME: Use better location, we should use proper tokens. SMLoc EqualLoc = Lexer.getLoc(); @@ -605,7 +605,7 @@ if (Lexer.isNot(asmtok::Identifier)) return TokError("expected identifier after '.set' directive"); - const char *Name = Lexer.getCurStrVal(); + StringRef Name = Lexer.getCurStrVal(); if (Lexer.Lex() != asmtok::Comma) return TokError("unexpected token in '.set'"); @@ -632,7 +632,7 @@ if (Lexer.isNot(asmtok::Identifier)) return TokError("expected identifier in '.section' directive"); Section += ','; - Section += Lexer.getCurStrVal(); + Section += Lexer.getCurStrVal().str(); Lexer.Lex(); } @@ -671,10 +671,10 @@ // FIXME: This shouldn't use a const char* + strlen, the string could have // embedded nulls. // FIXME: Should have accessor for getting string contents. - const char *Str = Lexer.getCurStrVal(); - Out.EmitBytes(Str + 1, strlen(Str) - 2); + StringRef Str = Lexer.getCurStrVal(); + Out.EmitBytes(Str.substr(1, Str.size() - 2)); if (ZeroTerminated) - Out.EmitBytes("\0", 1); + Out.EmitBytes(StringRef("\0", 1)); Lexer.Lex(); @@ -1026,7 +1026,7 @@ if (Lexer.isNot(asmtok::Identifier)) return TokError("expected section name after comma in '.zerofill' " "directive"); - Section += Lexer.getCurStrVal(); + Section += Lexer.getCurStrVal().str(); Lexer.Lex(); // FIXME: we will need to tell GetSection() that this is to be created with or @@ -1117,7 +1117,7 @@ /// ParseDirectiveAbort /// ::= .abort [ "abort_string" ] bool AsmParser::ParseDirectiveAbort() { - const char *Str = NULL; + StringRef Str = ""; if (Lexer.isNot(asmtok::EndOfStatement)) { if (Lexer.isNot(asmtok::String)) return TokError("expected string in '.abort' directive"); @@ -1132,7 +1132,8 @@ Lexer.Lex(); - Out.AbortAssembly(Str); + // FIXME: Handle here. + Out.AbortAssembly(Str.str().c_str()); return false; } Modified: llvm/trunk/tools/llvm-mc/AsmParser.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-mc/AsmParser.h?rev=77258&r1=77257&r2=77258&view=diff ============================================================================== --- llvm/trunk/tools/llvm-mc/AsmParser.h (original) +++ llvm/trunk/tools/llvm-mc/AsmParser.h Mon Jul 27 16:49:56 2009 @@ -58,7 +58,7 @@ void EatToEndOfStatement(); - bool ParseAssignment(const char *Name, bool IsDotSet); + bool ParseAssignment(const StringRef &Name, bool IsDotSet); /// ParseExpression - Parse a general assembly expression. /// @@ -97,7 +97,7 @@ bool ParseParenExpr(AsmExpr *&Res); // X86 specific. - bool ParseX86InstOperands(const char *InstName, MCInst &Inst); + bool ParseX86InstOperands(const StringRef &InstName, MCInst &Inst); bool ParseX86Operand(X86Operand &Op); bool ParseX86MemOperand(X86Operand &Op); bool ParseX86Register(X86Operand &Op); Modified: llvm/trunk/tools/llvm-mc/MC-X86Specific.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-mc/MC-X86Specific.cpp?rev=77258&r1=77257&r2=77258&view=diff ============================================================================== --- llvm/trunk/tools/llvm-mc/MC-X86Specific.cpp (original) +++ llvm/trunk/tools/llvm-mc/MC-X86Specific.cpp Mon Jul 27 16:49:56 2009 @@ -235,7 +235,7 @@ /// MatchX86Inst - Convert a parsed instruction name and operand list into a /// concrete instruction. -static bool MatchX86Inst(const char *Name, +static bool MatchX86Inst(const StringRef &Name, llvm::SmallVector &Operands, MCInst &Inst) { return false; @@ -243,7 +243,7 @@ /// ParseX86InstOperands - Parse the operands of an X86 instruction and return /// them as the operands of an MCInst. -bool AsmParser::ParseX86InstOperands(const char *InstName, MCInst &Inst) { +bool AsmParser::ParseX86InstOperands(const StringRef &InstName, MCInst &Inst) { llvm::SmallVector Operands; if (Lexer.isNot(asmtok::EndOfStatement)) { From gohman at apple.com Mon Jul 27 16:53:46 2009 From: gohman at apple.com (Dan Gohman) Date: Mon, 27 Jul 2009 21:53:46 -0000 Subject: [llvm-commits] [llvm] r77259 - in /llvm/trunk: docs/LangRef.html include/llvm/Bitcode/LLVMBitCodes.h include/llvm/Operator.h lib/AsmParser/LLLexer.cpp lib/AsmParser/LLParser.cpp lib/AsmParser/LLToken.h lib/Bitcode/Reader/BitcodeReader.cpp lib/Bitcode/Writer/BitcodeWriter.cpp lib/VMCore/AsmWriter.cpp test/Assembler/flags-plain.ll test/Assembler/flags.ll Message-ID: <200907272153.n6RLrkuk023065@zion.cs.uiuc.edu> Author: djg Date: Mon Jul 27 16:53:46 2009 New Revision: 77259 URL: http://llvm.org/viewvc/llvm-project?rev=77259&view=rev Log: Add a new keyword 'inbounds' for use with getelementptr. See the LangRef.html changes for details. Modified: llvm/trunk/docs/LangRef.html llvm/trunk/include/llvm/Bitcode/LLVMBitCodes.h llvm/trunk/include/llvm/Operator.h llvm/trunk/lib/AsmParser/LLLexer.cpp llvm/trunk/lib/AsmParser/LLParser.cpp llvm/trunk/lib/AsmParser/LLToken.h llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp llvm/trunk/lib/Bitcode/Writer/BitcodeWriter.cpp llvm/trunk/lib/VMCore/AsmWriter.cpp llvm/trunk/test/Assembler/flags-plain.ll llvm/trunk/test/Assembler/flags.ll Modified: llvm/trunk/docs/LangRef.html URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/LangRef.html?rev=77259&r1=77258&r2=77259&view=diff ============================================================================== --- llvm/trunk/docs/LangRef.html (original) +++ llvm/trunk/docs/LangRef.html Mon Jul 27 16:53:46 2009 @@ -2091,6 +2091,7 @@ instruction.
    getelementptr ( CSTPTR, IDX0, IDX1, ... )
    +
    getelementptr inbounds ( CSTPTR, IDX0, IDX1, ... )
    Perform the getelementptr operation on constants. As with the getelementptr instruction, the index list may have zero or more indexes, which are @@ -3902,6 +3903,7 @@
    Syntax:
       <result> = getelementptr <pty>* <ptrval>{, <ty> <idx>}*
    +  <result> = getelementptr inbounds <pty>* <ptrval>{, <ty> <idx>}*
     
    Overview:
    @@ -3990,6 +3992,20 @@ } +

    If the inbounds keyword is present, the result value of the + getelementptr is undefined if the base pointer is not pointing + into an allocated object, or if any of the addresses formed by successive + addition of the offsets implied by the indices to the base address is + outside of the allocated object into which the base pointer points.

    + +

    If the inbounds keyword is not present, the offsets are added to + the base address with silently-wrapping two's complement arithmetic, and + the result value of the getelementptr may be outside the object + pointed to by the base pointer. The result value may not necessarily be + used to access memory though, even if it happens to point into allocated + storage. See the Pointer Aliasing Rules + section for more information.

    +

    The getelementptr instruction is often confusing. For some more insight into how it works, see the getelementptr FAQ.

    Modified: llvm/trunk/include/llvm/Bitcode/LLVMBitCodes.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Bitcode/LLVMBitCodes.h?rev=77259&r1=77258&r2=77259&view=diff ============================================================================== --- llvm/trunk/include/llvm/Bitcode/LLVMBitCodes.h (original) +++ llvm/trunk/include/llvm/Bitcode/LLVMBitCodes.h Mon Jul 27 16:53:46 2009 @@ -132,7 +132,8 @@ CST_CODE_CE_SHUFFLEVEC = 16, // CE_SHUFFLEVEC: [opval, opval, opval] CST_CODE_CE_CMP = 17, // CE_CMP: [opty, opval, opval, pred] CST_CODE_INLINEASM = 18, // INLINEASM: [sideeffect,asmstr,conststr] - CST_CODE_CE_SHUFVEC_EX = 19 // SHUFVEC_EX: [opty, opval, opval, opval] + CST_CODE_CE_SHUFVEC_EX = 19, // SHUFVEC_EX: [opty, opval, opval, opval] + CST_CODE_CE_INBOUNDS_GEP = 20 // INBOUNDS_GEP: [n x operands] }; /// CastOpcodes - These are values used in the bitcode files to encode which @@ -229,7 +230,8 @@ // support legacy vicmp/vfcmp instructions. FUNC_CODE_INST_CMP2 = 28, // CMP2: [opty, opval, opval, pred] // new select on i1 or [N x i1] - FUNC_CODE_INST_VSELECT = 29 // VSELECT: [ty,opval,opval,predty,pred] + FUNC_CODE_INST_VSELECT = 29, // VSELECT: [ty,opval,opval,predty,pred] + FUNC_CODE_INST_INBOUNDS_GEP = 30 // INBOUNDS_GEP: [n x operands] }; } // End bitc namespace } // End llvm namespace Modified: llvm/trunk/include/llvm/Operator.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Operator.h?rev=77259&r1=77258&r2=77259&view=diff ============================================================================== --- llvm/trunk/include/llvm/Operator.h (original) +++ llvm/trunk/include/llvm/Operator.h Mon Jul 27 16:53:46 2009 @@ -181,6 +181,15 @@ class GEPOperator : public Operator { public: + /// isInBounds - Test whether this is an inbounds GEP, as defined + /// by LangRef.html. + bool isInBounds() const { + return SubclassOptionalData & (1 << 0); + } + void setIsInBounds(bool B) { + SubclassOptionalData = (SubclassOptionalData & ~(1 << 0)) | (B << 0); + } + inline op_iterator idx_begin() { return op_begin()+1; } inline const_op_iterator idx_begin() const { return op_begin()+1; } inline op_iterator idx_end() { return op_end(); } Modified: llvm/trunk/lib/AsmParser/LLLexer.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/AsmParser/LLLexer.cpp?rev=77259&r1=77258&r2=77259&view=diff ============================================================================== --- llvm/trunk/lib/AsmParser/LLLexer.cpp (original) +++ llvm/trunk/lib/AsmParser/LLLexer.cpp Mon Jul 27 16:53:46 2009 @@ -504,6 +504,7 @@ KEYWORD(nuw); KEYWORD(nsw); KEYWORD(exact); + KEYWORD(inbounds); KEYWORD(align); KEYWORD(addrspace); KEYWORD(section); Modified: llvm/trunk/lib/AsmParser/LLParser.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/AsmParser/LLParser.cpp?rev=77259&r1=77258&r2=77259&view=diff ============================================================================== --- llvm/trunk/lib/AsmParser/LLParser.cpp (original) +++ llvm/trunk/lib/AsmParser/LLParser.cpp Mon Jul 27 16:53:46 2009 @@ -457,7 +457,7 @@ /// Aliasee /// ::= TypeAndValue /// ::= 'bitcast' '(' TypeAndValue 'to' Type ')' -/// ::= 'getelementptr' '(' ... ')' +/// ::= 'getelementptr' 'inbounds'? '(' ... ')' /// /// Everything through visibility has already been parsed. /// @@ -2039,7 +2039,11 @@ case lltok::kw_select: { unsigned Opc = Lex.getUIntVal(); SmallVector Elts; + bool InBounds = false; Lex.Lex(); + if (Opc == Instruction::GetElementPtr) + if (EatIfPresent(lltok::kw_inbounds)) + InBounds = true; if (ParseToken(lltok::lparen, "expected '(' in constantexpr") || ParseGlobalValueVector(Elts) || ParseToken(lltok::rparen, "expected ')' in constantexpr")) @@ -2055,6 +2059,8 @@ return Error(ID.Loc, "invalid indices for getelementptr"); ID.ConstantVal = Context.getConstantExprGetElementPtr(Elts[0], Elts.data() + 1, Elts.size() - 1); + if (InBounds) + cast(ID.ConstantVal)->setIsInBounds(true); } else if (Opc == Instruction::Select) { if (Elts.size() != 3) return Error(ID.Loc, "expected three operands to select"); @@ -3368,9 +3374,14 @@ } /// ParseGetElementPtr -/// ::= 'getelementptr' TypeAndValue (',' TypeAndValue)* +/// ::= 'getelementptr' 'inbounds'? TypeAndValue (',' TypeAndValue)* bool LLParser::ParseGetElementPtr(Instruction *&Inst, PerFunctionState &PFS) { Value *Ptr, *Val; LocTy Loc, EltLoc; + bool InBounds = false; + + if (EatIfPresent(lltok::kw_inbounds)) + InBounds = true; + if (ParseTypeAndValue(Ptr, Loc, PFS)) return true; if (!isa(Ptr->getType())) @@ -3388,6 +3399,8 @@ Indices.begin(), Indices.end())) return Error(Loc, "invalid getelementptr indices"); Inst = GetElementPtrInst::Create(Ptr, Indices.begin(), Indices.end()); + if (InBounds) + cast(Inst)->setIsInBounds(true); return false; } Modified: llvm/trunk/lib/AsmParser/LLToken.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/AsmParser/LLToken.h?rev=77259&r1=77258&r2=77259&view=diff ============================================================================== --- llvm/trunk/lib/AsmParser/LLToken.h (original) +++ llvm/trunk/lib/AsmParser/LLToken.h Mon Jul 27 16:53:46 2009 @@ -54,6 +54,7 @@ kw_nuw, kw_nsw, kw_exact, + kw_inbounds, kw_align, kw_addrspace, kw_section, Modified: llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp?rev=77259&r1=77258&r2=77259&view=diff ============================================================================== --- llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp (original) +++ llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp Mon Jul 27 16:53:46 2009 @@ -997,6 +997,7 @@ } break; } + case bitc::CST_CODE_CE_INBOUNDS_GEP: case bitc::CST_CODE_CE_GEP: { // CE_GEP: [n x operands] if (Record.size() & 1) return Error("Invalid CE_GEP record"); SmallVector Elts; @@ -1007,6 +1008,8 @@ } V = Context.getConstantExprGetElementPtr(Elts[0], &Elts[1], Elts.size()-1); + if (BitCode == bitc::CST_CODE_CE_INBOUNDS_GEP) + cast(V)->setIsInBounds(true); break; } case bitc::CST_CODE_CE_SELECT: // CE_SELECT: [opval#, opval#, opval#] @@ -1556,6 +1559,7 @@ I = CastInst::Create((Instruction::CastOps)Opc, Op, ResTy); break; } + case bitc::FUNC_CODE_INST_INBOUNDS_GEP: case bitc::FUNC_CODE_INST_GEP: { // GEP: [n x operands] unsigned OpNum = 0; Value *BasePtr; @@ -1571,6 +1575,8 @@ } I = GetElementPtrInst::Create(BasePtr, GEPIdx.begin(), GEPIdx.end()); + if (BitCode == bitc::FUNC_CODE_INST_INBOUNDS_GEP) + cast(I)->setIsInBounds(true); break; } Modified: llvm/trunk/lib/Bitcode/Writer/BitcodeWriter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Bitcode/Writer/BitcodeWriter.cpp?rev=77259&r1=77258&r2=77259&view=diff ============================================================================== --- llvm/trunk/lib/Bitcode/Writer/BitcodeWriter.cpp (original) +++ llvm/trunk/lib/Bitcode/Writer/BitcodeWriter.cpp Mon Jul 27 16:53:46 2009 @@ -706,6 +706,8 @@ break; case Instruction::GetElementPtr: Code = bitc::CST_CODE_CE_GEP; + if (cast(C)->isInBounds()) + Code = bitc::CST_CODE_CE_INBOUNDS_GEP; for (unsigned i = 0, e = CE->getNumOperands(); i != e; ++i) { Record.push_back(VE.getTypeID(C->getOperand(i)->getType())); Record.push_back(VE.getValueID(C->getOperand(i))); @@ -829,6 +831,8 @@ case Instruction::GetElementPtr: Code = bitc::FUNC_CODE_INST_GEP; + if (cast(&I)->isInBounds()) + Code = bitc::FUNC_CODE_INST_INBOUNDS_GEP; for (unsigned i = 0, e = I.getNumOperands(); i != e; ++i) PushValueAndType(I.getOperand(i), InstID, Vals, VE); break; Modified: llvm/trunk/lib/VMCore/AsmWriter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/AsmWriter.cpp?rev=77259&r1=77258&r2=77259&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/AsmWriter.cpp (original) +++ llvm/trunk/lib/VMCore/AsmWriter.cpp Mon Jul 27 16:53:46 2009 @@ -854,6 +854,9 @@ } else if (const SDivOperator *Div = dyn_cast(U)) { if (Div->isExact()) Out << " exact"; + } else if (const GEPOperator *GEP = dyn_cast(U)) { + if (GEP->isInBounds()) + Out << " inbounds"; } } Modified: llvm/trunk/test/Assembler/flags-plain.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Assembler/flags-plain.ll?rev=77259&r1=77258&r2=77259&view=diff ============================================================================== --- llvm/trunk/test/Assembler/flags-plain.ll (original) +++ llvm/trunk/test/Assembler/flags-plain.ll Mon Jul 27 16:53:46 2009 @@ -21,3 +21,8 @@ ; CHECK: ret i64 sdiv (i64 ptrtoint (i64* @addr to i64), i64 91) ret i64 sdiv (i64 ptrtoint (i64* @addr to i64), i64 91) } + +define i64* @gep_plain_ce() { +; CHECK: ret i64* getelementptr (i64* @addr, i64 171) + ret i64* getelementptr (i64* @addr, i64 171) +} Modified: llvm/trunk/test/Assembler/flags.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Assembler/flags.ll?rev=77259&r1=77258&r2=77259&view=diff ============================================================================== --- llvm/trunk/test/Assembler/flags.ll (original) +++ llvm/trunk/test/Assembler/flags.ll Mon Jul 27 16:53:46 2009 @@ -104,6 +104,18 @@ ret i64 %z } +define i64* @gep_nw(i64* %p, i64 %x) { +; CHECK: %z = getelementptr inbounds i64* %p, i64 %x + %z = getelementptr inbounds i64* %p, i64 %x + ret i64* %z +} + +define i64* @gep_plain(i64* %p, i64 %x) { +; CHECK: %z = getelementptr i64* %p, i64 %x + %z = getelementptr i64* %p, i64 %x + ret i64* %z +} + define i64 @add_both_ce() { ; CHECK: ret i64 add nuw nsw (i64 ptrtoint (i64* @addr to i64), i64 91) ret i64 add nsw nuw (i64 ptrtoint (i64* @addr to i64), i64 91) @@ -123,3 +135,10 @@ ; CHECK: ret i64 sdiv exact (i64 ptrtoint (i64* @addr to i64), i64 91) ret i64 sdiv exact (i64 ptrtoint (i64* @addr to i64), i64 91) } + +define i64* @gep_nw_ce() { +; CHECK: ret i64* getelementptr inbounds (i64* @addr, i64 171) + ret i64* getelementptr inbounds (i64* @addr, i64 171) +} + + From gohman at apple.com Mon Jul 27 16:54:52 2009 From: gohman at apple.com (Dan Gohman) Date: Mon, 27 Jul 2009 21:54:52 -0000 Subject: [llvm-commits] [llvm] r77260 - /llvm/trunk/utils/vim/llvm.vim Message-ID: <200907272154.n6RLsq0I023125@zion.cs.uiuc.edu> Author: djg Date: Mon Jul 27 16:54:51 2009 New Revision: 77260 URL: http://llvm.org/viewvc/llvm-project?rev=77260&view=rev Log: vim syntax highlighting for inbounds keyword. Modified: llvm/trunk/utils/vim/llvm.vim Modified: llvm/trunk/utils/vim/llvm.vim URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/vim/llvm.vim?rev=77260&r1=77259&r2=77260&view=diff ============================================================================== --- llvm/trunk/utils/vim/llvm.vim (original) +++ llvm/trunk/utils/vim/llvm.vim Mon Jul 27 16:54:51 2009 @@ -29,7 +29,7 @@ syn keyword llvmStatement eq ne ugt uge ult ule sgt sge slt sle syn keyword llvmStatement oeq ogt oge olt ole one ord ueq ugt uge syn keyword llvmStatement ult ule une uno -syn keyword llvmStatement nuw nsw exact +syn keyword llvmStatement nuw nsw exact inbounds syn keyword llvmStatement phi call select shl lshr ashr va_arg syn keyword llvmStatement trunc zext sext syn keyword llvmStatement fptrunc fpext fptoui fptosi uitofp sitofp From gohman at apple.com Mon Jul 27 16:55:32 2009 From: gohman at apple.com (Dan Gohman) Date: Mon, 27 Jul 2009 21:55:32 -0000 Subject: [llvm-commits] [llvm] r77261 - /llvm/trunk/utils/llvm.grm Message-ID: <200907272155.n6RLtWfP023189@zion.cs.uiuc.edu> Author: djg Date: Mon Jul 27 16:55:32 2009 New Revision: 77261 URL: http://llvm.org/viewvc/llvm-project?rev=77261&view=rev Log: Add inbounds to the polygen grammar. Modified: llvm/trunk/utils/llvm.grm Modified: llvm/trunk/utils/llvm.grm URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/llvm.grm?rev=77261&r1=77260&r2=77261&view=diff ============================================================================== --- llvm/trunk/utils/llvm.grm (original) +++ llvm/trunk/utils/llvm.grm Mon Jul 27 16:55:32 2009 @@ -233,7 +233,7 @@ | Types FPVAL ; ConstExpr::= CastOps "(" ^ ConstVal to Types ^ ")" - | getelementptr "(" ^ ConstVal IndexList ^ ")" + | getelementptr OptInBounds "(" ^ ConstVal IndexList ^ ")" | select "(" ^ ConstVal ^ "," ConstVal ^ "," ConstVal ^ ")" | ArithmeticOps "(" ^ ConstVal ^ "," ConstVal ^ ")" | LogicalOps "(" ^ ConstVal ^ "," ConstVal ^ ")" @@ -397,6 +397,7 @@ OptNSW ::= - nsw | _ ; OptNUW ::= - nuw | _ ; OptNW ::= OptNUW OptNSW ; +OptInBounds ::= - inbounds | _ ; MemoryInst ::= malloc Types OptCAlign | malloc Types ^ "," INTTYPE ValueRef OptCAlign @@ -406,6 +407,6 @@ | OptVolatile load Types ValueRef OptCAlign | OptVolatile store ResolvedVal ^ "," Types ValueRef OptCAlign | getresult Types ValueRef ^ "," EUINT64VAL - | getelementptr Types ValueRef IndexList + | getelementptr OptInBounds Types ValueRef IndexList | extractvalue Types ValueRef ^ ConstantIndexList | insertvalue Types ValueRef ^ "," Types ValueRef ^ ConstantIndexList ; From gohman at apple.com Mon Jul 27 16:59:50 2009 From: gohman at apple.com (Dan Gohman) Date: Mon, 27 Jul 2009 21:59:50 -0000 Subject: [llvm-commits] [llvm] r77262 - /llvm/trunk/lib/VMCore/LLVMContext.cpp Message-ID: <200907272159.n6RLxogi023332@zion.cs.uiuc.edu> Author: djg Date: Mon Jul 27 16:59:50 2009 New Revision: 77262 URL: http://llvm.org/viewvc/llvm-project?rev=77262&view=rev Log: Add a comment about the "getelementptr null" trick. Modified: llvm/trunk/lib/VMCore/LLVMContext.cpp Modified: llvm/trunk/lib/VMCore/LLVMContext.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/LLVMContext.cpp?rev=77262&r1=77261&r2=77262&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/LLVMContext.cpp (original) +++ llvm/trunk/lib/VMCore/LLVMContext.cpp Mon Jul 27 16:59:50 2009 @@ -419,6 +419,7 @@ Constant* LLVMContext::getConstantExprSizeOf(const Type* Ty) { // sizeof is implemented as: (i64) gep (Ty*)null, 1 + // Note that a non-inbounds gep is used, as null isn't within any object. Constant *GEPIdx = ConstantInt::get(Type::Int32Ty, 1); Constant *GEP = getConstantExprGetElementPtr( getNullValue(getPointerTypeUnqual(Ty)), &GEPIdx, 1); From resistor at mac.com Mon Jul 27 17:29:26 2009 From: resistor at mac.com (Owen Anderson) Date: Mon, 27 Jul 2009 22:29:26 -0000 Subject: [llvm-commits] [llvm] r77266 - in /llvm/trunk: include/llvm/Constants.h include/llvm/LLVMContext.h lib/Analysis/DebugInfo.cpp lib/AsmParser/LLParser.cpp lib/Bitcode/Reader/BitcodeReader.cpp lib/CodeGen/ShadowStackGC.cpp lib/Linker/LinkModules.cpp lib/Transforms/IPO/GlobalOpt.cpp lib/Transforms/Utils/ValueMapper.cpp lib/VMCore/ConstantFold.cpp lib/VMCore/Constants.cpp lib/VMCore/Core.cpp lib/VMCore/LLVMContext.cpp lib/VMCore/LLVMContextImpl.cpp lib/VMCore/LLVMContextImpl.h tools/bugpoint/ExtractFunction.cpp Message-ID: <200907272229.n6RMTRAY024160@zion.cs.uiuc.edu> Author: resistor Date: Mon Jul 27 17:29:26 2009 New Revision: 77266 URL: http://llvm.org/viewvc/llvm-project?rev=77266&view=rev Log: Move ConstantStruct back to 2.5 API. Modified: llvm/trunk/include/llvm/Constants.h llvm/trunk/include/llvm/LLVMContext.h llvm/trunk/lib/Analysis/DebugInfo.cpp llvm/trunk/lib/AsmParser/LLParser.cpp llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp llvm/trunk/lib/CodeGen/ShadowStackGC.cpp llvm/trunk/lib/Linker/LinkModules.cpp llvm/trunk/lib/Transforms/IPO/GlobalOpt.cpp llvm/trunk/lib/Transforms/Utils/ValueMapper.cpp llvm/trunk/lib/VMCore/ConstantFold.cpp llvm/trunk/lib/VMCore/Constants.cpp llvm/trunk/lib/VMCore/Core.cpp llvm/trunk/lib/VMCore/LLVMContext.cpp llvm/trunk/lib/VMCore/LLVMContextImpl.cpp llvm/trunk/lib/VMCore/LLVMContextImpl.h llvm/trunk/tools/bugpoint/ExtractFunction.cpp Modified: llvm/trunk/include/llvm/Constants.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Constants.h?rev=77266&r1=77265&r2=77266&view=diff ============================================================================== --- llvm/trunk/include/llvm/Constants.h (original) +++ llvm/trunk/include/llvm/Constants.h Mon Jul 27 17:29:26 2009 @@ -385,10 +385,15 @@ friend struct ConstantCreator >; ConstantStruct(const ConstantStruct &); // DO NOT IMPLEMENT - friend class LLVMContextImpl; protected: ConstantStruct(const StructType *T, const std::vector &Val); public: + // ConstantStruct accessors + static Constant* get(const StructType* T, const std::vector& V); + static Constant* get(const std::vector& V, bool Packed = false); + static Constant* get(Constant* const *Vals, unsigned NumVals, + bool Packed = false); + /// Transparently provide more efficient getOperand methods. DECLARE_TRANSPARENT_OPERAND_ACCESSORS(Constant); Modified: llvm/trunk/include/llvm/LLVMContext.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/LLVMContext.h?rev=77266&r1=77265&r2=77266&view=diff ============================================================================== --- llvm/trunk/include/llvm/LLVMContext.h (original) +++ llvm/trunk/include/llvm/LLVMContext.h Mon Jul 27 17:29:26 2009 @@ -57,6 +57,7 @@ friend class ConstantInt; friend class ConstantFP; + friend class ConstantStruct; public: LLVMContext(); ~LLVMContext(); @@ -78,14 +79,6 @@ // ConstantPointerNull accessors ConstantPointerNull* getConstantPointerNull(const PointerType* T); - - // ConstantStruct accessors - Constant* getConstantStruct(const StructType* T, - const std::vector& V); - Constant* getConstantStruct(const std::vector& V, - bool Packed = false); - Constant* getConstantStruct(Constant* const *Vals, unsigned NumVals, - bool Packed = false); // ConstantAggregateZero accessors ConstantAggregateZero* getConstantAggregateZero(const Type* Ty); @@ -233,14 +226,11 @@ void erase(MDNode *M); void erase(ConstantAggregateZero *Z); void erase(ConstantArray *Z); - void erase(ConstantStruct *S); void erase(ConstantVector *V); // RAUW helpers Constant *replaceUsesOfWithOnConstant(ConstantArray *CA, Value *From, Value *To, Use *U); - Constant *replaceUsesOfWithOnConstant(ConstantStruct *CS, Value *From, - Value *To, Use *U); }; /// FOR BACKWARDS COMPATIBILITY - Returns a global context. Modified: llvm/trunk/lib/Analysis/DebugInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/DebugInfo.cpp?rev=77266&r1=77265&r2=77266&view=diff ============================================================================== --- llvm/trunk/lib/Analysis/DebugInfo.cpp (original) +++ llvm/trunk/lib/Analysis/DebugInfo.cpp Mon Jul 27 17:29:26 2009 @@ -545,8 +545,7 @@ ConstantInt::get(Type::Int64Ty, Hi) }; - Constant *Init = VMContext.getConstantStruct(Elts, - sizeof(Elts)/sizeof(Elts[0])); + Constant *Init = ConstantStruct::get(Elts, sizeof(Elts)/sizeof(Elts[0])); // If we already have this range, just return the uniqued version. DIDescriptor &Entry = SimpleConstantCache[Init]; @@ -587,8 +586,7 @@ ConstantInt::get(Type::Int32Ty, RunTimeVer) }; - Constant *Init = VMContext.getConstantStruct(Elts, - sizeof(Elts)/sizeof(Elts[0])); + Constant *Init = ConstantStruct::get(Elts, sizeof(Elts)/sizeof(Elts[0])); M.addTypeName("llvm.dbg.compile_unit.type", Init->getType()); GlobalVariable *GV = new GlobalVariable(M, Init->getType(), true, @@ -606,8 +604,7 @@ ConstantInt::get(Type::Int64Ty, Val) }; - Constant *Init = VMContext.getConstantStruct(Elts, - sizeof(Elts)/sizeof(Elts[0])); + Constant *Init = ConstantStruct::get(Elts, sizeof(Elts)/sizeof(Elts[0])); M.addTypeName("llvm.dbg.enumerator.type", Init->getType()); GlobalVariable *GV = new GlobalVariable(M, Init->getType(), true, @@ -640,8 +637,7 @@ ConstantInt::get(Type::Int32Ty, Encoding) }; - Constant *Init = VMContext.getConstantStruct(Elts, - sizeof(Elts)/sizeof(Elts[0])); + Constant *Init = ConstantStruct::get(Elts, sizeof(Elts)/sizeof(Elts[0])); M.addTypeName("llvm.dbg.basictype.type", Init->getType()); GlobalVariable *GV = new GlobalVariable(M, Init->getType(), true, @@ -676,8 +672,7 @@ getCastToEmpty(DerivedFrom) }; - Constant *Init = VMContext.getConstantStruct(Elts, - sizeof(Elts)/sizeof(Elts[0])); + Constant *Init = ConstantStruct::get(Elts, sizeof(Elts)/sizeof(Elts[0])); M.addTypeName("llvm.dbg.derivedtype.type", Init->getType()); GlobalVariable *GV = new GlobalVariable(M, Init->getType(), true, @@ -716,8 +711,7 @@ ConstantInt::get(Type::Int32Ty, RuntimeLang) }; - Constant *Init = VMContext.getConstantStruct(Elts, - sizeof(Elts)/sizeof(Elts[0])); + Constant *Init = ConstantStruct::get(Elts, sizeof(Elts)/sizeof(Elts[0])); M.addTypeName("llvm.dbg.composite.type", Init->getType()); GlobalVariable *GV = new GlobalVariable(M, Init->getType(), true, @@ -754,8 +748,7 @@ ConstantInt::get(Type::Int1Ty, isDefinition) }; - Constant *Init = VMContext.getConstantStruct(Elts, - sizeof(Elts)/sizeof(Elts[0])); + Constant *Init = ConstantStruct::get(Elts, sizeof(Elts)/sizeof(Elts[0])); M.addTypeName("llvm.dbg.subprogram.type", Init->getType()); GlobalVariable *GV = new GlobalVariable(M, Init->getType(), true, @@ -788,8 +781,7 @@ VMContext.getConstantExprBitCast(Val, EmptyStructPtr) }; - Constant *Init = VMContext.getConstantStruct(Elts, - sizeof(Elts)/sizeof(Elts[0])); + Constant *Init = ConstantStruct::get(Elts, sizeof(Elts)/sizeof(Elts[0])); M.addTypeName("llvm.dbg.global_variable.type", Init->getType()); GlobalVariable *GV = new GlobalVariable(M, Init->getType(), true, @@ -814,8 +806,7 @@ getCastToEmpty(Type) }; - Constant *Init = VMContext.getConstantStruct(Elts, - sizeof(Elts)/sizeof(Elts[0])); + Constant *Init = ConstantStruct::get(Elts, sizeof(Elts)/sizeof(Elts[0])); M.addTypeName("llvm.dbg.variable.type", Init->getType()); GlobalVariable *GV = new GlobalVariable(M, Init->getType(), true, @@ -834,8 +825,7 @@ getCastToEmpty(Context) }; - Constant *Init = VMContext.getConstantStruct(Elts, - sizeof(Elts)/sizeof(Elts[0])); + Constant *Init = ConstantStruct::get(Elts, sizeof(Elts)/sizeof(Elts[0])); M.addTypeName("llvm.dbg.block.type", Init->getType()); GlobalVariable *GV = new GlobalVariable(M, Init->getType(), true, Modified: llvm/trunk/lib/AsmParser/LLParser.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/AsmParser/LLParser.cpp?rev=77266&r1=77265&r2=77266&view=diff ============================================================================== --- llvm/trunk/lib/AsmParser/LLParser.cpp (original) +++ llvm/trunk/lib/AsmParser/LLParser.cpp Mon Jul 27 17:29:26 2009 @@ -1737,7 +1737,7 @@ ParseToken(lltok::rbrace, "expected end of struct constant")) return true; - ID.ConstantVal = Context.getConstantStruct(Elts.data(), Elts.size(), false); + ID.ConstantVal = ConstantStruct::get(Elts.data(), Elts.size(), false); ID.Kind = ValID::t_Constant; return false; } @@ -1757,7 +1757,7 @@ if (isPackedStruct) { ID.ConstantVal = - Context.getConstantStruct(Elts.data(), Elts.size(), true); + ConstantStruct::get(Elts.data(), Elts.size(), true); ID.Kind = ValID::t_Constant; return false; } Modified: llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp?rev=77266&r1=77265&r2=77266&view=diff ============================================================================== --- llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp (original) +++ llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp Mon Jul 27 17:29:26 2009 @@ -291,7 +291,7 @@ NewC = Context.getConstantArray(UserCA->getType(), &NewOps[0], NewOps.size()); } else if (ConstantStruct *UserCS = dyn_cast(UserC)) { - NewC = Context.getConstantStruct(&NewOps[0], NewOps.size(), + NewC = ConstantStruct::get(&NewOps[0], NewOps.size(), UserCS->getType()->isPacked()); } else if (isa(UserC)) { NewC = Context.getConstantVector(&NewOps[0], NewOps.size()); @@ -925,7 +925,7 @@ for (unsigned i = 0; i != Size; ++i) Elts.push_back(ValueList.getConstantFwdRef(Record[i], STy->getElementType(i))); - V = Context.getConstantStruct(STy, Elts); + V = ConstantStruct::get(STy, Elts); } else if (const ArrayType *ATy = dyn_cast(CurTy)) { const Type *EltTy = ATy->getElementType(); for (unsigned i = 0; i != Size; ++i) Modified: llvm/trunk/lib/CodeGen/ShadowStackGC.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/ShadowStackGC.cpp?rev=77266&r1=77265&r2=77266&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/ShadowStackGC.cpp (original) +++ llvm/trunk/lib/CodeGen/ShadowStackGC.cpp Mon Jul 27 17:29:26 2009 @@ -208,12 +208,12 @@ }; Constant *DescriptorElts[] = { - Context.getConstantStruct(BaseElts, 2), + ConstantStruct::get(BaseElts, 2), Context.getConstantArray(Context.getArrayType(VoidPtr, NumMeta), Metadata.begin(), NumMeta) }; - Constant *FrameMap = Context.getConstantStruct(DescriptorElts, 2); + Constant *FrameMap = ConstantStruct::get(DescriptorElts, 2); std::string TypeName("gc_map."); TypeName += utostr(NumMeta); Modified: llvm/trunk/lib/Linker/LinkModules.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Linker/LinkModules.cpp?rev=77266&r1=77265&r2=77266&view=diff ============================================================================== --- llvm/trunk/lib/Linker/LinkModules.cpp (original) +++ llvm/trunk/lib/Linker/LinkModules.cpp Mon Jul 27 17:29:26 2009 @@ -376,7 +376,7 @@ Operands[i] =cast(RemapOperand(CPS->getOperand(i), ValueMap, Context)); Result = - Context.getConstantStruct(cast(CPS->getType()), Operands); + ConstantStruct::get(cast(CPS->getType()), Operands); } else if (isa(CPV) || isa(CPV)) { Result = const_cast(CPV); } else if (const ConstantVector *CP = dyn_cast(CPV)) { Modified: llvm/trunk/lib/Transforms/IPO/GlobalOpt.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/GlobalOpt.cpp?rev=77266&r1=77265&r2=77266&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/IPO/GlobalOpt.cpp (original) +++ llvm/trunk/lib/Transforms/IPO/GlobalOpt.cpp Mon Jul 27 17:29:26 2009 @@ -1962,7 +1962,7 @@ CSVals[1] = Context.getNullValue(PFTy); CSVals[0] = ConstantInt::get(Type::Int32Ty, 2147483647); } - CAList.push_back(Context.getConstantStruct(CSVals)); + CAList.push_back(ConstantStruct::get(CSVals)); } // Create the array initializer. @@ -2070,7 +2070,7 @@ Elts[Idx] = EvaluateStoreInto(Elts[Idx], Val, Addr, OpNo+1, Context); // Return the modified struct. - return Context.getConstantStruct(&Elts[0], Elts.size(), STy->isPacked()); + return ConstantStruct::get(&Elts[0], Elts.size(), STy->isPacked()); } else { ConstantInt *CI = cast(Addr->getOperand(OpNo)); const ArrayType *ATy = cast(Init->getType()); Modified: llvm/trunk/lib/Transforms/Utils/ValueMapper.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/ValueMapper.cpp?rev=77266&r1=77265&r2=77266&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Utils/ValueMapper.cpp (original) +++ llvm/trunk/lib/Transforms/Utils/ValueMapper.cpp Mon Jul 27 17:29:26 2009 @@ -76,7 +76,7 @@ Values.push_back(cast(MV)); for (++i; i != e; ++i) Values.push_back(cast(MapValue(*i, VM, Context))); - return VM[V] = Context.getConstantStruct(CS->getType(), Values); + return VM[V] = ConstantStruct::get(CS->getType(), Values); } } return VM[V] = C; Modified: llvm/trunk/lib/VMCore/ConstantFold.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/ConstantFold.cpp?rev=77266&r1=77265&r2=77266&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/ConstantFold.cpp (original) +++ llvm/trunk/lib/VMCore/ConstantFold.cpp Mon Jul 27 17:29:26 2009 @@ -519,7 +519,7 @@ Ops[i] = const_cast(Op); } if (isa(AggTy)) - return Context.getConstantStruct(Ops); + return ConstantStruct::get(Ops); else return Context.getConstantArray(cast(AggTy), Ops); } @@ -548,7 +548,7 @@ Ops[i] = const_cast(Op); } if (isa(AggTy)) - return Context.getConstantStruct(Ops); + return ConstantStruct::get(Ops); else return Context.getConstantArray(cast(AggTy), Ops); } @@ -565,7 +565,7 @@ } Constant *C; if (isa(Agg->getType())) - C = Context.getConstantStruct(Ops); + C = ConstantStruct::get(Ops); else C = Context.getConstantArray(cast(Agg->getType()), Ops); return C; Modified: llvm/trunk/lib/VMCore/Constants.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Constants.cpp?rev=77266&r1=77265&r2=77266&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/Constants.cpp (original) +++ llvm/trunk/lib/VMCore/Constants.cpp Mon Jul 27 17:29:26 2009 @@ -397,6 +397,33 @@ } } +// ConstantStruct accessors. +Constant* ConstantStruct::get(const StructType* T, + const std::vector& V) { + LLVMContextImpl* pImpl = T->getContext().pImpl; + + // Create a ConstantAggregateZero value if all elements are zeros... + for (unsigned i = 0, e = V.size(); i != e; ++i) + if (!V[i]->isNullValue()) + // Implicitly locked. + return pImpl->StructConstants.getOrCreate(T, V); + + return T->getContext().getConstantAggregateZero(T); +} + +Constant* ConstantStruct::get(const std::vector& V, bool packed) { + std::vector StructEls; + StructEls.reserve(V.size()); + for (unsigned i = 0, e = V.size(); i != e; ++i) + StructEls.push_back(V[i]->getType()); + return get(StructType::get(StructEls, packed), V); +} + +Constant* ConstantStruct::get(Constant* const *Vals, unsigned NumVals, + bool Packed) { + // FIXME: make this the primary ctor method. + return get(std::vector(Vals, Vals+NumVals), Packed); +} ConstantVector::ConstantVector(const VectorType *T, const std::vector &V) @@ -981,7 +1008,7 @@ // void ConstantStruct::destroyConstant() { // Implicitly locked. - getType()->getContext().erase(this); + getType()->getContext().pImpl->StructConstants.remove(this); destroyConstantImpl(); } @@ -1897,11 +1924,74 @@ destroyConstant(); } +static std::vector getValType(ConstantStruct *CS) { + std::vector Elements; + Elements.reserve(CS->getNumOperands()); + for (unsigned i = 0, e = CS->getNumOperands(); i != e; ++i) + Elements.push_back(cast(CS->getOperand(i))); + return Elements; +} + void ConstantStruct::replaceUsesOfWithOnConstant(Value *From, Value *To, Use *U) { - Constant* Replacement = - getType()->getContext().replaceUsesOfWithOnConstant(this, From, To, U); - if (!Replacement) return; + assert(isa(To) && "Cannot make Constant refer to non-constant!"); + Constant *ToC = cast(To); + + unsigned OperandToUpdate = U-OperandList; + assert(getOperand(OperandToUpdate) == From && "ReplaceAllUsesWith broken!"); + + std::pair Lookup; + Lookup.first.first = getType(); + Lookup.second = this; + std::vector &Values = Lookup.first.second; + Values.reserve(getNumOperands()); // Build replacement struct. + + + // Fill values with the modified operands of the constant struct. Also, + // compute whether this turns into an all-zeros struct. + bool isAllZeros = false; + if (!ToC->isNullValue()) { + for (Use *O = OperandList, *E = OperandList + getNumOperands(); O != E; ++O) + Values.push_back(cast(O->get())); + } else { + isAllZeros = true; + for (Use *O = OperandList, *E = OperandList+getNumOperands(); O != E; ++O) { + Constant *Val = cast(O->get()); + Values.push_back(Val); + if (isAllZeros) isAllZeros = Val->isNullValue(); + } + } + Values[OperandToUpdate] = ToC; + + LLVMContext &Context = getType()->getContext(); + LLVMContextImpl *pImpl = Context.pImpl; + + Constant *Replacement = 0; + if (isAllZeros) { + Replacement = Context.getConstantAggregateZero(getType()); + } else { + // Check to see if we have this array type already. + sys::SmartScopedWriter Writer(pImpl->ConstantsLock); + bool Exists; + LLVMContextImpl::StructConstantsTy::MapTy::iterator I = + pImpl->StructConstants.InsertOrGetItem(Lookup, Exists); + + if (Exists) { + Replacement = I->second; + } else { + // Okay, the new shape doesn't exist in the system yet. Instead of + // creating a new constant struct, inserting it, replaceallusesof'ing the + // old with the new, then deleting the old... just update the current one + // in place! + pImpl->StructConstants.MoveConstantToNewSlot(this, I); + + // Update to the new value. + setOperand(OperandToUpdate, ToC); + return; + } + } + + assert(Replacement != this && "I didn't contain From!"); // Everyone using this now uses the replacement. uncheckedReplaceAllUsesWith(Replacement); Modified: llvm/trunk/lib/VMCore/Core.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Core.cpp?rev=77266&r1=77265&r2=77266&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/Core.cpp (original) +++ llvm/trunk/lib/VMCore/Core.cpp Mon Jul 27 17:29:26 2009 @@ -416,8 +416,7 @@ LLVMValueRef LLVMConstStruct(LLVMValueRef *ConstantVals, unsigned Count, int Packed) { - return wrap(getGlobalContext().getConstantStruct( - unwrap(ConstantVals, Count), + return wrap(ConstantStruct::get(unwrap(ConstantVals, Count), Count, Packed != 0)); } Modified: llvm/trunk/lib/VMCore/LLVMContext.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/LLVMContext.cpp?rev=77266&r1=77265&r2=77266&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/LLVMContext.cpp (original) +++ llvm/trunk/lib/VMCore/LLVMContext.cpp Mon Jul 27 17:29:26 2009 @@ -98,29 +98,6 @@ return ConstantPointerNull::get(T); } - -// ConstantStruct accessors. -Constant* LLVMContext::getConstantStruct(const StructType* T, - const std::vector& V) { - return pImpl->getConstantStruct(T, V); -} - -Constant* LLVMContext::getConstantStruct(const std::vector& V, - bool packed) { - std::vector StructEls; - StructEls.reserve(V.size()); - for (unsigned i = 0, e = V.size(); i != e; ++i) - StructEls.push_back(V[i]->getType()); - return getConstantStruct(getStructType(StructEls, packed), V); -} - -Constant* LLVMContext::getConstantStruct(Constant* const *Vals, - unsigned NumVals, bool Packed) { - // FIXME: make this the primary ctor method. - return getConstantStruct(std::vector(Vals, Vals+NumVals), Packed); -} - - // ConstantAggregateZero accessors. ConstantAggregateZero* LLVMContext::getConstantAggregateZero(const Type* Ty) { return pImpl->getConstantAggregateZero(Ty); @@ -552,10 +529,6 @@ pImpl->erase(C); } -void LLVMContext::erase(ConstantStruct *S) { - pImpl->erase(S); -} - void LLVMContext::erase(ConstantVector *V) { pImpl->erase(V); } @@ -564,8 +537,3 @@ Value *From, Value *To, Use *U) { return pImpl->replaceUsesOfWithOnConstant(CA, From, To, U); } - -Constant *LLVMContext::replaceUsesOfWithOnConstant(ConstantStruct *CS, - Value *From, Value *To, Use *U) { - return pImpl->replaceUsesOfWithOnConstant(CS, From, To, U); -} Modified: llvm/trunk/lib/VMCore/LLVMContextImpl.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/LLVMContextImpl.cpp?rev=77266&r1=77265&r2=77266&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/LLVMContextImpl.cpp (original) +++ llvm/trunk/lib/VMCore/LLVMContextImpl.cpp Mon Jul 27 17:29:26 2009 @@ -29,14 +29,6 @@ return Elements; } -static std::vector getValType(ConstantStruct *CS) { - std::vector Elements; - Elements.reserve(CS->getNumOperands()); - for (unsigned i = 0, e = CS->getNumOperands(); i != e; ++i) - Elements.push_back(cast(CS->getOperand(i))); - return Elements; -} - static std::vector getValType(ConstantVector *CP) { std::vector Elements; Elements.reserve(CP->getNumOperands()); @@ -112,17 +104,6 @@ return Context.getConstantAggregateZero(Ty); } -Constant *LLVMContextImpl::getConstantStruct(const StructType *Ty, - const std::vector &V) { - // Create a ConstantAggregateZero value if all elements are zeros... - for (unsigned i = 0, e = V.size(); i != e; ++i) - if (!V[i]->isNullValue()) - // Implicitly locked. - return StructConstants.getOrCreate(Ty, V); - - return Context.getConstantAggregateZero(Ty); -} - Constant *LLVMContextImpl::getConstantVector(const VectorType *Ty, const std::vector &V) { assert(!V.empty() && "Vectors can't be empty"); @@ -169,10 +150,6 @@ ArrayConstants.remove(C); } -void LLVMContextImpl::erase(ConstantStruct *S) { - StructConstants.remove(S); -} - void LLVMContextImpl::erase(ConstantVector *V) { VectorConstants.remove(V); } @@ -255,68 +232,4 @@ } return Replacement; -} - -Constant *LLVMContextImpl::replaceUsesOfWithOnConstant(ConstantStruct *CS, - Value *From, Value *To, Use *U) { - assert(isa(To) && "Cannot make Constant refer to non-constant!"); - Constant *ToC = cast(To); - - unsigned OperandToUpdate = U - CS->OperandList; - assert(CS->getOperand(OperandToUpdate) == From && - "ReplaceAllUsesWith broken!"); - - std::pair Lookup; - Lookup.first.first = CS->getType(); - Lookup.second = CS; - std::vector &Values = Lookup.first.second; - Values.reserve(CS->getNumOperands()); // Build replacement struct. - - - // Fill values with the modified operands of the constant struct. Also, - // compute whether this turns into an all-zeros struct. - bool isAllZeros = false; - if (!ToC->isNullValue()) { - for (Use *O = CS->OperandList, *E = CS->OperandList + CS->getNumOperands(); - O != E; ++O) - Values.push_back(cast(O->get())); - } else { - isAllZeros = true; - for (Use *O = CS->OperandList, *E = CS->OperandList + CS->getNumOperands(); - O != E; ++O) { - Constant *Val = cast(O->get()); - Values.push_back(Val); - if (isAllZeros) isAllZeros = Val->isNullValue(); - } - } - Values[OperandToUpdate] = ToC; - - Constant *Replacement = 0; - if (isAllZeros) { - Replacement = Context.getConstantAggregateZero(CS->getType()); - } else { - // Check to see if we have this array type already. - sys::SmartScopedWriter Writer(ConstantsLock); - bool Exists; - StructConstantsTy::MapTy::iterator I = - StructConstants.InsertOrGetItem(Lookup, Exists); - - if (Exists) { - Replacement = I->second; - } else { - // Okay, the new shape doesn't exist in the system yet. Instead of - // creating a new constant struct, inserting it, replaceallusesof'ing the - // old with the new, then deleting the old... just update the current one - // in place! - StructConstants.MoveConstantToNewSlot(CS, I); - - // Update to the new value. - CS->setOperand(OperandToUpdate, ToC); - return 0; - } - } - - assert(Replacement != CS && "I didn't contain From!"); - - return Replacement; -} +} \ No newline at end of file Modified: llvm/trunk/lib/VMCore/LLVMContextImpl.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/LLVMContextImpl.h?rev=77266&r1=77265&r2=77266&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/LLVMContextImpl.h (original) +++ llvm/trunk/lib/VMCore/LLVMContextImpl.h Mon Jul 27 17:29:26 2009 @@ -102,7 +102,7 @@ std::vector C; for (unsigned i = 0, e = OldC->getNumOperands(); i != e; ++i) C.push_back(cast(OldC->getOperand(i))); - Constant *New = NewTy->getContext().getConstantStruct(NewTy, C); + Constant *New = ConstantStruct::get(NewTy, C); assert(New != OldC && "Didn't replace constant??"); OldC->uncheckedReplaceAllUsesWith(New); @@ -458,6 +458,7 @@ friend class ConstantInt; friend class ConstantFP; + friend class ConstantStruct; public: LLVMContextImpl(LLVMContext &C); @@ -470,9 +471,6 @@ Constant *getConstantArray(const ArrayType *Ty, const std::vector &V); - Constant *getConstantStruct(const StructType *Ty, - const std::vector &V); - Constant *getConstantVector(const VectorType *Ty, const std::vector &V); @@ -494,15 +492,12 @@ void erase(MDNode *M); void erase(ConstantAggregateZero *Z); void erase(ConstantArray *C); - void erase(ConstantStruct *S); void erase(ConstantVector *V); // RAUW helpers Constant *replaceUsesOfWithOnConstant(ConstantArray *CA, Value *From, Value *To, Use *U); - Constant *replaceUsesOfWithOnConstant(ConstantStruct *CS, Value *From, - Value *To, Use *U); }; } Modified: llvm/trunk/tools/bugpoint/ExtractFunction.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/bugpoint/ExtractFunction.cpp?rev=77266&r1=77265&r2=77266&view=diff ============================================================================== --- llvm/trunk/tools/bugpoint/ExtractFunction.cpp (original) +++ llvm/trunk/tools/bugpoint/ExtractFunction.cpp Mon Jul 27 17:29:26 2009 @@ -187,7 +187,7 @@ std::vector Elts; Elts.push_back(ConstantInt::get(Type::Int32Ty, TorList[i].second)); Elts.push_back(TorList[i].first); - ArrayElts.push_back(Context.getConstantStruct(Elts)); + ArrayElts.push_back(ConstantStruct::get(Elts)); } return Context.getConstantArray(Context.getArrayType(ArrayElts[0]->getType(), ArrayElts.size()), From resistor at mac.com Mon Jul 27 17:30:01 2009 From: resistor at mac.com (Owen Anderson) Date: Mon, 27 Jul 2009 22:30:01 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r77268 - in /llvm-gcc-4.2/trunk/gcc: llvm-backend.cpp llvm-convert.cpp llvm-types.cpp Message-ID: <200907272230.n6RMU161024220@zion.cs.uiuc.edu> Author: resistor Date: Mon Jul 27 17:30:00 2009 New Revision: 77268 URL: http://llvm.org/viewvc/llvm-project?rev=77268&view=rev Log: Update for LLVM API change. Modified: llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp llvm-gcc-4.2/trunk/gcc/llvm-types.cpp Modified: llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp?rev=77268&r1=77267&r2=77268&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp (original) +++ llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp Mon Jul 27 17:30:00 2009 @@ -286,7 +286,7 @@ } // Create string table. - Constant *LLVMValuesTable = Context.getConstantStruct(ValuesForPCH, false); + Constant *LLVMValuesTable = ConstantStruct::get(ValuesForPCH, false); // Create variable to hold this string table. new GlobalVariable(*TheModule, LLVMValuesTable->getType(), true, @@ -811,7 +811,7 @@ // __attribute__(constructor) can be on a function with any type. Make sure // the pointer is void()*. StructInit[1] = TheFolder->CreateBitCast(Tors[i].first, FPTy); - InitList.push_back(Context.getConstantStruct(StructInit, false)); + InitList.push_back(ConstantStruct::get(StructInit, false)); } Constant *Array = Context.getConstantArray( Context.getArrayType(InitList[0]->getType(), InitList.size()), InitList); @@ -1152,7 +1152,7 @@ }; AttributeAnnotateGlobals.push_back( - Context.getConstantStruct(Element, 4, false)); + ConstantStruct::get(Element, 4, false)); } // Get next annotate attribute. Modified: llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp?rev=77268&r1=77267&r2=77268&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp (original) +++ llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp Mon Jul 27 17:30:00 2009 @@ -7116,7 +7116,7 @@ std::vector Elts; Elts.push_back(Convert(TREE_REALPART(exp))); Elts.push_back(Convert(TREE_IMAGPART(exp))); - return Context.getConstantStruct(Elts, false); + return ConstantStruct::get(Elts, false); } Constant *TreeConstantToLLVM::ConvertNOP_EXPR(tree exp) { @@ -7302,7 +7302,7 @@ if (AllEltsSameType) return Context.getConstantArray( Context.getArrayType(ElTy, ResultElts.size()), ResultElts); - return Context.getConstantStruct(ResultElts, false); + return ConstantStruct::get(ResultElts, false); } @@ -7723,7 +7723,7 @@ // Okay, we're done, return the computed elements. return - Context.getConstantStruct(LayoutInfo.ResultElts, LayoutInfo.StructIsPacked); + ConstantStruct::get(LayoutInfo.ResultElts, LayoutInfo.StructIsPacked); } Constant *TreeConstantToLLVM::ConvertUnionCONSTRUCTOR(tree exp) { @@ -7755,7 +7755,7 @@ Elts.push_back(Context.getNullValue(FillTy)); } } - return Context.getConstantStruct(Elts, false); + return ConstantStruct::get(Elts, false); } //===----------------------------------------------------------------------===// Modified: llvm-gcc-4.2/trunk/gcc/llvm-types.cpp URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-types.cpp?rev=77268&r1=77267&r2=77268&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/llvm-types.cpp (original) +++ llvm-gcc-4.2/trunk/gcc/llvm-types.cpp Mon Jul 27 17:30:00 2009 @@ -192,7 +192,7 @@ } // Create string table. - Constant *LTypesNameTable = Context.getConstantStruct(LTypesNames, false); + Constant *LTypesNameTable = ConstantStruct::get(LTypesNames, false); // Create variable to hold this string table. GlobalVariable *GV = new GlobalVariable(*TheModule, From daniel at zuster.org Mon Jul 27 17:39:14 2009 From: daniel at zuster.org (Daniel Dunbar) Date: Mon, 27 Jul 2009 22:39:14 -0000 Subject: [llvm-commits] [llvm] r77269 - /llvm/trunk/include/llvm/Value.h Message-ID: <200907272239.n6RMdFnY024533@zion.cs.uiuc.edu> Author: ddunbar Date: Mon Jul 27 17:39:14 2009 New Revision: 77269 URL: http://llvm.org/viewvc/llvm-project?rev=77269&view=rev Log: Add a comment on Value explaining the current getName() behavior. Modified: llvm/trunk/include/llvm/Value.h Modified: llvm/trunk/include/llvm/Value.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Value.h?rev=77269&r1=77268&r2=77269&view=diff ============================================================================== --- llvm/trunk/include/llvm/Value.h (original) +++ llvm/trunk/include/llvm/Value.h Mon Jul 27 17:39:14 2009 @@ -114,6 +114,12 @@ /// getName() - Return a constant reference to the value's name. This is cheap /// and guaranteed to return the same reference as long as the value is not /// modified. + /// + /// This is currently guaranteed to return a StringRef for which data() points + /// to a valid null terminated string. This usage is deprecated, however, and + /// clients should not rely on it. If such behavior is needed, clients should + /// use getNameStr() or switch to an interface that does not depend on null + /// termination. StringRef getName() const; /// getNameStr() - Return the name of the specified value, *constructing a From daniel at zuster.org Mon Jul 27 17:43:07 2009 From: daniel at zuster.org (Daniel Dunbar) Date: Mon, 27 Jul 2009 15:43:07 -0700 Subject: [llvm-commits] [llvm] r77149 - /llvm/trunk/lib/VMCore/Value.cpp In-Reply-To: <1531E511-8F9B-49B7-98A1-6C46B17930B5@apple.com> References: <200907260922.n6Q9MMQX020945@zion.cs.uiuc.edu> <1531E511-8F9B-49B7-98A1-6C46B17930B5@apple.com> Message-ID: <6a8523d60907271543va853dd5jf6fa9c1cd887cfd3@mail.gmail.com> Hi Dan, The problem is there can't be a c_str method on StringRef, it has no way to make that guarantee. Since you essentially called me out on adding a hack, let me explain. :) In my opinion, the real problem is that historically clients were using getNameStart() and expecting it to be null terminated. This happens to be true, because the contents are in a string map and they are null terminated, but (a) it may not be the full name, and (b) this was not really part of the getNameStart() contract. The right solution is for clients to use an API which doesn't depend on null termination (and I have actively been moving stuff over). I added a comment to Value::getName to make this clearer. Seem ok? - Daniel On Mon, Jul 27, 2009 at 2:07 PM, Dan Gohman wrote: > > On Jul 26, 2009, at 2:22 AM, Daniel Dunbar wrote: > > >> Author: ddunbar >> Date: Sun Jul 26 04:22:02 2009 >> New Revision: 77149 >> >> URL: http://llvm.org/viewvc/llvm-project?rev=77149&view=rev >> Log: >> Make sure getName().data() is always null terminated. > > Hi Daniel, > > The doxygen comment for StringRef::data() says it may not be null > terminated. This is also consistent with std::string. If there are > clients that need a nul-terminated string, shouldn't there be a > c_str() method? > > Dan > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits > From mrs at apple.com Mon Jul 27 18:14:11 2009 From: mrs at apple.com (Mike Stump) Date: Mon, 27 Jul 2009 23:14:11 -0000 Subject: [llvm-commits] [llvm] r77271 - in /llvm/trunk/lib: CodeGen/SimpleRegisterCoalescing.cpp Transforms/Scalar/LoopUnroll.cpp Transforms/Utils/LowerSwitch.cpp Message-ID: <200907272314.n6RNEBsP025576@zion.cs.uiuc.edu> Author: mrs Date: Mon Jul 27 18:14:11 2009 New Revision: 77271 URL: http://llvm.org/viewvc/llvm-project?rev=77271&view=rev Log: Avoid build warnings. Modified: llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp llvm/trunk/lib/Transforms/Scalar/LoopUnroll.cpp llvm/trunk/lib/Transforms/Utils/LowerSwitch.cpp Modified: llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp?rev=77271&r1=77270&r2=77271&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp (original) +++ llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp Mon Jul 27 18:14:11 2009 @@ -1308,6 +1308,7 @@ DEBUG(errs() << "\tIncompatible source regclass: " << tri_->getName(DstSubReg) << " not in " << SrcSubRC->getName() << ".\n"); + (void)DstSubReg; return false; // Not coalescable. } } Modified: llvm/trunk/lib/Transforms/Scalar/LoopUnroll.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/LoopUnroll.cpp?rev=77271&r1=77270&r2=77271&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/LoopUnroll.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/LoopUnroll.cpp Mon Jul 27 18:14:11 2009 @@ -121,6 +121,7 @@ BasicBlock *Header = L->getHeader(); DEBUG(errs() << "Loop Unroll: F[" << Header->getParent()->getName() << "] Loop %" << Header->getName() << "\n"); + (void)Header; // Find trip count unsigned TripCount = L->getSmallConstantTripCount(); Modified: llvm/trunk/lib/Transforms/Utils/LowerSwitch.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/LowerSwitch.cpp?rev=77271&r1=77270&r2=77271&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Utils/LowerSwitch.cpp (original) +++ llvm/trunk/lib/Transforms/Utils/LowerSwitch.cpp Mon Jul 27 18:14:11 2009 @@ -309,6 +309,7 @@ DEBUG(errs() << "Clusterify finished. Total clusters: " << Cases.size() << ". Total compares: " << numCmps << "\n"); DEBUG(errs() << "Cases: " << Cases << "\n"); + (void)numCmps; BasicBlock* SwitchBlock = switchConvert(Cases.begin(), Cases.end(), Val, OrigBlock, NewDefault); From daniel at zuster.org Mon Jul 27 18:20:53 2009 From: daniel at zuster.org (Daniel Dunbar) Date: Mon, 27 Jul 2009 23:20:53 -0000 Subject: [llvm-commits] [llvm] r77272 - in /llvm/trunk: include/llvm/MC/MCStreamer.h lib/MC/MCAsmStreamer.cpp test/MC/AsmParser/directive_abort.s tools/llvm-mc/AsmParser.cpp tools/llvm-mc/AsmParser.h tools/llvm-mc/MC-X86Specific.cpp Message-ID: <200907272320.n6RNKrd2025767@zion.cs.uiuc.edu> Author: ddunbar Date: Mon Jul 27 18:20:52 2009 New Revision: 77272 URL: http://llvm.org/viewvc/llvm-project?rev=77272&view=rev Log: llvm-mc: Implement .abort fully in the front end Modified: llvm/trunk/include/llvm/MC/MCStreamer.h llvm/trunk/lib/MC/MCAsmStreamer.cpp llvm/trunk/test/MC/AsmParser/directive_abort.s llvm/trunk/tools/llvm-mc/AsmParser.cpp llvm/trunk/tools/llvm-mc/AsmParser.h llvm/trunk/tools/llvm-mc/MC-X86Specific.cpp Modified: llvm/trunk/include/llvm/MC/MCStreamer.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCStreamer.h?rev=77272&r1=77271&r2=77272&view=diff ============================================================================== --- llvm/trunk/include/llvm/MC/MCStreamer.h (original) +++ llvm/trunk/include/llvm/MC/MCStreamer.h Mon Jul 27 18:20:52 2009 @@ -156,13 +156,6 @@ virtual void EmitZerofill(MCSection *Section, MCSymbol *Symbol = 0, unsigned Size = 0,unsigned Pow2Alignment = 0) = 0; - /// AbortAssembly - Stop and don't produce output, printing @param - /// AbortReason if non-NULL to indicate the reason the assembly is - /// terminated. - /// - /// @param AbortReason - The reason assembly is terminated, if non-NULL. - virtual void AbortAssembly(const char *AbortReason) = 0; - /// @} /// @name Generating Data /// @{ Modified: llvm/trunk/lib/MC/MCAsmStreamer.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCAsmStreamer.cpp?rev=77272&r1=77271&r2=77272&view=diff ============================================================================== --- llvm/trunk/lib/MC/MCAsmStreamer.cpp (original) +++ llvm/trunk/lib/MC/MCAsmStreamer.cpp Mon Jul 27 18:20:52 2009 @@ -55,8 +55,6 @@ virtual void EmitZerofill(MCSection *Section, MCSymbol *Symbol = NULL, unsigned Size = 0, unsigned Pow2Alignment = 0); - virtual void AbortAssembly(const char *AbortReason = NULL); - virtual void EmitBytes(const StringRef &Data); virtual void EmitValue(const MCValue &Value, unsigned Size); @@ -132,14 +130,6 @@ OS << '\n'; } -void MCAsmStreamer::AbortAssembly(const char *AbortReason) { - OS << ".abort"; - if (AbortReason != NULL) - OS << ' ' << AbortReason; - OS << '\n'; - -} - void MCAsmStreamer::EmitAssignment(MCSymbol *Symbol, const MCValue &Value, bool MakeAbsolute) { assert(!Symbol->getSection() && "Cannot assign to a label!"); Modified: llvm/trunk/test/MC/AsmParser/directive_abort.s URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/AsmParser/directive_abort.s?rev=77272&r1=77271&r2=77272&view=diff ============================================================================== --- llvm/trunk/test/MC/AsmParser/directive_abort.s (original) +++ llvm/trunk/test/MC/AsmParser/directive_abort.s Mon Jul 27 18:20:52 2009 @@ -1,8 +1,6 @@ -# RUN: llvm-mc -triple i386-unknown-unknown %s | FileCheck %s +# RUN: llvm-mc -triple i386-unknown-unknown %s 2> %t +# RUN: FileCheck -input-file %t %s -# CHECK: TEST0: # CHECK: .abort "please stop assembing" -# CHECK: .abort TEST0: .abort "please stop assembing" -.abort Modified: llvm/trunk/tools/llvm-mc/AsmParser.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-mc/AsmParser.cpp?rev=77272&r1=77271&r2=77272&view=diff ============================================================================== --- llvm/trunk/tools/llvm-mc/AsmParser.cpp (original) +++ llvm/trunk/tools/llvm-mc/AsmParser.cpp Mon Jul 27 18:20:52 2009 @@ -14,6 +14,7 @@ #include "AsmParser.h" #include "AsmExpr.h" +#include "llvm/ADT/Twine.h" #include "llvm/MC/MCContext.h" #include "llvm/MC/MCInst.h" #include "llvm/MC/MCStreamer.h" @@ -23,12 +24,12 @@ #include "llvm/Target/TargetAsmParser.h" using namespace llvm; -void AsmParser::Warning(SMLoc L, const char *Msg) { - Lexer.PrintMessage(L, Msg, "warning"); +void AsmParser::Warning(SMLoc L, const Twine &Msg) { + Lexer.PrintMessage(L, Msg.str(), "warning"); } -bool AsmParser::Error(SMLoc L, const char *Msg) { - Lexer.PrintMessage(L, Msg, "error"); +bool AsmParser::Error(SMLoc L, const Twine &Msg) { + Lexer.PrintMessage(L, Msg.str(), "error"); return true; } @@ -1117,6 +1118,9 @@ /// ParseDirectiveAbort /// ::= .abort [ "abort_string" ] bool AsmParser::ParseDirectiveAbort() { + // FIXME: Use loc from directive. + SMLoc Loc = Lexer.getLoc(); + StringRef Str = ""; if (Lexer.isNot(asmtok::EndOfStatement)) { if (Lexer.isNot(asmtok::String)) @@ -1133,7 +1137,10 @@ Lexer.Lex(); // FIXME: Handle here. - Out.AbortAssembly(Str.str().c_str()); + if (Str.empty()) + Error(Loc, ".abort detected. Assembly stopping."); + else + Error(Loc, ".abort '" + Str + "' detected. Assembly stopping."); return false; } Modified: llvm/trunk/tools/llvm-mc/AsmParser.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-mc/AsmParser.h?rev=77272&r1=77271&r2=77272&view=diff ============================================================================== --- llvm/trunk/tools/llvm-mc/AsmParser.h (original) +++ llvm/trunk/tools/llvm-mc/AsmParser.h Mon Jul 27 18:20:52 2009 @@ -25,6 +25,7 @@ class MCStreamer; class MCValue; class TargetAsmParser; +class Twine; class AsmParser : MCAsmParser { public: @@ -52,8 +53,8 @@ private: bool ParseStatement(); - void Warning(SMLoc L, const char *Msg); - bool Error(SMLoc L, const char *Msg); + void Warning(SMLoc L, const Twine &Msg); + bool Error(SMLoc L, const Twine &Msg); bool TokError(const char *Msg); void EatToEndOfStatement(); Modified: llvm/trunk/tools/llvm-mc/MC-X86Specific.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-mc/MC-X86Specific.cpp?rev=77272&r1=77271&r2=77272&view=diff ============================================================================== --- llvm/trunk/tools/llvm-mc/MC-X86Specific.cpp (original) +++ llvm/trunk/tools/llvm-mc/MC-X86Specific.cpp Mon Jul 27 18:20:52 2009 @@ -13,6 +13,7 @@ //===----------------------------------------------------------------------===// #include "AsmParser.h" +#include "llvm/ADT/Twine.h" #include "llvm/MC/MCInst.h" #include "llvm/Support/SourceMgr.h" using namespace llvm; From gohman at apple.com Mon Jul 27 18:23:48 2009 From: gohman at apple.com (Dan Gohman) Date: Mon, 27 Jul 2009 23:23:48 -0000 Subject: [llvm-commits] [llvm] r77273 - /llvm/trunk/tools/bugpoint/bugpoint.cpp Message-ID: <200907272323.n6RNNmlH025846@zion.cs.uiuc.edu> Author: djg Date: Mon Jul 27 18:23:47 2009 New Revision: 77273 URL: http://llvm.org/viewvc/llvm-project?rev=77273&view=rev Log: Pass true to the Internalize parameter of createStandardLTOPasses, to match llvm-ld's default behavior. Modified: llvm/trunk/tools/bugpoint/bugpoint.cpp Modified: llvm/trunk/tools/bugpoint/bugpoint.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/bugpoint/bugpoint.cpp?rev=77273&r1=77272&r2=77273&view=diff ============================================================================== --- llvm/trunk/tools/bugpoint/bugpoint.cpp (original) +++ llvm/trunk/tools/bugpoint/bugpoint.cpp Mon Jul 27 18:23:47 2009 @@ -113,7 +113,7 @@ } if (StandardLinkOpts) - createStandardLTOPasses(&PM, /*Internalize=*/false, + createStandardLTOPasses(&PM, /*Internalize=*/true, /*RunInliner=*/true, /*VerifyEach=*/false); From mrs at apple.com Mon Jul 27 18:33:35 2009 From: mrs at apple.com (Mike Stump) Date: Mon, 27 Jul 2009 23:33:35 -0000 Subject: [llvm-commits] [llvm] r77274 - /llvm/trunk/lib/Transforms/Utils/LowerSwitch.cpp Message-ID: <200907272333.n6RNXZkU026103@zion.cs.uiuc.edu> Author: mrs Date: Mon Jul 27 18:33:34 2009 New Revision: 77274 URL: http://llvm.org/viewvc/llvm-project?rev=77274&view=rev Log: Fix a release-asserts warning. Debug functions should be marked used, if there are no other uses. If people don't need this routine anymore, if should be deleted. Modified: llvm/trunk/lib/Transforms/Utils/LowerSwitch.cpp Modified: llvm/trunk/lib/Transforms/Utils/LowerSwitch.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/LowerSwitch.cpp?rev=77274&r1=77273&r2=77274&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Utils/LowerSwitch.cpp (original) +++ llvm/trunk/lib/Transforms/Utils/LowerSwitch.cpp Mon Jul 27 18:33:34 2009 @@ -110,6 +110,8 @@ // operator<< - Used for debugging purposes. // static raw_ostream& operator<<(raw_ostream &O, + const LowerSwitch::CaseVector &C) __attribute((used)); +static raw_ostream& operator<<(raw_ostream &O, const LowerSwitch::CaseVector &C) { O << "["; From david_goodwin at apple.com Mon Jul 27 18:34:12 2009 From: david_goodwin at apple.com (David Goodwin) Date: Mon, 27 Jul 2009 23:34:12 -0000 Subject: [llvm-commits] [llvm] r77275 - in /llvm/trunk: lib/Target/ARM/ARMInstrThumb2.td test/CodeGen/Thumb2/thumb2-orn.ll Message-ID: <200907272334.n6RNYCge026127@zion.cs.uiuc.edu> Author: david_goodwin Date: Mon Jul 27 18:34:12 2009 New Revision: 77275 URL: http://llvm.org/viewvc/llvm-project?rev=77275&view=rev Log: ORN does not require (and can not have) the ".w" suffix. "Orthogonality" is a dirty word at ARM. Modified: llvm/trunk/lib/Target/ARM/ARMInstrThumb2.td llvm/trunk/test/CodeGen/Thumb2/thumb2-orn.ll Modified: llvm/trunk/lib/Target/ARM/ARMInstrThumb2.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMInstrThumb2.td?rev=77275&r1=77274&r2=77275&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMInstrThumb2.td (original) +++ llvm/trunk/lib/Target/ARM/ARMInstrThumb2.td Mon Jul 27 18:34:12 2009 @@ -164,23 +164,29 @@ /// T2I_bin_irs - Defines a set of (op reg, {so_imm|r|so_reg}) patterns for a // binary operation that produces a value. These are predicable and can be /// changed to modify CPSR. -multiclass T2I_bin_irs { +multiclass T2I_bin_irs { // shifted imm def ri : T2sI<(outs GPR:$dst), (ins GPR:$lhs, t2_so_imm:$rhs), opc, " $dst, $lhs, $rhs", [(set GPR:$dst, (opnode GPR:$lhs, t2_so_imm:$rhs))]>; // register def rr : T2sI<(outs GPR:$dst), (ins GPR:$lhs, GPR:$rhs), - opc, ".w $dst, $lhs, $rhs", + opc, !strconcat(wide, " $dst, $lhs, $rhs"), [(set GPR:$dst, (opnode GPR:$lhs, GPR:$rhs))]> { let isCommutable = Commutable; } // shifted register def rs : T2sI<(outs GPR:$dst), (ins GPR:$lhs, t2_so_reg:$rhs), - opc, ".w $dst, $lhs, $rhs", + opc, !strconcat(wide, " $dst, $lhs, $rhs"), [(set GPR:$dst, (opnode GPR:$lhs, t2_so_reg:$rhs))]>; } +/// T2I_bin_w_irs - Same as T2I_bin_irs except these operations need +// the ".w" prefix to indicate that they are wide. +multiclass T2I_bin_w_irs : + T2I_bin_irs; + /// T2I_rbin_is - Same as T2I_bin_irs except the order of operands are /// reversed. It doesn't define the 'rr' form since it's handled by its /// T2I_bin_irs counterpart. @@ -731,11 +737,11 @@ // Bitwise Instructions. // -defm t2AND : T2I_bin_irs<"and", BinOpFrag<(and node:$LHS, node:$RHS)>, 1>; -defm t2ORR : T2I_bin_irs<"orr", BinOpFrag<(or node:$LHS, node:$RHS)>, 1>; -defm t2EOR : T2I_bin_irs<"eor", BinOpFrag<(xor node:$LHS, node:$RHS)>, 1>; +defm t2AND : T2I_bin_w_irs<"and", BinOpFrag<(and node:$LHS, node:$RHS)>, 1>; +defm t2ORR : T2I_bin_w_irs<"orr", BinOpFrag<(or node:$LHS, node:$RHS)>, 1>; +defm t2EOR : T2I_bin_w_irs<"eor", BinOpFrag<(xor node:$LHS, node:$RHS)>, 1>; -defm t2BIC : T2I_bin_irs<"bic", BinOpFrag<(and node:$LHS, (not node:$RHS))>>; +defm t2BIC : T2I_bin_w_irs<"bic", BinOpFrag<(and node:$LHS, (not node:$RHS))>>; let Constraints = "$src = $dst" in def t2BFC : T2I<(outs GPR:$dst), (ins GPR:$src, bf_inv_mask_imm:$imm), Modified: llvm/trunk/test/CodeGen/Thumb2/thumb2-orn.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Thumb2/thumb2-orn.ll?rev=77275&r1=77274&r2=77275&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/Thumb2/thumb2-orn.ll (original) +++ llvm/trunk/test/CodeGen/Thumb2/thumb2-orn.ll Mon Jul 27 18:34:12 2009 @@ -1,8 +1,8 @@ -; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {orn\\.w\\W*r\[0-9\]*,\\W*r\[0-9\]*,\\W*r\[0-9\]*$} | count 4 -; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {orn\\.w\\W*r\[0-9\],\\W*r\[0-9\],\\W*r\[0-9\],\\W*lsl\\W*#5$} | count 1 -; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {orn\\.w\\W*r\[0-9\],\\W*r\[0-9\],\\W*r\[0-9\],\\W*lsr\\W*#6$} | count 1 -; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {orn\\.w\\W*r\[0-9\],\\W*r\[0-9\],\\W*r\[0-9\],\\W*asr\\W*#7$} | count 1 -; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {orn\\.w\\W*r\[0-9\],\\W*r\[0-9\],\\W*r\[0-9\],\\W*ror\\W*#8$} | count 1 +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {orn\\W*r\[0-9\]*,\\W*r\[0-9\]*,\\W*r\[0-9\]*$} | count 4 +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {orn\\W*r\[0-9\],\\W*r\[0-9\],\\W*r\[0-9\],\\W*lsl\\W*#5$} | count 1 +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {orn\\W*r\[0-9\],\\W*r\[0-9\],\\W*r\[0-9\],\\W*lsr\\W*#6$} | count 1 +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {orn\\W*r\[0-9\],\\W*r\[0-9\],\\W*r\[0-9\],\\W*asr\\W*#7$} | count 1 +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {orn\\W*r\[0-9\],\\W*r\[0-9\],\\W*r\[0-9\],\\W*ror\\W*#8$} | count 1 define i32 @f1(i32 %a, i32 %b) { %tmp = xor i32 %b, 4294967295 From isanbard at gmail.com Mon Jul 27 18:50:57 2009 From: isanbard at gmail.com (Bill Wendling) Date: Mon, 27 Jul 2009 23:50:57 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r77276 - /llvm-gcc-4.2/trunk/gcc/objc/objc-act.c Message-ID: <200907272350.n6RNow4H026564@zion.cs.uiuc.edu> Author: void Date: Mon Jul 27 18:50:57 2009 New Revision: 77276 URL: http://llvm.org/viewvc/llvm-project?rev=77276&view=rev Log: LTO was stripping some Objective-C metadata symbols because IPSCCP thought that they were dead. They weren't in the llvm.used list. Mark them as "preserve" so that they're placed into the list. The testcase for this is the SingleSource/UnitTests/ObjC/protocols.m file in the test suite. Modified: llvm-gcc-4.2/trunk/gcc/objc/objc-act.c Modified: llvm-gcc-4.2/trunk/gcc/objc/objc-act.c URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/objc/objc-act.c?rev=77276&r1=77275&r2=77276&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/objc/objc-act.c (original) +++ llvm-gcc-4.2/trunk/gcc/objc/objc-act.c Mon Jul 27 18:50:57 2009 @@ -6200,6 +6200,9 @@ follow from the alignments of the component types. */ DECL_ALIGN(decl) = BITS_PER_WORD==32 ? 32 : 128; DECL_USER_ALIGN(decl) = 1; + + /* Let optimizer know that this decl is not removable. */ + DECL_PRESERVE_P (decl) = 1; #endif /* LLVM LOCAL end */ set_user_assembler_name (decl, buf); @@ -12504,6 +12507,12 @@ decl = create_hidden_decl (objc_protocol_type, string); DECL_WEAK (decl) = 1; set_user_assembler_name (decl, string); + /* LLVM LOCAL begin 7069676 */ +#ifdef ENABLE_LLVM + /* Let optimizer know that this decl is not removable. */ + DECL_PRESERVE_P (decl) = 1; +#endif + /* LLVM LOCAL end 7069676 */ expr = convert (objc_protocol_type, build_fold_addr_expr (expr)); /* APPLE LOCAL radar 4561192 */ objc_set_alignment_attribute (decl, objc_protocol_type); @@ -12615,7 +12624,12 @@ decl = create_hidden_decl (objc_protocol_type, buf); DECL_WEAK (decl) = 1; set_user_assembler_name (decl, buf); - + /* LLVM LOCAL begin 7069676 */ +#ifdef ENABLE_LLVM + /* Let optimizer know that this decl is not removable. */ + DECL_PRESERVE_P (decl) = 1; +#endif + /* LLVM LOCAL end 7069676 */ return decl; } /* APPLE LOCAL end radar 6351990 */ @@ -14194,6 +14208,10 @@ PROTOCOL_V2_FORWARD_DECL (p) = decl; /* LLVM LOCAL begin - radar 5476262 */ #ifdef ENABLE_LLVM + /* begin radar 7069676 */ + /* Let optimizer know that this decl is not removable. */ + DECL_PRESERVE_P (decl) = 1; + /* end radar 7069676 */ pushdecl_top_level(decl); #endif /* LLVM LOCAL end - radar 5476262 */ From gohman at apple.com Mon Jul 27 19:06:49 2009 From: gohman at apple.com (Dan Gohman) Date: Tue, 28 Jul 2009 00:06:49 -0000 Subject: [llvm-commits] [test-suite] r77278 - /test-suite/trunk/Makefile.programs Message-ID: <200907280006.n6S06nGO026994@zion.cs.uiuc.edu> Author: djg Date: Mon Jul 27 19:06:46 2009 New Revision: 77278 URL: http://llvm.org/viewvc/llvm-project?rev=77278&view=rev Log: Use bugpoint's new -std-compile-opts and -std-link-opts options instead of doing tricks to get this information. Modified: test-suite/trunk/Makefile.programs Modified: test-suite/trunk/Makefile.programs URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/Makefile.programs?rev=77278&r1=77277&r2=77278&view=diff ============================================================================== --- test-suite/trunk/Makefile.programs (original) +++ test-suite/trunk/Makefile.programs Mon Jul 27 19:06:46 2009 @@ -330,17 +330,6 @@ endif # ifndef DISABLE_FOR_LLVM_PROGRAMS -# Targets to get the pass arguments that opt and llvm-ld are using... -Output/opt-pass-args: $(LOPT) Output/.dir - -$(LLVMAS) < /dev/null -o - | \ - $(LOPT) $(EXTRA_LOPT_OPTIONS) -std-compile-opts -disable-output -debug-pass=Arguments 2>&1 | \ - sed 's/Pass Arguments: //' > $@ - -Output/llvm-ld-pass-args: $(LLVMLDPROG) Output/.dir - $(LLVMAS) < /dev/null > Output/llvm-ld.test.bc - $(LLVMLD) Output/llvm-ld.test.bc -o Output/llvm-ld.test-out -debug-pass=Arguments > $@.1 2>&1 - sed 's/Pass Arguments: //' < $@.1 > $@ - # If the program requires exception handling support, enable (potentially # expensive) support for it. ifdef REQUIRES_EH_SUPPORT @@ -557,13 +546,13 @@ # Rules to bugpoint the opt, llvm-ld, llc, or lli commands... $(PROGRAMS_TO_TEST:%=Output/%.bugpoint-opt): \ Output/%.bugpoint-opt: Output/%.noopt-llvm.bc $(LBUGPOINT) \ - Output/opt-pass-args Output/%.out-nat - PWD=$(CURDIR) $(LBUGPOINT) -llc-safe $< `cat Output/opt-pass-args` $(BUGPOINT_OPTIONS) $(BUGPOINT_ARGS) + Output/%.out-nat + PWD=$(CURDIR) $(LBUGPOINT) -llc-safe $< -std-compile-opts $(BUGPOINT_OPTIONS) $(BUGPOINT_ARGS) $(PROGRAMS_TO_TEST:%=Output/%.bugpoint-llvm-ld): \ Output/%.bugpoint-llvm-ld: Output/%.nollvm-ldopt-llvm.bc $(LBUGPOINT) \ - Output/llvm-ld-pass-args Output/%.out-nat - PWD=$(CURDIR) $(LBUGPOINT) -llc-safe $< `cat Output/llvm-ld-pass-args` $(OPTPASSES) $(BUGPOINT_OPTIONS) $(BUGPOINT_ARGS) + Output/%.out-nat + PWD=$(CURDIR) $(LBUGPOINT) -llc-safe $< -std-link-opts $(OPTPASSES) $(BUGPOINT_OPTIONS) $(BUGPOINT_ARGS) $(PROGRAMS_TO_TEST:%=Output/%.bugpoint-llc): \ Output/%.bugpoint-llc: Output/%.llvm.bc $(LBUGPOINT) Output/%.out-nat From bob.wilson at apple.com Mon Jul 27 19:21:56 2009 From: bob.wilson at apple.com (Bob Wilson) Date: Tue, 28 Jul 2009 00:21:56 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r77282 - /llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp Message-ID: <200907280021.n6S0LuTe027526@zion.cs.uiuc.edu> Author: bwilson Date: Mon Jul 27 19:21:55 2009 New Revision: 77282 URL: http://llvm.org/viewvc/llvm-project?rev=77282&view=rev Log: Handle builtin functions with aggregate operands. Modified: llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp Modified: llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp?rev=77282&r1=77281&r2=77282&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp (original) +++ llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp Mon Jul 27 19:21:55 2009 @@ -4696,8 +4696,16 @@ // Get the result type and operand line in an easy to consume format. const Type *ResultType = ConvertType(TREE_TYPE(TREE_TYPE(fndecl))); std::vector Operands; - for (tree Op = TREE_OPERAND(exp, 1); Op; Op = TREE_CHAIN(Op)) - Operands.push_back(Emit(TREE_VALUE(Op), 0)); + for (tree Op = TREE_OPERAND(exp, 1); Op; Op = TREE_CHAIN(Op)) { + tree OpVal = TREE_VALUE(Op); + if (isAggregateTreeType(TREE_TYPE(OpVal))) { + MemRef OpLoc = CreateTempLoc(ConvertType(TREE_TYPE(OpVal))); + Emit(OpVal, &OpLoc); + Operands.push_back(Builder.CreateLoad(OpLoc.Ptr)); + } else { + Operands.push_back(Emit(OpVal, NULL)); + } + } unsigned FnCode = DECL_FUNCTION_CODE(fndecl); return LLVM_TARGET_INTRINSIC_LOWER(exp, FnCode, DestLoc, Result, ResultType, From bob.wilson at apple.com Mon Jul 27 19:32:29 2009 From: bob.wilson at apple.com (Bob Wilson) Date: Tue, 28 Jul 2009 00:32:29 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r77283 - in /llvm-gcc-4.2/trunk/gcc/config/arm: arm.c arm_neon.h llvm-arm.cpp neon.ml Message-ID: <200907280032.n6S0WT6f027821@zion.cs.uiuc.edu> Author: bwilson Date: Mon Jul 27 19:32:28 2009 New Revision: 77283 URL: http://llvm.org/viewvc/llvm-project?rev=77283&view=rev Log: Change llvm-gcc to use new builtin struct types for ARM Neon builtins that operate on multiple adjacent vectors. gcc had been treating these arrays of vectors as wide integers, and subsequent references to the individual vectors were optimized by llvm to lshr/trunc/bitcast operations on the wide integer values. With this change, llvm can optimize the vector references to simple extractvalue operations, which get nicely folded away when building SelectionDAGs for codegen. Modified: llvm-gcc-4.2/trunk/gcc/config/arm/arm.c llvm-gcc-4.2/trunk/gcc/config/arm/arm_neon.h llvm-gcc-4.2/trunk/gcc/config/arm/llvm-arm.cpp llvm-gcc-4.2/trunk/gcc/config/arm/neon.ml Modified: llvm-gcc-4.2/trunk/gcc/config/arm/arm.c URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/arm/arm.c?rev=77283&r1=77282&r2=77283&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/config/arm/arm.c (original) +++ llvm-gcc-4.2/trunk/gcc/config/arm/arm.c Mon Jul 27 19:32:28 2009 @@ -16608,6 +16608,41 @@ } /* APPLE LOCAL end 7083296 Build without warnings. */ +/* LLVM LOCAL begin multi-vector types */ +#ifdef ENABLE_LLVM +/* Create a new builtin struct type containing NUMVECS fields (where NUMVECS + is in the range from 2 to 4) of type VECTYPE. */ +static tree +build_multivec_type (tree vectype, unsigned numvecs, const char *tag) +{ + tree record, name, fields, fld; + char fldname[5]; + unsigned n; + + record = (*lang_hooks.types.make_type) (RECORD_TYPE); + name = build_decl (TYPE_DECL, get_identifier (tag), record); + TYPE_NAME (record) = name; + + gcc_assert (numvecs >= 2 && numvecs <= 4); + fields = NULL; + for (n = 0; n < numvecs; ++n) + { + /* The fields are created in reverse order because it is easier to + chain them together that way. Number them accordingly. */ + sprintf (fldname, "val%u", numvecs - n - 1); + fld = build_decl (FIELD_DECL, get_identifier (fldname), vectype); + DECL_FIELD_CONTEXT (fld) = record; + TREE_CHAIN (fld) = fields; + fields = fld; + } + + TYPE_FIELDS (record) = fields; + layout_type (record); + return record; +} +#endif /* ENABLE_LLVM */ +/* LLVM LOCAL end multi-vector types */ + static void arm_init_neon_builtins (void) { @@ -16617,11 +16652,19 @@ #define qhi_TN neon_polyHI_type_node #define si_TN neon_intSI_type_node #define di_TN neon_intDI_type_node +/* LLVM LOCAL begin multi-vector types */ +#ifdef ENABLE_LLVM +#define ti_TN V8QI2_type_node +#define ei_TN V8QI3_type_node +#define oi_TN V8QI4_type_node +#else #define ti_TN intTI_type_node #define ei_TN intEI_type_node #define oi_TN intOI_type_node #define ci_TN intCI_type_node #define xi_TN intXI_type_node +#endif +/* LLVM LOCAL end multi-vector types */ #define sf_TN neon_float_type_node @@ -16731,12 +16774,99 @@ tree intUSI_type_node = make_unsigned_type (GET_MODE_PRECISION (SImode)); tree intUDI_type_node = make_unsigned_type (GET_MODE_PRECISION (DImode)); + /* LLVM LOCAL begin multi-vector types */ +#ifdef ENABLE_LLVM + tree V8QI2_type_node = build_multivec_type (V8QI_type_node, 2, + "__builtin_neon_v8qi2"); + tree V4HI2_type_node = build_multivec_type (V4HI_type_node, 2, + "__builtin_neon_v4hi2"); + tree V2SI2_type_node = build_multivec_type (V2SI_type_node, 2, + "__builtin_neon_v2si2"); + tree DI2_type_node = build_multivec_type (neon_intDI_type_node, 2, + "__builtin_neon_di2"); + tree V2SF2_type_node = build_multivec_type (V2SF_type_node, 2, + "__builtin_neon_v2sf2"); + tree V8QI3_type_node = build_multivec_type (V8QI_type_node, 3, + "__builtin_neon_v8qi3"); + tree V4HI3_type_node = build_multivec_type (V4HI_type_node, 3, + "__builtin_neon_v4hi3"); + tree V2SI3_type_node = build_multivec_type (V2SI_type_node, 3, + "__builtin_neon_v2si3"); + tree DI3_type_node = build_multivec_type (neon_intDI_type_node, 3, + "__builtin_neon_di3"); + tree V2SF3_type_node = build_multivec_type (V2SF_type_node, 3, + "__builtin_neon_v2sf3"); + tree V8QI4_type_node = build_multivec_type (V8QI_type_node, 4, + "__builtin_neon_v8qi4"); + tree V4HI4_type_node = build_multivec_type (V4HI_type_node, 4, + "__builtin_neon_v4hi4"); + tree V2SI4_type_node = build_multivec_type (V2SI_type_node, 4, + "__builtin_neon_v2si4"); + tree DI4_type_node = build_multivec_type (neon_intDI_type_node, 4, + "__builtin_neon_di4"); + tree V2SF4_type_node = build_multivec_type (V2SF_type_node, 4, + "__builtin_neon_v2sf4"); + tree V16QI2_type_node = build_multivec_type (V16QI_type_node, 2, + "__builtin_neon_v16qi2"); + tree V8HI2_type_node = build_multivec_type (V8HI_type_node, 2, + "__builtin_neon_v8hi2"); + tree V4SI2_type_node = build_multivec_type (V4SI_type_node, 2, + "__builtin_neon_v4si2"); + tree V4SF2_type_node = build_multivec_type (V4SF_type_node, 2, + "__builtin_neon_v4sf2"); + tree V16QI3_type_node = build_multivec_type (V16QI_type_node, 3, + "__builtin_neon_v16qi3"); + tree V8HI3_type_node = build_multivec_type (V8HI_type_node, 3, + "__builtin_neon_v8hi3"); + tree V4SI3_type_node = build_multivec_type (V4SI_type_node, 3, + "__builtin_neon_v4si3"); + tree V4SF3_type_node = build_multivec_type (V4SF_type_node, 3, + "__builtin_neon_v4sf3"); + tree V16QI4_type_node = build_multivec_type (V16QI_type_node, 4, + "__builtin_neon_v16qi4"); + tree V8HI4_type_node = build_multivec_type (V8HI_type_node, 4, + "__builtin_neon_v8hi4"); + tree V4SI4_type_node = build_multivec_type (V4SI_type_node, 4, + "__builtin_neon_v4si4"); + tree V4SF4_type_node = build_multivec_type (V4SF_type_node, 4, + "__builtin_neon_v4sf4"); +#else /* ENABLE_LLVM */ /* Opaque integer types for structures of vectors. */ tree intEI_type_node = make_signed_type (GET_MODE_PRECISION (EImode)); tree intOI_type_node = make_signed_type (GET_MODE_PRECISION (OImode)); tree intCI_type_node = make_signed_type (GET_MODE_PRECISION (CImode)); tree intXI_type_node = make_signed_type (GET_MODE_PRECISION (XImode)); + tree V8QI2_type_node = intTI_type_node; + tree V4HI2_type_node = intTI_type_node; + tree V2SI2_type_node = intTI_type_node; + tree DI2_type_node = intTI_type_node; + tree V2SF2_type_node = intTI_type_node; + tree V8QI3_type_node = intEI_type_node; + tree V4HI3_type_node = intEI_type_node; + tree V2SI3_type_node = intEI_type_node; + tree DI3_type_node = intEI_type_node; + tree V2SF3_type_node = intEI_type_node; + tree V8QI4_type_node = intOI_type_node; + tree V4HI4_type_node = intOI_type_node; + tree V2SI4_type_node = intOI_type_node; + tree DI4_type_node = intOI_type_node; + tree V2SF4_type_node = intOI_type_node; + tree V16QI2_type_node = intOI_type_node; + tree V8HI2_type_node = intOI_type_node; + tree V4SI2_type_node = intOI_type_node; + tree V4SF2_type_node = intOI_type_node; + tree V16QI3_type_node = intCI_type_node; + tree V8HI3_type_node = intCI_type_node; + tree V4SI3_type_node = intCI_type_node; + tree V4SF3_type_node = intCI_type_node; + tree V16QI4_type_node = intXI_type_node; + tree V8HI4_type_node = intXI_type_node; + tree V4SI4_type_node = intXI_type_node; + tree V4SF4_type_node = intXI_type_node; +#endif /* ENABLE_LLVM */ + /* LLVM LOCAL end multi-vector types */ + /* Pointers to vector types. */ tree V8QI_pointer_node = build_pointer_type (V8QI_type_node); tree V4HI_pointer_node = build_pointer_type (V4HI_type_node); @@ -17159,279 +17289,331 @@ V4SF_type_node, intSI_type_node, NULL); /* Load size-2 structure operations, double-word. */ + /* LLVM LOCAL begin multi-vector types */ + /* LLVM: To minimize changes to the GCC source, the original wide-integer + mode abbrevations (ti, ei, oi, ci, and xi) have not been replaced by + vector-type-specific names (e.g., v8qi2, etc.) in the following + types. OI-mode values, however, are type-ambiguous: they can be + structs of 4 double-register vectors or 2 quad-register vectors. In + places where this ambiguity exists, "d" and "q" suffixes are added to + the "oi" name, i.e., "oid" and "oiq", to distinguish the double- and + quad-register types. */ tree ti_ftype_const_qi_pointer = - build_function_type_list (intTI_type_node, const_intQI_pointer_node, NULL); + build_function_type_list (V8QI2_type_node, const_intQI_pointer_node, NULL); tree ti_ftype_const_hi_pointer = - build_function_type_list (intTI_type_node, const_intHI_pointer_node, NULL); + build_function_type_list (V4HI2_type_node, const_intHI_pointer_node, NULL); tree ti_ftype_const_si_pointer = - build_function_type_list (intTI_type_node, const_intSI_pointer_node, NULL); + build_function_type_list (V2SI2_type_node, const_intSI_pointer_node, NULL); tree ti_ftype_const_di_pointer = - build_function_type_list (intTI_type_node, const_intDI_pointer_node, NULL); + build_function_type_list (DI2_type_node, const_intDI_pointer_node, NULL); tree ti_ftype_const_sf_pointer = - build_function_type_list (intTI_type_node, const_float_pointer_node, NULL); + build_function_type_list (V2SF2_type_node, const_float_pointer_node, NULL); /* Load size-2 structure operations, quad-word; also load size-4, double-word. */ - tree oi_ftype_const_qi_pointer = - build_function_type_list (intOI_type_node, const_intQI_pointer_node, NULL); - tree oi_ftype_const_hi_pointer = - build_function_type_list (intOI_type_node, const_intHI_pointer_node, NULL); - tree oi_ftype_const_si_pointer = - build_function_type_list (intOI_type_node, const_intSI_pointer_node, NULL); - tree oi_ftype_const_sf_pointer = - build_function_type_list (intOI_type_node, const_float_pointer_node, NULL); + tree oiq_ftype_const_qi_pointer = + build_function_type_list (V16QI2_type_node, const_intQI_pointer_node, NULL); + tree oiq_ftype_const_hi_pointer = + build_function_type_list (V8HI2_type_node, const_intHI_pointer_node, NULL); + tree oiq_ftype_const_si_pointer = + build_function_type_list (V4SI2_type_node, const_intSI_pointer_node, NULL); + tree oiq_ftype_const_sf_pointer = + build_function_type_list (V4SF2_type_node, const_float_pointer_node, NULL); + + tree oid_ftype_const_qi_pointer = + build_function_type_list (V8QI4_type_node, const_intQI_pointer_node, NULL); + tree oid_ftype_const_hi_pointer = + build_function_type_list (V4HI4_type_node, const_intHI_pointer_node, NULL); + tree oid_ftype_const_si_pointer = + build_function_type_list (V2SI4_type_node, const_intSI_pointer_node, NULL); + tree oid_ftype_const_sf_pointer = + build_function_type_list (V2SF4_type_node, const_float_pointer_node, NULL); /* Load lane size-2 structure operations, double-word. */ tree ti_ftype_const_qi_pointer_ti_si = - build_function_type_list (intTI_type_node, const_intQI_pointer_node, - intTI_type_node, intSI_type_node, NULL); + build_function_type_list (V8QI2_type_node, const_intQI_pointer_node, + V8QI2_type_node, intSI_type_node, NULL); tree ti_ftype_const_hi_pointer_ti_si = - build_function_type_list (intTI_type_node, const_intHI_pointer_node, - intTI_type_node, intSI_type_node, NULL); + build_function_type_list (V4HI2_type_node, const_intHI_pointer_node, + V4HI2_type_node, intSI_type_node, NULL); tree ti_ftype_const_si_pointer_ti_si = - build_function_type_list (intTI_type_node, const_intSI_pointer_node, - intTI_type_node, intSI_type_node, NULL); + build_function_type_list (V2SI2_type_node, const_intSI_pointer_node, + V2SI2_type_node, intSI_type_node, NULL); tree ti_ftype_const_sf_pointer_ti_si = - build_function_type_list (intTI_type_node, const_float_pointer_node, - intTI_type_node, intSI_type_node, NULL); + build_function_type_list (V2SF2_type_node, const_float_pointer_node, + V2SF2_type_node, intSI_type_node, NULL); /* Load lane size-2 structure operations, quad-word; also load lane size-4, double-word. */ - tree oi_ftype_const_hi_pointer_oi_si = - build_function_type_list (intOI_type_node, const_intHI_pointer_node, - intOI_type_node, intSI_type_node, NULL); - tree oi_ftype_const_si_pointer_oi_si = - build_function_type_list (intOI_type_node, const_intSI_pointer_node, - intOI_type_node, intSI_type_node, NULL); - tree oi_ftype_const_sf_pointer_oi_si = - build_function_type_list (intOI_type_node, const_float_pointer_node, - intOI_type_node, intSI_type_node, NULL); + tree oiq_ftype_const_hi_pointer_oiq_si = + build_function_type_list (V8HI2_type_node, const_intHI_pointer_node, + V8HI2_type_node, intSI_type_node, NULL); + tree oiq_ftype_const_si_pointer_oiq_si = + build_function_type_list (V4SI2_type_node, const_intSI_pointer_node, + V4SI2_type_node, intSI_type_node, NULL); + tree oiq_ftype_const_sf_pointer_oiq_si = + build_function_type_list (V4SF2_type_node, const_float_pointer_node, + V4SF2_type_node, intSI_type_node, NULL); + + tree oid_ftype_const_hi_pointer_oid_si = + build_function_type_list (V4HI4_type_node, const_intHI_pointer_node, + V4HI4_type_node, intSI_type_node, NULL); + tree oid_ftype_const_si_pointer_oid_si = + build_function_type_list (V2SI4_type_node, const_intSI_pointer_node, + V2SI4_type_node, intSI_type_node, NULL); + tree oid_ftype_const_sf_pointer_oid_si = + build_function_type_list (V2SF4_type_node, const_float_pointer_node, + V2SF4_type_node, intSI_type_node, NULL); /* Store size-2 structure operations, double-word. */ tree void_ftype_qi_pointer_ti = build_function_type_list (void_type_node, intQI_pointer_node, - intTI_type_node, NULL); + V8QI2_type_node, NULL); tree void_ftype_hi_pointer_ti = build_function_type_list (void_type_node, intHI_pointer_node, - intTI_type_node, NULL); + V4HI2_type_node, NULL); tree void_ftype_si_pointer_ti = build_function_type_list (void_type_node, intSI_pointer_node, - intTI_type_node, NULL); + V2SI2_type_node, NULL); tree void_ftype_di_pointer_ti = build_function_type_list (void_type_node, intDI_pointer_node, - intTI_type_node, NULL); + DI2_type_node, NULL); tree void_ftype_sf_pointer_ti = build_function_type_list (void_type_node, float_pointer_node, - intTI_type_node, NULL); + V2SF2_type_node, NULL); /* Store size-2 structure operations, quad-word; also store size-4, double-word. */ - tree void_ftype_qi_pointer_oi = + tree void_ftype_qi_pointer_oiq = build_function_type_list (void_type_node, intQI_pointer_node, - intOI_type_node, NULL); - tree void_ftype_hi_pointer_oi = + V16QI2_type_node, NULL); + tree void_ftype_hi_pointer_oiq = build_function_type_list (void_type_node, intHI_pointer_node, - intOI_type_node, NULL); - tree void_ftype_si_pointer_oi = + V8HI2_type_node, NULL); + tree void_ftype_si_pointer_oiq = build_function_type_list (void_type_node, intSI_pointer_node, - intOI_type_node, NULL); - tree void_ftype_sf_pointer_oi = + V4SI2_type_node, NULL); + tree void_ftype_sf_pointer_oiq = build_function_type_list (void_type_node, float_pointer_node, - intOI_type_node, NULL); + V4SF2_type_node, NULL); + + tree void_ftype_qi_pointer_oid = + build_function_type_list (void_type_node, intQI_pointer_node, + V8QI4_type_node, NULL); + tree void_ftype_hi_pointer_oid = + build_function_type_list (void_type_node, intHI_pointer_node, + V4HI4_type_node, NULL); + tree void_ftype_si_pointer_oid = + build_function_type_list (void_type_node, intSI_pointer_node, + V2SI4_type_node, NULL); + tree void_ftype_sf_pointer_oid = + build_function_type_list (void_type_node, float_pointer_node, + V2SF4_type_node, NULL); /* Store lane size-2 structure operations, double-word. */ tree void_ftype_qi_pointer_ti_si = build_function_type_list (void_type_node, intQI_pointer_node, - intTI_type_node, intSI_type_node, NULL); + V8QI2_type_node, intSI_type_node, NULL); tree void_ftype_hi_pointer_ti_si = build_function_type_list (void_type_node, intHI_pointer_node, - intTI_type_node, intSI_type_node, NULL); + V4HI2_type_node, intSI_type_node, NULL); tree void_ftype_si_pointer_ti_si = build_function_type_list (void_type_node, intSI_pointer_node, - intTI_type_node, intSI_type_node, NULL); + V2SI2_type_node, intSI_type_node, NULL); tree void_ftype_sf_pointer_ti_si = build_function_type_list (void_type_node, float_pointer_node, - intTI_type_node, intSI_type_node, NULL); + V2SF2_type_node, intSI_type_node, NULL); /* Store lane size-2 structure operations, quad-word; also store lane size-4, double-word. */ - tree void_ftype_hi_pointer_oi_si = + tree void_ftype_hi_pointer_oiq_si = + build_function_type_list (void_type_node, intHI_pointer_node, + V8HI2_type_node, intSI_type_node, NULL); + tree void_ftype_si_pointer_oiq_si = + build_function_type_list (void_type_node, intSI_pointer_node, + V4SI2_type_node, intSI_type_node, NULL); + tree void_ftype_sf_pointer_oiq_si = + build_function_type_list (void_type_node, float_pointer_node, + V4SF2_type_node, intSI_type_node, NULL); + + tree void_ftype_hi_pointer_oid_si = build_function_type_list (void_type_node, intHI_pointer_node, - intOI_type_node, intSI_type_node, NULL); - tree void_ftype_si_pointer_oi_si = + V4HI4_type_node, intSI_type_node, NULL); + tree void_ftype_si_pointer_oid_si = build_function_type_list (void_type_node, intSI_pointer_node, - intOI_type_node, intSI_type_node, NULL); - tree void_ftype_sf_pointer_oi_si = + V2SI4_type_node, intSI_type_node, NULL); + tree void_ftype_sf_pointer_oid_si = build_function_type_list (void_type_node, float_pointer_node, - intOI_type_node, intSI_type_node, NULL); + V2SF4_type_node, intSI_type_node, NULL); /* Load size-3 structure operations, double-word. */ tree ei_ftype_const_qi_pointer = - build_function_type_list (intEI_type_node, const_intQI_pointer_node, NULL); + build_function_type_list (V8QI3_type_node, const_intQI_pointer_node, NULL); tree ei_ftype_const_hi_pointer = - build_function_type_list (intEI_type_node, const_intHI_pointer_node, NULL); + build_function_type_list (V4HI3_type_node, const_intHI_pointer_node, NULL); tree ei_ftype_const_si_pointer = - build_function_type_list (intEI_type_node, const_intSI_pointer_node, NULL); + build_function_type_list (V2SI3_type_node, const_intSI_pointer_node, NULL); tree ei_ftype_const_di_pointer = - build_function_type_list (intEI_type_node, const_intDI_pointer_node, NULL); + build_function_type_list (DI3_type_node, const_intDI_pointer_node, NULL); tree ei_ftype_const_sf_pointer = - build_function_type_list (intEI_type_node, const_float_pointer_node, NULL); + build_function_type_list (V2SF3_type_node, const_float_pointer_node, NULL); /* Load size-3 structure operations, quad-word. */ tree ci_ftype_const_qi_pointer = - build_function_type_list (intCI_type_node, const_intQI_pointer_node, NULL); + build_function_type_list (V16QI3_type_node, const_intQI_pointer_node, NULL); tree ci_ftype_const_hi_pointer = - build_function_type_list (intCI_type_node, const_intHI_pointer_node, NULL); + build_function_type_list (V8HI3_type_node, const_intHI_pointer_node, NULL); tree ci_ftype_const_si_pointer = - build_function_type_list (intCI_type_node, const_intSI_pointer_node, NULL); + build_function_type_list (V4SI3_type_node, const_intSI_pointer_node, NULL); tree ci_ftype_const_sf_pointer = - build_function_type_list (intCI_type_node, const_float_pointer_node, NULL); + build_function_type_list (V4SF3_type_node, const_float_pointer_node, NULL); /* Load lane size-3 structure operations, double-word. */ tree ei_ftype_const_qi_pointer_ei_si = - build_function_type_list (intEI_type_node, const_intQI_pointer_node, - intEI_type_node, intSI_type_node, NULL); + build_function_type_list (V8QI3_type_node, const_intQI_pointer_node, + V8QI3_type_node, intSI_type_node, NULL); tree ei_ftype_const_hi_pointer_ei_si = - build_function_type_list (intEI_type_node, const_intHI_pointer_node, - intEI_type_node, intSI_type_node, NULL); + build_function_type_list (V4HI3_type_node, const_intHI_pointer_node, + V4HI3_type_node, intSI_type_node, NULL); tree ei_ftype_const_si_pointer_ei_si = - build_function_type_list (intEI_type_node, const_intSI_pointer_node, - intEI_type_node, intSI_type_node, NULL); + build_function_type_list (V2SI3_type_node, const_intSI_pointer_node, + V2SI3_type_node, intSI_type_node, NULL); tree ei_ftype_const_sf_pointer_ei_si = - build_function_type_list (intEI_type_node, const_float_pointer_node, - intEI_type_node, intSI_type_node, NULL); + build_function_type_list (V2SF3_type_node, const_float_pointer_node, + V2SF3_type_node, intSI_type_node, NULL); /* Load lane size-3 structure operations, quad-word. */ tree ci_ftype_const_hi_pointer_ci_si = - build_function_type_list (intCI_type_node, const_intHI_pointer_node, - intCI_type_node, intSI_type_node, NULL); + build_function_type_list (V8HI3_type_node, const_intHI_pointer_node, + V8HI3_type_node, intSI_type_node, NULL); tree ci_ftype_const_si_pointer_ci_si = - build_function_type_list (intCI_type_node, const_intSI_pointer_node, - intCI_type_node, intSI_type_node, NULL); + build_function_type_list (V4SI3_type_node, const_intSI_pointer_node, + V4SI3_type_node, intSI_type_node, NULL); tree ci_ftype_const_sf_pointer_ci_si = - build_function_type_list (intCI_type_node, const_float_pointer_node, - intCI_type_node, intSI_type_node, NULL); + build_function_type_list (V4SF3_type_node, const_float_pointer_node, + V4SF3_type_node, intSI_type_node, NULL); /* Store size-3 structure operations, double-word. */ tree void_ftype_qi_pointer_ei = build_function_type_list (void_type_node, intQI_pointer_node, - intEI_type_node, NULL); + V8QI3_type_node, NULL); tree void_ftype_hi_pointer_ei = build_function_type_list (void_type_node, intHI_pointer_node, - intEI_type_node, NULL); + V4HI3_type_node, NULL); tree void_ftype_si_pointer_ei = build_function_type_list (void_type_node, intSI_pointer_node, - intEI_type_node, NULL); + V2SI3_type_node, NULL); tree void_ftype_di_pointer_ei = build_function_type_list (void_type_node, intDI_pointer_node, - intEI_type_node, NULL); + DI3_type_node, NULL); tree void_ftype_sf_pointer_ei = build_function_type_list (void_type_node, float_pointer_node, - intEI_type_node, NULL); + V2SF3_type_node, NULL); /* Store size-3 structure operations, quad-word. */ tree void_ftype_qi_pointer_ci = build_function_type_list (void_type_node, intQI_pointer_node, - intCI_type_node, NULL); + V16QI3_type_node, NULL); tree void_ftype_hi_pointer_ci = build_function_type_list (void_type_node, intHI_pointer_node, - intCI_type_node, NULL); + V8HI3_type_node, NULL); tree void_ftype_si_pointer_ci = build_function_type_list (void_type_node, intSI_pointer_node, - intCI_type_node, NULL); + V4SI3_type_node, NULL); tree void_ftype_sf_pointer_ci = build_function_type_list (void_type_node, float_pointer_node, - intCI_type_node, NULL); + V4SF3_type_node, NULL); /* Store lane size-3 structure operations, double-word. */ tree void_ftype_qi_pointer_ei_si = build_function_type_list (void_type_node, intQI_pointer_node, - intEI_type_node, intSI_type_node, NULL); + V8QI3_type_node, intSI_type_node, NULL); tree void_ftype_hi_pointer_ei_si = build_function_type_list (void_type_node, intHI_pointer_node, - intEI_type_node, intSI_type_node, NULL); + V4HI3_type_node, intSI_type_node, NULL); tree void_ftype_si_pointer_ei_si = build_function_type_list (void_type_node, intSI_pointer_node, - intEI_type_node, intSI_type_node, NULL); + V2SI3_type_node, intSI_type_node, NULL); tree void_ftype_sf_pointer_ei_si = build_function_type_list (void_type_node, float_pointer_node, - intEI_type_node, intSI_type_node, NULL); + V2SF3_type_node, intSI_type_node, NULL); /* Store lane size-3 structure operations, quad-word. */ tree void_ftype_hi_pointer_ci_si = build_function_type_list (void_type_node, intHI_pointer_node, - intCI_type_node, intSI_type_node, NULL); + V8HI3_type_node, intSI_type_node, NULL); tree void_ftype_si_pointer_ci_si = build_function_type_list (void_type_node, intSI_pointer_node, - intCI_type_node, intSI_type_node, NULL); + V4SI3_type_node, intSI_type_node, NULL); tree void_ftype_sf_pointer_ci_si = build_function_type_list (void_type_node, float_pointer_node, - intCI_type_node, intSI_type_node, NULL); + V4SF3_type_node, intSI_type_node, NULL); /* Load size-4 structure operations, double-word. */ tree oi_ftype_const_di_pointer = - build_function_type_list (intOI_type_node, const_intDI_pointer_node, NULL); + build_function_type_list (DI4_type_node, const_intDI_pointer_node, NULL); /* Load size-4 structure operations, quad-word. */ tree xi_ftype_const_qi_pointer = - build_function_type_list (intXI_type_node, const_intQI_pointer_node, NULL); + build_function_type_list (V16QI4_type_node, const_intQI_pointer_node, NULL); tree xi_ftype_const_hi_pointer = - build_function_type_list (intXI_type_node, const_intHI_pointer_node, NULL); + build_function_type_list (V8HI4_type_node, const_intHI_pointer_node, NULL); tree xi_ftype_const_si_pointer = - build_function_type_list (intXI_type_node, const_intSI_pointer_node, NULL); + build_function_type_list (V4SI4_type_node, const_intSI_pointer_node, NULL); tree xi_ftype_const_sf_pointer = - build_function_type_list (intXI_type_node, const_float_pointer_node, NULL); + build_function_type_list (V4SF4_type_node, const_float_pointer_node, NULL); /* Load lane size-4 structure operations, double-word. */ tree oi_ftype_const_qi_pointer_oi_si = - build_function_type_list (intOI_type_node, const_intQI_pointer_node, - intOI_type_node, intSI_type_node, NULL); + build_function_type_list (V8QI4_type_node, const_intQI_pointer_node, + V8QI4_type_node, intSI_type_node, NULL); /* Load lane size-4 structure operations, quad-word. */ tree xi_ftype_const_hi_pointer_xi_si = - build_function_type_list (intXI_type_node, const_intHI_pointer_node, - intXI_type_node, intSI_type_node, NULL); + build_function_type_list (V8HI4_type_node, const_intHI_pointer_node, + V8HI4_type_node, intSI_type_node, NULL); tree xi_ftype_const_si_pointer_xi_si = - build_function_type_list (intXI_type_node, const_intSI_pointer_node, - intXI_type_node, intSI_type_node, NULL); + build_function_type_list (V4SI4_type_node, const_intSI_pointer_node, + V4SI4_type_node, intSI_type_node, NULL); tree xi_ftype_const_sf_pointer_xi_si = - build_function_type_list (intXI_type_node, const_float_pointer_node, - intXI_type_node, intSI_type_node, NULL); + build_function_type_list (V4SF4_type_node, const_float_pointer_node, + V4SF4_type_node, intSI_type_node, NULL); /* Store size-4 structure operations, double-word. */ tree void_ftype_di_pointer_oi = build_function_type_list (void_type_node, intDI_pointer_node, - intOI_type_node, NULL); + DI4_type_node, NULL); /* Store size-4 structure operations, quad-word. */ tree void_ftype_qi_pointer_xi = build_function_type_list (void_type_node, intQI_pointer_node, - intXI_type_node, NULL); + V16QI4_type_node, NULL); tree void_ftype_hi_pointer_xi = build_function_type_list (void_type_node, intHI_pointer_node, - intXI_type_node, NULL); + V8HI4_type_node, NULL); tree void_ftype_si_pointer_xi = build_function_type_list (void_type_node, intSI_pointer_node, - intXI_type_node, NULL); + V4SI4_type_node, NULL); tree void_ftype_sf_pointer_xi = build_function_type_list (void_type_node, float_pointer_node, - intXI_type_node, NULL); + V4SF4_type_node, NULL); /* Store lane size-4 structure operations, double-word. */ tree void_ftype_qi_pointer_oi_si = build_function_type_list (void_type_node, intQI_pointer_node, - intOI_type_node, intSI_type_node, NULL); + V8QI4_type_node, intSI_type_node, NULL); /* Store lane size-4 structure operations, quad-word. */ tree void_ftype_hi_pointer_xi_si = build_function_type_list (void_type_node, intHI_pointer_node, - intXI_type_node, intSI_type_node, NULL); + V8HI4_type_node, intSI_type_node, NULL); tree void_ftype_si_pointer_xi_si = build_function_type_list (void_type_node, intSI_pointer_node, - intXI_type_node, intSI_type_node, NULL); + V4SI4_type_node, intSI_type_node, NULL); tree void_ftype_sf_pointer_xi_si = build_function_type_list (void_type_node, float_pointer_node, - intXI_type_node, intSI_type_node, NULL); + V4SF4_type_node, intSI_type_node, NULL); + /* LLVM LOCAL end multi-vector types */ tree reinterp_ftype_dreg[5][5]; tree reinterp_ftype_qreg[5][5]; @@ -17466,16 +17648,62 @@ (*lang_hooks.types.register_builtin_type) (intUDI_type_node, "__builtin_neon_udi"); - (*lang_hooks.types.register_builtin_type) (intTI_type_node, - "__builtin_neon_ti"); - (*lang_hooks.types.register_builtin_type) (intEI_type_node, - "__builtin_neon_ei"); - (*lang_hooks.types.register_builtin_type) (intOI_type_node, - "__builtin_neon_oi"); - (*lang_hooks.types.register_builtin_type) (intCI_type_node, - "__builtin_neon_ci"); - (*lang_hooks.types.register_builtin_type) (intXI_type_node, - "__builtin_neon_xi"); + /* LLVM LOCAL begin multi-vector types */ + (*lang_hooks.types.register_builtin_type) (V8QI2_type_node, + "__builtin_neon_v8qi2"); + (*lang_hooks.types.register_builtin_type) (V4HI2_type_node, + "__builtin_neon_v4hi2"); + (*lang_hooks.types.register_builtin_type) (V2SI2_type_node, + "__builtin_neon_v2si2"); + (*lang_hooks.types.register_builtin_type) (DI2_type_node, + "__builtin_neon_di2"); + (*lang_hooks.types.register_builtin_type) (V2SF2_type_node, + "__builtin_neon_v2sf2"); + (*lang_hooks.types.register_builtin_type) (V8QI3_type_node, + "__builtin_neon_v8qi3"); + (*lang_hooks.types.register_builtin_type) (V4HI3_type_node, + "__builtin_neon_v4hi3"); + (*lang_hooks.types.register_builtin_type) (V2SI3_type_node, + "__builtin_neon_v2si3"); + (*lang_hooks.types.register_builtin_type) (DI3_type_node, + "__builtin_neon_di3"); + (*lang_hooks.types.register_builtin_type) (V2SF3_type_node, + "__builtin_neon_v2sf3"); + (*lang_hooks.types.register_builtin_type) (V8QI4_type_node, + "__builtin_neon_v8qi4"); + (*lang_hooks.types.register_builtin_type) (V4HI4_type_node, + "__builtin_neon_v4hi4"); + (*lang_hooks.types.register_builtin_type) (V2SI4_type_node, + "__builtin_neon_v2si4"); + (*lang_hooks.types.register_builtin_type) (DI4_type_node, + "__builtin_neon_di4"); + (*lang_hooks.types.register_builtin_type) (V2SF4_type_node, + "__builtin_neon_v2sf4"); + (*lang_hooks.types.register_builtin_type) (V16QI2_type_node, + "__builtin_neon_v16qi2"); + (*lang_hooks.types.register_builtin_type) (V8HI2_type_node, + "__builtin_neon_v8hi2"); + (*lang_hooks.types.register_builtin_type) (V4SI2_type_node, + "__builtin_neon_v4si2"); + (*lang_hooks.types.register_builtin_type) (V4SF2_type_node, + "__builtin_neon_v4sf2"); + (*lang_hooks.types.register_builtin_type) (V16QI3_type_node, + "__builtin_neon_v16qi3"); + (*lang_hooks.types.register_builtin_type) (V8HI3_type_node, + "__builtin_neon_v8hi3"); + (*lang_hooks.types.register_builtin_type) (V4SI3_type_node, + "__builtin_neon_v4si3"); + (*lang_hooks.types.register_builtin_type) (V4SF3_type_node, + "__builtin_neon_v4sf3"); + (*lang_hooks.types.register_builtin_type) (V16QI4_type_node, + "__builtin_neon_v16qi4"); + (*lang_hooks.types.register_builtin_type) (V8HI4_type_node, + "__builtin_neon_v8hi4"); + (*lang_hooks.types.register_builtin_type) (V4SI4_type_node, + "__builtin_neon_v4si4"); + (*lang_hooks.types.register_builtin_type) (V4SF4_type_node, + "__builtin_neon_v4sf4"); + /* LLVM LOCAL end multi-vector types */ /* APPLE LOCAL end 7083296 Build without warnings. */ dreg_types[0] = V8QI_type_node; @@ -18663,15 +18891,17 @@ switch (1 << j) { /* vld2q cases. */ - case T_V16QI: ftype = oi_ftype_const_qi_pointer; break; - case T_V8HI: ftype = oi_ftype_const_hi_pointer; break; - case T_V4SI: ftype = oi_ftype_const_si_pointer; break; - case T_V4SF: ftype = oi_ftype_const_sf_pointer; break; + /* LLVM LOCAL begin multi-vector types */ + case T_V16QI: ftype = oiq_ftype_const_qi_pointer; break; + case T_V8HI: ftype = oiq_ftype_const_hi_pointer; break; + case T_V4SI: ftype = oiq_ftype_const_si_pointer; break; + case T_V4SF: ftype = oiq_ftype_const_sf_pointer; break; /* vld4 cases. */ - case T_V8QI: ftype = oi_ftype_const_qi_pointer; break; - case T_V4HI: ftype = oi_ftype_const_hi_pointer; break; - case T_V2SI: ftype = oi_ftype_const_si_pointer; break; - case T_V2SF: ftype = oi_ftype_const_sf_pointer; break; + case T_V8QI: ftype = oid_ftype_const_qi_pointer; break; + case T_V4HI: ftype = oid_ftype_const_hi_pointer; break; + case T_V2SI: ftype = oid_ftype_const_si_pointer; break; + case T_V2SF: ftype = oid_ftype_const_sf_pointer; break; + /* LLVM LOCAL end multi-vector types */ case T_DI: ftype = oi_ftype_const_di_pointer; break; default: gcc_unreachable (); } @@ -18756,28 +18986,30 @@ switch (1 << j) { /* vld2q_lane cases. */ + /* LLVM LOCAL begin multi-vector types */ case T_V8HI: - ftype = oi_ftype_const_hi_pointer_oi_si; + ftype = oiq_ftype_const_hi_pointer_oiq_si; break; case T_V4SI: - ftype = oi_ftype_const_si_pointer_oi_si; + ftype = oiq_ftype_const_si_pointer_oiq_si; break; case T_V4SF: - ftype = oi_ftype_const_sf_pointer_oi_si; + ftype = oiq_ftype_const_sf_pointer_oiq_si; break; /* vld4_lane cases. */ case T_V8QI: ftype = oi_ftype_const_qi_pointer_oi_si; break; case T_V4HI: - ftype = oi_ftype_const_hi_pointer_oi_si; + ftype = oid_ftype_const_hi_pointer_oid_si; break; case T_V2SI: - ftype = oi_ftype_const_si_pointer_oi_si; + ftype = oid_ftype_const_si_pointer_oid_si; break; case T_V2SF: - ftype = oi_ftype_const_sf_pointer_oi_si; + ftype = oid_ftype_const_sf_pointer_oid_si; break; + /* LLVM LOCAL end multi-vector types */ default: gcc_unreachable (); } @@ -18859,15 +19091,17 @@ switch (1 << j) { /* vst2q cases. */ - case T_V16QI: ftype = void_ftype_qi_pointer_oi; break; - case T_V8HI: ftype = void_ftype_hi_pointer_oi; break; - case T_V4SI: ftype = void_ftype_si_pointer_oi; break; - case T_V4SF: ftype = void_ftype_sf_pointer_oi; break; + /* LLVM LOCAL begin multi-vector types */ + case T_V16QI: ftype = void_ftype_qi_pointer_oiq; break; + case T_V8HI: ftype = void_ftype_hi_pointer_oiq; break; + case T_V4SI: ftype = void_ftype_si_pointer_oiq; break; + case T_V4SF: ftype = void_ftype_sf_pointer_oiq; break; /* vst4 cases. */ - case T_V8QI: ftype = void_ftype_qi_pointer_oi; break; - case T_V4HI: ftype = void_ftype_hi_pointer_oi; break; - case T_V2SI: ftype = void_ftype_si_pointer_oi; break; - case T_V2SF: ftype = void_ftype_sf_pointer_oi; break; + case T_V8QI: ftype = void_ftype_qi_pointer_oid; break; + case T_V4HI: ftype = void_ftype_hi_pointer_oid; break; + case T_V2SI: ftype = void_ftype_si_pointer_oid; break; + case T_V2SF: ftype = void_ftype_sf_pointer_oid; break; + /* LLVM LOCAL end multi-vector types */ case T_DI: ftype = void_ftype_di_pointer_oi; break; default: gcc_unreachable (); } @@ -18952,28 +19186,30 @@ switch (1 << j) { /* vst2q_lane cases. */ + /* LLVM LOCAL begin multi-vector types */ case T_V8HI: - ftype = void_ftype_hi_pointer_oi_si; + ftype = void_ftype_hi_pointer_oiq_si; break; case T_V4SI: - ftype = void_ftype_si_pointer_oi_si; + ftype = void_ftype_si_pointer_oiq_si; break; case T_V4SF: - ftype = void_ftype_sf_pointer_oi_si; + ftype = void_ftype_sf_pointer_oiq_si; break; /* vst4_lane cases. */ case T_V8QI: ftype = void_ftype_qi_pointer_oi_si; break; case T_V4HI: - ftype = void_ftype_hi_pointer_oi_si; + ftype = void_ftype_hi_pointer_oid_si; break; case T_V2SI: - ftype = void_ftype_si_pointer_oi_si; + ftype = void_ftype_si_pointer_oid_si; break; case T_V2SF: - ftype = void_ftype_sf_pointer_oi_si; + ftype = void_ftype_sf_pointer_oid_si; break; + /* LLVM LOCAL end multi-vector types */ default: gcc_unreachable (); } Modified: llvm-gcc-4.2/trunk/gcc/config/arm/arm_neon.h URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/arm/arm_neon.h?rev=77283&r1=77282&r2=77283&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/config/arm/arm_neon.h (original) +++ llvm-gcc-4.2/trunk/gcc/config/arm/arm_neon.h Mon Jul 27 19:32:28 2009 @@ -3253,55 +3253,55 @@ #define vtbl2_s8(__a, __b) \ ({ \ - union { int8x8x2_t __i; __builtin_neon_ti __o; } __au = { __a }; \ + union { int8x8x2_t __i; __builtin_neon_v8qi2 __o; } __au = { __a }; \ (int8x8_t)__builtin_neon_vtbl2v8qi (__au.__o, __b); \ }) #define vtbl2_u8(__a, __b) \ ({ \ - union { uint8x8x2_t __i; __builtin_neon_ti __o; } __au = { __a }; \ + union { uint8x8x2_t __i; __builtin_neon_v8qi2 __o; } __au = { __a }; \ (uint8x8_t)__builtin_neon_vtbl2v8qi (__au.__o, __b); \ }) #define vtbl2_p8(__a, __b) \ ({ \ - union { poly8x8x2_t __i; __builtin_neon_ti __o; } __au = { __a }; \ + union { poly8x8x2_t __i; __builtin_neon_v8qi2 __o; } __au = { __a }; \ (poly8x8_t)__builtin_neon_vtbl2v8qi (__au.__o, __b); \ }) #define vtbl3_s8(__a, __b) \ ({ \ - union { int8x8x3_t __i; __builtin_neon_ei __o; } __au = { __a }; \ + union { int8x8x3_t __i; __builtin_neon_v8qi3 __o; } __au = { __a }; \ (int8x8_t)__builtin_neon_vtbl3v8qi (__au.__o, __b); \ }) #define vtbl3_u8(__a, __b) \ ({ \ - union { uint8x8x3_t __i; __builtin_neon_ei __o; } __au = { __a }; \ + union { uint8x8x3_t __i; __builtin_neon_v8qi3 __o; } __au = { __a }; \ (uint8x8_t)__builtin_neon_vtbl3v8qi (__au.__o, __b); \ }) #define vtbl3_p8(__a, __b) \ ({ \ - union { poly8x8x3_t __i; __builtin_neon_ei __o; } __au = { __a }; \ + union { poly8x8x3_t __i; __builtin_neon_v8qi3 __o; } __au = { __a }; \ (poly8x8_t)__builtin_neon_vtbl3v8qi (__au.__o, __b); \ }) #define vtbl4_s8(__a, __b) \ ({ \ - union { int8x8x4_t __i; __builtin_neon_oi __o; } __au = { __a }; \ + union { int8x8x4_t __i; __builtin_neon_v8qi4 __o; } __au = { __a }; \ (int8x8_t)__builtin_neon_vtbl4v8qi (__au.__o, __b); \ }) #define vtbl4_u8(__a, __b) \ ({ \ - union { uint8x8x4_t __i; __builtin_neon_oi __o; } __au = { __a }; \ + union { uint8x8x4_t __i; __builtin_neon_v8qi4 __o; } __au = { __a }; \ (uint8x8_t)__builtin_neon_vtbl4v8qi (__au.__o, __b); \ }) #define vtbl4_p8(__a, __b) \ ({ \ - union { poly8x8x4_t __i; __builtin_neon_oi __o; } __au = { __a }; \ + union { poly8x8x4_t __i; __builtin_neon_v8qi4 __o; } __au = { __a }; \ (poly8x8_t)__builtin_neon_vtbl4v8qi (__au.__o, __b); \ }) @@ -3316,55 +3316,55 @@ #define vtbx2_s8(__a, __b, __c) \ ({ \ - union { int8x8x2_t __i; __builtin_neon_ti __o; } __bu = { __b }; \ + union { int8x8x2_t __i; __builtin_neon_v8qi2 __o; } __bu = { __b }; \ (int8x8_t)__builtin_neon_vtbx2v8qi (__a, __bu.__o, __c); \ }) #define vtbx2_u8(__a, __b, __c) \ ({ \ - union { uint8x8x2_t __i; __builtin_neon_ti __o; } __bu = { __b }; \ + union { uint8x8x2_t __i; __builtin_neon_v8qi2 __o; } __bu = { __b }; \ (uint8x8_t)__builtin_neon_vtbx2v8qi (__a, __bu.__o, __c); \ }) #define vtbx2_p8(__a, __b, __c) \ ({ \ - union { poly8x8x2_t __i; __builtin_neon_ti __o; } __bu = { __b }; \ + union { poly8x8x2_t __i; __builtin_neon_v8qi2 __o; } __bu = { __b }; \ (poly8x8_t)__builtin_neon_vtbx2v8qi (__a, __bu.__o, __c); \ }) #define vtbx3_s8(__a, __b, __c) \ ({ \ - union { int8x8x3_t __i; __builtin_neon_ei __o; } __bu = { __b }; \ + union { int8x8x3_t __i; __builtin_neon_v8qi3 __o; } __bu = { __b }; \ (int8x8_t)__builtin_neon_vtbx3v8qi (__a, __bu.__o, __c); \ }) #define vtbx3_u8(__a, __b, __c) \ ({ \ - union { uint8x8x3_t __i; __builtin_neon_ei __o; } __bu = { __b }; \ + union { uint8x8x3_t __i; __builtin_neon_v8qi3 __o; } __bu = { __b }; \ (uint8x8_t)__builtin_neon_vtbx3v8qi (__a, __bu.__o, __c); \ }) #define vtbx3_p8(__a, __b, __c) \ ({ \ - union { poly8x8x3_t __i; __builtin_neon_ei __o; } __bu = { __b }; \ + union { poly8x8x3_t __i; __builtin_neon_v8qi3 __o; } __bu = { __b }; \ (poly8x8_t)__builtin_neon_vtbx3v8qi (__a, __bu.__o, __c); \ }) #define vtbx4_s8(__a, __b, __c) \ ({ \ - union { int8x8x4_t __i; __builtin_neon_oi __o; } __bu = { __b }; \ + union { int8x8x4_t __i; __builtin_neon_v8qi4 __o; } __bu = { __b }; \ (int8x8_t)__builtin_neon_vtbx4v8qi (__a, __bu.__o, __c); \ }) #define vtbx4_u8(__a, __b, __c) \ ({ \ - union { uint8x8x4_t __i; __builtin_neon_oi __o; } __bu = { __b }; \ + union { uint8x8x4_t __i; __builtin_neon_v8qi4 __o; } __bu = { __b }; \ (uint8x8_t)__builtin_neon_vtbx4v8qi (__a, __bu.__o, __c); \ }) #define vtbx4_p8(__a, __b, __c) \ ({ \ - union { poly8x8x4_t __i; __builtin_neon_oi __o; } __bu = { __b }; \ + union { poly8x8x4_t __i; __builtin_neon_v8qi4 __o; } __bu = { __b }; \ (poly8x8_t)__builtin_neon_vtbx4v8qi (__a, __bu.__o, __c); \ }) @@ -4654,1642 +4654,1642 @@ #define vld2_s8(__a) \ ({ \ - union { int8x8x2_t __i; __builtin_neon_ti __o; } __rv; \ + union { int8x8x2_t __i; __builtin_neon_v8qi2 __o; } __rv; \ __rv.__o = __builtin_neon_vld2v8qi (__a); \ __rv.__i; \ }) #define vld2_s16(__a) \ ({ \ - union { int16x4x2_t __i; __builtin_neon_ti __o; } __rv; \ + union { int16x4x2_t __i; __builtin_neon_v4hi2 __o; } __rv; \ __rv.__o = __builtin_neon_vld2v4hi (__a); \ __rv.__i; \ }) #define vld2_s32(__a) \ ({ \ - union { int32x2x2_t __i; __builtin_neon_ti __o; } __rv; \ + union { int32x2x2_t __i; __builtin_neon_v2si2 __o; } __rv; \ __rv.__o = __builtin_neon_vld2v2si (__a); \ __rv.__i; \ }) #define vld2_f32(__a) \ ({ \ - union { float32x2x2_t __i; __builtin_neon_ti __o; } __rv; \ + union { float32x2x2_t __i; __builtin_neon_v2sf2 __o; } __rv; \ __rv.__o = __builtin_neon_vld2v2sf (__a); \ __rv.__i; \ }) #define vld2_u8(__a) \ ({ \ - union { uint8x8x2_t __i; __builtin_neon_ti __o; } __rv; \ + union { uint8x8x2_t __i; __builtin_neon_v8qi2 __o; } __rv; \ __rv.__o = __builtin_neon_vld2v8qi (__a); \ __rv.__i; \ }) #define vld2_u16(__a) \ ({ \ - union { uint16x4x2_t __i; __builtin_neon_ti __o; } __rv; \ + union { uint16x4x2_t __i; __builtin_neon_v4hi2 __o; } __rv; \ __rv.__o = __builtin_neon_vld2v4hi (__a); \ __rv.__i; \ }) #define vld2_u32(__a) \ ({ \ - union { uint32x2x2_t __i; __builtin_neon_ti __o; } __rv; \ + union { uint32x2x2_t __i; __builtin_neon_v2si2 __o; } __rv; \ __rv.__o = __builtin_neon_vld2v2si (__a); \ __rv.__i; \ }) #define vld2_p8(__a) \ ({ \ - union { poly8x8x2_t __i; __builtin_neon_ti __o; } __rv; \ + union { poly8x8x2_t __i; __builtin_neon_v8qi2 __o; } __rv; \ __rv.__o = __builtin_neon_vld2v8qi (__a); \ __rv.__i; \ }) #define vld2_p16(__a) \ ({ \ - union { poly16x4x2_t __i; __builtin_neon_ti __o; } __rv; \ + union { poly16x4x2_t __i; __builtin_neon_v4hi2 __o; } __rv; \ __rv.__o = __builtin_neon_vld2v4hi (__a); \ __rv.__i; \ }) #define vld2_s64(__a) \ ({ \ - union { int64x1x2_t __i; __builtin_neon_ti __o; } __rv; \ + union { int64x1x2_t __i; __builtin_neon_di2 __o; } __rv; \ __rv.__o = __builtin_neon_vld2di (__a); \ __rv.__i; \ }) #define vld2_u64(__a) \ ({ \ - union { uint64x1x2_t __i; __builtin_neon_ti __o; } __rv; \ + union { uint64x1x2_t __i; __builtin_neon_di2 __o; } __rv; \ __rv.__o = __builtin_neon_vld2di (__a); \ __rv.__i; \ }) #define vld2q_s8(__a) \ ({ \ - union { int8x16x2_t __i; __builtin_neon_oi __o; } __rv; \ + union { int8x16x2_t __i; __builtin_neon_v16qi2 __o; } __rv; \ __rv.__o = __builtin_neon_vld2v16qi (__a); \ __rv.__i; \ }) #define vld2q_s16(__a) \ ({ \ - union { int16x8x2_t __i; __builtin_neon_oi __o; } __rv; \ + union { int16x8x2_t __i; __builtin_neon_v8hi2 __o; } __rv; \ __rv.__o = __builtin_neon_vld2v8hi (__a); \ __rv.__i; \ }) #define vld2q_s32(__a) \ ({ \ - union { int32x4x2_t __i; __builtin_neon_oi __o; } __rv; \ + union { int32x4x2_t __i; __builtin_neon_v4si2 __o; } __rv; \ __rv.__o = __builtin_neon_vld2v4si (__a); \ __rv.__i; \ }) #define vld2q_f32(__a) \ ({ \ - union { float32x4x2_t __i; __builtin_neon_oi __o; } __rv; \ + union { float32x4x2_t __i; __builtin_neon_v4sf2 __o; } __rv; \ __rv.__o = __builtin_neon_vld2v4sf (__a); \ __rv.__i; \ }) #define vld2q_u8(__a) \ ({ \ - union { uint8x16x2_t __i; __builtin_neon_oi __o; } __rv; \ + union { uint8x16x2_t __i; __builtin_neon_v16qi2 __o; } __rv; \ __rv.__o = __builtin_neon_vld2v16qi (__a); \ __rv.__i; \ }) #define vld2q_u16(__a) \ ({ \ - union { uint16x8x2_t __i; __builtin_neon_oi __o; } __rv; \ + union { uint16x8x2_t __i; __builtin_neon_v8hi2 __o; } __rv; \ __rv.__o = __builtin_neon_vld2v8hi (__a); \ __rv.__i; \ }) #define vld2q_u32(__a) \ ({ \ - union { uint32x4x2_t __i; __builtin_neon_oi __o; } __rv; \ + union { uint32x4x2_t __i; __builtin_neon_v4si2 __o; } __rv; \ __rv.__o = __builtin_neon_vld2v4si (__a); \ __rv.__i; \ }) #define vld2q_p8(__a) \ ({ \ - union { poly8x16x2_t __i; __builtin_neon_oi __o; } __rv; \ + union { poly8x16x2_t __i; __builtin_neon_v16qi2 __o; } __rv; \ __rv.__o = __builtin_neon_vld2v16qi (__a); \ __rv.__i; \ }) #define vld2q_p16(__a) \ ({ \ - union { poly16x8x2_t __i; __builtin_neon_oi __o; } __rv; \ + union { poly16x8x2_t __i; __builtin_neon_v8hi2 __o; } __rv; \ __rv.__o = __builtin_neon_vld2v8hi (__a); \ __rv.__i; \ }) #define vld2_lane_s8(__a, __b, __c) \ ({ \ - union { int8x8x2_t __i; __builtin_neon_ti __o; } __bu = { __b }; \ - union { int8x8x2_t __i; __builtin_neon_ti __o; } __rv; \ + union { int8x8x2_t __i; __builtin_neon_v8qi2 __o; } __bu = { __b }; \ + union { int8x8x2_t __i; __builtin_neon_v8qi2 __o; } __rv; \ __rv.__o = __builtin_neon_vld2_lanev8qi (__a, __bu.__o, __c); \ __rv.__i; \ }) #define vld2_lane_s16(__a, __b, __c) \ ({ \ - union { int16x4x2_t __i; __builtin_neon_ti __o; } __bu = { __b }; \ - union { int16x4x2_t __i; __builtin_neon_ti __o; } __rv; \ + union { int16x4x2_t __i; __builtin_neon_v4hi2 __o; } __bu = { __b }; \ + union { int16x4x2_t __i; __builtin_neon_v4hi2 __o; } __rv; \ __rv.__o = __builtin_neon_vld2_lanev4hi (__a, __bu.__o, __c); \ __rv.__i; \ }) #define vld2_lane_s32(__a, __b, __c) \ ({ \ - union { int32x2x2_t __i; __builtin_neon_ti __o; } __bu = { __b }; \ - union { int32x2x2_t __i; __builtin_neon_ti __o; } __rv; \ + union { int32x2x2_t __i; __builtin_neon_v2si2 __o; } __bu = { __b }; \ + union { int32x2x2_t __i; __builtin_neon_v2si2 __o; } __rv; \ __rv.__o = __builtin_neon_vld2_lanev2si (__a, __bu.__o, __c); \ __rv.__i; \ }) #define vld2_lane_f32(__a, __b, __c) \ ({ \ - union { float32x2x2_t __i; __builtin_neon_ti __o; } __bu = { __b }; \ - union { float32x2x2_t __i; __builtin_neon_ti __o; } __rv; \ + union { float32x2x2_t __i; __builtin_neon_v2sf2 __o; } __bu = { __b }; \ + union { float32x2x2_t __i; __builtin_neon_v2sf2 __o; } __rv; \ __rv.__o = __builtin_neon_vld2_lanev2sf (__a, __bu.__o, __c); \ __rv.__i; \ }) #define vld2_lane_u8(__a, __b, __c) \ ({ \ - union { uint8x8x2_t __i; __builtin_neon_ti __o; } __bu = { __b }; \ - union { uint8x8x2_t __i; __builtin_neon_ti __o; } __rv; \ + union { uint8x8x2_t __i; __builtin_neon_v8qi2 __o; } __bu = { __b }; \ + union { uint8x8x2_t __i; __builtin_neon_v8qi2 __o; } __rv; \ __rv.__o = __builtin_neon_vld2_lanev8qi (__a, __bu.__o, __c); \ __rv.__i; \ }) #define vld2_lane_u16(__a, __b, __c) \ ({ \ - union { uint16x4x2_t __i; __builtin_neon_ti __o; } __bu = { __b }; \ - union { uint16x4x2_t __i; __builtin_neon_ti __o; } __rv; \ + union { uint16x4x2_t __i; __builtin_neon_v4hi2 __o; } __bu = { __b }; \ + union { uint16x4x2_t __i; __builtin_neon_v4hi2 __o; } __rv; \ __rv.__o = __builtin_neon_vld2_lanev4hi (__a, __bu.__o, __c); \ __rv.__i; \ }) #define vld2_lane_u32(__a, __b, __c) \ ({ \ - union { uint32x2x2_t __i; __builtin_neon_ti __o; } __bu = { __b }; \ - union { uint32x2x2_t __i; __builtin_neon_ti __o; } __rv; \ + union { uint32x2x2_t __i; __builtin_neon_v2si2 __o; } __bu = { __b }; \ + union { uint32x2x2_t __i; __builtin_neon_v2si2 __o; } __rv; \ __rv.__o = __builtin_neon_vld2_lanev2si (__a, __bu.__o, __c); \ __rv.__i; \ }) #define vld2_lane_p8(__a, __b, __c) \ ({ \ - union { poly8x8x2_t __i; __builtin_neon_ti __o; } __bu = { __b }; \ - union { poly8x8x2_t __i; __builtin_neon_ti __o; } __rv; \ + union { poly8x8x2_t __i; __builtin_neon_v8qi2 __o; } __bu = { __b }; \ + union { poly8x8x2_t __i; __builtin_neon_v8qi2 __o; } __rv; \ __rv.__o = __builtin_neon_vld2_lanev8qi (__a, __bu.__o, __c); \ __rv.__i; \ }) #define vld2_lane_p16(__a, __b, __c) \ ({ \ - union { poly16x4x2_t __i; __builtin_neon_ti __o; } __bu = { __b }; \ - union { poly16x4x2_t __i; __builtin_neon_ti __o; } __rv; \ + union { poly16x4x2_t __i; __builtin_neon_v4hi2 __o; } __bu = { __b }; \ + union { poly16x4x2_t __i; __builtin_neon_v4hi2 __o; } __rv; \ __rv.__o = __builtin_neon_vld2_lanev4hi (__a, __bu.__o, __c); \ __rv.__i; \ }) #define vld2q_lane_s16(__a, __b, __c) \ ({ \ - union { int16x8x2_t __i; __builtin_neon_oi __o; } __bu = { __b }; \ - union { int16x8x2_t __i; __builtin_neon_oi __o; } __rv; \ + union { int16x8x2_t __i; __builtin_neon_v8hi2 __o; } __bu = { __b }; \ + union { int16x8x2_t __i; __builtin_neon_v8hi2 __o; } __rv; \ __rv.__o = __builtin_neon_vld2_lanev8hi (__a, __bu.__o, __c); \ __rv.__i; \ }) #define vld2q_lane_s32(__a, __b, __c) \ ({ \ - union { int32x4x2_t __i; __builtin_neon_oi __o; } __bu = { __b }; \ - union { int32x4x2_t __i; __builtin_neon_oi __o; } __rv; \ + union { int32x4x2_t __i; __builtin_neon_v4si2 __o; } __bu = { __b }; \ + union { int32x4x2_t __i; __builtin_neon_v4si2 __o; } __rv; \ __rv.__o = __builtin_neon_vld2_lanev4si (__a, __bu.__o, __c); \ __rv.__i; \ }) #define vld2q_lane_f32(__a, __b, __c) \ ({ \ - union { float32x4x2_t __i; __builtin_neon_oi __o; } __bu = { __b }; \ - union { float32x4x2_t __i; __builtin_neon_oi __o; } __rv; \ + union { float32x4x2_t __i; __builtin_neon_v4sf2 __o; } __bu = { __b }; \ + union { float32x4x2_t __i; __builtin_neon_v4sf2 __o; } __rv; \ __rv.__o = __builtin_neon_vld2_lanev4sf (__a, __bu.__o, __c); \ __rv.__i; \ }) #define vld2q_lane_u16(__a, __b, __c) \ ({ \ - union { uint16x8x2_t __i; __builtin_neon_oi __o; } __bu = { __b }; \ - union { uint16x8x2_t __i; __builtin_neon_oi __o; } __rv; \ + union { uint16x8x2_t __i; __builtin_neon_v8hi2 __o; } __bu = { __b }; \ + union { uint16x8x2_t __i; __builtin_neon_v8hi2 __o; } __rv; \ __rv.__o = __builtin_neon_vld2_lanev8hi (__a, __bu.__o, __c); \ __rv.__i; \ }) #define vld2q_lane_u32(__a, __b, __c) \ ({ \ - union { uint32x4x2_t __i; __builtin_neon_oi __o; } __bu = { __b }; \ - union { uint32x4x2_t __i; __builtin_neon_oi __o; } __rv; \ + union { uint32x4x2_t __i; __builtin_neon_v4si2 __o; } __bu = { __b }; \ + union { uint32x4x2_t __i; __builtin_neon_v4si2 __o; } __rv; \ __rv.__o = __builtin_neon_vld2_lanev4si (__a, __bu.__o, __c); \ __rv.__i; \ }) #define vld2q_lane_p16(__a, __b, __c) \ ({ \ - union { poly16x8x2_t __i; __builtin_neon_oi __o; } __bu = { __b }; \ - union { poly16x8x2_t __i; __builtin_neon_oi __o; } __rv; \ + union { poly16x8x2_t __i; __builtin_neon_v8hi2 __o; } __bu = { __b }; \ + union { poly16x8x2_t __i; __builtin_neon_v8hi2 __o; } __rv; \ __rv.__o = __builtin_neon_vld2_lanev8hi (__a, __bu.__o, __c); \ __rv.__i; \ }) #define vld2_dup_s8(__a) \ ({ \ - union { int8x8x2_t __i; __builtin_neon_ti __o; } __rv; \ + union { int8x8x2_t __i; __builtin_neon_v8qi2 __o; } __rv; \ __rv.__o = __builtin_neon_vld2_dupv8qi (__a); \ __rv.__i; \ }) #define vld2_dup_s16(__a) \ ({ \ - union { int16x4x2_t __i; __builtin_neon_ti __o; } __rv; \ + union { int16x4x2_t __i; __builtin_neon_v4hi2 __o; } __rv; \ __rv.__o = __builtin_neon_vld2_dupv4hi (__a); \ __rv.__i; \ }) #define vld2_dup_s32(__a) \ ({ \ - union { int32x2x2_t __i; __builtin_neon_ti __o; } __rv; \ + union { int32x2x2_t __i; __builtin_neon_v2si2 __o; } __rv; \ __rv.__o = __builtin_neon_vld2_dupv2si (__a); \ __rv.__i; \ }) #define vld2_dup_f32(__a) \ ({ \ - union { float32x2x2_t __i; __builtin_neon_ti __o; } __rv; \ + union { float32x2x2_t __i; __builtin_neon_v2sf2 __o; } __rv; \ __rv.__o = __builtin_neon_vld2_dupv2sf (__a); \ __rv.__i; \ }) #define vld2_dup_u8(__a) \ ({ \ - union { uint8x8x2_t __i; __builtin_neon_ti __o; } __rv; \ + union { uint8x8x2_t __i; __builtin_neon_v8qi2 __o; } __rv; \ __rv.__o = __builtin_neon_vld2_dupv8qi (__a); \ __rv.__i; \ }) #define vld2_dup_u16(__a) \ ({ \ - union { uint16x4x2_t __i; __builtin_neon_ti __o; } __rv; \ + union { uint16x4x2_t __i; __builtin_neon_v4hi2 __o; } __rv; \ __rv.__o = __builtin_neon_vld2_dupv4hi (__a); \ __rv.__i; \ }) #define vld2_dup_u32(__a) \ ({ \ - union { uint32x2x2_t __i; __builtin_neon_ti __o; } __rv; \ + union { uint32x2x2_t __i; __builtin_neon_v2si2 __o; } __rv; \ __rv.__o = __builtin_neon_vld2_dupv2si (__a); \ __rv.__i; \ }) #define vld2_dup_p8(__a) \ ({ \ - union { poly8x8x2_t __i; __builtin_neon_ti __o; } __rv; \ + union { poly8x8x2_t __i; __builtin_neon_v8qi2 __o; } __rv; \ __rv.__o = __builtin_neon_vld2_dupv8qi (__a); \ __rv.__i; \ }) #define vld2_dup_p16(__a) \ ({ \ - union { poly16x4x2_t __i; __builtin_neon_ti __o; } __rv; \ + union { poly16x4x2_t __i; __builtin_neon_v4hi2 __o; } __rv; \ __rv.__o = __builtin_neon_vld2_dupv4hi (__a); \ __rv.__i; \ }) #define vld2_dup_s64(__a) \ ({ \ - union { int64x1x2_t __i; __builtin_neon_ti __o; } __rv; \ + union { int64x1x2_t __i; __builtin_neon_di2 __o; } __rv; \ __rv.__o = __builtin_neon_vld2_dupdi (__a); \ __rv.__i; \ }) #define vld2_dup_u64(__a) \ ({ \ - union { uint64x1x2_t __i; __builtin_neon_ti __o; } __rv; \ + union { uint64x1x2_t __i; __builtin_neon_di2 __o; } __rv; \ __rv.__o = __builtin_neon_vld2_dupdi (__a); \ __rv.__i; \ }) #define vst2_s8(__a, __b) \ ({ \ - union { int8x8x2_t __i; __builtin_neon_ti __o; } __bu = { __b }; \ + union { int8x8x2_t __i; __builtin_neon_v8qi2 __o; } __bu = { __b }; \ __builtin_neon_vst2v8qi (__a, __bu.__o); \ }) #define vst2_s16(__a, __b) \ ({ \ - union { int16x4x2_t __i; __builtin_neon_ti __o; } __bu = { __b }; \ + union { int16x4x2_t __i; __builtin_neon_v4hi2 __o; } __bu = { __b }; \ __builtin_neon_vst2v4hi (__a, __bu.__o); \ }) #define vst2_s32(__a, __b) \ ({ \ - union { int32x2x2_t __i; __builtin_neon_ti __o; } __bu = { __b }; \ + union { int32x2x2_t __i; __builtin_neon_v2si2 __o; } __bu = { __b }; \ __builtin_neon_vst2v2si (__a, __bu.__o); \ }) #define vst2_f32(__a, __b) \ ({ \ - union { float32x2x2_t __i; __builtin_neon_ti __o; } __bu = { __b }; \ + union { float32x2x2_t __i; __builtin_neon_v2sf2 __o; } __bu = { __b }; \ __builtin_neon_vst2v2sf (__a, __bu.__o); \ }) #define vst2_u8(__a, __b) \ ({ \ - union { uint8x8x2_t __i; __builtin_neon_ti __o; } __bu = { __b }; \ + union { uint8x8x2_t __i; __builtin_neon_v8qi2 __o; } __bu = { __b }; \ __builtin_neon_vst2v8qi (__a, __bu.__o); \ }) #define vst2_u16(__a, __b) \ ({ \ - union { uint16x4x2_t __i; __builtin_neon_ti __o; } __bu = { __b }; \ + union { uint16x4x2_t __i; __builtin_neon_v4hi2 __o; } __bu = { __b }; \ __builtin_neon_vst2v4hi (__a, __bu.__o); \ }) #define vst2_u32(__a, __b) \ ({ \ - union { uint32x2x2_t __i; __builtin_neon_ti __o; } __bu = { __b }; \ + union { uint32x2x2_t __i; __builtin_neon_v2si2 __o; } __bu = { __b }; \ __builtin_neon_vst2v2si (__a, __bu.__o); \ }) #define vst2_p8(__a, __b) \ ({ \ - union { poly8x8x2_t __i; __builtin_neon_ti __o; } __bu = { __b }; \ + union { poly8x8x2_t __i; __builtin_neon_v8qi2 __o; } __bu = { __b }; \ __builtin_neon_vst2v8qi (__a, __bu.__o); \ }) #define vst2_p16(__a, __b) \ ({ \ - union { poly16x4x2_t __i; __builtin_neon_ti __o; } __bu = { __b }; \ + union { poly16x4x2_t __i; __builtin_neon_v4hi2 __o; } __bu = { __b }; \ __builtin_neon_vst2v4hi (__a, __bu.__o); \ }) #define vst2_s64(__a, __b) \ ({ \ - union { int64x1x2_t __i; __builtin_neon_ti __o; } __bu = { __b }; \ + union { int64x1x2_t __i; __builtin_neon_di2 __o; } __bu = { __b }; \ __builtin_neon_vst2di (__a, __bu.__o); \ }) #define vst2_u64(__a, __b) \ ({ \ - union { uint64x1x2_t __i; __builtin_neon_ti __o; } __bu = { __b }; \ + union { uint64x1x2_t __i; __builtin_neon_di2 __o; } __bu = { __b }; \ __builtin_neon_vst2di (__a, __bu.__o); \ }) #define vst2q_s8(__a, __b) \ ({ \ - union { int8x16x2_t __i; __builtin_neon_oi __o; } __bu = { __b }; \ + union { int8x16x2_t __i; __builtin_neon_v16qi2 __o; } __bu = { __b }; \ __builtin_neon_vst2v16qi (__a, __bu.__o); \ }) #define vst2q_s16(__a, __b) \ ({ \ - union { int16x8x2_t __i; __builtin_neon_oi __o; } __bu = { __b }; \ + union { int16x8x2_t __i; __builtin_neon_v8hi2 __o; } __bu = { __b }; \ __builtin_neon_vst2v8hi (__a, __bu.__o); \ }) #define vst2q_s32(__a, __b) \ ({ \ - union { int32x4x2_t __i; __builtin_neon_oi __o; } __bu = { __b }; \ + union { int32x4x2_t __i; __builtin_neon_v4si2 __o; } __bu = { __b }; \ __builtin_neon_vst2v4si (__a, __bu.__o); \ }) #define vst2q_f32(__a, __b) \ ({ \ - union { float32x4x2_t __i; __builtin_neon_oi __o; } __bu = { __b }; \ + union { float32x4x2_t __i; __builtin_neon_v4sf2 __o; } __bu = { __b }; \ __builtin_neon_vst2v4sf (__a, __bu.__o); \ }) #define vst2q_u8(__a, __b) \ ({ \ - union { uint8x16x2_t __i; __builtin_neon_oi __o; } __bu = { __b }; \ + union { uint8x16x2_t __i; __builtin_neon_v16qi2 __o; } __bu = { __b }; \ __builtin_neon_vst2v16qi (__a, __bu.__o); \ }) #define vst2q_u16(__a, __b) \ ({ \ - union { uint16x8x2_t __i; __builtin_neon_oi __o; } __bu = { __b }; \ + union { uint16x8x2_t __i; __builtin_neon_v8hi2 __o; } __bu = { __b }; \ __builtin_neon_vst2v8hi (__a, __bu.__o); \ }) #define vst2q_u32(__a, __b) \ ({ \ - union { uint32x4x2_t __i; __builtin_neon_oi __o; } __bu = { __b }; \ + union { uint32x4x2_t __i; __builtin_neon_v4si2 __o; } __bu = { __b }; \ __builtin_neon_vst2v4si (__a, __bu.__o); \ }) #define vst2q_p8(__a, __b) \ ({ \ - union { poly8x16x2_t __i; __builtin_neon_oi __o; } __bu = { __b }; \ + union { poly8x16x2_t __i; __builtin_neon_v16qi2 __o; } __bu = { __b }; \ __builtin_neon_vst2v16qi (__a, __bu.__o); \ }) #define vst2q_p16(__a, __b) \ ({ \ - union { poly16x8x2_t __i; __builtin_neon_oi __o; } __bu = { __b }; \ + union { poly16x8x2_t __i; __builtin_neon_v8hi2 __o; } __bu = { __b }; \ __builtin_neon_vst2v8hi (__a, __bu.__o); \ }) #define vst2_lane_s8(__a, __b, __c) \ ({ \ - union { int8x8x2_t __i; __builtin_neon_ti __o; } __bu = { __b }; \ + union { int8x8x2_t __i; __builtin_neon_v8qi2 __o; } __bu = { __b }; \ __builtin_neon_vst2_lanev8qi (__a, __bu.__o, __c); \ }) #define vst2_lane_s16(__a, __b, __c) \ ({ \ - union { int16x4x2_t __i; __builtin_neon_ti __o; } __bu = { __b }; \ + union { int16x4x2_t __i; __builtin_neon_v4hi2 __o; } __bu = { __b }; \ __builtin_neon_vst2_lanev4hi (__a, __bu.__o, __c); \ }) #define vst2_lane_s32(__a, __b, __c) \ ({ \ - union { int32x2x2_t __i; __builtin_neon_ti __o; } __bu = { __b }; \ + union { int32x2x2_t __i; __builtin_neon_v2si2 __o; } __bu = { __b }; \ __builtin_neon_vst2_lanev2si (__a, __bu.__o, __c); \ }) #define vst2_lane_f32(__a, __b, __c) \ ({ \ - union { float32x2x2_t __i; __builtin_neon_ti __o; } __bu = { __b }; \ + union { float32x2x2_t __i; __builtin_neon_v2sf2 __o; } __bu = { __b }; \ __builtin_neon_vst2_lanev2sf (__a, __bu.__o, __c); \ }) #define vst2_lane_u8(__a, __b, __c) \ ({ \ - union { uint8x8x2_t __i; __builtin_neon_ti __o; } __bu = { __b }; \ + union { uint8x8x2_t __i; __builtin_neon_v8qi2 __o; } __bu = { __b }; \ __builtin_neon_vst2_lanev8qi (__a, __bu.__o, __c); \ }) #define vst2_lane_u16(__a, __b, __c) \ ({ \ - union { uint16x4x2_t __i; __builtin_neon_ti __o; } __bu = { __b }; \ + union { uint16x4x2_t __i; __builtin_neon_v4hi2 __o; } __bu = { __b }; \ __builtin_neon_vst2_lanev4hi (__a, __bu.__o, __c); \ }) #define vst2_lane_u32(__a, __b, __c) \ ({ \ - union { uint32x2x2_t __i; __builtin_neon_ti __o; } __bu = { __b }; \ + union { uint32x2x2_t __i; __builtin_neon_v2si2 __o; } __bu = { __b }; \ __builtin_neon_vst2_lanev2si (__a, __bu.__o, __c); \ }) #define vst2_lane_p8(__a, __b, __c) \ ({ \ - union { poly8x8x2_t __i; __builtin_neon_ti __o; } __bu = { __b }; \ + union { poly8x8x2_t __i; __builtin_neon_v8qi2 __o; } __bu = { __b }; \ __builtin_neon_vst2_lanev8qi (__a, __bu.__o, __c); \ }) #define vst2_lane_p16(__a, __b, __c) \ ({ \ - union { poly16x4x2_t __i; __builtin_neon_ti __o; } __bu = { __b }; \ + union { poly16x4x2_t __i; __builtin_neon_v4hi2 __o; } __bu = { __b }; \ __builtin_neon_vst2_lanev4hi (__a, __bu.__o, __c); \ }) #define vst2q_lane_s16(__a, __b, __c) \ ({ \ - union { int16x8x2_t __i; __builtin_neon_oi __o; } __bu = { __b }; \ + union { int16x8x2_t __i; __builtin_neon_v8hi2 __o; } __bu = { __b }; \ __builtin_neon_vst2_lanev8hi (__a, __bu.__o, __c); \ }) #define vst2q_lane_s32(__a, __b, __c) \ ({ \ - union { int32x4x2_t __i; __builtin_neon_oi __o; } __bu = { __b }; \ + union { int32x4x2_t __i; __builtin_neon_v4si2 __o; } __bu = { __b }; \ __builtin_neon_vst2_lanev4si (__a, __bu.__o, __c); \ }) #define vst2q_lane_f32(__a, __b, __c) \ ({ \ - union { float32x4x2_t __i; __builtin_neon_oi __o; } __bu = { __b }; \ + union { float32x4x2_t __i; __builtin_neon_v4sf2 __o; } __bu = { __b }; \ __builtin_neon_vst2_lanev4sf (__a, __bu.__o, __c); \ }) #define vst2q_lane_u16(__a, __b, __c) \ ({ \ - union { uint16x8x2_t __i; __builtin_neon_oi __o; } __bu = { __b }; \ + union { uint16x8x2_t __i; __builtin_neon_v8hi2 __o; } __bu = { __b }; \ __builtin_neon_vst2_lanev8hi (__a, __bu.__o, __c); \ }) #define vst2q_lane_u32(__a, __b, __c) \ ({ \ - union { uint32x4x2_t __i; __builtin_neon_oi __o; } __bu = { __b }; \ + union { uint32x4x2_t __i; __builtin_neon_v4si2 __o; } __bu = { __b }; \ __builtin_neon_vst2_lanev4si (__a, __bu.__o, __c); \ }) #define vst2q_lane_p16(__a, __b, __c) \ ({ \ - union { poly16x8x2_t __i; __builtin_neon_oi __o; } __bu = { __b }; \ + union { poly16x8x2_t __i; __builtin_neon_v8hi2 __o; } __bu = { __b }; \ __builtin_neon_vst2_lanev8hi (__a, __bu.__o, __c); \ }) #define vld3_s8(__a) \ ({ \ - union { int8x8x3_t __i; __builtin_neon_ei __o; } __rv; \ + union { int8x8x3_t __i; __builtin_neon_v8qi3 __o; } __rv; \ __rv.__o = __builtin_neon_vld3v8qi (__a); \ __rv.__i; \ }) #define vld3_s16(__a) \ ({ \ - union { int16x4x3_t __i; __builtin_neon_ei __o; } __rv; \ + union { int16x4x3_t __i; __builtin_neon_v4hi3 __o; } __rv; \ __rv.__o = __builtin_neon_vld3v4hi (__a); \ __rv.__i; \ }) #define vld3_s32(__a) \ ({ \ - union { int32x2x3_t __i; __builtin_neon_ei __o; } __rv; \ + union { int32x2x3_t __i; __builtin_neon_v2si3 __o; } __rv; \ __rv.__o = __builtin_neon_vld3v2si (__a); \ __rv.__i; \ }) #define vld3_f32(__a) \ ({ \ - union { float32x2x3_t __i; __builtin_neon_ei __o; } __rv; \ + union { float32x2x3_t __i; __builtin_neon_v2sf3 __o; } __rv; \ __rv.__o = __builtin_neon_vld3v2sf (__a); \ __rv.__i; \ }) #define vld3_u8(__a) \ ({ \ - union { uint8x8x3_t __i; __builtin_neon_ei __o; } __rv; \ + union { uint8x8x3_t __i; __builtin_neon_v8qi3 __o; } __rv; \ __rv.__o = __builtin_neon_vld3v8qi (__a); \ __rv.__i; \ }) #define vld3_u16(__a) \ ({ \ - union { uint16x4x3_t __i; __builtin_neon_ei __o; } __rv; \ + union { uint16x4x3_t __i; __builtin_neon_v4hi3 __o; } __rv; \ __rv.__o = __builtin_neon_vld3v4hi (__a); \ __rv.__i; \ }) #define vld3_u32(__a) \ ({ \ - union { uint32x2x3_t __i; __builtin_neon_ei __o; } __rv; \ + union { uint32x2x3_t __i; __builtin_neon_v2si3 __o; } __rv; \ __rv.__o = __builtin_neon_vld3v2si (__a); \ __rv.__i; \ }) #define vld3_p8(__a) \ ({ \ - union { poly8x8x3_t __i; __builtin_neon_ei __o; } __rv; \ + union { poly8x8x3_t __i; __builtin_neon_v8qi3 __o; } __rv; \ __rv.__o = __builtin_neon_vld3v8qi (__a); \ __rv.__i; \ }) #define vld3_p16(__a) \ ({ \ - union { poly16x4x3_t __i; __builtin_neon_ei __o; } __rv; \ + union { poly16x4x3_t __i; __builtin_neon_v4hi3 __o; } __rv; \ __rv.__o = __builtin_neon_vld3v4hi (__a); \ __rv.__i; \ }) #define vld3_s64(__a) \ ({ \ - union { int64x1x3_t __i; __builtin_neon_ei __o; } __rv; \ + union { int64x1x3_t __i; __builtin_neon_di3 __o; } __rv; \ __rv.__o = __builtin_neon_vld3di (__a); \ __rv.__i; \ }) #define vld3_u64(__a) \ ({ \ - union { uint64x1x3_t __i; __builtin_neon_ei __o; } __rv; \ + union { uint64x1x3_t __i; __builtin_neon_di3 __o; } __rv; \ __rv.__o = __builtin_neon_vld3di (__a); \ __rv.__i; \ }) #define vld3q_s8(__a) \ ({ \ - union { int8x16x3_t __i; __builtin_neon_ci __o; } __rv; \ + union { int8x16x3_t __i; __builtin_neon_v16qi3 __o; } __rv; \ __rv.__o = __builtin_neon_vld3v16qi (__a); \ __rv.__i; \ }) #define vld3q_s16(__a) \ ({ \ - union { int16x8x3_t __i; __builtin_neon_ci __o; } __rv; \ + union { int16x8x3_t __i; __builtin_neon_v8hi3 __o; } __rv; \ __rv.__o = __builtin_neon_vld3v8hi (__a); \ __rv.__i; \ }) #define vld3q_s32(__a) \ ({ \ - union { int32x4x3_t __i; __builtin_neon_ci __o; } __rv; \ + union { int32x4x3_t __i; __builtin_neon_v4si3 __o; } __rv; \ __rv.__o = __builtin_neon_vld3v4si (__a); \ __rv.__i; \ }) #define vld3q_f32(__a) \ ({ \ - union { float32x4x3_t __i; __builtin_neon_ci __o; } __rv; \ + union { float32x4x3_t __i; __builtin_neon_v4sf3 __o; } __rv; \ __rv.__o = __builtin_neon_vld3v4sf (__a); \ __rv.__i; \ }) #define vld3q_u8(__a) \ ({ \ - union { uint8x16x3_t __i; __builtin_neon_ci __o; } __rv; \ + union { uint8x16x3_t __i; __builtin_neon_v16qi3 __o; } __rv; \ __rv.__o = __builtin_neon_vld3v16qi (__a); \ __rv.__i; \ }) #define vld3q_u16(__a) \ ({ \ - union { uint16x8x3_t __i; __builtin_neon_ci __o; } __rv; \ + union { uint16x8x3_t __i; __builtin_neon_v8hi3 __o; } __rv; \ __rv.__o = __builtin_neon_vld3v8hi (__a); \ __rv.__i; \ }) #define vld3q_u32(__a) \ ({ \ - union { uint32x4x3_t __i; __builtin_neon_ci __o; } __rv; \ + union { uint32x4x3_t __i; __builtin_neon_v4si3 __o; } __rv; \ __rv.__o = __builtin_neon_vld3v4si (__a); \ __rv.__i; \ }) #define vld3q_p8(__a) \ ({ \ - union { poly8x16x3_t __i; __builtin_neon_ci __o; } __rv; \ + union { poly8x16x3_t __i; __builtin_neon_v16qi3 __o; } __rv; \ __rv.__o = __builtin_neon_vld3v16qi (__a); \ __rv.__i; \ }) #define vld3q_p16(__a) \ ({ \ - union { poly16x8x3_t __i; __builtin_neon_ci __o; } __rv; \ + union { poly16x8x3_t __i; __builtin_neon_v8hi3 __o; } __rv; \ __rv.__o = __builtin_neon_vld3v8hi (__a); \ __rv.__i; \ }) #define vld3_lane_s8(__a, __b, __c) \ ({ \ - union { int8x8x3_t __i; __builtin_neon_ei __o; } __bu = { __b }; \ - union { int8x8x3_t __i; __builtin_neon_ei __o; } __rv; \ + union { int8x8x3_t __i; __builtin_neon_v8qi3 __o; } __bu = { __b }; \ + union { int8x8x3_t __i; __builtin_neon_v8qi3 __o; } __rv; \ __rv.__o = __builtin_neon_vld3_lanev8qi (__a, __bu.__o, __c); \ __rv.__i; \ }) #define vld3_lane_s16(__a, __b, __c) \ ({ \ - union { int16x4x3_t __i; __builtin_neon_ei __o; } __bu = { __b }; \ - union { int16x4x3_t __i; __builtin_neon_ei __o; } __rv; \ + union { int16x4x3_t __i; __builtin_neon_v4hi3 __o; } __bu = { __b }; \ + union { int16x4x3_t __i; __builtin_neon_v4hi3 __o; } __rv; \ __rv.__o = __builtin_neon_vld3_lanev4hi (__a, __bu.__o, __c); \ __rv.__i; \ }) #define vld3_lane_s32(__a, __b, __c) \ ({ \ - union { int32x2x3_t __i; __builtin_neon_ei __o; } __bu = { __b }; \ - union { int32x2x3_t __i; __builtin_neon_ei __o; } __rv; \ + union { int32x2x3_t __i; __builtin_neon_v2si3 __o; } __bu = { __b }; \ + union { int32x2x3_t __i; __builtin_neon_v2si3 __o; } __rv; \ __rv.__o = __builtin_neon_vld3_lanev2si (__a, __bu.__o, __c); \ __rv.__i; \ }) #define vld3_lane_f32(__a, __b, __c) \ ({ \ - union { float32x2x3_t __i; __builtin_neon_ei __o; } __bu = { __b }; \ - union { float32x2x3_t __i; __builtin_neon_ei __o; } __rv; \ + union { float32x2x3_t __i; __builtin_neon_v2sf3 __o; } __bu = { __b }; \ + union { float32x2x3_t __i; __builtin_neon_v2sf3 __o; } __rv; \ __rv.__o = __builtin_neon_vld3_lanev2sf (__a, __bu.__o, __c); \ __rv.__i; \ }) #define vld3_lane_u8(__a, __b, __c) \ ({ \ - union { uint8x8x3_t __i; __builtin_neon_ei __o; } __bu = { __b }; \ - union { uint8x8x3_t __i; __builtin_neon_ei __o; } __rv; \ + union { uint8x8x3_t __i; __builtin_neon_v8qi3 __o; } __bu = { __b }; \ + union { uint8x8x3_t __i; __builtin_neon_v8qi3 __o; } __rv; \ __rv.__o = __builtin_neon_vld3_lanev8qi (__a, __bu.__o, __c); \ __rv.__i; \ }) #define vld3_lane_u16(__a, __b, __c) \ ({ \ - union { uint16x4x3_t __i; __builtin_neon_ei __o; } __bu = { __b }; \ - union { uint16x4x3_t __i; __builtin_neon_ei __o; } __rv; \ + union { uint16x4x3_t __i; __builtin_neon_v4hi3 __o; } __bu = { __b }; \ + union { uint16x4x3_t __i; __builtin_neon_v4hi3 __o; } __rv; \ __rv.__o = __builtin_neon_vld3_lanev4hi (__a, __bu.__o, __c); \ __rv.__i; \ }) #define vld3_lane_u32(__a, __b, __c) \ ({ \ - union { uint32x2x3_t __i; __builtin_neon_ei __o; } __bu = { __b }; \ - union { uint32x2x3_t __i; __builtin_neon_ei __o; } __rv; \ + union { uint32x2x3_t __i; __builtin_neon_v2si3 __o; } __bu = { __b }; \ + union { uint32x2x3_t __i; __builtin_neon_v2si3 __o; } __rv; \ __rv.__o = __builtin_neon_vld3_lanev2si (__a, __bu.__o, __c); \ __rv.__i; \ }) #define vld3_lane_p8(__a, __b, __c) \ ({ \ - union { poly8x8x3_t __i; __builtin_neon_ei __o; } __bu = { __b }; \ - union { poly8x8x3_t __i; __builtin_neon_ei __o; } __rv; \ + union { poly8x8x3_t __i; __builtin_neon_v8qi3 __o; } __bu = { __b }; \ + union { poly8x8x3_t __i; __builtin_neon_v8qi3 __o; } __rv; \ __rv.__o = __builtin_neon_vld3_lanev8qi (__a, __bu.__o, __c); \ __rv.__i; \ }) #define vld3_lane_p16(__a, __b, __c) \ ({ \ - union { poly16x4x3_t __i; __builtin_neon_ei __o; } __bu = { __b }; \ - union { poly16x4x3_t __i; __builtin_neon_ei __o; } __rv; \ + union { poly16x4x3_t __i; __builtin_neon_v4hi3 __o; } __bu = { __b }; \ + union { poly16x4x3_t __i; __builtin_neon_v4hi3 __o; } __rv; \ __rv.__o = __builtin_neon_vld3_lanev4hi (__a, __bu.__o, __c); \ __rv.__i; \ }) #define vld3q_lane_s16(__a, __b, __c) \ ({ \ - union { int16x8x3_t __i; __builtin_neon_ci __o; } __bu = { __b }; \ - union { int16x8x3_t __i; __builtin_neon_ci __o; } __rv; \ + union { int16x8x3_t __i; __builtin_neon_v8hi3 __o; } __bu = { __b }; \ + union { int16x8x3_t __i; __builtin_neon_v8hi3 __o; } __rv; \ __rv.__o = __builtin_neon_vld3_lanev8hi (__a, __bu.__o, __c); \ __rv.__i; \ }) #define vld3q_lane_s32(__a, __b, __c) \ ({ \ - union { int32x4x3_t __i; __builtin_neon_ci __o; } __bu = { __b }; \ - union { int32x4x3_t __i; __builtin_neon_ci __o; } __rv; \ + union { int32x4x3_t __i; __builtin_neon_v4si3 __o; } __bu = { __b }; \ + union { int32x4x3_t __i; __builtin_neon_v4si3 __o; } __rv; \ __rv.__o = __builtin_neon_vld3_lanev4si (__a, __bu.__o, __c); \ __rv.__i; \ }) #define vld3q_lane_f32(__a, __b, __c) \ ({ \ - union { float32x4x3_t __i; __builtin_neon_ci __o; } __bu = { __b }; \ - union { float32x4x3_t __i; __builtin_neon_ci __o; } __rv; \ + union { float32x4x3_t __i; __builtin_neon_v4sf3 __o; } __bu = { __b }; \ + union { float32x4x3_t __i; __builtin_neon_v4sf3 __o; } __rv; \ __rv.__o = __builtin_neon_vld3_lanev4sf (__a, __bu.__o, __c); \ __rv.__i; \ }) #define vld3q_lane_u16(__a, __b, __c) \ ({ \ - union { uint16x8x3_t __i; __builtin_neon_ci __o; } __bu = { __b }; \ - union { uint16x8x3_t __i; __builtin_neon_ci __o; } __rv; \ + union { uint16x8x3_t __i; __builtin_neon_v8hi3 __o; } __bu = { __b }; \ + union { uint16x8x3_t __i; __builtin_neon_v8hi3 __o; } __rv; \ __rv.__o = __builtin_neon_vld3_lanev8hi (__a, __bu.__o, __c); \ __rv.__i; \ }) #define vld3q_lane_u32(__a, __b, __c) \ ({ \ - union { uint32x4x3_t __i; __builtin_neon_ci __o; } __bu = { __b }; \ - union { uint32x4x3_t __i; __builtin_neon_ci __o; } __rv; \ + union { uint32x4x3_t __i; __builtin_neon_v4si3 __o; } __bu = { __b }; \ + union { uint32x4x3_t __i; __builtin_neon_v4si3 __o; } __rv; \ __rv.__o = __builtin_neon_vld3_lanev4si (__a, __bu.__o, __c); \ __rv.__i; \ }) #define vld3q_lane_p16(__a, __b, __c) \ ({ \ - union { poly16x8x3_t __i; __builtin_neon_ci __o; } __bu = { __b }; \ - union { poly16x8x3_t __i; __builtin_neon_ci __o; } __rv; \ + union { poly16x8x3_t __i; __builtin_neon_v8hi3 __o; } __bu = { __b }; \ + union { poly16x8x3_t __i; __builtin_neon_v8hi3 __o; } __rv; \ __rv.__o = __builtin_neon_vld3_lanev8hi (__a, __bu.__o, __c); \ __rv.__i; \ }) #define vld3_dup_s8(__a) \ ({ \ - union { int8x8x3_t __i; __builtin_neon_ei __o; } __rv; \ + union { int8x8x3_t __i; __builtin_neon_v8qi3 __o; } __rv; \ __rv.__o = __builtin_neon_vld3_dupv8qi (__a); \ __rv.__i; \ }) #define vld3_dup_s16(__a) \ ({ \ - union { int16x4x3_t __i; __builtin_neon_ei __o; } __rv; \ + union { int16x4x3_t __i; __builtin_neon_v4hi3 __o; } __rv; \ __rv.__o = __builtin_neon_vld3_dupv4hi (__a); \ __rv.__i; \ }) #define vld3_dup_s32(__a) \ ({ \ - union { int32x2x3_t __i; __builtin_neon_ei __o; } __rv; \ + union { int32x2x3_t __i; __builtin_neon_v2si3 __o; } __rv; \ __rv.__o = __builtin_neon_vld3_dupv2si (__a); \ __rv.__i; \ }) #define vld3_dup_f32(__a) \ ({ \ - union { float32x2x3_t __i; __builtin_neon_ei __o; } __rv; \ + union { float32x2x3_t __i; __builtin_neon_v2sf3 __o; } __rv; \ __rv.__o = __builtin_neon_vld3_dupv2sf (__a); \ __rv.__i; \ }) #define vld3_dup_u8(__a) \ ({ \ - union { uint8x8x3_t __i; __builtin_neon_ei __o; } __rv; \ + union { uint8x8x3_t __i; __builtin_neon_v8qi3 __o; } __rv; \ __rv.__o = __builtin_neon_vld3_dupv8qi (__a); \ __rv.__i; \ }) #define vld3_dup_u16(__a) \ ({ \ - union { uint16x4x3_t __i; __builtin_neon_ei __o; } __rv; \ + union { uint16x4x3_t __i; __builtin_neon_v4hi3 __o; } __rv; \ __rv.__o = __builtin_neon_vld3_dupv4hi (__a); \ __rv.__i; \ }) #define vld3_dup_u32(__a) \ ({ \ - union { uint32x2x3_t __i; __builtin_neon_ei __o; } __rv; \ + union { uint32x2x3_t __i; __builtin_neon_v2si3 __o; } __rv; \ __rv.__o = __builtin_neon_vld3_dupv2si (__a); \ __rv.__i; \ }) #define vld3_dup_p8(__a) \ ({ \ - union { poly8x8x3_t __i; __builtin_neon_ei __o; } __rv; \ + union { poly8x8x3_t __i; __builtin_neon_v8qi3 __o; } __rv; \ __rv.__o = __builtin_neon_vld3_dupv8qi (__a); \ __rv.__i; \ }) #define vld3_dup_p16(__a) \ ({ \ - union { poly16x4x3_t __i; __builtin_neon_ei __o; } __rv; \ + union { poly16x4x3_t __i; __builtin_neon_v4hi3 __o; } __rv; \ __rv.__o = __builtin_neon_vld3_dupv4hi (__a); \ __rv.__i; \ }) #define vld3_dup_s64(__a) \ ({ \ - union { int64x1x3_t __i; __builtin_neon_ei __o; } __rv; \ + union { int64x1x3_t __i; __builtin_neon_di3 __o; } __rv; \ __rv.__o = __builtin_neon_vld3_dupdi (__a); \ __rv.__i; \ }) #define vld3_dup_u64(__a) \ ({ \ - union { uint64x1x3_t __i; __builtin_neon_ei __o; } __rv; \ + union { uint64x1x3_t __i; __builtin_neon_di3 __o; } __rv; \ __rv.__o = __builtin_neon_vld3_dupdi (__a); \ __rv.__i; \ }) #define vst3_s8(__a, __b) \ ({ \ - union { int8x8x3_t __i; __builtin_neon_ei __o; } __bu = { __b }; \ + union { int8x8x3_t __i; __builtin_neon_v8qi3 __o; } __bu = { __b }; \ __builtin_neon_vst3v8qi (__a, __bu.__o); \ }) #define vst3_s16(__a, __b) \ ({ \ - union { int16x4x3_t __i; __builtin_neon_ei __o; } __bu = { __b }; \ + union { int16x4x3_t __i; __builtin_neon_v4hi3 __o; } __bu = { __b }; \ __builtin_neon_vst3v4hi (__a, __bu.__o); \ }) #define vst3_s32(__a, __b) \ ({ \ - union { int32x2x3_t __i; __builtin_neon_ei __o; } __bu = { __b }; \ + union { int32x2x3_t __i; __builtin_neon_v2si3 __o; } __bu = { __b }; \ __builtin_neon_vst3v2si (__a, __bu.__o); \ }) #define vst3_f32(__a, __b) \ ({ \ - union { float32x2x3_t __i; __builtin_neon_ei __o; } __bu = { __b }; \ + union { float32x2x3_t __i; __builtin_neon_v2sf3 __o; } __bu = { __b }; \ __builtin_neon_vst3v2sf (__a, __bu.__o); \ }) #define vst3_u8(__a, __b) \ ({ \ - union { uint8x8x3_t __i; __builtin_neon_ei __o; } __bu = { __b }; \ + union { uint8x8x3_t __i; __builtin_neon_v8qi3 __o; } __bu = { __b }; \ __builtin_neon_vst3v8qi (__a, __bu.__o); \ }) #define vst3_u16(__a, __b) \ ({ \ - union { uint16x4x3_t __i; __builtin_neon_ei __o; } __bu = { __b }; \ + union { uint16x4x3_t __i; __builtin_neon_v4hi3 __o; } __bu = { __b }; \ __builtin_neon_vst3v4hi (__a, __bu.__o); \ }) #define vst3_u32(__a, __b) \ ({ \ - union { uint32x2x3_t __i; __builtin_neon_ei __o; } __bu = { __b }; \ + union { uint32x2x3_t __i; __builtin_neon_v2si3 __o; } __bu = { __b }; \ __builtin_neon_vst3v2si (__a, __bu.__o); \ }) #define vst3_p8(__a, __b) \ ({ \ - union { poly8x8x3_t __i; __builtin_neon_ei __o; } __bu = { __b }; \ + union { poly8x8x3_t __i; __builtin_neon_v8qi3 __o; } __bu = { __b }; \ __builtin_neon_vst3v8qi (__a, __bu.__o); \ }) #define vst3_p16(__a, __b) \ ({ \ - union { poly16x4x3_t __i; __builtin_neon_ei __o; } __bu = { __b }; \ + union { poly16x4x3_t __i; __builtin_neon_v4hi3 __o; } __bu = { __b }; \ __builtin_neon_vst3v4hi (__a, __bu.__o); \ }) #define vst3_s64(__a, __b) \ ({ \ - union { int64x1x3_t __i; __builtin_neon_ei __o; } __bu = { __b }; \ + union { int64x1x3_t __i; __builtin_neon_di3 __o; } __bu = { __b }; \ __builtin_neon_vst3di (__a, __bu.__o); \ }) #define vst3_u64(__a, __b) \ ({ \ - union { uint64x1x3_t __i; __builtin_neon_ei __o; } __bu = { __b }; \ + union { uint64x1x3_t __i; __builtin_neon_di3 __o; } __bu = { __b }; \ __builtin_neon_vst3di (__a, __bu.__o); \ }) #define vst3q_s8(__a, __b) \ ({ \ - union { int8x16x3_t __i; __builtin_neon_ci __o; } __bu = { __b }; \ + union { int8x16x3_t __i; __builtin_neon_v16qi3 __o; } __bu = { __b }; \ __builtin_neon_vst3v16qi (__a, __bu.__o); \ }) #define vst3q_s16(__a, __b) \ ({ \ - union { int16x8x3_t __i; __builtin_neon_ci __o; } __bu = { __b }; \ + union { int16x8x3_t __i; __builtin_neon_v8hi3 __o; } __bu = { __b }; \ __builtin_neon_vst3v8hi (__a, __bu.__o); \ }) #define vst3q_s32(__a, __b) \ ({ \ - union { int32x4x3_t __i; __builtin_neon_ci __o; } __bu = { __b }; \ + union { int32x4x3_t __i; __builtin_neon_v4si3 __o; } __bu = { __b }; \ __builtin_neon_vst3v4si (__a, __bu.__o); \ }) #define vst3q_f32(__a, __b) \ ({ \ - union { float32x4x3_t __i; __builtin_neon_ci __o; } __bu = { __b }; \ + union { float32x4x3_t __i; __builtin_neon_v4sf3 __o; } __bu = { __b }; \ __builtin_neon_vst3v4sf (__a, __bu.__o); \ }) #define vst3q_u8(__a, __b) \ ({ \ - union { uint8x16x3_t __i; __builtin_neon_ci __o; } __bu = { __b }; \ + union { uint8x16x3_t __i; __builtin_neon_v16qi3 __o; } __bu = { __b }; \ __builtin_neon_vst3v16qi (__a, __bu.__o); \ }) #define vst3q_u16(__a, __b) \ ({ \ - union { uint16x8x3_t __i; __builtin_neon_ci __o; } __bu = { __b }; \ + union { uint16x8x3_t __i; __builtin_neon_v8hi3 __o; } __bu = { __b }; \ __builtin_neon_vst3v8hi (__a, __bu.__o); \ }) #define vst3q_u32(__a, __b) \ ({ \ - union { uint32x4x3_t __i; __builtin_neon_ci __o; } __bu = { __b }; \ + union { uint32x4x3_t __i; __builtin_neon_v4si3 __o; } __bu = { __b }; \ __builtin_neon_vst3v4si (__a, __bu.__o); \ }) #define vst3q_p8(__a, __b) \ ({ \ - union { poly8x16x3_t __i; __builtin_neon_ci __o; } __bu = { __b }; \ + union { poly8x16x3_t __i; __builtin_neon_v16qi3 __o; } __bu = { __b }; \ __builtin_neon_vst3v16qi (__a, __bu.__o); \ }) #define vst3q_p16(__a, __b) \ ({ \ - union { poly16x8x3_t __i; __builtin_neon_ci __o; } __bu = { __b }; \ + union { poly16x8x3_t __i; __builtin_neon_v8hi3 __o; } __bu = { __b }; \ __builtin_neon_vst3v8hi (__a, __bu.__o); \ }) #define vst3_lane_s8(__a, __b, __c) \ ({ \ - union { int8x8x3_t __i; __builtin_neon_ei __o; } __bu = { __b }; \ + union { int8x8x3_t __i; __builtin_neon_v8qi3 __o; } __bu = { __b }; \ __builtin_neon_vst3_lanev8qi (__a, __bu.__o, __c); \ }) #define vst3_lane_s16(__a, __b, __c) \ ({ \ - union { int16x4x3_t __i; __builtin_neon_ei __o; } __bu = { __b }; \ + union { int16x4x3_t __i; __builtin_neon_v4hi3 __o; } __bu = { __b }; \ __builtin_neon_vst3_lanev4hi (__a, __bu.__o, __c); \ }) #define vst3_lane_s32(__a, __b, __c) \ ({ \ - union { int32x2x3_t __i; __builtin_neon_ei __o; } __bu = { __b }; \ + union { int32x2x3_t __i; __builtin_neon_v2si3 __o; } __bu = { __b }; \ __builtin_neon_vst3_lanev2si (__a, __bu.__o, __c); \ }) #define vst3_lane_f32(__a, __b, __c) \ ({ \ - union { float32x2x3_t __i; __builtin_neon_ei __o; } __bu = { __b }; \ + union { float32x2x3_t __i; __builtin_neon_v2sf3 __o; } __bu = { __b }; \ __builtin_neon_vst3_lanev2sf (__a, __bu.__o, __c); \ }) #define vst3_lane_u8(__a, __b, __c) \ ({ \ - union { uint8x8x3_t __i; __builtin_neon_ei __o; } __bu = { __b }; \ + union { uint8x8x3_t __i; __builtin_neon_v8qi3 __o; } __bu = { __b }; \ __builtin_neon_vst3_lanev8qi (__a, __bu.__o, __c); \ }) #define vst3_lane_u16(__a, __b, __c) \ ({ \ - union { uint16x4x3_t __i; __builtin_neon_ei __o; } __bu = { __b }; \ + union { uint16x4x3_t __i; __builtin_neon_v4hi3 __o; } __bu = { __b }; \ __builtin_neon_vst3_lanev4hi (__a, __bu.__o, __c); \ }) #define vst3_lane_u32(__a, __b, __c) \ ({ \ - union { uint32x2x3_t __i; __builtin_neon_ei __o; } __bu = { __b }; \ + union { uint32x2x3_t __i; __builtin_neon_v2si3 __o; } __bu = { __b }; \ __builtin_neon_vst3_lanev2si (__a, __bu.__o, __c); \ }) #define vst3_lane_p8(__a, __b, __c) \ ({ \ - union { poly8x8x3_t __i; __builtin_neon_ei __o; } __bu = { __b }; \ + union { poly8x8x3_t __i; __builtin_neon_v8qi3 __o; } __bu = { __b }; \ __builtin_neon_vst3_lanev8qi (__a, __bu.__o, __c); \ }) #define vst3_lane_p16(__a, __b, __c) \ ({ \ - union { poly16x4x3_t __i; __builtin_neon_ei __o; } __bu = { __b }; \ + union { poly16x4x3_t __i; __builtin_neon_v4hi3 __o; } __bu = { __b }; \ __builtin_neon_vst3_lanev4hi (__a, __bu.__o, __c); \ }) #define vst3q_lane_s16(__a, __b, __c) \ ({ \ - union { int16x8x3_t __i; __builtin_neon_ci __o; } __bu = { __b }; \ + union { int16x8x3_t __i; __builtin_neon_v8hi3 __o; } __bu = { __b }; \ __builtin_neon_vst3_lanev8hi (__a, __bu.__o, __c); \ }) #define vst3q_lane_s32(__a, __b, __c) \ ({ \ - union { int32x4x3_t __i; __builtin_neon_ci __o; } __bu = { __b }; \ + union { int32x4x3_t __i; __builtin_neon_v4si3 __o; } __bu = { __b }; \ __builtin_neon_vst3_lanev4si (__a, __bu.__o, __c); \ }) #define vst3q_lane_f32(__a, __b, __c) \ ({ \ - union { float32x4x3_t __i; __builtin_neon_ci __o; } __bu = { __b }; \ + union { float32x4x3_t __i; __builtin_neon_v4sf3 __o; } __bu = { __b }; \ __builtin_neon_vst3_lanev4sf (__a, __bu.__o, __c); \ }) #define vst3q_lane_u16(__a, __b, __c) \ ({ \ - union { uint16x8x3_t __i; __builtin_neon_ci __o; } __bu = { __b }; \ + union { uint16x8x3_t __i; __builtin_neon_v8hi3 __o; } __bu = { __b }; \ __builtin_neon_vst3_lanev8hi (__a, __bu.__o, __c); \ }) #define vst3q_lane_u32(__a, __b, __c) \ ({ \ - union { uint32x4x3_t __i; __builtin_neon_ci __o; } __bu = { __b }; \ + union { uint32x4x3_t __i; __builtin_neon_v4si3 __o; } __bu = { __b }; \ __builtin_neon_vst3_lanev4si (__a, __bu.__o, __c); \ }) #define vst3q_lane_p16(__a, __b, __c) \ ({ \ - union { poly16x8x3_t __i; __builtin_neon_ci __o; } __bu = { __b }; \ + union { poly16x8x3_t __i; __builtin_neon_v8hi3 __o; } __bu = { __b }; \ __builtin_neon_vst3_lanev8hi (__a, __bu.__o, __c); \ }) #define vld4_s8(__a) \ ({ \ - union { int8x8x4_t __i; __builtin_neon_oi __o; } __rv; \ + union { int8x8x4_t __i; __builtin_neon_v8qi4 __o; } __rv; \ __rv.__o = __builtin_neon_vld4v8qi (__a); \ __rv.__i; \ }) #define vld4_s16(__a) \ ({ \ - union { int16x4x4_t __i; __builtin_neon_oi __o; } __rv; \ + union { int16x4x4_t __i; __builtin_neon_v4hi4 __o; } __rv; \ __rv.__o = __builtin_neon_vld4v4hi (__a); \ __rv.__i; \ }) #define vld4_s32(__a) \ ({ \ - union { int32x2x4_t __i; __builtin_neon_oi __o; } __rv; \ + union { int32x2x4_t __i; __builtin_neon_v2si4 __o; } __rv; \ __rv.__o = __builtin_neon_vld4v2si (__a); \ __rv.__i; \ }) #define vld4_f32(__a) \ ({ \ - union { float32x2x4_t __i; __builtin_neon_oi __o; } __rv; \ + union { float32x2x4_t __i; __builtin_neon_v2sf4 __o; } __rv; \ __rv.__o = __builtin_neon_vld4v2sf (__a); \ __rv.__i; \ }) #define vld4_u8(__a) \ ({ \ - union { uint8x8x4_t __i; __builtin_neon_oi __o; } __rv; \ + union { uint8x8x4_t __i; __builtin_neon_v8qi4 __o; } __rv; \ __rv.__o = __builtin_neon_vld4v8qi (__a); \ __rv.__i; \ }) #define vld4_u16(__a) \ ({ \ - union { uint16x4x4_t __i; __builtin_neon_oi __o; } __rv; \ + union { uint16x4x4_t __i; __builtin_neon_v4hi4 __o; } __rv; \ __rv.__o = __builtin_neon_vld4v4hi (__a); \ __rv.__i; \ }) #define vld4_u32(__a) \ ({ \ - union { uint32x2x4_t __i; __builtin_neon_oi __o; } __rv; \ + union { uint32x2x4_t __i; __builtin_neon_v2si4 __o; } __rv; \ __rv.__o = __builtin_neon_vld4v2si (__a); \ __rv.__i; \ }) #define vld4_p8(__a) \ ({ \ - union { poly8x8x4_t __i; __builtin_neon_oi __o; } __rv; \ + union { poly8x8x4_t __i; __builtin_neon_v8qi4 __o; } __rv; \ __rv.__o = __builtin_neon_vld4v8qi (__a); \ __rv.__i; \ }) #define vld4_p16(__a) \ ({ \ - union { poly16x4x4_t __i; __builtin_neon_oi __o; } __rv; \ + union { poly16x4x4_t __i; __builtin_neon_v4hi4 __o; } __rv; \ __rv.__o = __builtin_neon_vld4v4hi (__a); \ __rv.__i; \ }) #define vld4_s64(__a) \ ({ \ - union { int64x1x4_t __i; __builtin_neon_oi __o; } __rv; \ + union { int64x1x4_t __i; __builtin_neon_di4 __o; } __rv; \ __rv.__o = __builtin_neon_vld4di (__a); \ __rv.__i; \ }) #define vld4_u64(__a) \ ({ \ - union { uint64x1x4_t __i; __builtin_neon_oi __o; } __rv; \ + union { uint64x1x4_t __i; __builtin_neon_di4 __o; } __rv; \ __rv.__o = __builtin_neon_vld4di (__a); \ __rv.__i; \ }) #define vld4q_s8(__a) \ ({ \ - union { int8x16x4_t __i; __builtin_neon_xi __o; } __rv; \ + union { int8x16x4_t __i; __builtin_neon_v16qi4 __o; } __rv; \ __rv.__o = __builtin_neon_vld4v16qi (__a); \ __rv.__i; \ }) #define vld4q_s16(__a) \ ({ \ - union { int16x8x4_t __i; __builtin_neon_xi __o; } __rv; \ + union { int16x8x4_t __i; __builtin_neon_v8hi4 __o; } __rv; \ __rv.__o = __builtin_neon_vld4v8hi (__a); \ __rv.__i; \ }) #define vld4q_s32(__a) \ ({ \ - union { int32x4x4_t __i; __builtin_neon_xi __o; } __rv; \ + union { int32x4x4_t __i; __builtin_neon_v4si4 __o; } __rv; \ __rv.__o = __builtin_neon_vld4v4si (__a); \ __rv.__i; \ }) #define vld4q_f32(__a) \ ({ \ - union { float32x4x4_t __i; __builtin_neon_xi __o; } __rv; \ + union { float32x4x4_t __i; __builtin_neon_v4sf4 __o; } __rv; \ __rv.__o = __builtin_neon_vld4v4sf (__a); \ __rv.__i; \ }) #define vld4q_u8(__a) \ ({ \ - union { uint8x16x4_t __i; __builtin_neon_xi __o; } __rv; \ + union { uint8x16x4_t __i; __builtin_neon_v16qi4 __o; } __rv; \ __rv.__o = __builtin_neon_vld4v16qi (__a); \ __rv.__i; \ }) #define vld4q_u16(__a) \ ({ \ - union { uint16x8x4_t __i; __builtin_neon_xi __o; } __rv; \ + union { uint16x8x4_t __i; __builtin_neon_v8hi4 __o; } __rv; \ __rv.__o = __builtin_neon_vld4v8hi (__a); \ __rv.__i; \ }) #define vld4q_u32(__a) \ ({ \ - union { uint32x4x4_t __i; __builtin_neon_xi __o; } __rv; \ + union { uint32x4x4_t __i; __builtin_neon_v4si4 __o; } __rv; \ __rv.__o = __builtin_neon_vld4v4si (__a); \ __rv.__i; \ }) #define vld4q_p8(__a) \ ({ \ - union { poly8x16x4_t __i; __builtin_neon_xi __o; } __rv; \ + union { poly8x16x4_t __i; __builtin_neon_v16qi4 __o; } __rv; \ __rv.__o = __builtin_neon_vld4v16qi (__a); \ __rv.__i; \ }) #define vld4q_p16(__a) \ ({ \ - union { poly16x8x4_t __i; __builtin_neon_xi __o; } __rv; \ + union { poly16x8x4_t __i; __builtin_neon_v8hi4 __o; } __rv; \ __rv.__o = __builtin_neon_vld4v8hi (__a); \ __rv.__i; \ }) #define vld4_lane_s8(__a, __b, __c) \ ({ \ - union { int8x8x4_t __i; __builtin_neon_oi __o; } __bu = { __b }; \ - union { int8x8x4_t __i; __builtin_neon_oi __o; } __rv; \ + union { int8x8x4_t __i; __builtin_neon_v8qi4 __o; } __bu = { __b }; \ + union { int8x8x4_t __i; __builtin_neon_v8qi4 __o; } __rv; \ __rv.__o = __builtin_neon_vld4_lanev8qi (__a, __bu.__o, __c); \ __rv.__i; \ }) #define vld4_lane_s16(__a, __b, __c) \ ({ \ - union { int16x4x4_t __i; __builtin_neon_oi __o; } __bu = { __b }; \ - union { int16x4x4_t __i; __builtin_neon_oi __o; } __rv; \ + union { int16x4x4_t __i; __builtin_neon_v4hi4 __o; } __bu = { __b }; \ + union { int16x4x4_t __i; __builtin_neon_v4hi4 __o; } __rv; \ __rv.__o = __builtin_neon_vld4_lanev4hi (__a, __bu.__o, __c); \ __rv.__i; \ }) #define vld4_lane_s32(__a, __b, __c) \ ({ \ - union { int32x2x4_t __i; __builtin_neon_oi __o; } __bu = { __b }; \ - union { int32x2x4_t __i; __builtin_neon_oi __o; } __rv; \ + union { int32x2x4_t __i; __builtin_neon_v2si4 __o; } __bu = { __b }; \ + union { int32x2x4_t __i; __builtin_neon_v2si4 __o; } __rv; \ __rv.__o = __builtin_neon_vld4_lanev2si (__a, __bu.__o, __c); \ __rv.__i; \ }) #define vld4_lane_f32(__a, __b, __c) \ ({ \ - union { float32x2x4_t __i; __builtin_neon_oi __o; } __bu = { __b }; \ - union { float32x2x4_t __i; __builtin_neon_oi __o; } __rv; \ + union { float32x2x4_t __i; __builtin_neon_v2sf4 __o; } __bu = { __b }; \ + union { float32x2x4_t __i; __builtin_neon_v2sf4 __o; } __rv; \ __rv.__o = __builtin_neon_vld4_lanev2sf (__a, __bu.__o, __c); \ __rv.__i; \ }) #define vld4_lane_u8(__a, __b, __c) \ ({ \ - union { uint8x8x4_t __i; __builtin_neon_oi __o; } __bu = { __b }; \ - union { uint8x8x4_t __i; __builtin_neon_oi __o; } __rv; \ + union { uint8x8x4_t __i; __builtin_neon_v8qi4 __o; } __bu = { __b }; \ + union { uint8x8x4_t __i; __builtin_neon_v8qi4 __o; } __rv; \ __rv.__o = __builtin_neon_vld4_lanev8qi (__a, __bu.__o, __c); \ __rv.__i; \ }) #define vld4_lane_u16(__a, __b, __c) \ ({ \ - union { uint16x4x4_t __i; __builtin_neon_oi __o; } __bu = { __b }; \ - union { uint16x4x4_t __i; __builtin_neon_oi __o; } __rv; \ + union { uint16x4x4_t __i; __builtin_neon_v4hi4 __o; } __bu = { __b }; \ + union { uint16x4x4_t __i; __builtin_neon_v4hi4 __o; } __rv; \ __rv.__o = __builtin_neon_vld4_lanev4hi (__a, __bu.__o, __c); \ __rv.__i; \ }) #define vld4_lane_u32(__a, __b, __c) \ ({ \ - union { uint32x2x4_t __i; __builtin_neon_oi __o; } __bu = { __b }; \ - union { uint32x2x4_t __i; __builtin_neon_oi __o; } __rv; \ + union { uint32x2x4_t __i; __builtin_neon_v2si4 __o; } __bu = { __b }; \ + union { uint32x2x4_t __i; __builtin_neon_v2si4 __o; } __rv; \ __rv.__o = __builtin_neon_vld4_lanev2si (__a, __bu.__o, __c); \ __rv.__i; \ }) #define vld4_lane_p8(__a, __b, __c) \ ({ \ - union { poly8x8x4_t __i; __builtin_neon_oi __o; } __bu = { __b }; \ - union { poly8x8x4_t __i; __builtin_neon_oi __o; } __rv; \ + union { poly8x8x4_t __i; __builtin_neon_v8qi4 __o; } __bu = { __b }; \ + union { poly8x8x4_t __i; __builtin_neon_v8qi4 __o; } __rv; \ __rv.__o = __builtin_neon_vld4_lanev8qi (__a, __bu.__o, __c); \ __rv.__i; \ }) #define vld4_lane_p16(__a, __b, __c) \ ({ \ - union { poly16x4x4_t __i; __builtin_neon_oi __o; } __bu = { __b }; \ - union { poly16x4x4_t __i; __builtin_neon_oi __o; } __rv; \ + union { poly16x4x4_t __i; __builtin_neon_v4hi4 __o; } __bu = { __b }; \ + union { poly16x4x4_t __i; __builtin_neon_v4hi4 __o; } __rv; \ __rv.__o = __builtin_neon_vld4_lanev4hi (__a, __bu.__o, __c); \ __rv.__i; \ }) #define vld4q_lane_s16(__a, __b, __c) \ ({ \ - union { int16x8x4_t __i; __builtin_neon_xi __o; } __bu = { __b }; \ - union { int16x8x4_t __i; __builtin_neon_xi __o; } __rv; \ + union { int16x8x4_t __i; __builtin_neon_v8hi4 __o; } __bu = { __b }; \ + union { int16x8x4_t __i; __builtin_neon_v8hi4 __o; } __rv; \ __rv.__o = __builtin_neon_vld4_lanev8hi (__a, __bu.__o, __c); \ __rv.__i; \ }) #define vld4q_lane_s32(__a, __b, __c) \ ({ \ - union { int32x4x4_t __i; __builtin_neon_xi __o; } __bu = { __b }; \ - union { int32x4x4_t __i; __builtin_neon_xi __o; } __rv; \ + union { int32x4x4_t __i; __builtin_neon_v4si4 __o; } __bu = { __b }; \ + union { int32x4x4_t __i; __builtin_neon_v4si4 __o; } __rv; \ __rv.__o = __builtin_neon_vld4_lanev4si (__a, __bu.__o, __c); \ __rv.__i; \ }) #define vld4q_lane_f32(__a, __b, __c) \ ({ \ - union { float32x4x4_t __i; __builtin_neon_xi __o; } __bu = { __b }; \ - union { float32x4x4_t __i; __builtin_neon_xi __o; } __rv; \ + union { float32x4x4_t __i; __builtin_neon_v4sf4 __o; } __bu = { __b }; \ + union { float32x4x4_t __i; __builtin_neon_v4sf4 __o; } __rv; \ __rv.__o = __builtin_neon_vld4_lanev4sf (__a, __bu.__o, __c); \ __rv.__i; \ }) #define vld4q_lane_u16(__a, __b, __c) \ ({ \ - union { uint16x8x4_t __i; __builtin_neon_xi __o; } __bu = { __b }; \ - union { uint16x8x4_t __i; __builtin_neon_xi __o; } __rv; \ + union { uint16x8x4_t __i; __builtin_neon_v8hi4 __o; } __bu = { __b }; \ + union { uint16x8x4_t __i; __builtin_neon_v8hi4 __o; } __rv; \ __rv.__o = __builtin_neon_vld4_lanev8hi (__a, __bu.__o, __c); \ __rv.__i; \ }) #define vld4q_lane_u32(__a, __b, __c) \ ({ \ - union { uint32x4x4_t __i; __builtin_neon_xi __o; } __bu = { __b }; \ - union { uint32x4x4_t __i; __builtin_neon_xi __o; } __rv; \ + union { uint32x4x4_t __i; __builtin_neon_v4si4 __o; } __bu = { __b }; \ + union { uint32x4x4_t __i; __builtin_neon_v4si4 __o; } __rv; \ __rv.__o = __builtin_neon_vld4_lanev4si (__a, __bu.__o, __c); \ __rv.__i; \ }) #define vld4q_lane_p16(__a, __b, __c) \ ({ \ - union { poly16x8x4_t __i; __builtin_neon_xi __o; } __bu = { __b }; \ - union { poly16x8x4_t __i; __builtin_neon_xi __o; } __rv; \ + union { poly16x8x4_t __i; __builtin_neon_v8hi4 __o; } __bu = { __b }; \ + union { poly16x8x4_t __i; __builtin_neon_v8hi4 __o; } __rv; \ __rv.__o = __builtin_neon_vld4_lanev8hi (__a, __bu.__o, __c); \ __rv.__i; \ }) #define vld4_dup_s8(__a) \ ({ \ - union { int8x8x4_t __i; __builtin_neon_oi __o; } __rv; \ + union { int8x8x4_t __i; __builtin_neon_v8qi4 __o; } __rv; \ __rv.__o = __builtin_neon_vld4_dupv8qi (__a); \ __rv.__i; \ }) #define vld4_dup_s16(__a) \ ({ \ - union { int16x4x4_t __i; __builtin_neon_oi __o; } __rv; \ + union { int16x4x4_t __i; __builtin_neon_v4hi4 __o; } __rv; \ __rv.__o = __builtin_neon_vld4_dupv4hi (__a); \ __rv.__i; \ }) #define vld4_dup_s32(__a) \ ({ \ - union { int32x2x4_t __i; __builtin_neon_oi __o; } __rv; \ + union { int32x2x4_t __i; __builtin_neon_v2si4 __o; } __rv; \ __rv.__o = __builtin_neon_vld4_dupv2si (__a); \ __rv.__i; \ }) #define vld4_dup_f32(__a) \ ({ \ - union { float32x2x4_t __i; __builtin_neon_oi __o; } __rv; \ + union { float32x2x4_t __i; __builtin_neon_v2sf4 __o; } __rv; \ __rv.__o = __builtin_neon_vld4_dupv2sf (__a); \ __rv.__i; \ }) #define vld4_dup_u8(__a) \ ({ \ - union { uint8x8x4_t __i; __builtin_neon_oi __o; } __rv; \ + union { uint8x8x4_t __i; __builtin_neon_v8qi4 __o; } __rv; \ __rv.__o = __builtin_neon_vld4_dupv8qi (__a); \ __rv.__i; \ }) #define vld4_dup_u16(__a) \ ({ \ - union { uint16x4x4_t __i; __builtin_neon_oi __o; } __rv; \ + union { uint16x4x4_t __i; __builtin_neon_v4hi4 __o; } __rv; \ __rv.__o = __builtin_neon_vld4_dupv4hi (__a); \ __rv.__i; \ }) #define vld4_dup_u32(__a) \ ({ \ - union { uint32x2x4_t __i; __builtin_neon_oi __o; } __rv; \ + union { uint32x2x4_t __i; __builtin_neon_v2si4 __o; } __rv; \ __rv.__o = __builtin_neon_vld4_dupv2si (__a); \ __rv.__i; \ }) #define vld4_dup_p8(__a) \ ({ \ - union { poly8x8x4_t __i; __builtin_neon_oi __o; } __rv; \ + union { poly8x8x4_t __i; __builtin_neon_v8qi4 __o; } __rv; \ __rv.__o = __builtin_neon_vld4_dupv8qi (__a); \ __rv.__i; \ }) #define vld4_dup_p16(__a) \ ({ \ - union { poly16x4x4_t __i; __builtin_neon_oi __o; } __rv; \ + union { poly16x4x4_t __i; __builtin_neon_v4hi4 __o; } __rv; \ __rv.__o = __builtin_neon_vld4_dupv4hi (__a); \ __rv.__i; \ }) #define vld4_dup_s64(__a) \ ({ \ - union { int64x1x4_t __i; __builtin_neon_oi __o; } __rv; \ + union { int64x1x4_t __i; __builtin_neon_di4 __o; } __rv; \ __rv.__o = __builtin_neon_vld4_dupdi (__a); \ __rv.__i; \ }) #define vld4_dup_u64(__a) \ ({ \ - union { uint64x1x4_t __i; __builtin_neon_oi __o; } __rv; \ + union { uint64x1x4_t __i; __builtin_neon_di4 __o; } __rv; \ __rv.__o = __builtin_neon_vld4_dupdi (__a); \ __rv.__i; \ }) #define vst4_s8(__a, __b) \ ({ \ - union { int8x8x4_t __i; __builtin_neon_oi __o; } __bu = { __b }; \ + union { int8x8x4_t __i; __builtin_neon_v8qi4 __o; } __bu = { __b }; \ __builtin_neon_vst4v8qi (__a, __bu.__o); \ }) #define vst4_s16(__a, __b) \ ({ \ - union { int16x4x4_t __i; __builtin_neon_oi __o; } __bu = { __b }; \ + union { int16x4x4_t __i; __builtin_neon_v4hi4 __o; } __bu = { __b }; \ __builtin_neon_vst4v4hi (__a, __bu.__o); \ }) #define vst4_s32(__a, __b) \ ({ \ - union { int32x2x4_t __i; __builtin_neon_oi __o; } __bu = { __b }; \ + union { int32x2x4_t __i; __builtin_neon_v2si4 __o; } __bu = { __b }; \ __builtin_neon_vst4v2si (__a, __bu.__o); \ }) #define vst4_f32(__a, __b) \ ({ \ - union { float32x2x4_t __i; __builtin_neon_oi __o; } __bu = { __b }; \ + union { float32x2x4_t __i; __builtin_neon_v2sf4 __o; } __bu = { __b }; \ __builtin_neon_vst4v2sf (__a, __bu.__o); \ }) #define vst4_u8(__a, __b) \ ({ \ - union { uint8x8x4_t __i; __builtin_neon_oi __o; } __bu = { __b }; \ + union { uint8x8x4_t __i; __builtin_neon_v8qi4 __o; } __bu = { __b }; \ __builtin_neon_vst4v8qi (__a, __bu.__o); \ }) #define vst4_u16(__a, __b) \ ({ \ - union { uint16x4x4_t __i; __builtin_neon_oi __o; } __bu = { __b }; \ + union { uint16x4x4_t __i; __builtin_neon_v4hi4 __o; } __bu = { __b }; \ __builtin_neon_vst4v4hi (__a, __bu.__o); \ }) #define vst4_u32(__a, __b) \ ({ \ - union { uint32x2x4_t __i; __builtin_neon_oi __o; } __bu = { __b }; \ + union { uint32x2x4_t __i; __builtin_neon_v2si4 __o; } __bu = { __b }; \ __builtin_neon_vst4v2si (__a, __bu.__o); \ }) #define vst4_p8(__a, __b) \ ({ \ - union { poly8x8x4_t __i; __builtin_neon_oi __o; } __bu = { __b }; \ + union { poly8x8x4_t __i; __builtin_neon_v8qi4 __o; } __bu = { __b }; \ __builtin_neon_vst4v8qi (__a, __bu.__o); \ }) #define vst4_p16(__a, __b) \ ({ \ - union { poly16x4x4_t __i; __builtin_neon_oi __o; } __bu = { __b }; \ + union { poly16x4x4_t __i; __builtin_neon_v4hi4 __o; } __bu = { __b }; \ __builtin_neon_vst4v4hi (__a, __bu.__o); \ }) #define vst4_s64(__a, __b) \ ({ \ - union { int64x1x4_t __i; __builtin_neon_oi __o; } __bu = { __b }; \ + union { int64x1x4_t __i; __builtin_neon_di4 __o; } __bu = { __b }; \ __builtin_neon_vst4di (__a, __bu.__o); \ }) #define vst4_u64(__a, __b) \ ({ \ - union { uint64x1x4_t __i; __builtin_neon_oi __o; } __bu = { __b }; \ + union { uint64x1x4_t __i; __builtin_neon_di4 __o; } __bu = { __b }; \ __builtin_neon_vst4di (__a, __bu.__o); \ }) #define vst4q_s8(__a, __b) \ ({ \ - union { int8x16x4_t __i; __builtin_neon_xi __o; } __bu = { __b }; \ + union { int8x16x4_t __i; __builtin_neon_v16qi4 __o; } __bu = { __b }; \ __builtin_neon_vst4v16qi (__a, __bu.__o); \ }) #define vst4q_s16(__a, __b) \ ({ \ - union { int16x8x4_t __i; __builtin_neon_xi __o; } __bu = { __b }; \ + union { int16x8x4_t __i; __builtin_neon_v8hi4 __o; } __bu = { __b }; \ __builtin_neon_vst4v8hi (__a, __bu.__o); \ }) #define vst4q_s32(__a, __b) \ ({ \ - union { int32x4x4_t __i; __builtin_neon_xi __o; } __bu = { __b }; \ + union { int32x4x4_t __i; __builtin_neon_v4si4 __o; } __bu = { __b }; \ __builtin_neon_vst4v4si (__a, __bu.__o); \ }) #define vst4q_f32(__a, __b) \ ({ \ - union { float32x4x4_t __i; __builtin_neon_xi __o; } __bu = { __b }; \ + union { float32x4x4_t __i; __builtin_neon_v4sf4 __o; } __bu = { __b }; \ __builtin_neon_vst4v4sf (__a, __bu.__o); \ }) #define vst4q_u8(__a, __b) \ ({ \ - union { uint8x16x4_t __i; __builtin_neon_xi __o; } __bu = { __b }; \ + union { uint8x16x4_t __i; __builtin_neon_v16qi4 __o; } __bu = { __b }; \ __builtin_neon_vst4v16qi (__a, __bu.__o); \ }) #define vst4q_u16(__a, __b) \ ({ \ - union { uint16x8x4_t __i; __builtin_neon_xi __o; } __bu = { __b }; \ + union { uint16x8x4_t __i; __builtin_neon_v8hi4 __o; } __bu = { __b }; \ __builtin_neon_vst4v8hi (__a, __bu.__o); \ }) #define vst4q_u32(__a, __b) \ ({ \ - union { uint32x4x4_t __i; __builtin_neon_xi __o; } __bu = { __b }; \ + union { uint32x4x4_t __i; __builtin_neon_v4si4 __o; } __bu = { __b }; \ __builtin_neon_vst4v4si (__a, __bu.__o); \ }) #define vst4q_p8(__a, __b) \ ({ \ - union { poly8x16x4_t __i; __builtin_neon_xi __o; } __bu = { __b }; \ + union { poly8x16x4_t __i; __builtin_neon_v16qi4 __o; } __bu = { __b }; \ __builtin_neon_vst4v16qi (__a, __bu.__o); \ }) #define vst4q_p16(__a, __b) \ ({ \ - union { poly16x8x4_t __i; __builtin_neon_xi __o; } __bu = { __b }; \ + union { poly16x8x4_t __i; __builtin_neon_v8hi4 __o; } __bu = { __b }; \ __builtin_neon_vst4v8hi (__a, __bu.__o); \ }) #define vst4_lane_s8(__a, __b, __c) \ ({ \ - union { int8x8x4_t __i; __builtin_neon_oi __o; } __bu = { __b }; \ + union { int8x8x4_t __i; __builtin_neon_v8qi4 __o; } __bu = { __b }; \ __builtin_neon_vst4_lanev8qi (__a, __bu.__o, __c); \ }) #define vst4_lane_s16(__a, __b, __c) \ ({ \ - union { int16x4x4_t __i; __builtin_neon_oi __o; } __bu = { __b }; \ + union { int16x4x4_t __i; __builtin_neon_v4hi4 __o; } __bu = { __b }; \ __builtin_neon_vst4_lanev4hi (__a, __bu.__o, __c); \ }) #define vst4_lane_s32(__a, __b, __c) \ ({ \ - union { int32x2x4_t __i; __builtin_neon_oi __o; } __bu = { __b }; \ + union { int32x2x4_t __i; __builtin_neon_v2si4 __o; } __bu = { __b }; \ __builtin_neon_vst4_lanev2si (__a, __bu.__o, __c); \ }) #define vst4_lane_f32(__a, __b, __c) \ ({ \ - union { float32x2x4_t __i; __builtin_neon_oi __o; } __bu = { __b }; \ + union { float32x2x4_t __i; __builtin_neon_v2sf4 __o; } __bu = { __b }; \ __builtin_neon_vst4_lanev2sf (__a, __bu.__o, __c); \ }) #define vst4_lane_u8(__a, __b, __c) \ ({ \ - union { uint8x8x4_t __i; __builtin_neon_oi __o; } __bu = { __b }; \ + union { uint8x8x4_t __i; __builtin_neon_v8qi4 __o; } __bu = { __b }; \ __builtin_neon_vst4_lanev8qi (__a, __bu.__o, __c); \ }) #define vst4_lane_u16(__a, __b, __c) \ ({ \ - union { uint16x4x4_t __i; __builtin_neon_oi __o; } __bu = { __b }; \ + union { uint16x4x4_t __i; __builtin_neon_v4hi4 __o; } __bu = { __b }; \ __builtin_neon_vst4_lanev4hi (__a, __bu.__o, __c); \ }) #define vst4_lane_u32(__a, __b, __c) \ ({ \ - union { uint32x2x4_t __i; __builtin_neon_oi __o; } __bu = { __b }; \ + union { uint32x2x4_t __i; __builtin_neon_v2si4 __o; } __bu = { __b }; \ __builtin_neon_vst4_lanev2si (__a, __bu.__o, __c); \ }) #define vst4_lane_p8(__a, __b, __c) \ ({ \ - union { poly8x8x4_t __i; __builtin_neon_oi __o; } __bu = { __b }; \ + union { poly8x8x4_t __i; __builtin_neon_v8qi4 __o; } __bu = { __b }; \ __builtin_neon_vst4_lanev8qi (__a, __bu.__o, __c); \ }) #define vst4_lane_p16(__a, __b, __c) \ ({ \ - union { poly16x4x4_t __i; __builtin_neon_oi __o; } __bu = { __b }; \ + union { poly16x4x4_t __i; __builtin_neon_v4hi4 __o; } __bu = { __b }; \ __builtin_neon_vst4_lanev4hi (__a, __bu.__o, __c); \ }) #define vst4q_lane_s16(__a, __b, __c) \ ({ \ - union { int16x8x4_t __i; __builtin_neon_xi __o; } __bu = { __b }; \ + union { int16x8x4_t __i; __builtin_neon_v8hi4 __o; } __bu = { __b }; \ __builtin_neon_vst4_lanev8hi (__a, __bu.__o, __c); \ }) #define vst4q_lane_s32(__a, __b, __c) \ ({ \ - union { int32x4x4_t __i; __builtin_neon_xi __o; } __bu = { __b }; \ + union { int32x4x4_t __i; __builtin_neon_v4si4 __o; } __bu = { __b }; \ __builtin_neon_vst4_lanev4si (__a, __bu.__o, __c); \ }) #define vst4q_lane_f32(__a, __b, __c) \ ({ \ - union { float32x4x4_t __i; __builtin_neon_xi __o; } __bu = { __b }; \ + union { float32x4x4_t __i; __builtin_neon_v4sf4 __o; } __bu = { __b }; \ __builtin_neon_vst4_lanev4sf (__a, __bu.__o, __c); \ }) #define vst4q_lane_u16(__a, __b, __c) \ ({ \ - union { uint16x8x4_t __i; __builtin_neon_xi __o; } __bu = { __b }; \ + union { uint16x8x4_t __i; __builtin_neon_v8hi4 __o; } __bu = { __b }; \ __builtin_neon_vst4_lanev8hi (__a, __bu.__o, __c); \ }) #define vst4q_lane_u32(__a, __b, __c) \ ({ \ - union { uint32x4x4_t __i; __builtin_neon_xi __o; } __bu = { __b }; \ + union { uint32x4x4_t __i; __builtin_neon_v4si4 __o; } __bu = { __b }; \ __builtin_neon_vst4_lanev4si (__a, __bu.__o, __c); \ }) #define vst4q_lane_p16(__a, __b, __c) \ ({ \ - union { poly16x8x4_t __i; __builtin_neon_xi __o; } __bu = { __b }; \ + union { poly16x8x4_t __i; __builtin_neon_v8hi4 __o; } __bu = { __b }; \ __builtin_neon_vst4_lanev8hi (__a, __bu.__o, __c); \ }) Modified: llvm-gcc-4.2/trunk/gcc/config/arm/llvm-arm.cpp URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/arm/llvm-arm.cpp?rev=77283&r1=77282&r2=77283&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/config/arm/llvm-arm.cpp (original) +++ llvm-gcc-4.2/trunk/gcc/config/arm/llvm-arm.cpp Mon Jul 27 19:32:28 2009 @@ -1988,7 +1988,9 @@ Type *VPTy = Context.getPointerTypeUnqual(Type::Int8Ty); Result = Builder.CreateCall2(intFn, BitCastToType(Ops[0], VPTy), ConstantInt::get(Type::Int32Ty, N)); - Result = BitCastToType(Result, ResultType); + Type *PtrToWideVec = Context.getPointerTypeUnqual(Result->getType()); + Builder.CreateStore(Result, BitCastToType(DestLoc->Ptr, PtrToWideVec)); + Result = 0; break; } @@ -2018,7 +2020,9 @@ LaneVal + (n * NUnits)); Result = Builder.CreateInsertElement(Result, Elt, Ndx); } - Result = BitCastToType(Result, ResultType); + Type *PtrToWideVec = Context.getPointerTypeUnqual(VTy); + Builder.CreateStore(Result, BitCastToType(DestLoc->Ptr, PtrToWideVec)); + Result = 0; break; } @@ -2056,7 +2060,9 @@ Result = Builder.CreateShuffleVector(Result, Context.getUndef(VTy), Context.getConstantVector(Idxs)); } - Result = BitCastToType(Result, ResultType); + Type *PtrToWideVec = Context.getPointerTypeUnqual(VTy); + Builder.CreateStore(Result, BitCastToType(DestLoc->Ptr, PtrToWideVec)); + Result = 0; break; } @@ -2082,7 +2088,10 @@ } Type *VPTy = Context.getPointerTypeUnqual(Type::Int8Ty); - Value *Vec = BitCastToType(Ops[1], VTy); + Value *Tmp = CreateTemporary(VTy); + Type *PtrToStruct = Context.getPointerTypeUnqual(Ops[1]->getType()); + Builder.CreateStore(Ops[1], BitCastToType(Tmp, PtrToStruct)); + Value *Vec = Builder.CreateLoad(Tmp); Builder.CreateCall3(intFn, BitCastToType(Ops[0], VPTy), Vec, ConstantInt::get(Type::Int32Ty, N)); Result = 0; @@ -2106,7 +2115,10 @@ unsigned NUnits = VTy->getNumElements() / NumVecs; if (!isValidLane(Ops[2], NUnits, &LaneVal)) return UnexpectedError("%Hinvalid lane number", exp, Result); - Value *Vec = BitCastToType(Ops[1], VTy); + Value *Tmp = CreateTemporary(VTy); + Type *PtrToStruct = Context.getPointerTypeUnqual(Ops[1]->getType()); + Builder.CreateStore(Ops[1], BitCastToType(Tmp, PtrToStruct)); + Value *Vec = Builder.CreateLoad(Tmp); for (unsigned n = 0; n != NumVecs; ++n) { Value *Addr = (n == 0) ? Ops[0] : Builder.CreateGEP(Ops[0], ConstantInt::get(Type::Int32Ty, n)); Modified: llvm-gcc-4.2/trunk/gcc/config/arm/neon.ml URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/arm/neon.ml?rev=77283&r1=77282&r2=77283&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/config/arm/neon.ml (original) +++ llvm-gcc-4.2/trunk/gcc/config/arm/neon.ml Mon Jul 27 19:32:28 2009 @@ -62,7 +62,18 @@ XImode : "heXadeca", eight registers (sixteen words). *) -type inttype = B_TImode | B_EImode | B_OImode | B_CImode | B_XImode +(* LLVM LOCAL begin Use a different type for each vector type. *) +type inttype = B_TId8mode | B_EId8mode | B_OId8mode + | B_TId16mode | B_EId16mode | B_OId16mode + | B_TId32mode | B_EId32mode | B_OId32mode + | B_TId64mode | B_EId64mode | B_OId64mode + | B_TIdSFmode | B_EIdSFmode | B_OIdSFmode + | B_OIq8mode | B_CIq8mode | B_XIq8mode + | B_OIq16mode | B_CIq16mode | B_XIq16mode + | B_OIq32mode | B_CIq32mode | B_XIq32mode + | B_OIq64mode | B_CIq64mode | B_XIq64mode + | B_OIqSFmode | B_CIqSFmode | B_XIqSFmode +(* LLVM LOCAL end Use a different type for each vector type. *) type shape_elt = Dreg | Qreg | Corereg | Immed | VecArray of int * shape_elt | PtrTo of shape_elt | CstPtrTo of shape_elt @@ -461,17 +472,60 @@ | T_uint8x16 | T_uint16x8 | T_uint32x4 | T_uint64x2 | T_float32x4 | T_poly8x16 | T_poly16x8 -> 128 | _ -> raise Not_found + +(* LLVM LOCAL begin Map vector types to modes. *) +let vectype_mode = function + T_int8x8 | T_uint8x8 | T_poly8x8 -> V8QI + | T_int8x16 | T_uint8x16 | T_poly8x16 -> V16QI + | T_int16x4 | T_uint16x4 | T_poly16x4 -> V4HI + | T_int16x8 | T_uint16x8 | T_poly16x8 -> V8HI + | T_int32x2 | T_uint32x2 -> V2SI + | T_int32x4 | T_uint32x4 -> V4SI + | T_int64x1 | T_uint64x1 -> DI + | T_int64x2 | T_uint64x2 -> V2DI + | T_float32x2 -> V2SF + | T_float32x4 -> V4SF + | _ -> raise Not_found +(* LLVM LOCAL end Map vector types to modes. *) let inttype_for_array num elttype = let eltsize = vectype_size elttype in let numwords = (num * eltsize) / 32 in - match numwords with - 4 -> B_TImode - | 6 -> B_EImode - | 8 -> B_OImode - | 12 -> B_CImode - | 16 -> B_XImode + (* LLVM LOCAL begin Match vector type, too. *) + let vecmode = vectype_mode elttype in + match numwords, vecmode with + 4, V8QI -> B_TId8mode + | 4, V4HI -> B_TId16mode + | 4, V2SI -> B_TId32mode + | 4, DI -> B_TId64mode + | 4, V2SF -> B_TIdSFmode + | 6, V8QI -> B_EId8mode + | 6, V4HI -> B_EId16mode + | 6, V2SI -> B_EId32mode + | 6, DI -> B_EId64mode + | 6, V2SF -> B_EIdSFmode + | 8, V8QI -> B_OId8mode + | 8, V4HI -> B_OId16mode + | 8, V2SI -> B_OId32mode + | 8, DI -> B_OId64mode + | 8, V2SF -> B_OIdSFmode + | 8, V16QI -> B_OIq8mode + | 8, V8HI -> B_OIq16mode + | 8, V4SI -> B_OIq32mode + | 8, V2DI -> B_OIq64mode + | 8, V4SF -> B_OIqSFmode + | 12, V16QI -> B_CIq8mode + | 12, V8HI -> B_CIq16mode + | 12, V4SI -> B_CIq32mode + | 12, V2DI -> B_CIq64mode + | 12, V4SF -> B_CIqSFmode + | 16, V16QI -> B_XIq8mode + | 16, V8HI -> B_XIq16mode + | 16, V4SI -> B_XIq32mode + | 16, V2DI -> B_XIq64mode + | 16, V4SF -> B_XIqSFmode | _ -> failwith ("no int type for size " ^ string_of_int numwords) + (* LLVM LOCAL end Match vector type, too. *) (* These functions return pairs of (internal, external) types, where "internal" types are those seen by GCC, and "external" are those seen by the assembler. @@ -1707,12 +1761,39 @@ in name (fun x -> x ^ "_t") vt +(* LLVM LOCAL begin Print builtin type names that include the vector type. *) let string_of_inttype = function - B_TImode -> "__builtin_neon_ti" - | B_EImode -> "__builtin_neon_ei" - | B_OImode -> "__builtin_neon_oi" - | B_CImode -> "__builtin_neon_ci" - | B_XImode -> "__builtin_neon_xi" + B_TId8mode -> "__builtin_neon_v8qi2" + | B_TId16mode -> "__builtin_neon_v4hi2" + | B_TId32mode -> "__builtin_neon_v2si2" + | B_TId64mode -> "__builtin_neon_di2" + | B_TIdSFmode -> "__builtin_neon_v2sf2" + | B_EId8mode -> "__builtin_neon_v8qi3" + | B_EId16mode -> "__builtin_neon_v4hi3" + | B_EId32mode -> "__builtin_neon_v2si3" + | B_EId64mode -> "__builtin_neon_di3" + | B_EIdSFmode -> "__builtin_neon_v2sf3" + | B_OId8mode -> "__builtin_neon_v8qi4" + | B_OId16mode -> "__builtin_neon_v4hi4" + | B_OId32mode -> "__builtin_neon_v2si4" + | B_OId64mode -> "__builtin_neon_di4" + | B_OIdSFmode -> "__builtin_neon_v2sf4" + | B_OIq8mode -> "__builtin_neon_v16qi2" + | B_OIq16mode -> "__builtin_neon_v8hi2" + | B_OIq32mode -> "__builtin_neon_v4si2" + | B_OIq64mode -> "__builtin_neon_v2di2" + | B_OIqSFmode -> "__builtin_neon_v4sf2" + | B_CIq8mode -> "__builtin_neon_v16qi3" + | B_CIq16mode -> "__builtin_neon_v8hi3" + | B_CIq32mode -> "__builtin_neon_v4si3" + | B_CIq64mode -> "__builtin_neon_v2di3" + | B_CIqSFmode -> "__builtin_neon_v4sf3" + | B_XIq8mode -> "__builtin_neon_v16qi4" + | B_XIq16mode -> "__builtin_neon_v8hi4" + | B_XIq32mode -> "__builtin_neon_v4si4" + | B_XIq64mode -> "__builtin_neon_v2di4" + | B_XIqSFmode -> "__builtin_neon_v4sf4" +(* LLVM LOCAL end Print builtin type names that include the vector type. *) let string_of_mode = function V8QI -> "v8qi" | V4HI -> "v4hi" | V2SI -> "v2si" | V2SF -> "v2sf" From gohman at apple.com Mon Jul 27 19:37:06 2009 From: gohman at apple.com (Dan Gohman) Date: Tue, 28 Jul 2009 00:37:06 -0000 Subject: [llvm-commits] [llvm] r77285 - /llvm/trunk/lib/Transforms/Scalar/MemCpyOptimizer.cpp Message-ID: <200907280037.n6S0b6gu027963@zion.cs.uiuc.edu> Author: djg Date: Mon Jul 27 19:37:06 2009 New Revision: 77285 URL: http://llvm.org/viewvc/llvm-project?rev=77285&view=rev Log: Grab the LLVMContext and parent Module of SI ahead of the point where SI can get deleted. This fixes a use of free'd memory. This fixes Externals/Povray. Modified: llvm/trunk/lib/Transforms/Scalar/MemCpyOptimizer.cpp Modified: llvm/trunk/lib/Transforms/Scalar/MemCpyOptimizer.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/MemCpyOptimizer.cpp?rev=77285&r1=77284&r2=77285&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/MemCpyOptimizer.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/MemCpyOptimizer.cpp Mon Jul 27 19:37:06 2009 @@ -352,6 +352,8 @@ TargetData &TD = getAnalysis(); AliasAnalysis &AA = getAnalysis(); + LLVMContext &Context = SI->getContext(); + Module *M = SI->getParent()->getParent()->getParent(); // Okay, so we now have a single store that can be splatable. Scan to find // all subsequent stores of the same value to offset from the same pointer. @@ -431,8 +433,7 @@ if (MemSetF == 0) { const Type *Tys[] = {Type::Int64Ty}; - MemSetF = Intrinsic::getDeclaration(SI->getParent()->getParent() - ->getParent(), Intrinsic::memset, + MemSetF = Intrinsic::getDeclaration(M, Intrinsic::memset, Tys, 1); } @@ -440,7 +441,7 @@ StartPtr = Range.StartPtr; // Cast the start ptr to be i8* as memset requires. - const Type *i8Ptr = SI->getContext().getPointerTypeUnqual(Type::Int8Ty); + const Type *i8Ptr = Context.getPointerTypeUnqual(Type::Int8Ty); if (StartPtr->getType() != i8Ptr) StartPtr = new BitCastInst(StartPtr, i8Ptr, StartPtr->getName(), InsertPt); From gohman at apple.com Mon Jul 27 19:37:50 2009 From: gohman at apple.com (Dan Gohman) Date: Tue, 28 Jul 2009 00:37:50 -0000 Subject: [llvm-commits] [llvm] r77286 - /llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp Message-ID: <200907280037.n6S0boOF028001@zion.cs.uiuc.edu> Author: djg Date: Mon Jul 27 19:37:50 2009 New Revision: 77286 URL: http://llvm.org/viewvc/llvm-project?rev=77286&view=rev Log: Replace dyn_castGetElementPtr with dyn_cast. Modified: llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp Modified: llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp?rev=77286&r1=77285&r2=77286&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp Mon Jul 27 19:37:50 2009 @@ -628,16 +628,6 @@ return 0; } -/// dyn_castGetElementPtr - If this is a getelementptr instruction or constant -/// expression, return it. -static User *dyn_castGetElementPtr(Value *V) { - if (isa(V)) return cast(V); - if (ConstantExpr *CE = dyn_cast(V)) - if (CE->getOpcode() == Instruction::GetElementPtr) - return cast(V); - return false; -} - /// AddOne - Add one to a ConstantInt static Constant *AddOne(Constant *C, LLVMContext *Context) { return Context->getConstantExprAdd(C, @@ -5572,7 +5562,7 @@ Instruction *InstCombiner::FoldGEPICmp(User *GEPLHS, Value *RHS, ICmpInst::Predicate Cond, Instruction &I) { - assert(dyn_castGetElementPtr(GEPLHS) && "LHS is not a getelementptr!"); + assert(isa(GEPLHS) && "LHS is not a getelementptr!"); // Look through bitcasts. if (BitCastInst *BCI = dyn_cast(RHS)) @@ -5590,7 +5580,7 @@ Offset = EmitGEPOffset(GEPLHS, I, *this); return new ICmpInst(*Context, ICmpInst::getSignedPredicate(Cond), Offset, Context->getNullValue(Offset->getType())); - } else if (User *GEPRHS = dyn_castGetElementPtr(RHS)) { + } else if (User *GEPRHS = dyn_cast(RHS)) { // If the base pointers are different, but the indices are the same, just // compare the base pointer. if (PtrBase != GEPRHS->getOperand(0)) { @@ -6355,10 +6345,10 @@ } // If we can optimize a 'icmp GEP, P' or 'icmp P, GEP', do so now. - if (User *GEP = dyn_castGetElementPtr(Op0)) + if (User *GEP = dyn_cast(Op0)) if (Instruction *NI = FoldGEPICmp(GEP, Op1, I.getPredicate(), I)) return NI; - if (User *GEP = dyn_castGetElementPtr(Op1)) + if (User *GEP = dyn_cast(Op1)) if (Instruction *NI = FoldGEPICmp(GEP, Op0, ICmpInst::getSwappedPredicate(I.getPredicate()), I)) return NI; @@ -11065,7 +11055,7 @@ // getelementptr instructions into a single instruction. // SmallVector SrcGEPOperands; - if (User *Src = dyn_castGetElementPtr(PtrOp)) + if (User *Src = dyn_cast(PtrOp)) SrcGEPOperands.append(Src->op_begin(), Src->op_end()); if (!SrcGEPOperands.empty()) { From daniel at zuster.org Mon Jul 27 19:58:51 2009 From: daniel at zuster.org (Daniel Dunbar) Date: Tue, 28 Jul 2009 00:58:51 -0000 Subject: [llvm-commits] [llvm] r77287 - in /llvm/trunk/tools/llvm-mc: AsmLexer.cpp AsmLexer.h Message-ID: <200907280058.n6S0wpGO028830@zion.cs.uiuc.edu> Author: ddunbar Date: Mon Jul 27 19:58:50 2009 New Revision: 77287 URL: http://llvm.org/viewvc/llvm-project?rev=77287&view=rev Log: llvm-mc: Stop uniqueing string tokens, nothing actually uses this. Modified: llvm/trunk/tools/llvm-mc/AsmLexer.cpp llvm/trunk/tools/llvm-mc/AsmLexer.h Modified: llvm/trunk/tools/llvm-mc/AsmLexer.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-mc/AsmLexer.cpp?rev=77287&r1=77286&r2=77287&view=diff ============================================================================== --- llvm/trunk/tools/llvm-mc/AsmLexer.cpp (original) +++ llvm/trunk/tools/llvm-mc/AsmLexer.cpp Mon Jul 27 19:58:50 2009 @@ -12,7 +12,6 @@ //===----------------------------------------------------------------------===// #include "AsmLexer.h" -#include "llvm/ADT/StringSet.h" #include "llvm/Support/SourceMgr.h" #include "llvm/Support/MemoryBuffer.h" #include "llvm/Config/config.h" // for strtoull. @@ -21,21 +20,14 @@ #include using namespace llvm; -static StringSet<> &getSS(void *TheSS) { - return *(StringSet<>*)TheSS; -} - AsmLexer::AsmLexer(SourceMgr &SM) : SrcMgr(SM) { CurBuffer = 0; CurBuf = SrcMgr.getMemoryBuffer(CurBuffer); CurPtr = CurBuf->getBufferStart(); TokStart = 0; - - TheStringSet = new StringSet<>(); } AsmLexer::~AsmLexer() { - delete &getSS(TheStringSet); } SMLoc AsmLexer::getLoc() const { @@ -107,9 +99,7 @@ *CurPtr == '.' || *CurPtr == '@') ++CurPtr; // Unique string. - CurStrVal = getSS(TheStringSet).GetOrCreateValue(StringRef(TokStart, - CurPtr - TokStart), - 0).getKeyData(); + CurStrVal = StringRef(TokStart, CurPtr - TokStart); return asmtok::Identifier; } @@ -122,9 +112,7 @@ ++CurPtr; // Unique string. - CurStrVal = getSS(TheStringSet).GetOrCreateValue(StringRef(TokStart, - CurPtr - TokStart), - 0).getKeyData(); + CurStrVal = StringRef(TokStart, CurPtr - TokStart); return asmtok::Register; } @@ -251,9 +239,7 @@ } // Unique string, include quotes for now. - CurStrVal = getSS(TheStringSet).GetOrCreateValue(StringRef(TokStart, - CurPtr - TokStart), - 0).getKeyData(); + CurStrVal = StringRef(TokStart, CurPtr - TokStart); return asmtok::String; } Modified: llvm/trunk/tools/llvm-mc/AsmLexer.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-mc/AsmLexer.h?rev=77287&r1=77286&r2=77287&view=diff ============================================================================== --- llvm/trunk/tools/llvm-mc/AsmLexer.h (original) +++ llvm/trunk/tools/llvm-mc/AsmLexer.h Mon Jul 27 19:58:50 2009 @@ -59,13 +59,11 @@ const char *CurPtr; const MemoryBuffer *CurBuf; - // A llvm::StringSet<>, which provides uniqued and null-terminated strings. - void *TheStringSet; // Information about the current token. const char *TokStart; asmtok::TokKind CurKind; - const char *CurStrVal; // This is valid for Identifier. + StringRef CurStrVal; // This is valid for Identifier. int64_t CurIntVal; /// CurBuffer - This is the current buffer index we're lexing from as managed From howard0su at gmail.com Mon Jul 27 20:06:54 2009 From: howard0su at gmail.com (Howard Su) Date: Tue, 28 Jul 2009 09:06:54 +0800 Subject: [llvm-commits] [llvm] r77274 - /llvm/trunk/lib/Transforms/Utils/LowerSwitch.cpp In-Reply-To: <200907272333.n6RNXZkU026103@zion.cs.uiuc.edu> References: <200907272333.n6RNXZkU026103@zion.cs.uiuc.edu> Message-ID: this option is a gcc extension. it cause compile error under VC. On Tue, Jul 28, 2009 at 7:33 AM, Mike Stump wrote: > Author: mrs > Date: Mon Jul 27 18:33:34 2009 > New Revision: 77274 > > URL: http://llvm.org/viewvc/llvm-project?rev=77274&view=rev > Log: > Fix a release-asserts warning. Debug functions should be marked used, > if there are no other uses. If people don't need this routine > anymore, if should be deleted. > > Modified: > llvm/trunk/lib/Transforms/Utils/LowerSwitch.cpp > > Modified: llvm/trunk/lib/Transforms/Utils/LowerSwitch.cpp > URL: > http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/LowerSwitch.cpp?rev=77274&r1=77273&r2=77274&view=diff > > > ============================================================================== > --- llvm/trunk/lib/Transforms/Utils/LowerSwitch.cpp (original) > +++ llvm/trunk/lib/Transforms/Utils/LowerSwitch.cpp Mon Jul 27 18:33:34 > 2009 > @@ -110,6 +110,8 @@ > // operator<< - Used for debugging purposes. > // > static raw_ostream& operator<<(raw_ostream &O, > + const LowerSwitch::CaseVector &C) > __attribute((used)); > +static raw_ostream& operator<<(raw_ostream &O, > const LowerSwitch::CaseVector &C) { > O << "["; > > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits > -- -Howard -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20090728/248782ab/attachment.html From howard0su at gmail.com Mon Jul 27 20:26:08 2009 From: howard0su at gmail.com (Howard Su) Date: Tue, 28 Jul 2009 09:26:08 +0800 Subject: [llvm-commits] [llvm] r77204 - in /llvm/trunk: include/llvm/Target/COFFTargetAsmInfo.h include/llvm/Target/ELFTargetAsmInfo.h lib/Target/COFFTargetAsmInfo.cpp lib/Target/X86/X86TargetAsmInfo.cpp lib/Target/X86/X86TargetAsmInfo.h In-Reply-To: <200907271646.n6RGk16h012710@zion.cs.uiuc.edu> References: <200907271646.n6RGk16h012710@zion.cs.uiuc.edu> Message-ID: PIC16 is also using COFF as its target. On Tue, Jul 28, 2009 at 12:46 AM, Chris Lattner wrote: > Author: lattner > Date: Mon Jul 27 11:45:59 2009 > New Revision: 77204 > > URL: http://llvm.org/viewvc/llvm-project?rev=77204&view=rev > Log: > make COFF work like ELF and macho, by splitting out into its own > header even though there is only one COFF target. > > Added: > llvm/trunk/include/llvm/Target/COFFTargetAsmInfo.h > llvm/trunk/lib/Target/COFFTargetAsmInfo.cpp > Modified: > llvm/trunk/include/llvm/Target/ELFTargetAsmInfo.h > llvm/trunk/lib/Target/X86/X86TargetAsmInfo.cpp > llvm/trunk/lib/Target/X86/X86TargetAsmInfo.h > > Added: llvm/trunk/include/llvm/Target/COFFTargetAsmInfo.h > URL: > http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/COFFTargetAsmInfo.h?rev=77204&view=auto > > > ============================================================================== > --- llvm/trunk/include/llvm/Target/COFFTargetAsmInfo.h (added) > +++ llvm/trunk/include/llvm/Target/COFFTargetAsmInfo.h Mon Jul 27 11:45:59 > 2009 > @@ -0,0 +1,30 @@ > +//===-- COFFTargetAsmInfo.h - COFF asm properties ---------------*- C++ > -*-===// > +// > +// The LLVM Compiler Infrastructure > +// > +// This file is distributed under the University of Illinois Open Source > +// License. See LICENSE.TXT for details. > +// > > +//===----------------------------------------------------------------------===// > + > +#ifndef LLVM_COFF_TARGET_ASM_INFO_H > +#define LLVM_COFF_TARGET_ASM_INFO_H > + > +#include "llvm/Target/TargetAsmInfo.h" > + > +namespace llvm { > + class COFFTargetAsmInfo : public TargetAsmInfo { > + protected: > + explicit COFFTargetAsmInfo(const TargetMachine &TM); > + public: > + > + virtual const char * > + getSectionPrefixForUniqueGlobal(SectionKind kind) const; > + > + virtual void getSectionFlagsAsString(SectionKind Kind, > + SmallVectorImpl &Str) > const; > + }; > +} > + > + > +#endif // LLVM_ELF_TARGET_ASM_INFO_H > > Modified: llvm/trunk/include/llvm/Target/ELFTargetAsmInfo.h > URL: > http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/ELFTargetAsmInfo.h?rev=77204&r1=77203&r2=77204&view=diff > > > ============================================================================== > --- llvm/trunk/include/llvm/Target/ELFTargetAsmInfo.h (original) > +++ llvm/trunk/include/llvm/Target/ELFTargetAsmInfo.h Mon Jul 27 11:45:59 > 2009 > @@ -18,7 +18,6 @@ > #include "llvm/Target/TargetAsmInfo.h" > > namespace llvm { > - class GlobalValue; > > struct ELFTargetAsmInfo : public TargetAsmInfo { > ELFTargetAsmInfo(const TargetMachine &TM); > > Added: llvm/trunk/lib/Target/COFFTargetAsmInfo.cpp > URL: > http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/COFFTargetAsmInfo.cpp?rev=77204&view=auto > > > ============================================================================== > --- llvm/trunk/lib/Target/COFFTargetAsmInfo.cpp (added) > +++ llvm/trunk/lib/Target/COFFTargetAsmInfo.cpp Mon Jul 27 11:45:59 2009 > @@ -0,0 +1,76 @@ > +//===-- COFFTargetAsmInfo.cpp - COFF asm properties -------------*- C++ > -*-===// > +// > +// The LLVM Compiler Infrastructure > +// > +// This file is distributed under the University of Illinois Open Source > +// License. See LICENSE.TXT for details. > +// > > +//===----------------------------------------------------------------------===// > +// > +// This file defines target asm properties related what form asm > statements > +// should take in general on COFF-based targets > +// > > +//===----------------------------------------------------------------------===// > + > +#include "llvm/Target/COFFTargetAsmInfo.h" > +#include "llvm/ADT/SmallVector.h" > +using namespace llvm; > + > +COFFTargetAsmInfo::COFFTargetAsmInfo(const TargetMachine &TM) > + : TargetAsmInfo(TM) { > + > + TextSection = getOrCreateSection("_text", true, SectionKind::Text); > + DataSection = getOrCreateSection("_data", true, SectionKind::DataRel); > + > + GlobalPrefix = "_"; > + LCOMMDirective = "\t.lcomm\t"; > + COMMDirectiveTakesAlignment = false; > + HasDotTypeDotSizeDirective = false; > + HasSingleParameterDotFile = false; > + StaticCtorsSection = "\t.section .ctors,\"aw\""; > + StaticDtorsSection = "\t.section .dtors,\"aw\""; > + HiddenDirective = NULL; > + PrivateGlobalPrefix = "L"; // Prefix for private global symbols > + WeakRefDirective = "\t.weak\t"; > + SetDirective = "\t.set\t"; > + > + // Set up DWARF directives > + HasLEB128 = true; // Target asm supports leb128 directives > (little-endian) > + AbsoluteDebugSectionOffsets = true; > + AbsoluteEHSectionOffsets = false; > + SupportsDebugInformation = true; > + DwarfSectionOffsetDirective = "\t.secrel32\t"; > + DwarfAbbrevSection = "\t.section\t.debug_abbrev,\"dr\""; > + DwarfInfoSection = "\t.section\t.debug_info,\"dr\""; > + DwarfLineSection = "\t.section\t.debug_line,\"dr\""; > + DwarfFrameSection = "\t.section\t.debug_frame,\"dr\""; > + DwarfPubNamesSection ="\t.section\t.debug_pubnames,\"dr\""; > + DwarfPubTypesSection ="\t.section\t.debug_pubtypes,\"dr\""; > + DwarfStrSection = "\t.section\t.debug_str,\"dr\""; > + DwarfLocSection = "\t.section\t.debug_loc,\"dr\""; > + DwarfARangesSection = "\t.section\t.debug_aranges,\"dr\""; > + DwarfRangesSection = "\t.section\t.debug_ranges,\"dr\""; > + DwarfMacroInfoSection = "\t.section\t.debug_macinfo,\"dr\""; > +} > + > +const char *COFFTargetAsmInfo:: > +getSectionPrefixForUniqueGlobal(SectionKind Kind) const { > + if (Kind.isText()) > + return ".text$linkonce"; > + if (Kind.isWriteable()) > + return ".data$linkonce"; > + return ".rdata$linkonce"; > +} > + > +void COFFTargetAsmInfo::getSectionFlagsAsString(SectionKind Kind, > + SmallVectorImpl &Str) > const { > + // FIXME: Inefficient. > + std::string Res = ",\""; > + if (Kind.isText()) > + Res += 'x'; > + if (Kind.isWriteable()) > + Res += 'w'; > + Res += "\""; > + > + Str.append(Res.begin(), Res.end()); > +} > > Modified: llvm/trunk/lib/Target/X86/X86TargetAsmInfo.cpp > URL: > http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86TargetAsmInfo.cpp?rev=77204&r1=77203&r2=77204&view=diff > > > ============================================================================== > --- llvm/trunk/lib/Target/X86/X86TargetAsmInfo.cpp (original) > +++ llvm/trunk/lib/Target/X86/X86TargetAsmInfo.cpp Mon Jul 27 11:45:59 2009 > @@ -188,42 +188,6 @@ > } > } > > -X86COFFTargetAsmInfo::X86COFFTargetAsmInfo(const X86TargetMachine &TM): > - X86GenericTargetAsmInfo(TM) { > - > - TextSection = getOrCreateSection("_text", true, SectionKind::Text); > - DataSection = getOrCreateSection("_data", true, SectionKind::DataRel); > - > - GlobalPrefix = "_"; > - LCOMMDirective = "\t.lcomm\t"; > - COMMDirectiveTakesAlignment = false; > - HasDotTypeDotSizeDirective = false; > - HasSingleParameterDotFile = false; > - StaticCtorsSection = "\t.section .ctors,\"aw\""; > - StaticDtorsSection = "\t.section .dtors,\"aw\""; > - HiddenDirective = NULL; > - PrivateGlobalPrefix = "L"; // Prefix for private global symbols > - WeakRefDirective = "\t.weak\t"; > - SetDirective = "\t.set\t"; > - > - // Set up DWARF directives > - HasLEB128 = true; // Target asm supports leb128 directives > (little-endian) > - AbsoluteDebugSectionOffsets = true; > - AbsoluteEHSectionOffsets = false; > - SupportsDebugInformation = true; > - DwarfSectionOffsetDirective = "\t.secrel32\t"; > - DwarfAbbrevSection = "\t.section\t.debug_abbrev,\"dr\""; > - DwarfInfoSection = "\t.section\t.debug_info,\"dr\""; > - DwarfLineSection = "\t.section\t.debug_line,\"dr\""; > - DwarfFrameSection = "\t.section\t.debug_frame,\"dr\""; > - DwarfPubNamesSection ="\t.section\t.debug_pubnames,\"dr\""; > - DwarfPubTypesSection ="\t.section\t.debug_pubtypes,\"dr\""; > - DwarfStrSection = "\t.section\t.debug_str,\"dr\""; > - DwarfLocSection = "\t.section\t.debug_loc,\"dr\""; > - DwarfARangesSection = "\t.section\t.debug_aranges,\"dr\""; > - DwarfRangesSection = "\t.section\t.debug_ranges,\"dr\""; > - DwarfMacroInfoSection = "\t.section\t.debug_macinfo,\"dr\""; > -} > > unsigned > X86COFFTargetAsmInfo::PreferredEHDataFormat(DwarfEncoding::Target Reason, > @@ -263,32 +227,10 @@ > return DW_EH_PE_absptr; > } > > -const char *X86COFFTargetAsmInfo:: > -getSectionPrefixForUniqueGlobal(SectionKind Kind) const { > - if (Kind.isText()) > - return ".text$linkonce"; > - if (Kind.isWriteable()) > - return ".data$linkonce"; > - return ".rdata$linkonce"; > -} > - > > > -void X86COFFTargetAsmInfo::getSectionFlagsAsString(SectionKind Kind, > - SmallVectorImpl &Str) > const { > - // FIXME: Inefficient. > - std::string Res = ",\""; > - if (Kind.isText()) > - Res += 'x'; > - if (Kind.isWriteable()) > - Res += 'w'; > - Res += "\""; > - > - Str.append(Res.begin(), Res.end()); > -} > - > X86WinTargetAsmInfo::X86WinTargetAsmInfo(const X86TargetMachine &TM): > - X86GenericTargetAsmInfo(TM) { > + X86TargetAsmInfo(TM) { > GlobalPrefix = "_"; > CommentString = ";"; > > > Modified: llvm/trunk/lib/Target/X86/X86TargetAsmInfo.h > URL: > http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86TargetAsmInfo.h?rev=77204&r1=77203&r2=77204&view=diff > > > ============================================================================== > --- llvm/trunk/lib/Target/X86/X86TargetAsmInfo.h (original) > +++ llvm/trunk/lib/Target/X86/X86TargetAsmInfo.h Mon Jul 27 11:45:59 2009 > @@ -16,8 +16,9 @@ > > #include "X86TargetMachine.h" > #include "llvm/Target/TargetAsmInfo.h" > -#include "llvm/Target/ELFTargetAsmInfo.h" > +#include "llvm/Target/COFFTargetAsmInfo.h" > #include "llvm/Target/DarwinTargetAsmInfo.h" > +#include "llvm/Target/ELFTargetAsmInfo.h" > #include "llvm/Support/Compiler.h" > > namespace llvm { > @@ -49,16 +50,13 @@ > bool Global) const; > }; > > - struct X86COFFTargetAsmInfo : public X86GenericTargetAsmInfo { > - explicit X86COFFTargetAsmInfo(const X86TargetMachine &TM); > + struct X86COFFTargetAsmInfo : public X86TargetAsmInfo > { > + explicit X86COFFTargetAsmInfo(const X86TargetMachine &TM) : > + X86TargetAsmInfo(TM) {} > virtual unsigned PreferredEHDataFormat(DwarfEncoding::Target Reason, > bool Global) const; > - virtual const char * > - getSectionPrefixForUniqueGlobal(SectionKind kind) const; > - > - virtual void getSectionFlagsAsString(SectionKind Kind, > - SmallVectorImpl &Str) > const; > }; > + > > struct X86WinTargetAsmInfo : public X86GenericTargetAsmInfo { > explicit X86WinTargetAsmInfo(const X86TargetMachine &TM); > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits > -- -Howard -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20090728/ea8fea75/attachment.html From mrs at apple.com Mon Jul 27 20:35:35 2009 From: mrs at apple.com (Mike Stump) Date: Tue, 28 Jul 2009 01:35:35 -0000 Subject: [llvm-commits] [llvm] r77289 - /llvm/trunk/lib/Transforms/Utils/LowerSwitch.cpp Message-ID: <200907280135.n6S1ZZKR029983@zion.cs.uiuc.edu> Author: mrs Date: Mon Jul 27 20:35:34 2009 New Revision: 77289 URL: http://llvm.org/viewvc/llvm-project?rev=77289&view=rev Log: Fix a small little typo. Modified: llvm/trunk/lib/Transforms/Utils/LowerSwitch.cpp Modified: llvm/trunk/lib/Transforms/Utils/LowerSwitch.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/LowerSwitch.cpp?rev=77289&r1=77288&r2=77289&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Utils/LowerSwitch.cpp (original) +++ llvm/trunk/lib/Transforms/Utils/LowerSwitch.cpp Mon Jul 27 20:35:34 2009 @@ -110,7 +110,7 @@ // operator<< - Used for debugging purposes. // static raw_ostream& operator<<(raw_ostream &O, - const LowerSwitch::CaseVector &C) __attribute((used)); + const LowerSwitch::CaseVector &C) ATTRIBUTE_USED; static raw_ostream& operator<<(raw_ostream &O, const LowerSwitch::CaseVector &C) { O << "["; From mrs at apple.com Mon Jul 27 20:36:09 2009 From: mrs at apple.com (Mike Stump) Date: Mon, 27 Jul 2009 18:36:09 -0700 Subject: [llvm-commits] [llvm] r77274 - /llvm/trunk/lib/Transforms/Utils/LowerSwitch.cpp In-Reply-To: References: <200907272333.n6RNXZkU026103@zion.cs.uiuc.edu> Message-ID: <31B3D2D4-AF91-4615-B4BC-4C3603F6FCA4@apple.com> On Jul 27, 2009, at 6:06 PM, Howard Su wrote: > this option is a gcc extension. it cause compile error under VC. Oops, fixed in r77289. From gohman at apple.com Mon Jul 27 20:40:03 2009 From: gohman at apple.com (Dan Gohman) Date: Tue, 28 Jul 2009 01:40:03 -0000 Subject: [llvm-commits] [llvm] r77290 - in /llvm/trunk: lib/Analysis/ScalarEvolutionExpander.cpp lib/Transforms/Scalar/InstructionCombining.cpp test/Transforms/InstCombine/2008-02-04-GEPIdxBug.ll test/Transforms/InstCombine/getelementptr-setcc.ll test/Transforms/InstCombine/getelementptr-seteq.ll Message-ID: <200907280140.n6S1e44w030129@zion.cs.uiuc.edu> Author: djg Date: Mon Jul 27 20:40:03 2009 New Revision: 77290 URL: http://llvm.org/viewvc/llvm-project?rev=77290&view=rev Log: Teach instcombine to respect and preserve inbounds. Add inbounds to a few tests where it is required for the expected transformation. Modified: llvm/trunk/lib/Analysis/ScalarEvolutionExpander.cpp llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp llvm/trunk/test/Transforms/InstCombine/2008-02-04-GEPIdxBug.ll llvm/trunk/test/Transforms/InstCombine/getelementptr-setcc.ll llvm/trunk/test/Transforms/InstCombine/getelementptr-seteq.ll Modified: llvm/trunk/lib/Analysis/ScalarEvolutionExpander.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/ScalarEvolutionExpander.cpp?rev=77290&r1=77289&r2=77290&view=diff ============================================================================== --- llvm/trunk/lib/Analysis/ScalarEvolutionExpander.cpp (original) +++ llvm/trunk/lib/Analysis/ScalarEvolutionExpander.cpp Mon Jul 27 20:40:03 2009 @@ -349,7 +349,9 @@ return GEP; } - // Insert a pretty getelementptr. + // Insert a pretty getelementptr. Note that this GEP is not marked inbounds, + // because ScalarEvolution may have changed the address arithmetic to + // compute a value which is beyond the end of the allocated object. Value *GEP = Builder.CreateGEP(V, GepIndices.begin(), GepIndices.end(), Modified: llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp?rev=77290&r1=77289&r2=77290&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp Mon Jul 27 20:40:03 2009 @@ -213,7 +213,7 @@ Instruction *FoldICmpDivCst(ICmpInst &ICI, BinaryOperator *DivI, ConstantInt *DivRHS); - Instruction *FoldGEPICmp(User *GEPLHS, Value *RHS, + Instruction *FoldGEPICmp(GEPOperator *GEPLHS, Value *RHS, ICmpInst::Predicate Cond, Instruction &I); Instruction *FoldShiftByConstant(Value *Op0, ConstantInt *Op1, BinaryOperator &I); @@ -5559,20 +5559,19 @@ /// FoldGEPICmp - Fold comparisons between a GEP instruction and something /// else. At this point we know that the GEP is on the LHS of the comparison. -Instruction *InstCombiner::FoldGEPICmp(User *GEPLHS, Value *RHS, +Instruction *InstCombiner::FoldGEPICmp(GEPOperator *GEPLHS, Value *RHS, ICmpInst::Predicate Cond, Instruction &I) { - assert(isa(GEPLHS) && "LHS is not a getelementptr!"); - // Look through bitcasts. if (BitCastInst *BCI = dyn_cast(RHS)) RHS = BCI->getOperand(0); Value *PtrBase = GEPLHS->getOperand(0); - if (TD && PtrBase == RHS) { + if (TD && PtrBase == RHS && GEPLHS->isInBounds()) { // ((gep Ptr, OFFSET) cmp Ptr) ---> (OFFSET cmp 0). // This transformation (ignoring the base and scales) is valid because we - // know pointers can't overflow. See if we can output an optimized form. + // know pointers can't overflow since the gep is inbounds. See if we can + // output an optimized form. Value *Offset = EvaluateGEPOffsetExpression(GEPLHS, I, *this); // If not, synthesize the offset the hard way. @@ -5580,7 +5579,7 @@ Offset = EmitGEPOffset(GEPLHS, I, *this); return new ICmpInst(*Context, ICmpInst::getSignedPredicate(Cond), Offset, Context->getNullValue(Offset->getType())); - } else if (User *GEPRHS = dyn_cast(RHS)) { + } else if (GEPOperator *GEPRHS = dyn_cast(RHS)) { // If the base pointers are different, but the indices are the same, just // compare the base pointer. if (PtrBase != GEPRHS->getOperand(0)) { @@ -6345,10 +6344,10 @@ } // If we can optimize a 'icmp GEP, P' or 'icmp P, GEP', do so now. - if (User *GEP = dyn_cast(Op0)) + if (GEPOperator *GEP = dyn_cast(Op0)) if (Instruction *NI = FoldGEPICmp(GEP, Op1, I.getPredicate(), I)) return NI; - if (User *GEP = dyn_cast(Op1)) + if (GEPOperator *GEP = dyn_cast(Op1)) if (Instruction *NI = FoldGEPICmp(GEP, Op0, ICmpInst::getSwappedPredicate(I.getPredicate()), I)) return NI; @@ -8252,6 +8251,8 @@ NewIndices.end(), ""); InsertNewInstBefore(NGEP, CI); NGEP->takeName(GEP); + if (cast(GEP)->isInBounds()) + cast(NGEP)->setIsInBounds(true); if (isa(CI)) return new BitCastInst(NGEP, CI.getType()); @@ -8981,8 +8982,11 @@ // If we found a path from the src to dest, create the getelementptr now. if (SrcElTy == DstElTy) { SmallVector Idxs(NumZeros+1, ZeroUInt); - return GetElementPtrInst::Create(Src, Idxs.begin(), Idxs.end(), "", - ((Instruction*) NULL)); + Instruction *GEP = GetElementPtrInst::Create(Src, + Idxs.begin(), Idxs.end(), "", + ((Instruction*) NULL)); + cast(GEP)->setIsInBounds(true); + return GEP; } } @@ -10663,8 +10667,12 @@ } Value *Base = FixedOperands[0]; - return GetElementPtrInst::Create(Base, FixedOperands.begin()+1, - FixedOperands.end()); + GetElementPtrInst *GEP = + GetElementPtrInst::Create(Base, FixedOperands.begin()+1, + FixedOperands.end()); + if (cast(FirstInst)->isInBounds()) + cast(GEP)->setIsInBounds(true); + return GEP; } @@ -11055,8 +11063,12 @@ // getelementptr instructions into a single instruction. // SmallVector SrcGEPOperands; - if (User *Src = dyn_cast(PtrOp)) + bool BothInBounds = cast(&GEP)->isInBounds(); + if (GEPOperator *Src = dyn_cast(PtrOp)) { SrcGEPOperands.append(Src->op_begin(), Src->op_end()); + if (!Src->isInBounds()) + BothInBounds = false; + } if (!SrcGEPOperands.empty()) { // Note that if our source is a gep chain itself that we wait for that @@ -11140,9 +11152,15 @@ Indices.insert(Indices.end(), GEP.idx_begin()+1, GEP.idx_end()); } - if (!Indices.empty()) - return GetElementPtrInst::Create(SrcGEPOperands[0], Indices.begin(), - Indices.end(), GEP.getName()); + if (!Indices.empty()) { + GetElementPtrInst *NewGEP = GetElementPtrInst::Create(SrcGEPOperands[0], + Indices.begin(), + Indices.end(), + GEP.getName()); + if (BothInBounds) + cast(NewGEP)->setIsInBounds(true); + return NewGEP; + } } else if (GlobalValue *GV = dyn_cast(PtrOp)) { // GEP of global variable. If all of the indices for this GEP are @@ -11180,8 +11198,12 @@ if (CATy->getElementType() == XTy->getElementType()) { // -> GEP i8* X, ... SmallVector Indices(GEP.idx_begin()+1, GEP.idx_end()); - return GetElementPtrInst::Create(X, Indices.begin(), Indices.end(), - GEP.getName()); + GetElementPtrInst *NewGEP = + GetElementPtrInst::Create(X, Indices.begin(), Indices.end(), + GEP.getName()); + if (cast(&GEP)->isInBounds()) + cast(NewGEP)->setIsInBounds(true); + return NewGEP; } else if (const ArrayType *XATy = dyn_cast(XTy->getElementType())) { // GEP (bitcast [10 x i8]* X to [0 x i8]*), i32 0, ... ? @@ -11208,8 +11230,11 @@ Value *Idx[2]; Idx[0] = Context->getNullValue(Type::Int32Ty); Idx[1] = GEP.getOperand(1); - Value *V = InsertNewInstBefore( - GetElementPtrInst::Create(X, Idx, Idx + 2, GEP.getName()), GEP); + GetElementPtrInst *NewGEP = + GetElementPtrInst::Create(X, Idx, Idx + 2, GEP.getName()); + if (cast(&GEP)->isInBounds()) + cast(NewGEP)->setIsInBounds(true); + Value *V = InsertNewInstBefore(NewGEP, GEP); // V and GEP are both pointer types --> BitCast return new BitCastInst(V, GEP.getType()); } @@ -11271,6 +11296,8 @@ Idx[1] = NewIdx; Instruction *NewGEP = GetElementPtrInst::Create(X, Idx, Idx + 2, GEP.getName()); + if (cast(&GEP)->isInBounds()) + cast(NewGEP)->setIsInBounds(true); NewGEP = InsertNewInstBefore(NewGEP, GEP); // The NewGEP must be pointer typed, so must the old one -> BitCast return new BitCastInst(NewGEP, GEP.getType()); @@ -11323,6 +11350,8 @@ GetElementPtrInst::Create(BCI->getOperand(0), NewIndices.begin(), NewIndices.end()); if (NGEP->getType() == GEP.getType()) return NGEP; + if (cast(&GEP)->isInBounds()) + cast(NGEP)->setIsInBounds(true); InsertNewInstBefore(NGEP, GEP); NGEP->takeName(&GEP); return new BitCastInst(NGEP, GEP.getType()); @@ -11366,6 +11395,7 @@ Idx[1] = NullIdx; Value *V = GetElementPtrInst::Create(New, Idx, Idx + 2, New->getName()+".sub", It); + cast(V)->setIsInBounds(true); // Now make everything use the getelementptr instead of the original // allocation. @@ -11745,6 +11775,7 @@ CastOp = IC.InsertNewInstBefore( GetElementPtrInst::Create(CastOp, NewGEPIndices.begin(), NewGEPIndices.end()), SI); + cast(CastOp)->setIsInBounds(true); } if (Constant *C = dyn_cast(SIOp0)) @@ -12428,6 +12459,7 @@ Context->getPointerType(EI.getType(), AS),EI); GetElementPtrInst *GEP = GetElementPtrInst::Create(Ptr, EI.getOperand(1), I->getName()+".gep"); + cast(GEP)->setIsInBounds(true); InsertNewInstBefore(GEP, EI); return new LoadInst(GEP); } Modified: llvm/trunk/test/Transforms/InstCombine/2008-02-04-GEPIdxBug.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/2008-02-04-GEPIdxBug.ll?rev=77290&r1=77289&r2=77290&view=diff ============================================================================== --- llvm/trunk/test/Transforms/InstCombine/2008-02-04-GEPIdxBug.ll (original) +++ llvm/trunk/test/Transforms/InstCombine/2008-02-04-GEPIdxBug.ll Mon Jul 27 20:40:03 2009 @@ -10,7 +10,7 @@ entry: %orientations = alloca [1 x [1 x %struct.x]] ; <[1 x [1 x %struct.x]]*> [#uses=2] %tmp3 = call i32 @puts( i8* getelementptr ([6 x i8]* @.str, i32 0, i32 0) ) nounwind ; [#uses=0] - %tmp45 = getelementptr [1 x [1 x %struct.x]]* %orientations, i32 1, i32 0, i32 0 ; <%struct.x*> [#uses=1] + %tmp45 = getelementptr inbounds [1 x [1 x %struct.x]]* %orientations, i32 1, i32 0, i32 0 ; <%struct.x*> [#uses=1] %orientations62 = getelementptr [1 x [1 x %struct.x]]* %orientations, i32 0, i32 0, i32 0 ; <%struct.x*> [#uses=1] br label %bb10 @@ -18,7 +18,7 @@ %indvar = phi i32 [ 0, %entry ], [ %indvar.next, %bb10 ] ; [#uses=2] %tmp.0.reg2mem.0.rec = mul i32 %indvar, -1 ; [#uses=1] %tmp12.rec = add i32 %tmp.0.reg2mem.0.rec, -1 ; [#uses=1] - %tmp12 = getelementptr %struct.x* %tmp45, i32 %tmp12.rec ; <%struct.x*> [#uses=2] + %tmp12 = getelementptr inbounds %struct.x* %tmp45, i32 %tmp12.rec ; <%struct.x*> [#uses=2] %tmp16 = call i32 (i8*, ...)* @printf( i8* getelementptr ([12 x i8]* @.str1, i32 0, i32 0), %struct.x* %tmp12 ) nounwind ; [#uses=0] %tmp84 = icmp eq %struct.x* %tmp12, %orientations62 ; [#uses=1] %indvar.next = add i32 %indvar, 1 ; [#uses=1] Modified: llvm/trunk/test/Transforms/InstCombine/getelementptr-setcc.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/getelementptr-setcc.ll?rev=77290&r1=77289&r2=77290&view=diff ============================================================================== --- llvm/trunk/test/Transforms/InstCombine/getelementptr-setcc.ll (original) +++ llvm/trunk/test/Transforms/InstCombine/getelementptr-setcc.ll Mon Jul 27 20:40:03 2009 @@ -2,28 +2,28 @@ ; RUN: not grep getelementptr define i1 @test1(i16* %P, i32 %I, i32 %J) { - %X = getelementptr i16* %P, i32 %I ; [#uses=1] - %Y = getelementptr i16* %P, i32 %J ; [#uses=1] + %X = getelementptr inbounds i16* %P, i32 %I ; [#uses=1] + %Y = getelementptr inbounds i16* %P, i32 %J ; [#uses=1] %C = icmp ult i16* %X, %Y ; [#uses=1] ret i1 %C } define i1 @test2(i16* %P, i32 %I) { - %X = getelementptr i16* %P, i32 %I ; [#uses=1] + %X = getelementptr inbounds i16* %P, i32 %I ; [#uses=1] %C = icmp ult i16* %X, %P ; [#uses=1] ret i1 %C } define i32 @test3(i32* %P, i32 %A, i32 %B) { - %tmp.4 = getelementptr i32* %P, i32 %A ; [#uses=1] - %tmp.9 = getelementptr i32* %P, i32 %B ; [#uses=1] + %tmp.4 = getelementptr inbounds i32* %P, i32 %A ; [#uses=1] + %tmp.9 = getelementptr inbounds i32* %P, i32 %B ; [#uses=1] %tmp.10 = icmp eq i32* %tmp.4, %tmp.9 ; [#uses=1] %tmp.11 = zext i1 %tmp.10 to i32 ; [#uses=1] ret i32 %tmp.11 } define i32 @test4(i32* %P, i32 %A, i32 %B) { - %tmp.4 = getelementptr i32* %P, i32 %A ; [#uses=1] + %tmp.4 = getelementptr inbounds i32* %P, i32 %A ; [#uses=1] %tmp.6 = icmp eq i32* %tmp.4, %P ; [#uses=1] %tmp.7 = zext i1 %tmp.6 to i32 ; [#uses=1] ret i32 %tmp.7 Modified: llvm/trunk/test/Transforms/InstCombine/getelementptr-seteq.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/getelementptr-seteq.ll?rev=77290&r1=77289&r2=77290&view=diff ============================================================================== --- llvm/trunk/test/Transforms/InstCombine/getelementptr-seteq.ll (original) +++ llvm/trunk/test/Transforms/InstCombine/getelementptr-seteq.ll Mon Jul 27 20:40:03 2009 @@ -5,8 +5,8 @@ %S = type { i32, [ 100 x i32] } define i1 @test(i64 %X, %S* %P) { - %A = getelementptr %S* %P, i32 0, i32 1, i64 %X - %B = getelementptr %S* %P, i32 0, i32 0 + %A = getelementptr inbounds %S* %P, i32 0, i32 1, i64 %X + %B = getelementptr inbounds %S* %P, i32 0, i32 0 %C = icmp eq i32* %A, %B ret i1 %C } From daniel at zuster.org Mon Jul 27 22:00:54 2009 From: daniel at zuster.org (Daniel Dunbar) Date: Tue, 28 Jul 2009 03:00:54 -0000 Subject: [llvm-commits] [llvm] r77292 - in /llvm/trunk/tools/llvm-mc: AsmLexer.cpp AsmLexer.h Message-ID: <200907280300.n6S30sGv032343@zion.cs.uiuc.edu> Author: ddunbar Date: Mon Jul 27 22:00:54 2009 New Revision: 77292 URL: http://llvm.org/viewvc/llvm-project?rev=77292&view=rev Log: llvm-mc: Factor AsmToken class out of AsmLexer. Modified: llvm/trunk/tools/llvm-mc/AsmLexer.cpp llvm/trunk/tools/llvm-mc/AsmLexer.h Modified: llvm/trunk/tools/llvm-mc/AsmLexer.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-mc/AsmLexer.cpp?rev=77292&r1=77291&r2=77292&view=diff ============================================================================== --- llvm/trunk/tools/llvm-mc/AsmLexer.cpp (original) +++ llvm/trunk/tools/llvm-mc/AsmLexer.cpp Mon Jul 27 22:00:54 2009 @@ -20,10 +20,11 @@ #include using namespace llvm; -AsmLexer::AsmLexer(SourceMgr &SM) : SrcMgr(SM) { +AsmLexer::AsmLexer(SourceMgr &SM) : SrcMgr(SM) { CurBuffer = 0; CurBuf = SrcMgr.getMemoryBuffer(CurBuffer); CurPtr = CurBuf->getBufferStart(); + CurTok = AsmToken(asmtok::Error, StringRef(CurPtr, 0)); TokStart = 0; } @@ -41,9 +42,9 @@ /// ReturnError - Set the error to the specified string at the specified /// location. This is defined to always return asmtok::Error. -asmtok::TokKind AsmLexer::ReturnError(const char *Loc, const std::string &Msg) { +AsmToken AsmLexer::ReturnError(const char *Loc, const std::string &Msg) { SrcMgr.PrintMessage(SMLoc::getFromPointer(Loc), Msg, "error"); - return asmtok::Error; + return AsmToken(asmtok::Error, StringRef(Loc, 0)); } /// EnterIncludeFile - Enter the specified file. This prints an error and @@ -94,35 +95,31 @@ } /// LexIdentifier: [a-zA-Z_.][a-zA-Z0-9_$.@]* -asmtok::TokKind AsmLexer::LexIdentifier() { +AsmToken AsmLexer::LexIdentifier() { while (isalnum(*CurPtr) || *CurPtr == '_' || *CurPtr == '$' || *CurPtr == '.' || *CurPtr == '@') ++CurPtr; - // Unique string. - CurStrVal = StringRef(TokStart, CurPtr - TokStart); - return asmtok::Identifier; + return AsmToken(asmtok::Identifier, StringRef(TokStart, CurPtr - TokStart)); } /// LexPercent: Register: %[a-zA-Z0-9]+ -asmtok::TokKind AsmLexer::LexPercent() { +AsmToken AsmLexer::LexPercent() { if (!isalnum(*CurPtr)) - return asmtok::Percent; // Single %. + return AsmToken(asmtok::Percent, StringRef(CurPtr, 1)); // Single %. while (isalnum(*CurPtr)) ++CurPtr; - // Unique string. - CurStrVal = StringRef(TokStart, CurPtr - TokStart); - return asmtok::Register; + return AsmToken(asmtok::Register, StringRef(TokStart, CurPtr - TokStart)); } /// LexSlash: Slash: / /// C-Style Comment: /* ... */ -asmtok::TokKind AsmLexer::LexSlash() { +AsmToken AsmLexer::LexSlash() { switch (*CurPtr) { case '*': break; // C style comment. case '/': return ++CurPtr, LexLineComment(); - default: return asmtok::Slash; + default: return AsmToken(asmtok::Slash, StringRef(CurPtr, 1)); } // C Style comment. @@ -144,14 +141,16 @@ /// LexLineComment: Comment: #[^\n]* /// : //[^\n]* -asmtok::TokKind AsmLexer::LexLineComment() { +AsmToken AsmLexer::LexLineComment() { + // FIXME: This is broken if we happen to a comment at the end of a file, which + // was .included, and which doesn't end with a newline. int CurChar = getNextChar(); while (CurChar != '\n' && CurChar != '\n' && CurChar != EOF) CurChar = getNextChar(); if (CurChar == EOF) - return asmtok::Eof; - return asmtok::EndOfStatement; + return AsmToken(asmtok::Eof, StringRef(CurPtr, 0)); + return AsmToken(asmtok::EndOfStatement, StringRef(CurPtr, 0)); } @@ -163,7 +162,7 @@ /// Hex integer: 0x[0-9a-fA-F]+ /// Decimal integer: [1-9][0-9]* /// TODO: FP literal. -asmtok::TokKind AsmLexer::LexDigit() { +AsmToken AsmLexer::LexDigit() { if (*CurPtr == ':') return ReturnError(TokStart, "FIXME: local label not implemented"); if (*CurPtr == 'f' || *CurPtr == 'b') @@ -173,8 +172,8 @@ if (CurPtr[-1] != '0') { while (isdigit(*CurPtr)) ++CurPtr; - CurIntVal = strtoll(TokStart, 0, 10); - return asmtok::IntVal; + return AsmToken(asmtok::IntVal, StringRef(TokStart, CurPtr - TokStart), + strtoll(TokStart, 0, 10)); } if (*CurPtr == 'b') { @@ -186,8 +185,8 @@ // Requires at least one binary digit. if (CurPtr == NumStart) return ReturnError(CurPtr-2, "Invalid binary number"); - CurIntVal = strtoll(NumStart, 0, 2); - return asmtok::IntVal; + return AsmToken(asmtok::IntVal, StringRef(TokStart, CurPtr - TokStart), + strtoll(NumStart, 0, 2)); } if (*CurPtr == 'x') { @@ -201,29 +200,28 @@ return ReturnError(CurPtr-2, "Invalid hexadecimal number"); errno = 0; - CurIntVal = strtoll(NumStart, 0, 16); if (errno == EINVAL) return ReturnError(CurPtr-2, "Invalid hexadecimal number"); if (errno == ERANGE) { errno = 0; - CurIntVal = (int64_t)strtoull(NumStart, 0, 16); if (errno == EINVAL) return ReturnError(CurPtr-2, "Invalid hexadecimal number"); if (errno == ERANGE) return ReturnError(CurPtr-2, "Hexadecimal number out of range"); } - return asmtok::IntVal; + return AsmToken(asmtok::IntVal, StringRef(TokStart, CurPtr - TokStart), + (int64_t) strtoull(NumStart, 0, 16)); } // Must be an octal number, it starts with 0. while (*CurPtr >= '0' && *CurPtr <= '7') ++CurPtr; - CurIntVal = strtoll(TokStart, 0, 8); - return asmtok::IntVal; + return AsmToken(asmtok::IntVal, StringRef(TokStart, CurPtr - TokStart), + strtoll(TokStart, 0, 8)); } /// LexQuote: String: "..." -asmtok::TokKind AsmLexer::LexQuote() { +AsmToken AsmLexer::LexQuote() { int CurChar = getNextChar(); // TODO: does gas allow multiline string constants? while (CurChar != '"') { @@ -238,13 +236,11 @@ CurChar = getNextChar(); } - // Unique string, include quotes for now. - CurStrVal = StringRef(TokStart, CurPtr - TokStart); - return asmtok::String; + return AsmToken(asmtok::String, StringRef(TokStart, CurPtr - TokStart)); } -asmtok::TokKind AsmLexer::LexToken() { +AsmToken AsmLexer::LexToken() { TokStart = CurPtr; // This always consumes at least one character. int CurChar = getNextChar(); @@ -257,7 +253,7 @@ // Unknown character, emit an error. return ReturnError(TokStart, "invalid character in input"); - case EOF: return asmtok::Eof; + case EOF: return AsmToken(asmtok::Eof, StringRef(TokStart, 0)); case 0: case ' ': case '\t': @@ -265,33 +261,33 @@ return LexToken(); case '\n': // FALL THROUGH. case '\r': // FALL THROUGH. - case ';': return asmtok::EndOfStatement; - case ':': return asmtok::Colon; - case '+': return asmtok::Plus; - case '-': return asmtok::Minus; - case '~': return asmtok::Tilde; - case '(': return asmtok::LParen; - case ')': return asmtok::RParen; - case '*': return asmtok::Star; - case ',': return asmtok::Comma; - case '$': return asmtok::Dollar; + case ';': return AsmToken(asmtok::EndOfStatement, StringRef(TokStart, 1)); + case ':': return AsmToken(asmtok::Colon, StringRef(TokStart, 1)); + case '+': return AsmToken(asmtok::Plus, StringRef(TokStart, 1)); + case '-': return AsmToken(asmtok::Minus, StringRef(TokStart, 1)); + case '~': return AsmToken(asmtok::Tilde, StringRef(TokStart, 1)); + case '(': return AsmToken(asmtok::LParen, StringRef(TokStart, 1)); + case ')': return AsmToken(asmtok::RParen, StringRef(TokStart, 1)); + case '*': return AsmToken(asmtok::Star, StringRef(TokStart, 1)); + case ',': return AsmToken(asmtok::Comma, StringRef(TokStart, 1)); + case '$': return AsmToken(asmtok::Dollar, StringRef(TokStart, 1)); case '=': if (*CurPtr == '=') - return ++CurPtr, asmtok::EqualEqual; - return asmtok::Equal; + return ++CurPtr, AsmToken(asmtok::EqualEqual, StringRef(TokStart, 2)); + return AsmToken(asmtok::Equal, StringRef(TokStart, 1)); case '|': if (*CurPtr == '|') - return ++CurPtr, asmtok::PipePipe; - return asmtok::Pipe; - case '^': return asmtok::Caret; + return ++CurPtr, AsmToken(asmtok::PipePipe, StringRef(TokStart, 2)); + return AsmToken(asmtok::Pipe, StringRef(TokStart, 1)); + case '^': return AsmToken(asmtok::Caret, StringRef(TokStart, 1)); case '&': if (*CurPtr == '&') - return ++CurPtr, asmtok::AmpAmp; - return asmtok::Amp; + return ++CurPtr, AsmToken(asmtok::AmpAmp, StringRef(TokStart, 2)); + return AsmToken(asmtok::Amp, StringRef(TokStart, 1)); case '!': if (*CurPtr == '=') - return ++CurPtr, asmtok::ExclaimEqual; - return asmtok::Exclaim; + return ++CurPtr, AsmToken(asmtok::ExclaimEqual, StringRef(TokStart, 2)); + return AsmToken(asmtok::Exclaim, StringRef(TokStart, 1)); case '%': return LexPercent(); case '/': return LexSlash(); case '#': return LexLineComment(); @@ -301,16 +297,21 @@ return LexDigit(); case '<': switch (*CurPtr) { - case '<': return ++CurPtr, asmtok::LessLess; - case '=': return ++CurPtr, asmtok::LessEqual; - case '>': return ++CurPtr, asmtok::LessGreater; - default: return asmtok::Less; + case '<': return ++CurPtr, AsmToken(asmtok::LessLess, + StringRef(TokStart, 2)); + case '=': return ++CurPtr, AsmToken(asmtok::LessEqual, + StringRef(TokStart, 2)); + case '>': return ++CurPtr, AsmToken(asmtok::LessGreater, + StringRef(TokStart, 2)); + default: return AsmToken(asmtok::Less, StringRef(TokStart, 1)); } case '>': switch (*CurPtr) { - case '>': return ++CurPtr, asmtok::GreaterGreater; - case '=': return ++CurPtr, asmtok::GreaterEqual; - default: return asmtok::Greater; + case '>': return ++CurPtr, AsmToken(asmtok::GreaterGreater, + StringRef(TokStart, 2)); + case '=': return ++CurPtr, AsmToken(asmtok::GreaterEqual, + StringRef(TokStart, 2)); + default: return AsmToken(asmtok::Greater, StringRef(TokStart, 1)); } // TODO: Quoted identifiers (objc methods etc) Modified: llvm/trunk/tools/llvm-mc/AsmLexer.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-mc/AsmLexer.h?rev=77292&r1=77291&r2=77292&view=diff ============================================================================== --- llvm/trunk/tools/llvm-mc/AsmLexer.h (original) +++ llvm/trunk/tools/llvm-mc/AsmLexer.h Mon Jul 27 22:00:54 2009 @@ -53,6 +53,35 @@ }; } +/// AsmToken - Target independent representation for an assembler token. +struct AsmToken { + asmtok::TokKind Kind; + + /// A reference to the entire token contents; this is always a pointer into + /// a memory buffer owned by the source manager. + StringRef Str; + + int64_t IntVal; + +public: + AsmToken() {} + AsmToken(asmtok::TokKind _Kind, const StringRef &_Str, int64_t _IntVal = 0) + : Kind(_Kind), Str(_Str), IntVal(_IntVal) {} + + asmtok::TokKind getKind() const { return Kind; } + bool is(asmtok::TokKind K) const { return Kind == K; } + bool isNot(asmtok::TokKind K) const { return Kind != K; } + + SMLoc getLoc() const; + + StringRef getString() const { return Str; } + + int64_t getIntVal() const { + assert(Kind == asmtok::IntVal && "This token isn't an integer"); + return IntVal; + } +}; + /// AsmLexer - Lexer class for assembly files. class AsmLexer : public MCAsmLexer { SourceMgr &SrcMgr; @@ -60,14 +89,13 @@ const char *CurPtr; const MemoryBuffer *CurBuf; - // Information about the current token. const char *TokStart; - asmtok::TokKind CurKind; - StringRef CurStrVal; // This is valid for Identifier. - int64_t CurIntVal; + + /// The current token. + AsmToken CurTok; - /// CurBuffer - This is the current buffer index we're lexing from as managed - /// by the SourceMgr object. + /// This is the current buffer index we're lexing from as managed by the + /// SourceMgr object. int CurBuffer; void operator=(const AsmLexer&); // DO NOT IMPLEMENT @@ -77,12 +105,12 @@ ~AsmLexer(); asmtok::TokKind Lex() { - return CurKind = LexToken(); + return CurTok = LexToken(), getKind(); } - asmtok::TokKind getKind() const { return CurKind; } - bool is(asmtok::TokKind K) const { return CurKind == K; } - bool isNot(asmtok::TokKind K) const { return CurKind != K; } + asmtok::TokKind getKind() const { return CurTok.getKind(); } + bool is(asmtok::TokKind K) const { return CurTok.is(K); } + bool isNot(asmtok::TokKind K) const { return CurTok.isNot(K); } /// getCurStrVal - Get the string for the current token, this includes all /// characters (for example, the quotes on strings) in the token. @@ -90,14 +118,10 @@ /// The returned StringRef points into the source manager's memory buffer, and /// is safe to store across calls to Lex(). StringRef getCurStrVal() const { - assert((CurKind == asmtok::Identifier || CurKind == asmtok::Register || - CurKind == asmtok::String) && - "This token doesn't have a string value"); - return CurStrVal; + return CurTok.getString(); } int64_t getCurIntVal() const { - assert(CurKind == asmtok::IntVal && "This token isn't an integer"); - return CurIntVal; + return CurTok.getIntVal(); } SMLoc getLoc() const; @@ -109,16 +133,16 @@ private: int getNextChar(); - asmtok::TokKind ReturnError(const char *Loc, const std::string &Msg); + AsmToken ReturnError(const char *Loc, const std::string &Msg); /// LexToken - Read the next token and return its code. - asmtok::TokKind LexToken(); - asmtok::TokKind LexIdentifier(); - asmtok::TokKind LexPercent(); - asmtok::TokKind LexSlash(); - asmtok::TokKind LexLineComment(); - asmtok::TokKind LexDigit(); - asmtok::TokKind LexQuote(); + AsmToken LexToken(); + AsmToken LexIdentifier(); + AsmToken LexPercent(); + AsmToken LexSlash(); + AsmToken LexLineComment(); + AsmToken LexDigit(); + AsmToken LexQuote(); }; } // end namespace llvm From sabre at nondot.org Mon Jul 27 22:05:41 2009 From: sabre at nondot.org (Chris Lattner) Date: Tue, 28 Jul 2009 03:05:41 -0000 Subject: [llvm-commits] [llvm] r77293 - /llvm/trunk/lib/Target/PIC16/PIC16ISelDAGToDAG.h Message-ID: <200907280305.n6S35gb6032471@zion.cs.uiuc.edu> Author: lattner Date: Mon Jul 27 22:05:40 2009 New Revision: 77293 URL: http://llvm.org/viewvc/llvm-project?rev=77293&view=rev Log: don't copy TargetLowering. Modified: llvm/trunk/lib/Target/PIC16/PIC16ISelDAGToDAG.h Modified: llvm/trunk/lib/Target/PIC16/PIC16ISelDAGToDAG.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PIC16/PIC16ISelDAGToDAG.h?rev=77293&r1=77292&r2=77293&view=diff ============================================================================== --- llvm/trunk/lib/Target/PIC16/PIC16ISelDAGToDAG.h (original) +++ llvm/trunk/lib/Target/PIC16/PIC16ISelDAGToDAG.h Mon Jul 27 22:05:40 2009 @@ -31,7 +31,7 @@ /// PIC16Lowering - This object fully describes how to lower LLVM code to an /// PIC16-specific SelectionDAG. - PIC16TargetLowering PIC16Lowering; + PIC16TargetLowering &PIC16Lowering; public: explicit PIC16DAGToDAGISel(PIC16TargetMachine &tm) : From sabre at nondot.org Mon Jul 27 22:13:25 2009 From: sabre at nondot.org (Chris Lattner) Date: Tue, 28 Jul 2009 03:13:25 -0000 Subject: [llvm-commits] [llvm] r77294 - in /llvm/trunk: include/llvm/CodeGen/ include/llvm/Target/ lib/CodeGen/ lib/CodeGen/AsmPrinter/ lib/CodeGen/SelectionDAG/ lib/Target/ lib/Target/ARM/ lib/Target/ARM/AsmPrinter/ lib/Target/Alpha/ lib/Target/Alpha/AsmPrinter/ lib/Target/CellSPU/ lib/Target/CellSPU/AsmPrinter/ lib/Target/MSP430/ lib/Target/Mips/ lib/Target/Mips/AsmPrinter/ lib/Target/PIC16/ lib/Target/PowerPC/ lib/Target/PowerPC/AsmPrinter/ lib/Target/Sparc/ lib/Target/Sparc/AsmPrinter/ lib/Target/SystemZ/ lib/Target/SystemZ... Message-ID: <200907280313.n6S3DT9k000302@zion.cs.uiuc.edu> Author: lattner Date: Mon Jul 27 22:13:23 2009 New Revision: 77294 URL: http://llvm.org/viewvc/llvm-project?rev=77294&view=rev Log: Rip all of the global variable lowering logic out of TargetAsmInfo. Since it is highly specific to the object file that will be generated in the end, this introduces a new TargetLoweringObjectFile interface that is implemented for each of ELF/MachO/COFF/Alpha/PIC16 and XCore. Though still is still a brutal and ugly refactoring, this is a major step towards goodness. This patch also: 1. fixes a bunch of dangling pointer problems in the PIC16 backend. 2. disables the TargetLowering copy ctor which PIC16 was accidentally using. 3. gets us closer to xcore having its own crazy target section flags and pic16 not having to shadow sections with its own objects. 4. fixes wierdness where ELF targets would set CStringSection but not CStringSection_. Factor the code better. 5. fixes some bugs in string lowering on ELF targets. Added: llvm/trunk/include/llvm/Target/TargetLoweringObjectFile.h llvm/trunk/lib/Target/PIC16/PIC16TargetObjectFile.cpp llvm/trunk/lib/Target/PIC16/PIC16TargetObjectFile.h llvm/trunk/lib/Target/TargetLoweringObjectFile.cpp llvm/trunk/lib/Target/XCore/XCoreTargetObjectFile.cpp llvm/trunk/lib/Target/XCore/XCoreTargetObjectFile.h Modified: llvm/trunk/include/llvm/CodeGen/AsmPrinter.h llvm/trunk/include/llvm/Target/COFFTargetAsmInfo.h llvm/trunk/include/llvm/Target/DarwinTargetAsmInfo.h llvm/trunk/include/llvm/Target/ELFTargetAsmInfo.h llvm/trunk/include/llvm/Target/TargetAsmInfo.h llvm/trunk/include/llvm/Target/TargetLowering.h llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp llvm/trunk/lib/CodeGen/AsmPrinter/OcamlGCPrinter.cpp llvm/trunk/lib/CodeGen/ELFWriter.cpp llvm/trunk/lib/CodeGen/SelectionDAG/TargetLowering.cpp llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp llvm/trunk/lib/Target/ARM/ARMTargetAsmInfo.cpp llvm/trunk/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp llvm/trunk/lib/Target/Alpha/AlphaISelLowering.cpp llvm/trunk/lib/Target/Alpha/AlphaTargetAsmInfo.cpp llvm/trunk/lib/Target/Alpha/AsmPrinter/AlphaAsmPrinter.cpp llvm/trunk/lib/Target/CMakeLists.txt llvm/trunk/lib/Target/COFFTargetAsmInfo.cpp llvm/trunk/lib/Target/CellSPU/AsmPrinter/SPUAsmPrinter.cpp llvm/trunk/lib/Target/CellSPU/SPUISelLowering.cpp llvm/trunk/lib/Target/CellSPU/SPUTargetAsmInfo.cpp llvm/trunk/lib/Target/DarwinTargetAsmInfo.cpp llvm/trunk/lib/Target/ELFTargetAsmInfo.cpp llvm/trunk/lib/Target/MSP430/MSP430AsmPrinter.cpp llvm/trunk/lib/Target/MSP430/MSP430ISelLowering.cpp llvm/trunk/lib/Target/MSP430/MSP430TargetAsmInfo.cpp llvm/trunk/lib/Target/Mips/AsmPrinter/MipsAsmPrinter.cpp llvm/trunk/lib/Target/Mips/MipsISelLowering.cpp llvm/trunk/lib/Target/Mips/MipsTargetAsmInfo.cpp llvm/trunk/lib/Target/PIC16/CMakeLists.txt llvm/trunk/lib/Target/PIC16/PIC16AsmPrinter.cpp llvm/trunk/lib/Target/PIC16/PIC16AsmPrinter.h llvm/trunk/lib/Target/PIC16/PIC16ISelLowering.cpp llvm/trunk/lib/Target/PIC16/PIC16TargetAsmInfo.cpp llvm/trunk/lib/Target/PIC16/PIC16TargetAsmInfo.h llvm/trunk/lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp llvm/trunk/lib/Target/PowerPC/PPCTargetAsmInfo.cpp llvm/trunk/lib/Target/Sparc/AsmPrinter/SparcAsmPrinter.cpp llvm/trunk/lib/Target/Sparc/SparcISelLowering.cpp llvm/trunk/lib/Target/Sparc/SparcTargetAsmInfo.cpp llvm/trunk/lib/Target/Sparc/SparcTargetAsmInfo.h llvm/trunk/lib/Target/SystemZ/AsmPrinter/SystemZAsmPrinter.cpp llvm/trunk/lib/Target/SystemZ/SystemZISelLowering.cpp llvm/trunk/lib/Target/SystemZ/SystemZTargetAsmInfo.cpp llvm/trunk/lib/Target/TargetAsmInfo.cpp llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp llvm/trunk/lib/Target/X86/AsmPrinter/X86IntelAsmPrinter.cpp llvm/trunk/lib/Target/X86/X86ISelLowering.cpp llvm/trunk/lib/Target/X86/X86TargetAsmInfo.cpp llvm/trunk/lib/Target/X86/X86TargetAsmInfo.h llvm/trunk/lib/Target/X86/X86TargetMachine.cpp llvm/trunk/lib/Target/XCore/CMakeLists.txt llvm/trunk/lib/Target/XCore/XCoreAsmPrinter.cpp llvm/trunk/lib/Target/XCore/XCoreISelLowering.cpp llvm/trunk/lib/Target/XCore/XCoreTargetAsmInfo.cpp llvm/trunk/lib/Target/XCore/XCoreTargetAsmInfo.h Modified: llvm/trunk/include/llvm/CodeGen/AsmPrinter.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/AsmPrinter.h?rev=77294&r1=77293&r2=77294&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/AsmPrinter.h (original) +++ llvm/trunk/include/llvm/CodeGen/AsmPrinter.h Mon Jul 27 22:13:23 2009 @@ -39,6 +39,7 @@ class Mangler; class Section; class TargetAsmInfo; + class TargetLoweringObjectFile; class Type; class formatted_raw_ostream; @@ -75,6 +76,9 @@ /// TargetMachine &TM; + /// getObjFileLowering - Return information about object file lowering. + const TargetLoweringObjectFile &getObjFileLowering() const; + /// Target Asm Printer information. /// const TargetAsmInfo *TAI; Modified: llvm/trunk/include/llvm/Target/COFFTargetAsmInfo.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/COFFTargetAsmInfo.h?rev=77294&r1=77293&r2=77294&view=diff ============================================================================== --- llvm/trunk/include/llvm/Target/COFFTargetAsmInfo.h (original) +++ llvm/trunk/include/llvm/Target/COFFTargetAsmInfo.h Mon Jul 27 22:13:23 2009 @@ -16,15 +16,9 @@ class COFFTargetAsmInfo : public TargetAsmInfo { protected: explicit COFFTargetAsmInfo(const TargetMachine &TM); - public: - virtual void getSectionFlagsAsString(SectionKind Kind, - SmallVectorImpl &Str) const; - - virtual const Section * - SelectSectionForGlobal(const GlobalValue *GV, SectionKind Kind) const; }; } -#endif // LLVM_ELF_TARGET_ASM_INFO_H +#endif // LLVM_COFF_TARGET_ASM_INFO_H Modified: llvm/trunk/include/llvm/Target/DarwinTargetAsmInfo.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/DarwinTargetAsmInfo.h?rev=77294&r1=77293&r2=77294&view=diff ============================================================================== --- llvm/trunk/include/llvm/Target/DarwinTargetAsmInfo.h (original) +++ llvm/trunk/include/llvm/Target/DarwinTargetAsmInfo.h Mon Jul 27 22:13:23 2009 @@ -24,27 +24,9 @@ class Mangler; struct DarwinTargetAsmInfo : public TargetAsmInfo { - const Section* TextCoalSection; - const Section* ConstTextCoalSection; - const Section* ConstDataCoalSection; - const Section* ConstDataSection; - const Section* DataCoalSection; - const Section* FourByteConstantSection; - const Section* EightByteConstantSection; - const Section* SixteenByteConstantSection; - explicit DarwinTargetAsmInfo(const TargetMachine &TM); - virtual const Section* SelectSectionForGlobal(const GlobalValue *GV, - SectionKind Kind) const; virtual bool emitUsedDirectiveFor(const GlobalValue *GV, Mangler *Mang) const; - - - virtual const Section * - getSectionForMergeableConstant(SectionKind Kind) const; - - private: - const Section* MergeableStringSection(const GlobalVariable *GV) const; }; } Modified: llvm/trunk/include/llvm/Target/ELFTargetAsmInfo.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/ELFTargetAsmInfo.h?rev=77294&r1=77293&r2=77294&view=diff ============================================================================== --- llvm/trunk/include/llvm/Target/ELFTargetAsmInfo.h (original) +++ llvm/trunk/include/llvm/Target/ELFTargetAsmInfo.h Mon Jul 27 22:13:23 2009 @@ -21,29 +21,6 @@ struct ELFTargetAsmInfo : public TargetAsmInfo { ELFTargetAsmInfo(const TargetMachine &TM); - - /// getSectionForMergeableConstant - Given a mergeable constant with the - /// specified size and relocation information, return a section that it - /// should be placed in. - virtual const Section * - getSectionForMergeableConstant(SectionKind Kind) const; - - virtual SectionKind::Kind getKindForNamedSection(const char *Section, - SectionKind::Kind K) const; - void getSectionFlagsAsString(SectionKind Kind, - SmallVectorImpl &Str) const; - - virtual const Section* SelectSectionForGlobal(const GlobalValue *GV, - SectionKind Kind) const; - - const Section *DataRelSection; - const Section *DataRelLocalSection; - const Section *DataRelROSection; - const Section *DataRelROLocalSection; - - const Section *MergeableConst4Section; - const Section *MergeableConst8Section; - const Section *MergeableConst16Section; }; } Modified: llvm/trunk/include/llvm/Target/TargetAsmInfo.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetAsmInfo.h?rev=77294&r1=77293&r2=77294&view=diff ============================================================================== --- llvm/trunk/include/llvm/Target/TargetAsmInfo.h (original) +++ llvm/trunk/include/llvm/Target/TargetAsmInfo.h Mon Jul 27 22:13:23 2009 @@ -214,15 +214,12 @@ }; class Section { - friend class TargetAsmInfo; - friend class StringMapEntry
    ; - friend class StringMap
    ; + public: std::string Name; SectionKind Kind; - explicit Section() { } - public: + explicit Section() { } const std::string &getName() const { return Name; } SectionKind getKind() const { return Kind; } }; @@ -230,8 +227,6 @@ /// TargetAsmInfo - This class is intended to be used as a base class for asm /// properties and features specific to the target. class TargetAsmInfo { - private: - mutable StringMap
    Sections; protected: /// TM - The current TargetMachine. const TargetMachine &TM; @@ -240,33 +235,11 @@ // Properties to be set by the target writer, used to configure asm printer. // - /// TextSection - Section directive for standard text. - /// - const Section *TextSection; // Defaults to ".text". - - /// DataSection - Section directive for standard data. - /// - const Section *DataSection; // Defaults to ".data". - /// BSSSection - Section directive for uninitialized data. Null if this /// target doesn't support a BSS section. /// +/// FIXME: REMOVE. const char *BSSSection; // Default to ".bss". - const Section *BSSSection_; - - /// ReadOnlySection - This is the directive that is emitted to switch to a - /// read-only section for constant data (e.g. data declared const, - /// jump tables). - const Section *ReadOnlySection; // Defaults to NULL - - /// TLSDataSection - Section directive for Thread Local data. - /// - const Section *TLSDataSection; // Defaults to ".tdata". - - /// TLSBSSSection - Section directive for Thread Local uninitialized data. - /// Null if this target doesn't support a BSS section. - /// - const Section *TLSBSSSection; // Defaults to ".tbss". /// ZeroFillDirective - Directive for emitting a global to the ZeroFill /// section on this target. Null if this target doesn't support zerofill. @@ -456,8 +429,8 @@ /// cstring constants (null terminated string that does not contain any /// other null bytes) on this target. This is commonly supported as /// ".cstring". +/// FIXME: REMOVE. const char *CStringSection; // Defaults to NULL - const Section *CStringSection_; /// StaticCtorsSection - This is the directive that is emitted to switch to /// a section to emit the static constructor list. @@ -642,10 +615,6 @@ explicit TargetAsmInfo(const TargetMachine &TM); virtual ~TargetAsmInfo(); - const Section *getOrCreateSection(const char *Name, - bool isDirective, - SectionKind::Kind K) const; - /// Measure the specified inline asm to determine an approximation of its /// length. virtual unsigned getInlineAsmLength(const char *Str) const; @@ -665,48 +634,6 @@ virtual unsigned PreferredEHDataFormat(DwarfEncoding::Target Reason, bool Global) const; - - /// getSectionForMergeableConstant - Given a Mergeable constant with the - /// specified size and relocation information, return a section that it - /// should be placed in. - virtual const Section *getSectionForMergeableConstant(SectionKind Kind)const; - - - /// getKindForNamedSection - If this target wants to be able to override - /// section flags based on the name of the section specified for a global - /// variable, it can implement this. This is used on ELF systems so that - /// ".tbss" gets the TLS bit set etc. - virtual SectionKind::Kind getKindForNamedSection(const char *Section, - SectionKind::Kind K) const{ - return K; - } - - /// SectionForGlobal - This method computes the appropriate section to emit - /// the specified global variable or function definition. This should not - /// be passed external (or available externally) globals. - // FIXME: MOVE TO ASMPRINTER. - const Section* SectionForGlobal(const GlobalValue *GV) const; - - /// getSpecialCasedSectionGlobals - Allow the target to completely override - /// section assignment of a global. - /// FIXME: ELIMINATE this by making PIC16 implement ADDRESS with - /// getFlagsForNamedSection. - virtual const Section * - getSpecialCasedSectionGlobals(const GlobalValue *GV, - SectionKind Kind) const { - return 0; - } - - /// getSectionFlagsAsString - Turn the flags in the specified SectionKind - /// into a string that can be printed to the assembly file after the - /// ".section foo" part of a section directive. - virtual void getSectionFlagsAsString(SectionKind Kind, - SmallVectorImpl &Str) const { - } - -// FIXME: Eliminate this. - virtual const Section* SelectSectionForGlobal(const GlobalValue *GV, - SectionKind Kind) const; /// getSLEB128Size - Compute the number of bytes required for a signed /// leb128 value. @@ -734,27 +661,9 @@ // Accessors. // - const Section *getTextSection() const { - return TextSection; - } - const Section *getDataSection() const { - return DataSection; - } const char *getBSSSection() const { return BSSSection; } - const Section *getBSSSection_() const { - return BSSSection_; - } - const Section *getReadOnlySection() const { - return ReadOnlySection; - } - const Section *getTLSDataSection() const { - return TLSDataSection; - } - const Section *getTLSBSSSection() const { - return TLSBSSSection; - } const char *getZeroFillDirective() const { return ZeroFillDirective; } @@ -869,9 +778,6 @@ const char *getCStringSection() const { return CStringSection; } - const Section *getCStringSection_() const { - return CStringSection_; - } const char *getStaticCtorsSection() const { return StaticCtorsSection; } Modified: llvm/trunk/include/llvm/Target/TargetLowering.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetLowering.h?rev=77294&r1=77293&r2=77294&view=diff ============================================================================== --- llvm/trunk/include/llvm/Target/TargetLowering.h (original) +++ llvm/trunk/include/llvm/Target/TargetLowering.h Mon Jul 27 22:13:23 2009 @@ -54,6 +54,7 @@ class TargetMachine; class TargetRegisterClass; class TargetSubtarget; + class TargetLoweringObjectFile; class Value; // FIXME: should this be here? @@ -77,6 +78,8 @@ /// target-specific constructs to SelectionDAG operators. /// class TargetLowering { + TargetLowering(const TargetLowering&); // DO NOT IMPLEMENT + void operator=(const TargetLowering&); // DO NOT IMPLEMENT public: /// LegalizeAction - This enum indicates whether operations are valid for a /// target, and if not, what action should be used to make them valid. @@ -98,11 +101,13 @@ SchedulingForRegPressure // Scheduling for lowest register pressure. }; - explicit TargetLowering(TargetMachine &TM); + /// NOTE: The constructor takes ownership of TLOF. + explicit TargetLowering(TargetMachine &TM, TargetLoweringObjectFile *TLOF); virtual ~TargetLowering(); TargetMachine &getTargetMachine() const { return TM; } const TargetData *getTargetData() const { return TD; } + const TargetLoweringObjectFile &getObjFileLowering() const { return TLOF; } bool isBigEndian() const { return !IsLittleEndian; } bool isLittleEndian() const { return IsLittleEndian; } @@ -1475,6 +1480,7 @@ private: TargetMachine &TM; const TargetData *TD; + TargetLoweringObjectFile &TLOF; /// PointerTy - The type to use for pointers, usually i32 or i64. /// Added: llvm/trunk/include/llvm/Target/TargetLoweringObjectFile.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetLoweringObjectFile.h?rev=77294&view=auto ============================================================================== --- llvm/trunk/include/llvm/Target/TargetLoweringObjectFile.h (added) +++ llvm/trunk/include/llvm/Target/TargetLoweringObjectFile.h Mon Jul 27 22:13:23 2009 @@ -0,0 +1,187 @@ +//===-- llvm/Target/TargetLoweringObjectFile.h - Object Info ----*- 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 classes used to handle lowerings specific to common +// object file formats. +// +//===----------------------------------------------------------------------===// + +#ifndef LLVM_TARGET_TARGETLOWERINGOBJECTFILE_H +#define LLVM_TARGET_TARGETLOWERINGOBJECTFILE_H + +// FIXME: Switch to MC. +#include "llvm/Target/TargetAsmInfo.h" + +namespace llvm { + +class TargetLoweringObjectFile { +private: + mutable StringMap
    Sections; +protected: + + TargetLoweringObjectFile(); + + /// TextSection - Section directive for standard text. + /// + const Section *TextSection; // Defaults to ".text". + + /// DataSection - Section directive for standard data. + /// + const Section *DataSection; // Defaults to ".data". + + + + // FIXME: SINK THESE. + const Section *BSSSection_; + + /// ReadOnlySection - This is the directive that is emitted to switch to a + /// read-only section for constant data (e.g. data declared const, + /// jump tables). + const Section *ReadOnlySection; // Defaults to NULL + + /// TLSDataSection - Section directive for Thread Local data. + /// + const Section *TLSDataSection; // Defaults to ".tdata". + + /// TLSBSSSection - Section directive for Thread Local uninitialized data. + /// Null if this target doesn't support a BSS section. + /// + const Section *TLSBSSSection; // Defaults to ".tbss". + + const Section *CStringSection_; + +public: + // FIXME: NONPUB. + const Section *getOrCreateSection(const char *Name, + bool isDirective, + SectionKind::Kind K) const; +public: + + virtual ~TargetLoweringObjectFile(); + + const Section *getTextSection() const { return TextSection; } + const Section *getDataSection() const { return DataSection; } + + + /// getSectionForMergeableConstant - Given a mergeable constant with the + /// specified size and relocation information, return a section that it + /// should be placed in. + virtual const Section * + getSectionForMergeableConstant(SectionKind Kind) const; + + /// getKindForNamedSection - If this target wants to be able to override + /// section flags based on the name of the section specified for a global + /// variable, it can implement this. This is used on ELF systems so that + /// ".tbss" gets the TLS bit set etc. + virtual SectionKind::Kind getKindForNamedSection(const char *Section, + SectionKind::Kind K) const{ + return K; + } + + /// SectionForGlobal - This method computes the appropriate section to emit + /// the specified global variable or function definition. This should not + /// be passed external (or available externally) globals. + const Section *SectionForGlobal(const GlobalValue *GV, + const TargetMachine &TM) const; + + /// getSpecialCasedSectionGlobals - Allow the target to completely override + /// section assignment of a global. + /// FIXME: ELIMINATE this by making PIC16 implement ADDRESS with + /// getFlagsForNamedSection. + virtual const Section * + getSpecialCasedSectionGlobals(const GlobalValue *GV, + SectionKind Kind) const { + return 0; + } + + /// getSectionFlagsAsString - Turn the flags in the specified SectionKind + /// into a string that can be printed to the assembly file after the + /// ".section foo" part of a section directive. + virtual void getSectionFlagsAsString(SectionKind Kind, + SmallVectorImpl &Str) const { + } + +protected: + virtual const Section *SelectSectionForGlobal(const GlobalValue *GV, + SectionKind Kind, + const TargetMachine &TM) const; +}; + + + + +class TargetLoweringObjectFileELF : public TargetLoweringObjectFile { + bool AtIsCommentChar; // True if @ is the comment character on this target. +public: + /// ELF Constructor - AtIsCommentChar is true if the CommentCharacter from TAI + /// is "@". + TargetLoweringObjectFileELF(bool AtIsCommentChar = false, + // FIXME: REMOVE AFTER UNIQUING IS FIXED. + bool HasCrazyBSS = false); + + /// getSectionForMergeableConstant - Given a mergeable constant with the + /// specified size and relocation information, return a section that it + /// should be placed in. + virtual const Section * + getSectionForMergeableConstant(SectionKind Kind) const; + + virtual SectionKind::Kind getKindForNamedSection(const char *Section, + SectionKind::Kind K) const; + void getSectionFlagsAsString(SectionKind Kind, + SmallVectorImpl &Str) const; + + virtual const Section* SelectSectionForGlobal(const GlobalValue *GV, + SectionKind Kind, + const TargetMachine &TM) const; +protected: + const Section *DataRelSection; + const Section *DataRelLocalSection; + const Section *DataRelROSection; + const Section *DataRelROLocalSection; + + const Section *MergeableConst4Section; + const Section *MergeableConst8Section; + const Section *MergeableConst16Section; +}; + +class TargetLoweringObjectFileMachO : public TargetLoweringObjectFile { + const Section *TextCoalSection; + const Section *ConstTextCoalSection; + const Section *ConstDataCoalSection; + const Section *ConstDataSection; + const Section *DataCoalSection; + const Section *FourByteConstantSection; + const Section *EightByteConstantSection; + const Section *SixteenByteConstantSection; +public: + TargetLoweringObjectFileMachO(); + virtual const Section *SelectSectionForGlobal(const GlobalValue *GV, + SectionKind Kind, + const TargetMachine &TM) const; + + virtual const Section * + getSectionForMergeableConstant(SectionKind Kind) const; +}; + + + +class TargetLoweringObjectFileCOFF : public TargetLoweringObjectFile { +public: + TargetLoweringObjectFileCOFF(); + virtual void getSectionFlagsAsString(SectionKind Kind, + SmallVectorImpl &Str) const; + + virtual const Section * + SelectSectionForGlobal(const GlobalValue *GV, SectionKind Kind, + const TargetMachine &TM) const; +}; + +} // end namespace llvm + +#endif Modified: llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp?rev=77294&r1=77293&r2=77294&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp (original) +++ llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp Mon Jul 27 22:13:23 2009 @@ -32,6 +32,7 @@ #include "llvm/Target/TargetAsmInfo.h" #include "llvm/Target/TargetData.h" #include "llvm/Target/TargetLowering.h" +#include "llvm/Target/TargetLoweringObjectFile.h" #include "llvm/Target/TargetOptions.h" #include "llvm/Target/TargetRegisterInfo.h" #include "llvm/ADT/SmallPtrSet.h" @@ -72,6 +73,11 @@ delete &OutContext; } +const TargetLoweringObjectFile &AsmPrinter::getObjFileLowering() const { + return TM.getTargetLowering()->getObjFileLowering(); +} + + /// SwitchToTextSection - Switch to the specified text section of the executable /// if we are not already in it! /// @@ -146,7 +152,8 @@ // some magic assembler directive. if (NS->getKind().hasExplicitSection()) { SmallString<32> FlagsStr; - TAI->getSectionFlagsAsString(NS->getKind(), FlagsStr); + + getObjFileLowering().getSectionFlagsAsString(NS->getKind(), FlagsStr); O << TAI->getSwitchToSectionDirective() << CurrentSection @@ -240,9 +247,6 @@ } if (TAI->getSetDirective()) { - if (!M.alias_empty()) - SwitchToSection(TAI->getTextSection()); - O << '\n'; for (Module::const_alias_iterator I = M.alias_begin(), E = M.alias_end(); I != E; ++I) { @@ -339,7 +343,7 @@ } } - const Section *S = TAI->getSectionForMergeableConstant(Kind); + const Section *S =getObjFileLowering().getSectionForMergeableConstant(Kind); // The number of sections are small, just do a linear search from the // last section to the first. @@ -410,8 +414,9 @@ const char* JumpTableDataSection = TAI->getJumpTableDataSection(); const Function *F = MF.getFunction(); - const Section *FuncSection = TAI->SectionForGlobal(F); + const Section *FuncSection = getObjFileLowering().SectionForGlobal(F, TM); + bool JTInDiffSection = false; if ((IsPic && !(LoweringInfo && LoweringInfo->usesGlobalOffsetTable())) || !JumpTableDataSection || Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp?rev=77294&r1=77293&r2=77294&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp (original) +++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp Mon Jul 27 22:13:23 2009 @@ -17,9 +17,10 @@ #include "llvm/Support/Timer.h" #include "llvm/System/Path.h" #include "llvm/Target/TargetAsmInfo.h" -#include "llvm/Target/TargetRegisterInfo.h" #include "llvm/Target/TargetData.h" #include "llvm/Target/TargetFrameInfo.h" +#include "llvm/Target/TargetLoweringObjectFile.h" +#include "llvm/Target/TargetRegisterInfo.h" using namespace llvm; static TimerGroup &getDwarfTimerGroup() { @@ -1328,7 +1329,7 @@ MMI->setDebugInfoAvailability(true); // Prime section data. - SectionMap.insert(TAI->getTextSection()); + SectionMap.insert(Asm->getObjFileLowering().getTextSection()); // Print out .file directives to specify files for .loc directives. These are // printed out early so that they precede any .loc directives. @@ -1363,9 +1364,9 @@ DebugTimer->startTimer(); // Standard sections final addresses. - Asm->SwitchToSection(TAI->getTextSection()); + Asm->SwitchToSection(Asm->getObjFileLowering().getTextSection()); EmitLabel("text_end", 0); - Asm->SwitchToSection(TAI->getDataSection()); + Asm->SwitchToSection(Asm->getObjFileLowering().getDataSection()); EmitLabel("data_end", 0); // End text sections. @@ -1893,9 +1894,9 @@ Asm->SwitchToDataSection(TAI->getDwarfRangesSection()); EmitLabel("section_ranges", 0); - Asm->SwitchToSection(TAI->getTextSection()); + Asm->SwitchToSection(Asm->getObjFileLowering().getTextSection()); EmitLabel("text_begin", 0); - Asm->SwitchToSection(TAI->getDataSection()); + Asm->SwitchToSection(Asm->getObjFileLowering().getDataSection()); EmitLabel("data_begin", 0); } Modified: llvm/trunk/lib/CodeGen/AsmPrinter/OcamlGCPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/OcamlGCPrinter.cpp?rev=77294&r1=77293&r2=77294&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/AsmPrinter/OcamlGCPrinter.cpp (original) +++ llvm/trunk/lib/CodeGen/AsmPrinter/OcamlGCPrinter.cpp Mon Jul 27 22:13:23 2009 @@ -20,8 +20,8 @@ #include "llvm/Support/raw_ostream.h" #include "llvm/Target/TargetAsmInfo.h" #include "llvm/Target/TargetData.h" +#include "llvm/Target/TargetLoweringObjectFile.h" #include "llvm/Target/TargetMachine.h" - using namespace llvm; namespace { @@ -64,10 +64,10 @@ void OcamlGCMetadataPrinter::beginAssembly(raw_ostream &OS, AsmPrinter &AP, const TargetAsmInfo &TAI) { - AP.SwitchToSection(TAI.getTextSection()); + AP.SwitchToSection(AP.getObjFileLowering().getTextSection()); EmitCamlGlobal(getModule(), OS, AP, TAI, "code_begin"); - AP.SwitchToSection(TAI.getDataSection()); + AP.SwitchToSection(AP.getObjFileLowering().getDataSection()); EmitCamlGlobal(getModule(), OS, AP, TAI, "data_begin"); } @@ -99,16 +99,16 @@ AddressAlignLog = 3; } - AP.SwitchToSection(TAI.getTextSection()); + AP.SwitchToSection(AP.getObjFileLowering().getTextSection()); EmitCamlGlobal(getModule(), OS, AP, TAI, "code_end"); - AP.SwitchToSection(TAI.getDataSection()); + AP.SwitchToSection(AP.getObjFileLowering().getDataSection()); EmitCamlGlobal(getModule(), OS, AP, TAI, "data_end"); OS << AddressDirective << 0; // FIXME: Why does ocaml emit this?? AP.EOL(); - AP.SwitchToSection(TAI.getDataSection()); + AP.SwitchToSection(AP.getObjFileLowering().getDataSection()); EmitCamlGlobal(getModule(), OS, AP, TAI, "frametable"); for (iterator I = begin(), IE = end(); I != IE; ++I) { Modified: llvm/trunk/lib/CodeGen/ELFWriter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/ELFWriter.cpp?rev=77294&r1=77293&r2=77294&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/ELFWriter.cpp (original) +++ llvm/trunk/lib/CodeGen/ELFWriter.cpp Mon Jul 27 22:13:23 2009 @@ -45,6 +45,8 @@ #include "llvm/Target/TargetAsmInfo.h" #include "llvm/Target/TargetData.h" #include "llvm/Target/TargetELFWriterInfo.h" +#include "llvm/Target/TargetLowering.h" +#include "llvm/Target/TargetLoweringObjectFile.h" #include "llvm/Target/TargetMachine.h" #include "llvm/Support/Mangler.h" #include "llvm/Support/Streams.h" @@ -185,7 +187,10 @@ } } - return getSection(TAI->getSectionForMergeableConstant(Kind)->getName(), + const TargetLoweringObjectFile &TLOF = + TM.getTargetLowering()->getObjFileLowering(); + + return getSection(TLOF.getSectionForMergeableConstant(Kind)->getName(), ELFSection::SHT_PROGBITS, ELFSection::SHF_MERGE | ELFSection::SHF_ALLOC, CPE.getAlignment()); @@ -312,8 +317,11 @@ assert(isa(GV) && "GV not a global variable!"); const GlobalVariable *GVar = dyn_cast(GV); + const TargetLoweringObjectFile &TLOF = + TM.getTargetLowering()->getObjFileLowering(); + // Get ELF section from TAI - const Section *S = TAI->SectionForGlobal(GV); + const Section *S = TLOF.SectionForGlobal(GV, TM); unsigned SectionFlags = getElfSectionFlags(S->getKind()); // The symbol align should update the section alignment if needed Modified: llvm/trunk/lib/CodeGen/SelectionDAG/TargetLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/TargetLowering.cpp?rev=77294&r1=77293&r2=77294&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/TargetLowering.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/TargetLowering.cpp Mon Jul 27 22:13:23 2009 @@ -11,12 +11,13 @@ // //===----------------------------------------------------------------------===// -#include "llvm/Target/TargetAsmInfo.h" #include "llvm/Target/TargetLowering.h" -#include "llvm/Target/TargetSubtarget.h" +#include "llvm/Target/TargetAsmInfo.h" #include "llvm/Target/TargetData.h" +#include "llvm/Target/TargetLoweringObjectFile.h" #include "llvm/Target/TargetMachine.h" #include "llvm/Target/TargetRegisterInfo.h" +#include "llvm/Target/TargetSubtarget.h" #include "llvm/GlobalVariable.h" #include "llvm/DerivedTypes.h" #include "llvm/CodeGen/MachineFrameInfo.h" @@ -440,8 +441,9 @@ CCs[RTLIB::O_F64] = ISD::SETEQ; } -TargetLowering::TargetLowering(TargetMachine &tm) - : TM(tm), TD(TM.getTargetData()) { +/// NOTE: The constructor takes ownership of TLOF. +TargetLowering::TargetLowering(TargetMachine &tm,TargetLoweringObjectFile *tlof) + : TM(tm), TD(TM.getTargetData()), TLOF(*tlof) { // All operations default to being supported. memset(OpActions, 0, sizeof(OpActions)); memset(LoadExtActions, 0, sizeof(LoadExtActions)); @@ -522,7 +524,9 @@ setOperationAction(ISD::DEBUG_LOC, MVT::Other, Expand); } -TargetLowering::~TargetLowering() {} +TargetLowering::~TargetLowering() { + delete &TLOF; +} /// computeRegisterProperties - Once all of the register classes are added, /// this allows us to compute derived properties we expose. Modified: llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp?rev=77294&r1=77293&r2=77294&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp (original) +++ llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp Mon Jul 27 22:13:23 2009 @@ -34,6 +34,7 @@ #include "llvm/CodeGen/MachineRegisterInfo.h" #include "llvm/CodeGen/PseudoSourceValue.h" #include "llvm/CodeGen/SelectionDAG.h" +#include "llvm/Target/TargetLoweringObjectFile.h" #include "llvm/Target/TargetOptions.h" #include "llvm/ADT/VectorExtras.h" #include "llvm/Support/ErrorHandling.h" @@ -103,8 +104,14 @@ addTypeForNEON(VT, MVT::v2f64, MVT::v4i32); } +static TargetLoweringObjectFile *createTLOF(TargetMachine &TM) { + if (TM.getSubtarget().isTargetDarwin()) + return new TargetLoweringObjectFileMachO(); + return new TargetLoweringObjectFileELF(true); +} + ARMTargetLowering::ARMTargetLowering(TargetMachine &TM) - : TargetLowering(TM), ARMPCLabelIndex(0) { + : TargetLowering(TM, createTLOF(TM)), ARMPCLabelIndex(0) { Subtarget = &TM.getSubtarget(); if (Subtarget->isTargetDarwin()) { Modified: llvm/trunk/lib/Target/ARM/ARMTargetAsmInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMTargetAsmInfo.cpp?rev=77294&r1=77293&r2=77294&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMTargetAsmInfo.cpp (original) +++ llvm/trunk/lib/Target/ARM/ARMTargetAsmInfo.cpp Mon Jul 27 22:13:23 2009 @@ -59,8 +59,6 @@ ARMTargetAsmInfo(TM) { Subtarget = &TM.getSubtarget(); - BSSSection_ = getOrCreateSection("\t.bss", true, SectionKind::BSS); - NeedsSet = false; HasLEB128 = true; AbsoluteDebugSectionOffsets = true; Modified: llvm/trunk/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp?rev=77294&r1=77293&r2=77294&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp (original) +++ llvm/trunk/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp Mon Jul 27 22:13:23 2009 @@ -29,6 +29,7 @@ #include "llvm/CodeGen/MachineJumpTableInfo.h" #include "llvm/Target/TargetAsmInfo.h" #include "llvm/Target/TargetData.h" +#include "llvm/Target/TargetLoweringObjectFile.h" #include "llvm/Target/TargetMachine.h" #include "llvm/Target/TargetOptions.h" #include "llvm/Target/TargetRegistry.h" @@ -1127,7 +1128,7 @@ if (Subtarget->isTargetELF()) O << "\t.type " << name << ",%object\n"; - const Section *TheSection = TAI->SectionForGlobal(GVar); + const Section *TheSection = getObjFileLowering().SectionForGlobal(GVar, TM); SwitchToSection(TheSection); // FIXME: get this stuff from section kind flags. @@ -1154,7 +1155,7 @@ O << TAI->getCOMMDirective() << name << "," << Size << ',' << Align; } else { - SwitchToSection(TAI->SectionForGlobal(GVar)); + SwitchToSection(getObjFileLowering().SectionForGlobal(GVar, TM)); O << "\t.globl " << name << '\n' << TAI->getWeakDefDirective() << name << '\n'; EmitAlignment(Align, GVar); @@ -1285,7 +1286,7 @@ } if (!HiddenGVNonLazyPtrs.empty()) { - SwitchToSection(TAI->getDataSection()); + SwitchToSection(getObjFileLowering().getDataSection()); for (StringMap::iterator I = HiddenGVNonLazyPtrs.begin(), E = HiddenGVNonLazyPtrs.end(); I != E; ++I) { EmitAlignment(2); Modified: llvm/trunk/lib/Target/Alpha/AlphaISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Alpha/AlphaISelLowering.cpp?rev=77294&r1=77293&r2=77294&view=diff ============================================================================== --- llvm/trunk/lib/Target/Alpha/AlphaISelLowering.cpp (original) +++ llvm/trunk/lib/Target/Alpha/AlphaISelLowering.cpp Mon Jul 27 22:13:23 2009 @@ -21,6 +21,7 @@ #include "llvm/CodeGen/SelectionDAG.h" #include "llvm/CodeGen/MachineRegisterInfo.h" #include "llvm/CodeGen/PseudoSourceValue.h" +#include "llvm/Target/TargetLoweringObjectFile.h" #include "llvm/Constants.h" #include "llvm/Function.h" #include "llvm/Module.h" @@ -30,6 +31,17 @@ #include "llvm/Support/raw_ostream.h" using namespace llvm; + +class TargetLoweringObjectFileAlpha : public TargetLoweringObjectFile { +public: + TargetLoweringObjectFileAlpha() { + TextSection = getOrCreateSection("_text", true, SectionKind::Text); + DataSection = getOrCreateSection("_data", true, SectionKind::DataRel); + } +}; + + + /// AddLiveIn - This helper function adds the specified physical register to the /// MachineFunction as a live in value. It also creates a corresponding virtual /// register for it. @@ -41,7 +53,8 @@ return VReg; } -AlphaTargetLowering::AlphaTargetLowering(TargetMachine &TM) : TargetLowering(TM) { +AlphaTargetLowering::AlphaTargetLowering(TargetMachine &TM) + : TargetLowering(TM, new TargetLoweringObjectFileAlpha()) { // Set up the TargetLowering object. //I am having problems with shr n i8 1 setShiftAmountType(MVT::i64); Modified: llvm/trunk/lib/Target/Alpha/AlphaTargetAsmInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Alpha/AlphaTargetAsmInfo.cpp?rev=77294&r1=77293&r2=77294&view=diff ============================================================================== --- llvm/trunk/lib/Target/Alpha/AlphaTargetAsmInfo.cpp (original) +++ llvm/trunk/lib/Target/Alpha/AlphaTargetAsmInfo.cpp Mon Jul 27 22:13:23 2009 @@ -23,7 +23,4 @@ JumpTableDirective = ".gprel32"; JumpTableDataSection = "\t.section .rodata\n"; WeakRefDirective = "\t.weak\t"; - - TextSection = getOrCreateSection("_text", true, SectionKind::Text); - DataSection = getOrCreateSection("_data", true, SectionKind::DataRel); } Modified: llvm/trunk/lib/Target/Alpha/AsmPrinter/AlphaAsmPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Alpha/AsmPrinter/AlphaAsmPrinter.cpp?rev=77294&r1=77293&r2=77294&view=diff ============================================================================== --- llvm/trunk/lib/Target/Alpha/AsmPrinter/AlphaAsmPrinter.cpp (original) +++ llvm/trunk/lib/Target/Alpha/AsmPrinter/AlphaAsmPrinter.cpp Mon Jul 27 22:13:23 2009 @@ -23,6 +23,7 @@ #include "llvm/CodeGen/AsmPrinter.h" #include "llvm/CodeGen/DwarfWriter.h" #include "llvm/Target/TargetAsmInfo.h" +#include "llvm/Target/TargetLoweringObjectFile.h" #include "llvm/Target/TargetMachine.h" #include "llvm/Target/TargetRegistry.h" #include "llvm/Support/Compiler.h" @@ -138,7 +139,7 @@ // Print out labels for the function. const Function *F = MF.getFunction(); - SwitchToSection(TAI->SectionForGlobal(F)); + SwitchToSection(getObjFileLowering().SectionForGlobal(F, TM)); EmitAlignment(MF.getAlignment(), F); switch (F->getLinkage()) { @@ -214,7 +215,7 @@ unsigned Align = TD->getPreferredAlignmentLog(GVar); // 0: Switch to section - SwitchToSection(TAI->SectionForGlobal(GVar)); + SwitchToSection(getObjFileLowering().SectionForGlobal(GVar, TM)); // 1: Check visibility printVisibility(name, GVar->getVisibility()); Modified: llvm/trunk/lib/Target/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/CMakeLists.txt?rev=77294&r1=77293&r2=77294&view=diff ============================================================================== --- llvm/trunk/lib/Target/CMakeLists.txt (original) +++ llvm/trunk/lib/Target/CMakeLists.txt Mon Jul 27 22:13:23 2009 @@ -10,6 +10,7 @@ TargetFrameInfo.cpp TargetInstrInfo.cpp TargetIntrinsicInfo.cpp + TargetLoweringObjectFile.cpp TargetMachOWriterInfo.cpp TargetMachine.cpp TargetRegisterInfo.cpp Modified: llvm/trunk/lib/Target/COFFTargetAsmInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/COFFTargetAsmInfo.cpp?rev=77294&r1=77293&r2=77294&view=diff ============================================================================== --- llvm/trunk/lib/Target/COFFTargetAsmInfo.cpp (original) +++ llvm/trunk/lib/Target/COFFTargetAsmInfo.cpp Mon Jul 27 22:13:23 2009 @@ -19,9 +19,6 @@ COFFTargetAsmInfo::COFFTargetAsmInfo(const TargetMachine &TM) : TargetAsmInfo(TM) { - TextSection = getOrCreateSection("_text", true, SectionKind::Text); - DataSection = getOrCreateSection("_data", true, SectionKind::DataRel); - GlobalPrefix = "_"; LCOMMDirective = "\t.lcomm\t"; COMMDirectiveTakesAlignment = false; @@ -53,57 +50,3 @@ DwarfMacroInfoSection = "\t.section\t.debug_macinfo,\"dr\""; } -void COFFTargetAsmInfo::getSectionFlagsAsString(SectionKind Kind, - SmallVectorImpl &Str) const { - // FIXME: Inefficient. - std::string Res = ",\""; - if (Kind.isText()) - Res += 'x'; - if (Kind.isWriteable()) - Res += 'w'; - Res += "\""; - - Str.append(Res.begin(), Res.end()); -} - -//===----------------------------------------------------------------------===// -// Move to AsmPrinter (mangler access). -//===----------------------------------------------------------------------===// - -#include "llvm/GlobalVariable.h" - -static const char *getSectionPrefixForUniqueGlobal(SectionKind Kind) { - if (Kind.isText()) - return ".text$linkonce"; - if (Kind.isWriteable()) - return ".data$linkonce"; - return ".rdata$linkonce"; -} - -const Section * -COFFTargetAsmInfo::SelectSectionForGlobal(const GlobalValue *GV, - SectionKind Kind) const { - assert(!Kind.isThreadLocal() && "Doesn't support TLS"); - - // If this global is linkonce/weak and the target handles this by emitting it - // into a 'uniqued' section name, create and return the section now. - if (Kind.isWeak()) { - const char *Prefix = getSectionPrefixForUniqueGlobal(Kind); - // FIXME: Use mangler interface (PR4584). - std::string Name = Prefix+GV->getNameStr(); - return getOrCreateSection(Name.c_str(), false, Kind.getKind()); - } - - if (Kind.isText()) - return getTextSection(); - - if (Kind.isBSS()) - if (const Section *S = getBSSSection_()) - return S; - - if (Kind.isReadOnly()) - if (const Section *S = getReadOnlySection()) - return S; - - return getDataSection(); -} Modified: llvm/trunk/lib/Target/CellSPU/AsmPrinter/SPUAsmPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/CellSPU/AsmPrinter/SPUAsmPrinter.cpp?rev=77294&r1=77293&r2=77294&view=diff ============================================================================== --- llvm/trunk/lib/Target/CellSPU/AsmPrinter/SPUAsmPrinter.cpp (original) +++ llvm/trunk/lib/Target/CellSPU/AsmPrinter/SPUAsmPrinter.cpp Mon Jul 27 22:13:23 2009 @@ -34,9 +34,10 @@ #include "llvm/Support/Compiler.h" #include "llvm/Support/FormattedStream.h" #include "llvm/Target/TargetAsmInfo.h" -#include "llvm/Target/TargetRegisterInfo.h" +#include "llvm/Target/TargetLoweringObjectFile.h" #include "llvm/Target/TargetInstrInfo.h" #include "llvm/Target/TargetOptions.h" +#include "llvm/Target/TargetRegisterInfo.h" #include "llvm/Target/TargetRegistry.h" #include "llvm/ADT/Statistic.h" #include "llvm/ADT/StringExtras.h" @@ -427,7 +428,7 @@ // Print out labels for the function. const Function *F = MF.getFunction(); - SwitchToSection(TAI->SectionForGlobal(F)); + SwitchToSection(getObjFileLowering().SectionForGlobal(F, TM)); EmitAlignment(MF.getAlignment(), F); switch (F->getLinkage()) { @@ -525,7 +526,7 @@ unsigned Size = TD->getTypeAllocSize(Type); unsigned Align = TD->getPreferredAlignmentLog(GVar); - SwitchToSection(TAI->SectionForGlobal(GVar)); + SwitchToSection(getObjFileLowering().SectionForGlobal(GVar, TM)); if (C->isNullValue() && /* FIXME: Verify correct */ !GVar->hasSection() && Modified: llvm/trunk/lib/Target/CellSPU/SPUISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/CellSPU/SPUISelLowering.cpp?rev=77294&r1=77293&r2=77294&view=diff ============================================================================== --- llvm/trunk/lib/Target/CellSPU/SPUISelLowering.cpp (original) +++ llvm/trunk/lib/Target/CellSPU/SPUISelLowering.cpp Mon Jul 27 22:13:23 2009 @@ -15,8 +15,9 @@ #include "SPUISelLowering.h" #include "SPUTargetMachine.h" #include "SPUFrameInfo.h" -#include "llvm/ADT/APInt.h" -#include "llvm/ADT/VectorExtras.h" +#include "llvm/Constants.h" +#include "llvm/Function.h" +#include "llvm/Intrinsics.h" #include "llvm/CallingConv.h" #include "llvm/CodeGen/CallingConvLower.h" #include "llvm/CodeGen/MachineFrameInfo.h" @@ -24,15 +25,13 @@ #include "llvm/CodeGen/MachineInstrBuilder.h" #include "llvm/CodeGen/MachineRegisterInfo.h" #include "llvm/CodeGen/SelectionDAG.h" -#include "llvm/Constants.h" -#include "llvm/Function.h" -#include "llvm/Intrinsics.h" +#include "llvm/Target/TargetLoweringObjectFile.h" +#include "llvm/Target/TargetOptions.h" +#include "llvm/ADT/VectorExtras.h" #include "llvm/Support/Debug.h" #include "llvm/Support/ErrorHandling.h" #include "llvm/Support/MathExtras.h" #include "llvm/Support/raw_ostream.h" -#include "llvm/Target/TargetOptions.h" - #include using namespace llvm; @@ -125,9 +124,8 @@ } SPUTargetLowering::SPUTargetLowering(SPUTargetMachine &TM) - : TargetLowering(TM), - SPUTM(TM) -{ + : TargetLowering(TM, new TargetLoweringObjectFileELF()), + SPUTM(TM) { // Fold away setcc operations if possible. setPow2DivIsCheap(); Modified: llvm/trunk/lib/Target/CellSPU/SPUTargetAsmInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/CellSPU/SPUTargetAsmInfo.cpp?rev=77294&r1=77293&r2=77294&view=diff ============================================================================== --- llvm/trunk/lib/Target/CellSPU/SPUTargetAsmInfo.cpp (original) +++ llvm/trunk/lib/Target/CellSPU/SPUTargetAsmInfo.cpp Mon Jul 27 22:13:23 2009 @@ -33,10 +33,6 @@ HasLEB128 = true; HasDotLocAndDotFile = true; - // BSS section needs to be emitted as ".section" - BSSSection = "\t.section\t.bss"; - BSSSection_ = getOrCreateSection("\t.bss", false, SectionKind::BSS); - SupportsDebugInformation = true; NeedsSet = true; DwarfAbbrevSection = "\t.section .debug_abbrev,\"\", at progbits"; Modified: llvm/trunk/lib/Target/DarwinTargetAsmInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/DarwinTargetAsmInfo.cpp?rev=77294&r1=77293&r2=77294&view=diff ============================================================================== --- llvm/trunk/lib/Target/DarwinTargetAsmInfo.cpp (original) +++ llvm/trunk/lib/Target/DarwinTargetAsmInfo.cpp Mon Jul 27 22:13:23 2009 @@ -27,32 +27,7 @@ DarwinTargetAsmInfo::DarwinTargetAsmInfo(const TargetMachine &TM) : TargetAsmInfo(TM) { - TextSection = getOrCreateSection("\t.text", true, SectionKind::Text); - DataSection = getOrCreateSection("\t.data", true, SectionKind::DataRel); - - CStringSection_ = getOrCreateSection("\t.cstring", true, - SectionKind::MergeableCString); - FourByteConstantSection = getOrCreateSection("\t.literal4\n", true, - SectionKind::MergeableConst4); - EightByteConstantSection = getOrCreateSection("\t.literal8\n", true, - SectionKind::MergeableConst8); - SixteenByteConstantSection = - getOrCreateSection("\t.literal16\n", true, SectionKind::MergeableConst16); - - ReadOnlySection = getOrCreateSection("\t.const", true, SectionKind::ReadOnly); - - TextCoalSection = - getOrCreateSection("\t__TEXT,__textcoal_nt,coalesced,pure_instructions", - false, SectionKind::Text); - ConstTextCoalSection = getOrCreateSection("\t__TEXT,__const_coal,coalesced", - false, SectionKind::Text); - ConstDataCoalSection = getOrCreateSection("\t__DATA,__const_coal,coalesced", - false, SectionKind::Text); - ConstDataSection = getOrCreateSection("\t.const_data", true, - SectionKind::ReadOnlyWithRel); - DataCoalSection = getOrCreateSection("\t__DATA,__datacoal_nt,coalesced", - false, SectionKind::DataRel); - + // Common settings for all Darwin targets. // Syntax: GlobalPrefix = "_"; @@ -124,79 +99,3 @@ return true; } -const Section* -DarwinTargetAsmInfo::SelectSectionForGlobal(const GlobalValue *GV, - SectionKind Kind) const { - assert(!Kind.isThreadLocal() && "Darwin doesn't support TLS"); - - if (Kind.isText()) - return Kind.isWeak() ? TextCoalSection : TextSection; - - // If this is weak/linkonce, put this in a coalescable section, either in text - // or data depending on if it is writable. - if (Kind.isWeak()) { - if (Kind.isReadOnly()) - return ConstTextCoalSection; - return DataCoalSection; - } - - // FIXME: Alignment check should be handled by section classifier. - if (Kind.isMergeableCString()) - return MergeableStringSection(cast(GV)); - - if (Kind.isMergeableConst()) { - if (Kind.isMergeableConst4()) - return FourByteConstantSection; - if (Kind.isMergeableConst8()) - return EightByteConstantSection; - if (Kind.isMergeableConst16()) - return SixteenByteConstantSection; - return ReadOnlySection; // .const - } - - // FIXME: ROData -> const in -static mode that is relocatable but they happen - // by the static linker. Why not mergeable? - if (Kind.isReadOnly()) - return getReadOnlySection(); - - // If this is marked const, put it into a const section. But if the dynamic - // linker needs to write to it, put it in the data segment. - if (Kind.isReadOnlyWithRel()) - return ConstDataSection; - - // Otherwise, just drop the variable in the normal data section. - return DataSection; -} - -const Section* -DarwinTargetAsmInfo::MergeableStringSection(const GlobalVariable *GV) const { - const TargetData *TD = TM.getTargetData(); - Constant *C = cast(GV)->getInitializer(); - const Type *Ty = cast(C->getType())->getElementType(); - - unsigned Size = TD->getTypeAllocSize(Ty); - if (Size) { - unsigned Align = TD->getPreferredAlignment(GV); - if (Align <= 32) - return getCStringSection_(); - } - - return getReadOnlySection(); -} - -const Section * -DarwinTargetAsmInfo::getSectionForMergeableConstant(SectionKind Kind) const { - // If this constant requires a relocation, we have to put it in the data - // segment, not in the text segment. - if (Kind.isDataRel()) - return ConstDataSection; - - if (Kind.isMergeableConst4()) - return FourByteConstantSection; - if (Kind.isMergeableConst8()) - return EightByteConstantSection; - if (Kind.isMergeableConst16()) - return SixteenByteConstantSection; - return ReadOnlySection; // .const -} - Modified: llvm/trunk/lib/Target/ELFTargetAsmInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ELFTargetAsmInfo.cpp?rev=77294&r1=77293&r2=77294&view=diff ============================================================================== --- llvm/trunk/lib/Target/ELFTargetAsmInfo.cpp (original) +++ llvm/trunk/lib/Target/ELFTargetAsmInfo.cpp Mon Jul 27 22:13:23 2009 @@ -18,217 +18,4 @@ ELFTargetAsmInfo::ELFTargetAsmInfo(const TargetMachine &TM) : TargetAsmInfo(TM) { - - TextSection = getOrCreateSection("\t.text", true, SectionKind::Text); - DataSection = getOrCreateSection("\t.data", true, SectionKind::DataRel); - ReadOnlySection = - getOrCreateSection("\t.rodata", false, SectionKind::ReadOnly); - TLSDataSection = - getOrCreateSection("\t.tdata", false, SectionKind::ThreadData); - TLSBSSSection = getOrCreateSection("\t.tbss", false, SectionKind::ThreadBSS); - - DataRelSection = getOrCreateSection("\t.data.rel", false, - SectionKind::DataRel); - DataRelLocalSection = getOrCreateSection("\t.data.rel.local", false, - SectionKind::DataRelLocal); - DataRelROSection = getOrCreateSection("\t.data.rel.ro", false, - SectionKind::ReadOnlyWithRel); - DataRelROLocalSection = - getOrCreateSection("\t.data.rel.ro.local", false, - SectionKind::ReadOnlyWithRelLocal); - - MergeableConst4Section = getOrCreateSection(".rodata.cst4", false, - SectionKind::MergeableConst4); - MergeableConst8Section = getOrCreateSection(".rodata.cst8", false, - SectionKind::MergeableConst8); - MergeableConst16Section = getOrCreateSection(".rodata.cst16", false, - SectionKind::MergeableConst16); -} - -/// getFlagsForNamedSection - If this target wants to be able to infer -/// section flags based on the name of the section specified for a global -/// variable, it can implement this. -SectionKind::Kind ELFTargetAsmInfo::getKindForNamedSection(const char *Name, - SectionKind::Kind K) const { - if (Name[0] != '.') return K; - - // Some lame default implementation based on some magic section names. - if (strncmp(Name, ".gnu.linkonce.b.", 16) == 0 || - strncmp(Name, ".llvm.linkonce.b.", 17) == 0 || - strncmp(Name, ".gnu.linkonce.sb.", 17) == 0 || - strncmp(Name, ".llvm.linkonce.sb.", 18) == 0) - return SectionKind::BSS; - - if (strcmp(Name, ".tdata") == 0 || - strncmp(Name, ".tdata.", 7) == 0 || - strncmp(Name, ".gnu.linkonce.td.", 17) == 0 || - strncmp(Name, ".llvm.linkonce.td.", 18) == 0) - return SectionKind::ThreadData; - - if (strcmp(Name, ".tbss") == 0 || - strncmp(Name, ".tbss.", 6) == 0 || - strncmp(Name, ".gnu.linkonce.tb.", 17) == 0 || - strncmp(Name, ".llvm.linkonce.tb.", 18) == 0) - return SectionKind::ThreadBSS; - - return K; } - - -void ELFTargetAsmInfo::getSectionFlagsAsString(SectionKind Kind, - SmallVectorImpl &Str) const { - Str.push_back(','); - Str.push_back('"'); - - if (!Kind.isMetadata()) - Str.push_back('a'); - if (Kind.isText()) - Str.push_back('x'); - if (Kind.isWriteable()) - Str.push_back('w'); - if (Kind.isMergeableConst() || Kind.isMergeableCString()) - Str.push_back('M'); - if (Kind.isMergeableCString()) - Str.push_back('S'); - if (Kind.isThreadLocal()) - Str.push_back('T'); - - Str.push_back('"'); - Str.push_back(','); - - // If comment string is '@', e.g. as on ARM - use '%' instead - if (strcmp(CommentString, "@") == 0) - Str.push_back('%'); - else - Str.push_back('@'); - - const char *KindStr; - if (Kind.isBSS()) - KindStr = "nobits"; - else - KindStr = "progbits"; - - Str.append(KindStr, KindStr+strlen(KindStr)); - - if (Kind.isMergeableCString()) { - // TODO: Eventually handle multiple byte character strings. For now, all - // mergable C strings are single byte. - Str.push_back(','); - Str.push_back('1'); - } else if (Kind.isMergeableConst4()) { - Str.push_back(','); - Str.push_back('4'); - } else if (Kind.isMergeableConst8()) { - Str.push_back(','); - Str.push_back('8'); - } else if (Kind.isMergeableConst16()) { - Str.push_back(','); - Str.push_back('1'); - Str.push_back('6'); - } -} - - - -//===----------------------------------------------------------------------===// -// Move to AsmPrinter (mangler access). -//===----------------------------------------------------------------------===// - -#include "llvm/DerivedTypes.h" -#include "llvm/GlobalVariable.h" -#include "llvm/Target/TargetData.h" -#include "llvm/Target/TargetMachine.h" -#include "llvm/ADT/StringExtras.h" - -static const char *getSectionPrefixForUniqueGlobal(SectionKind Kind) { - if (Kind.isText()) return ".gnu.linkonce.t."; - if (Kind.isReadOnly()) return ".gnu.linkonce.r."; - - if (Kind.isThreadData()) return ".gnu.linkonce.td."; - if (Kind.isThreadBSS()) return ".gnu.linkonce.tb."; - - if (Kind.isBSS()) return ".gnu.linkonce.b."; - if (Kind.isDataNoRel()) return ".gnu.linkonce.d."; - if (Kind.isDataRelLocal()) return ".gnu.linkonce.d.rel.local."; - if (Kind.isDataRel()) return ".gnu.linkonce.d.rel."; - if (Kind.isReadOnlyWithRelLocal()) return ".gnu.linkonce.d.rel.ro.local."; - - assert(Kind.isReadOnlyWithRel() && "Unknown section kind"); - return ".gnu.linkonce.d.rel.ro."; -} - -const Section* -ELFTargetAsmInfo::SelectSectionForGlobal(const GlobalValue *GV, - SectionKind Kind) const { - - // If this global is linkonce/weak and the target handles this by emitting it - // into a 'uniqued' section name, create and return the section now. - if (Kind.isWeak()) { - const char *Prefix = getSectionPrefixForUniqueGlobal(Kind); - // FIXME: Use mangler interface (PR4584). - std::string Name = Prefix+GV->getNameStr(); - return getOrCreateSection(Name.c_str(), false, Kind.getKind()); - } - - if (Kind.isText()) return TextSection; - if (Kind.isMergeableCString()) { - const TargetData *TD = TM.getTargetData(); - Constant *C = cast(GV)->getInitializer(); - const Type *Ty = cast(C->getType())->getElementType(); - - unsigned Size = TD->getTypeAllocSize(Ty); - if (Size <= 16) { - assert(getCStringSection() && "Should have string section prefix"); - - // We also need alignment here. - // FIXME: this is getting the alignment of the character, not the - // alignment of the string!! - unsigned Align = TD->getPrefTypeAlignment(Ty); - if (Align < Size) - Align = Size; - - std::string Name = getCStringSection() + utostr(Size) + '.' + - utostr(Align); - return getOrCreateSection(Name.c_str(), false, - SectionKind::MergeableCString); - } - - return getReadOnlySection(); - } - - if (Kind.isMergeableConst()) { - if (Kind.isMergeableConst4()) - return MergeableConst4Section; - if (Kind.isMergeableConst8()) - return MergeableConst8Section; - if (Kind.isMergeableConst16()) - return MergeableConst16Section; - return ReadOnlySection; // .const - } - - if (Kind.isReadOnly()) return getReadOnlySection(); - - - if (Kind.isThreadData()) return TLSDataSection; - if (Kind.isThreadBSS()) return TLSBSSSection; - - if (Kind.isBSS()) return getBSSSection_(); - - - if (Kind.isDataNoRel()) return DataSection; - if (Kind.isDataRelLocal()) return DataRelLocalSection; - if (Kind.isDataRel()) return DataRelSection; - if (Kind.isReadOnlyWithRelLocal()) return DataRelROLocalSection; - - assert(Kind.isReadOnlyWithRel() && "Unknown section kind"); - return DataRelROSection; -} - -/// getSectionForMergeableConstant - Given a Mergeable constant with the -/// specified size and relocation information, return a section that it -/// should be placed in. -const Section * -ELFTargetAsmInfo::getSectionForMergeableConstant(SectionKind Kind) const { - return SelectSectionForGlobal(0, Kind); -} - Modified: llvm/trunk/lib/Target/MSP430/MSP430AsmPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/MSP430/MSP430AsmPrinter.cpp?rev=77294&r1=77293&r2=77294&view=diff ============================================================================== --- llvm/trunk/lib/Target/MSP430/MSP430AsmPrinter.cpp (original) +++ llvm/trunk/lib/Target/MSP430/MSP430AsmPrinter.cpp Mon Jul 27 22:13:23 2009 @@ -27,6 +27,7 @@ #include "llvm/CodeGen/MachineInstr.h" #include "llvm/Target/TargetAsmInfo.h" #include "llvm/Target/TargetData.h" +#include "llvm/Target/TargetLoweringObjectFile.h" #include "llvm/Target/TargetRegistry.h" #include "llvm/ADT/Statistic.h" #include "llvm/Support/Compiler.h" @@ -77,7 +78,7 @@ void MSP430AsmPrinter::emitFunctionHeader(const MachineFunction &MF) { const Function *F = MF.getFunction(); - SwitchToSection(TAI->SectionForGlobal(F)); + SwitchToSection(getObjFileLowering().SectionForGlobal(F, TM)); unsigned FnAlign = MF.getAlignment(); EmitAlignment(FnAlign, F); Modified: llvm/trunk/lib/Target/MSP430/MSP430ISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/MSP430/MSP430ISelLowering.cpp?rev=77294&r1=77293&r2=77294&view=diff ============================================================================== --- llvm/trunk/lib/Target/MSP430/MSP430ISelLowering.cpp (original) +++ llvm/trunk/lib/Target/MSP430/MSP430ISelLowering.cpp Mon Jul 27 22:13:23 2009 @@ -31,13 +31,15 @@ #include "llvm/CodeGen/PseudoSourceValue.h" #include "llvm/CodeGen/SelectionDAGISel.h" #include "llvm/CodeGen/ValueTypes.h" +#include "llvm/Target/TargetLoweringObjectFile.h" #include "llvm/Support/Debug.h" #include "llvm/Support/ErrorHandling.h" #include "llvm/ADT/VectorExtras.h" using namespace llvm; MSP430TargetLowering::MSP430TargetLowering(MSP430TargetMachine &tm) : - TargetLowering(tm), Subtarget(*tm.getSubtargetImpl()), TM(tm) { + TargetLowering(tm, new TargetLoweringObjectFileELF()), + Subtarget(*tm.getSubtargetImpl()), TM(tm) { // Set up the register classes. addRegisterClass(MVT::i8, MSP430::GR8RegisterClass); Modified: llvm/trunk/lib/Target/MSP430/MSP430TargetAsmInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/MSP430/MSP430TargetAsmInfo.cpp?rev=77294&r1=77293&r2=77294&view=diff ============================================================================== --- llvm/trunk/lib/Target/MSP430/MSP430TargetAsmInfo.cpp (original) +++ llvm/trunk/lib/Target/MSP430/MSP430TargetAsmInfo.cpp Mon Jul 27 22:13:23 2009 @@ -17,6 +17,4 @@ MSP430TargetAsmInfo::MSP430TargetAsmInfo(const TargetMachine &TM) : ELFTargetAsmInfo(TM) { AlignmentIsInBytes = false; - - BSSSection_ = getOrCreateSection("\t.bss", true, SectionKind::BSS); } Modified: llvm/trunk/lib/Target/Mips/AsmPrinter/MipsAsmPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mips/AsmPrinter/MipsAsmPrinter.cpp?rev=77294&r1=77293&r2=77294&view=diff ============================================================================== --- llvm/trunk/lib/Target/Mips/AsmPrinter/MipsAsmPrinter.cpp (original) +++ llvm/trunk/lib/Target/Mips/AsmPrinter/MipsAsmPrinter.cpp Mon Jul 27 22:13:23 2009 @@ -31,6 +31,7 @@ #include "llvm/CodeGen/MachineInstr.h" #include "llvm/Target/TargetAsmInfo.h" #include "llvm/Target/TargetData.h" +#include "llvm/Target/TargetLoweringObjectFile.h" #include "llvm/Target/TargetMachine.h" #include "llvm/Target/TargetOptions.h" #include "llvm/Target/TargetRegistry.h" @@ -211,12 +212,10 @@ } /// Emit the directives used by GAS on the start of functions -void MipsAsmPrinter:: -emitFunctionStart(MachineFunction &MF) -{ +void MipsAsmPrinter::emitFunctionStart(MachineFunction &MF) { // Print out the label for the function. const Function *F = MF.getFunction(); - SwitchToSection(TAI->SectionForGlobal(F)); + SwitchToSection(getObjFileLowering().SectionForGlobal(F, TM)); // 2 bits aligned EmitAlignment(MF.getAlignment(), F); @@ -485,7 +484,7 @@ printVisibility(name, GVar->getVisibility()); - SwitchToSection(TAI->SectionForGlobal(GVar)); + SwitchToSection(getObjFileLowering().SectionForGlobal(GVar, TM)); if (C->isNullValue() && !GVar->hasSection()) { if (!GVar->isThreadLocal() && Modified: llvm/trunk/lib/Target/Mips/MipsISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mips/MipsISelLowering.cpp?rev=77294&r1=77293&r2=77294&view=diff ============================================================================== --- llvm/trunk/lib/Target/Mips/MipsISelLowering.cpp (original) +++ llvm/trunk/lib/Target/Mips/MipsISelLowering.cpp Mon Jul 27 22:13:23 2009 @@ -30,15 +30,13 @@ #include "llvm/CodeGen/MachineRegisterInfo.h" #include "llvm/CodeGen/SelectionDAGISel.h" #include "llvm/CodeGen/ValueTypes.h" +#include "llvm/Target/TargetLoweringObjectFile.h" #include "llvm/Support/Debug.h" #include "llvm/Support/ErrorHandling.h" using namespace llvm; -const char *MipsTargetLowering:: -getTargetNodeName(unsigned Opcode) const -{ - switch (Opcode) - { +const char *MipsTargetLowering::getTargetNodeName(unsigned Opcode) const { + switch (Opcode) { case MipsISD::JmpLink : return "MipsISD::JmpLink"; case MipsISD::Hi : return "MipsISD::Hi"; case MipsISD::Lo : return "MipsISD::Lo"; @@ -55,8 +53,8 @@ } MipsTargetLowering:: -MipsTargetLowering(MipsTargetMachine &TM): TargetLowering(TM) -{ +MipsTargetLowering(MipsTargetMachine &TM) + : TargetLowering(TM, new TargetLoweringObjectFileELF()) { Subtarget = &TM.getSubtarget(); // Mips does not have i1 type, so use i32 for Modified: llvm/trunk/lib/Target/Mips/MipsTargetAsmInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mips/MipsTargetAsmInfo.cpp?rev=77294&r1=77293&r2=77294&view=diff ============================================================================== --- llvm/trunk/lib/Target/Mips/MipsTargetAsmInfo.cpp (original) +++ llvm/trunk/lib/Target/Mips/MipsTargetAsmInfo.cpp Mon Jul 27 22:13:23 2009 @@ -30,8 +30,6 @@ BSSSection = "\t.section\t.bss"; CStringSection = ".rodata.str"; - BSSSection_ = getOrCreateSection("\t.bss", true, SectionKind::BSS); - if (!TM.getSubtarget().hasABICall()) JumpTableDirective = "\t.word\t"; else Modified: llvm/trunk/lib/Target/PIC16/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PIC16/CMakeLists.txt?rev=77294&r1=77293&r2=77294&view=diff ============================================================================== --- llvm/trunk/lib/Target/PIC16/CMakeLists.txt (original) +++ llvm/trunk/lib/Target/PIC16/CMakeLists.txt Mon Jul 27 22:13:23 2009 @@ -21,4 +21,5 @@ PIC16Subtarget.cpp PIC16TargetAsmInfo.cpp PIC16TargetMachine.cpp + PIC16TargetObjectFile.cpp ) Modified: llvm/trunk/lib/Target/PIC16/PIC16AsmPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PIC16/PIC16AsmPrinter.cpp?rev=77294&r1=77293&r2=77294&view=diff ============================================================================== --- llvm/trunk/lib/Target/PIC16/PIC16AsmPrinter.cpp (original) +++ llvm/trunk/lib/Target/PIC16/PIC16AsmPrinter.cpp Mon Jul 27 22:13:23 2009 @@ -25,11 +25,20 @@ #include "llvm/CodeGen/DwarfWriter.h" #include "llvm/CodeGen/MachineModuleInfo.h" #include "llvm/Target/TargetRegistry.h" +#include "llvm/Target/TargetLoweringObjectFile.h" using namespace llvm; #include "PIC16GenAsmWriter.inc" +PIC16AsmPrinter::PIC16AsmPrinter(formatted_raw_ostream &O, TargetMachine &TM, + const TargetAsmInfo *T, bool V) +: AsmPrinter(O, TM, T, V), DbgInfo(O, T) { + PTLI = static_cast(TM.getTargetLowering()); + PTAI = static_cast(T); + PTOF = static_cast(&PTLI->getObjFileLowering()); +} + bool PIC16AsmPrinter::printMachineInstruction(const MachineInstr *MI) { printInstruction(MI); return true; @@ -59,10 +68,12 @@ EmitAutos(CurrentFnName); // Now emit the instructions of function in its code section. - const char *codeSection = PAN::getCodeSectionName(CurrentFnName).c_str(); + std::string T = PAN::getCodeSectionName(CurrentFnName); + const char *codeSection = T.c_str(); const Section *fCodeSection = - TAI->getOrCreateSection(codeSection, false, SectionKind::Text); + getObjFileLowering().getOrCreateSection(codeSection, false, + SectionKind::Text); // Start the Code Section. O << "\n"; SwitchToSection(fCodeSection); @@ -211,9 +222,8 @@ // Set the section names for all globals. for (Module::global_iterator I = M.global_begin(), E = M.global_end(); - I != E; ++I) { - I->setSection(TAI->SectionForGlobal(I)->getName()); - } + I != E; ++I) + I->setSection(getObjFileLowering().SectionForGlobal(I, TM)->getName()); DbgInfo.BeginModule(M); EmitFunctionDecls(M); @@ -256,7 +266,7 @@ // Emit variables imported from other Modules. void PIC16AsmPrinter::EmitUndefinedVars(Module &M) { - std::vector Items = PTAI->ExternalVarDecls->Items; + std::vector Items = PTOF->ExternalVarDecls->Items; if (!Items.size()) return; O << "\n" << TAI->getCommentString() << "Imported Variables - BEGIN" << "\n"; @@ -268,7 +278,7 @@ // Emit variables defined in this module and are available to other modules. void PIC16AsmPrinter::EmitDefinedVars(Module &M) { - std::vector Items = PTAI->ExternalVarDefs->Items; + std::vector Items = PTOF->ExternalVarDefs->Items; if (!Items.size()) return; O << "\n" << TAI->getCommentString() << "Exported Variables - BEGIN" << "\n"; @@ -281,12 +291,12 @@ // Emit initialized data placed in ROM. void PIC16AsmPrinter::EmitRomData(Module &M) { // Print ROM Data section. - const std::vector &ROSections = PTAI->ROSections; + const std::vector &ROSections = PTOF->ROSections; for (unsigned i = 0; i < ROSections.size(); i++) { const std::vector &Items = ROSections[i]->Items; if (!Items.size()) continue; O << "\n"; - SwitchToSection(PTAI->ROSections[i]->S_); + SwitchToSection(PTOF->ROSections[i]->S_); for (unsigned j = 0; j < Items.size(); j++) { O << Mang->getMangledName(Items[j]); Constant *C = Items[j]->getInitializer(); @@ -310,10 +320,12 @@ const TargetData *TD = TM.getTargetData(); // Emit the data section name. O << "\n"; - const char *SectionName = PAN::getFrameSectionName(CurrentFnName).c_str(); + std::string T = PAN::getFrameSectionName(CurrentFnName); + const char *SectionName = T.c_str(); const Section *fPDataSection = - TAI->getOrCreateSection(SectionName, false, SectionKind::DataRel); + getObjFileLowering().getOrCreateSection(SectionName, false, + SectionKind::DataRel); SwitchToSection(fPDataSection); // Emit function frame label @@ -352,7 +364,7 @@ void PIC16AsmPrinter::EmitIData(Module &M) { // Print all IDATA sections. - const std::vector &IDATASections = PTAI->IDATASections; + const std::vector &IDATASections = PTOF->IDATASections; for (unsigned i = 0; i < IDATASections.size(); i++) { O << "\n"; if (IDATASections[i]->S_->getName().find("llvm.") != std::string::npos) @@ -373,7 +385,7 @@ const TargetData *TD = TM.getTargetData(); // Print all BSS sections. - const std::vector &BSSSections = PTAI->BSSSections; + const std::vector &BSSSections = PTOF->BSSSections; for (unsigned i = 0; i < BSSSections.size(); i++) { O << "\n"; SwitchToSection(BSSSections[i]->S_); @@ -395,7 +407,7 @@ // Now print Autos section for this function. std::string SectionName = PAN::getAutosSectionName(FunctName); - const std::vector &AutosSections = PTAI->AutosSections; + const std::vector &AutosSections = PTOF->AutosSections; for (unsigned i = 0; i < AutosSections.size(); i++) { O << "\n"; if (AutosSections[i]->S_->getName() == SectionName) { @@ -422,7 +434,7 @@ const TargetData *TD = TM.getTargetData(); // Now print Autos section for this function. - std::vector AutosSections = PTAI->AutosSections; + std::vector AutosSections = PTOF->AutosSections; for (unsigned i = 0; i < AutosSections.size(); i++) { // if the section is already printed then don't print again Modified: llvm/trunk/lib/Target/PIC16/PIC16AsmPrinter.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PIC16/PIC16AsmPrinter.h?rev=77294&r1=77293&r2=77294&view=diff ============================================================================== --- llvm/trunk/lib/Target/PIC16/PIC16AsmPrinter.h (original) +++ llvm/trunk/lib/Target/PIC16/PIC16AsmPrinter.h Mon Jul 27 22:13:23 2009 @@ -18,6 +18,7 @@ #include "PIC16.h" #include "PIC16TargetMachine.h" #include "PIC16DebugInfo.h" +#include "PIC16TargetObjectFile.h" #include "llvm/Analysis/DebugInfo.h" #include "PIC16TargetAsmInfo.h" #include "llvm/CodeGen/AsmPrinter.h" @@ -28,13 +29,10 @@ #include namespace llvm { - struct VISIBILITY_HIDDEN PIC16AsmPrinter : public AsmPrinter { + class VISIBILITY_HIDDEN PIC16AsmPrinter : public AsmPrinter { + public: explicit PIC16AsmPrinter(formatted_raw_ostream &O, TargetMachine &TM, - const TargetAsmInfo *T, bool V) - : AsmPrinter(O, TM, T, V), DbgInfo(O, T) { - PTLI = static_cast (TM.getTargetLowering()); - PTAI = static_cast (T); - } + const TargetAsmInfo *T, bool V); private: virtual const char *getPassName() const { return "PIC16 Assembly Printer"; @@ -66,6 +64,7 @@ } private: + PIC16TargetObjectFile *PTOF; PIC16TargetLowering *PTLI; PIC16DbgInfo DbgInfo; const PIC16TargetAsmInfo *PTAI; Modified: llvm/trunk/lib/Target/PIC16/PIC16ISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PIC16/PIC16ISelLowering.cpp?rev=77294&r1=77293&r2=77294&view=diff ============================================================================== --- llvm/trunk/lib/Target/PIC16/PIC16ISelLowering.cpp (original) +++ llvm/trunk/lib/Target/PIC16/PIC16ISelLowering.cpp Mon Jul 27 22:13:23 2009 @@ -12,8 +12,8 @@ //===----------------------------------------------------------------------===// #define DEBUG_TYPE "pic16-lower" - #include "PIC16ISelLowering.h" +#include "PIC16TargetObjectFile.h" #include "PIC16TargetMachine.h" #include "llvm/DerivedTypes.h" #include "llvm/GlobalValue.h" @@ -123,7 +123,7 @@ // PIC16TargetLowering Constructor. PIC16TargetLowering::PIC16TargetLowering(PIC16TargetMachine &TM) - : TargetLowering(TM), TmpSize(0) { + : TargetLowering(TM, new PIC16TargetObjectFile(TM)), TmpSize(0) { Subtarget = &TM.getSubtarget(); Modified: llvm/trunk/lib/Target/PIC16/PIC16TargetAsmInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PIC16/PIC16TargetAsmInfo.cpp?rev=77294&r1=77293&r2=77294&view=diff ============================================================================== --- llvm/trunk/lib/Target/PIC16/PIC16TargetAsmInfo.cpp (original) +++ llvm/trunk/lib/Target/PIC16/PIC16TargetAsmInfo.cpp Mon Jul 27 22:13:23 2009 @@ -31,36 +31,26 @@ Data16bitsDirective = " dw "; Data32bitsDirective = " dl "; Data64bitsDirective = NULL; - RomData8bitsDirective = " dw "; - RomData16bitsDirective = " rom_di "; - RomData32bitsDirective = " rom_dl "; ZeroDirective = NULL; AsciiDirective = " dt "; AscizDirective = NULL; - BSSSection_ = getOrCreateSection("udata.# UDATA", false, SectionKind::BSS); - ReadOnlySection = getOrCreateSection("romdata.# ROMDATA", false, - SectionKind::ReadOnly); - DataSection = getOrCreateSection("idata.# IDATA", false,SectionKind::DataRel); SwitchToSectionDirective = ""; - // Need because otherwise a .text symbol is emitted by DwarfWriter - // in BeginModule, and gpasm cribbs for that .text symbol. - TextSection = getOrCreateSection("", true, SectionKind::Text); - PIC16Section *ROSection = new PIC16Section(getReadOnlySection()); - ROSections.push_back(ROSection); - // FIXME: I don't know what the classification of these sections really is. - ExternalVarDecls = new PIC16Section(getOrCreateSection("ExternalVarDecls", - false, - SectionKind::Metadata)); - ExternalVarDefs = new PIC16Section(getOrCreateSection("ExternalVarDefs", - false, - SectionKind::Metadata)); + RomData8bitsDirective = " dw "; + RomData16bitsDirective = " rom_di "; + RomData32bitsDirective = " rom_dl "; + + // Set it to false because we weed to generate c file name and not bc file // name. HasSingleParameterDotFile = false; } -const char *PIC16TargetAsmInfo::getRomDirective(unsigned Size) const { +const char *PIC16TargetAsmInfo:: +getDataASDirective(unsigned Size, unsigned AS) const { + if (AS != PIC16ISD::ROM_SPACE) + return 0; + switch (Size) { case 8: return RomData8bitsDirective; case 16: return RomData16bitsDirective; @@ -69,369 +59,3 @@ } } - -const char *PIC16TargetAsmInfo:: -getDataASDirective(unsigned Size, unsigned AS) const { - if (AS == PIC16ISD::ROM_SPACE) - return getRomDirective(Size); - return NULL; -} - -const Section * -PIC16TargetAsmInfo::getBSSSectionForGlobal(const GlobalVariable *GV) const { - assert(GV->hasInitializer() && "This global doesn't need space"); - Constant *C = GV->getInitializer(); - assert(C->isNullValue() && "Unitialized globals has non-zero initializer"); - - // Find how much space this global needs. - const TargetData *TD = TM.getTargetData(); - const Type *Ty = C->getType(); - unsigned ValSize = TD->getTypeAllocSize(Ty); - - // Go through all BSS Sections and assign this variable - // to the first available section having enough space. - PIC16Section *FoundBSS = NULL; - for (unsigned i = 0; i < BSSSections.size(); i++) { - if (DataBankSize - BSSSections[i]->Size >= ValSize) { - FoundBSS = BSSSections[i]; - break; - } - } - - // No BSS section spacious enough was found. Crate a new one. - if (!FoundBSS) { - std::string name = PAN::getUdataSectionName(BSSSections.size()); - const Section *NewSection = getOrCreateSection(name.c_str(), false, - // FIXME. - SectionKind::Metadata); - - FoundBSS = new PIC16Section(NewSection); - - // Add this newly created BSS section to the list of BSSSections. - BSSSections.push_back(FoundBSS); - } - - // Insert the GV into this BSS. - FoundBSS->Items.push_back(GV); - FoundBSS->Size += ValSize; - return FoundBSS->S_; -} - -const Section * -PIC16TargetAsmInfo::getIDATASectionForGlobal(const GlobalVariable *GV) const { - assert(GV->hasInitializer() && "This global doesn't need space"); - Constant *C = GV->getInitializer(); - assert(!C->isNullValue() && "initialized globals has zero initializer"); - assert(GV->getType()->getAddressSpace() == PIC16ISD::RAM_SPACE && - "can split initialized RAM data only"); - - // Find how much space this global needs. - const TargetData *TD = TM.getTargetData(); - const Type *Ty = C->getType(); - unsigned ValSize = TD->getTypeAllocSize(Ty); - - // Go through all IDATA Sections and assign this variable - // to the first available section having enough space. - PIC16Section *FoundIDATA = NULL; - for (unsigned i = 0; i < IDATASections.size(); i++) { - if (DataBankSize - IDATASections[i]->Size >= ValSize) { - FoundIDATA = IDATASections[i]; - break; - } - } - - // No IDATA section spacious enough was found. Crate a new one. - if (!FoundIDATA) { - std::string name = PAN::getIdataSectionName(IDATASections.size()); - const Section *NewSection = getOrCreateSection(name.c_str(), - false, - // FIXME. - SectionKind::Metadata); - - FoundIDATA = new PIC16Section(NewSection); - - // Add this newly created IDATA section to the list of IDATASections. - IDATASections.push_back(FoundIDATA); - } - - // Insert the GV into this IDATA. - FoundIDATA->Items.push_back(GV); - FoundIDATA->Size += ValSize; - return FoundIDATA->S_; -} - -// Get the section for an automatic variable of a function. -// For PIC16 they are globals only with mangled names. -const Section * -PIC16TargetAsmInfo::getSectionForAuto(const GlobalVariable *GV) const { - - const std::string name = PAN::getSectionNameForSym(GV->getName()); - - // Go through all Auto Sections and assign this variable - // to the appropriate section. - PIC16Section *FoundAutoSec = NULL; - for (unsigned i = 0; i < AutosSections.size(); i++) { - if (AutosSections[i]->S_->getName() == name) { - FoundAutoSec = AutosSections[i]; - break; - } - } - - // No Auto section was found. Crate a new one. - if (!FoundAutoSec) { - const Section *NewSection = getOrCreateSection(name.c_str(), - // FIXME. - false, - SectionKind::Metadata); - - FoundAutoSec = new PIC16Section(NewSection); - - // Add this newly created autos section to the list of AutosSections. - AutosSections.push_back(FoundAutoSec); - } - - // Insert the auto into this section. - FoundAutoSec->Items.push_back(GV); - - return FoundAutoSec->S_; -} - - -// Override default implementation to put the true globals into -// multiple data sections if required. -const Section* -PIC16TargetAsmInfo::SelectSectionForGlobal(const GlobalValue *GV1, - SectionKind Kind) const { - // We select the section based on the initializer here, so it really - // has to be a GlobalVariable. - const GlobalVariable *GV = dyn_cast(GV1); - if (!GV) - return TargetAsmInfo::SelectSectionForGlobal(GV1, Kind); - - // Record External Var Decls. - if (GV->isDeclaration()) { - ExternalVarDecls->Items.push_back(GV); - return ExternalVarDecls->S_; - } - - assert(GV->hasInitializer() && "A def without initializer?"); - - // First, if this is an automatic variable for a function, get the section - // name for it and return. - std::string name = GV->getName(); - if (PAN::isLocalName(name)) - return getSectionForAuto(GV); - - // Record Exteranl Var Defs. - if (GV->hasExternalLinkage() || GV->hasCommonLinkage()) - ExternalVarDefs->Items.push_back(GV); - - // See if this is an uninitialized global. - const Constant *C = GV->getInitializer(); - if (C->isNullValue()) - return getBSSSectionForGlobal(GV); - - // If this is initialized data in RAM. Put it in the correct IDATA section. - if (GV->getType()->getAddressSpace() == PIC16ISD::RAM_SPACE) - return getIDATASectionForGlobal(GV); - - // This is initialized data in rom, put it in the readonly section. - if (GV->getType()->getAddressSpace() == PIC16ISD::ROM_SPACE) - return getROSectionForGlobal(GV); - - // Else let the default implementation take care of it. - return TargetAsmInfo::SelectSectionForGlobal(GV, Kind); -} - -PIC16TargetAsmInfo::~PIC16TargetAsmInfo() { - for (unsigned i = 0; i < BSSSections.size(); i++) - delete BSSSections[i]; - for (unsigned i = 0; i < IDATASections.size(); i++) - delete IDATASections[i]; - for (unsigned i = 0; i < AutosSections.size(); i++) - delete AutosSections[i]; - for (unsigned i = 0; i < ROSections.size(); i++) - delete ROSections[i]; - delete ExternalVarDecls; - delete ExternalVarDefs; -} - - -/// getSpecialCasedSectionGlobals - Allow the target to completely override -/// section assignment of a global. -const Section * -PIC16TargetAsmInfo::getSpecialCasedSectionGlobals(const GlobalValue *GV, - SectionKind Kind) const { - // If GV has a sectin name or section address create that section now. - if (GV->hasSection()) { - if (const GlobalVariable *GVar = cast(GV)) { - std::string SectName = GVar->getSection(); - // If address for a variable is specified, get the address and create - // section. - std::string AddrStr = "Address="; - if (SectName.compare(0, AddrStr.length(), AddrStr) == 0) { - std::string SectAddr = SectName.substr(AddrStr.length()); - return CreateSectionForGlobal(GVar, SectAddr); - } - - // Create the section specified with section attribute. - return CreateSectionForGlobal(GVar); - } - } - - return 0; -} - -// Create a new section for global variable. If Addr is given then create -// section at that address else create by name. -const Section * -PIC16TargetAsmInfo::CreateSectionForGlobal(const GlobalVariable *GV, - const std::string &Addr) const { - // See if this is an uninitialized global. - const Constant *C = GV->getInitializer(); - if (C->isNullValue()) - return CreateBSSSectionForGlobal(GV, Addr); - - // If this is initialized data in RAM. Put it in the correct IDATA section. - if (GV->getType()->getAddressSpace() == PIC16ISD::RAM_SPACE) - return CreateIDATASectionForGlobal(GV, Addr); - - // This is initialized data in rom, put it in the readonly section. - if (GV->getType()->getAddressSpace() == PIC16ISD::ROM_SPACE) - return CreateROSectionForGlobal(GV, Addr); - - // Else let the default implementation take care of it. - return TargetAsmInfo::SectionForGlobal(GV); -} - -// Create uninitialized section for a variable. -const Section * -PIC16TargetAsmInfo::CreateBSSSectionForGlobal(const GlobalVariable *GV, - std::string Addr) const { - assert(GV->hasInitializer() && "This global doesn't need space"); - assert(GV->getInitializer()->isNullValue() && - "Unitialized global has non-zero initializer"); - std::string Name; - // If address is given then create a section at that address else create a - // section by section name specified in GV. - PIC16Section *FoundBSS = NULL; - if (Addr.empty()) { - Name = GV->getSection() + " UDATA"; - for (unsigned i = 0; i < BSSSections.size(); i++) { - if (BSSSections[i]->S_->getName() == Name) { - FoundBSS = BSSSections[i]; - break; - } - } - } else { - std::string Prefix = GV->getNameStr() + "." + Addr + "."; - Name = PAN::getUdataSectionName(BSSSections.size(), Prefix) + " " + Addr; - } - - PIC16Section *NewBSS = FoundBSS; - if (NewBSS == NULL) { - const Section *NewSection = getOrCreateSection(Name.c_str(), - false, SectionKind::BSS); - NewBSS = new PIC16Section(NewSection); - BSSSections.push_back(NewBSS); - } - - // Insert the GV into this BSS. - NewBSS->Items.push_back(GV); - - // We do not want to put any GV without explicit section into this section - // so set its size to DatabankSize. - NewBSS->Size = DataBankSize; - return NewBSS->S_; -} - -// Get rom section for a variable. Currently there can be only one rom section -// unless a variable explicitly requests a section. -const Section * -PIC16TargetAsmInfo::getROSectionForGlobal(const GlobalVariable *GV) const { - ROSections[0]->Items.push_back(GV); - return ROSections[0]->S_; -} - -// Create initialized data section for a variable. -const Section * -PIC16TargetAsmInfo::CreateIDATASectionForGlobal(const GlobalVariable *GV, - std::string Addr) const { - assert(GV->hasInitializer() && "This global doesn't need space"); - assert(!GV->getInitializer()->isNullValue() && - "initialized global has zero initializer"); - assert(GV->getType()->getAddressSpace() == PIC16ISD::RAM_SPACE && - "can be used for initialized RAM data only"); - - std::string Name; - // If address is given then create a section at that address else create a - // section by section name specified in GV. - PIC16Section *FoundIDATASec = NULL; - if (Addr.empty()) { - Name = GV->getSection() + " IDATA"; - for (unsigned i = 0; i < IDATASections.size(); i++) { - if (IDATASections[i]->S_->getName() == Name) { - FoundIDATASec = IDATASections[i]; - break; - } - } - } else { - std::string Prefix = GV->getNameStr() + "." + Addr + "."; - Name = PAN::getIdataSectionName(IDATASections.size(), Prefix) + " " + Addr; - } - - PIC16Section *NewIDATASec = FoundIDATASec; - if (NewIDATASec == NULL) { - const Section *NewSection = getOrCreateSection(Name.c_str(), - false, - // FIXME: - SectionKind::Metadata); - NewIDATASec = new PIC16Section(NewSection); - IDATASections.push_back(NewIDATASec); - } - // Insert the GV into this IDATA Section. - NewIDATASec->Items.push_back(GV); - // We do not want to put any GV without explicit section into this section - // so set its size to DatabankSize. - NewIDATASec->Size = DataBankSize; - return NewIDATASec->S_; -} - -// Create a section in rom for a variable. -const Section * -PIC16TargetAsmInfo::CreateROSectionForGlobal(const GlobalVariable *GV, - std::string Addr) const { - assert(GV->getType()->getAddressSpace() == PIC16ISD::ROM_SPACE && - "can be used for ROM data only"); - - std::string Name; - // If address is given then create a section at that address else create a - // section by section name specified in GV. - PIC16Section *FoundROSec = NULL; - if (Addr.empty()) { - Name = GV->getSection() + " ROMDATA"; - for (unsigned i = 1; i < ROSections.size(); i++) { - if (ROSections[i]->S_->getName() == Name) { - FoundROSec = ROSections[i]; - break; - } - } - } else { - std::string Prefix = GV->getNameStr() + "." + Addr + "."; - Name = PAN::getRomdataSectionName(ROSections.size(), Prefix) + " " + Addr; - } - - PIC16Section *NewRomSec = FoundROSec; - if (NewRomSec == NULL) { - const Section *NewSection = getOrCreateSection(Name.c_str(), - false, - SectionKind::ReadOnly); - NewRomSec = new PIC16Section(NewSection); - ROSections.push_back(NewRomSec); - } - - // Insert the GV into this ROM Section. - NewRomSec->Items.push_back(GV); - return NewRomSec->S_; -} - Modified: llvm/trunk/lib/Target/PIC16/PIC16TargetAsmInfo.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PIC16/PIC16TargetAsmInfo.h?rev=77294&r1=77293&r2=77294&view=diff ============================================================================== --- llvm/trunk/lib/Target/PIC16/PIC16TargetAsmInfo.h (original) +++ llvm/trunk/lib/Target/PIC16/PIC16TargetAsmInfo.h Mon Jul 27 22:13:23 2009 @@ -14,91 +14,22 @@ #ifndef PIC16TARGETASMINFO_H #define PIC16TARGETASMINFO_H -#include "PIC16.h" #include "llvm/Target/TargetAsmInfo.h" -#include -#include "llvm/Module.h" namespace llvm { - enum { DataBankSize = 80 }; - // Forward declaration. class PIC16TargetMachine; - class GlobalVariable; - - /// PIC16 Splits the global data into mulitple udata and idata sections. - /// Each udata and idata section needs to contain a list of globals that - /// they contain, in order to avoid scanning over all the global values - /// again and printing only those that match the current section. - /// Keeping values inside the sections make printing a section much easier. - struct PIC16Section { - const Section *S_; // Connection to actual Section. - unsigned Size; // Total size of the objects contained. - bool SectionPrinted; - std::vector Items; - - PIC16Section(const Section *s) { - S_ = s; - Size = 0; - SectionPrinted = false; - } - bool isPrinted() const { return SectionPrinted; } - void setPrintedStatus(bool status) { SectionPrinted = status; } - }; - struct PIC16TargetAsmInfo : public TargetAsmInfo { - std::string getSectionNameForSym(const std::string &Sym) const; - PIC16TargetAsmInfo(const PIC16TargetMachine &TM); - mutable std::vector BSSSections; - mutable std::vector IDATASections; - mutable std::vector AutosSections; - mutable std::vector ROSections; - mutable PIC16Section *ExternalVarDecls; - mutable PIC16Section *ExternalVarDefs; - virtual ~PIC16TargetAsmInfo(); - - private: + class PIC16TargetAsmInfo : public TargetAsmInfo { const char *RomData8bitsDirective; const char *RomData16bitsDirective; const char *RomData32bitsDirective; - const char *getRomDirective(unsigned size) const; - virtual const char *getDataASDirective(unsigned size, unsigned AS) const; - const Section *getBSSSectionForGlobal(const GlobalVariable *GV) const; - const Section *getIDATASectionForGlobal(const GlobalVariable *GV) const; - const Section *getSectionForAuto(const GlobalVariable *GV) const; - const Section *CreateBSSSectionForGlobal(const GlobalVariable *GV, - std::string Addr = "") const; - const Section *CreateIDATASectionForGlobal(const GlobalVariable *GV, - std::string Addr = "") const; - const Section *getROSectionForGlobal(const GlobalVariable *GV) const; - const Section *CreateROSectionForGlobal(const GlobalVariable *GV, - std::string Addr = "") const; - virtual const Section *SelectSectionForGlobal(const GlobalValue *GV, - SectionKind Kind) const; - const Section *CreateSectionForGlobal(const GlobalVariable *GV, - const std::string &Addr = "") const; - public: - void SetSectionForGVs(Module &M); - const std::vector &getBSSSections() const { - return BSSSections; - } - const std::vector &getIDATASections() const { - return IDATASections; - } - const std::vector &getAutosSections() const { - return AutosSections; - } - const std::vector &getROSections() const { - return ROSections; - } - - /// getSpecialCasedSectionGlobals - Allow the target to completely override - /// section assignment of a global. - virtual const Section * - getSpecialCasedSectionGlobals(const GlobalValue *GV, - SectionKind Kind) const; + public: + PIC16TargetAsmInfo(const PIC16TargetMachine &TM); + + virtual const char *getDataASDirective(unsigned size, unsigned AS) const; }; } // namespace llvm Added: llvm/trunk/lib/Target/PIC16/PIC16TargetObjectFile.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PIC16/PIC16TargetObjectFile.cpp?rev=77294&view=auto ============================================================================== --- llvm/trunk/lib/Target/PIC16/PIC16TargetObjectFile.cpp (added) +++ llvm/trunk/lib/Target/PIC16/PIC16TargetObjectFile.cpp Mon Jul 27 22:13:23 2009 @@ -0,0 +1,401 @@ +//===-- PIC16TargetObjectFile.cpp - PIC16 object files --------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#include "PIC16TargetObjectFile.h" +#include "PIC16ISelLowering.h" +#include "PIC16TargetMachine.h" +#include "llvm/DerivedTypes.h" +#include "llvm/Module.h" +using namespace llvm; + + +PIC16TargetObjectFile::PIC16TargetObjectFile(const PIC16TargetMachine &tm) +: TM (tm) { + BSSSection_ = getOrCreateSection("udata.# UDATA", false, SectionKind::BSS); + ReadOnlySection = getOrCreateSection("romdata.# ROMDATA", false, + SectionKind::ReadOnly); + DataSection = getOrCreateSection("idata.# IDATA", false,SectionKind::DataRel); + + // Need because otherwise a .text symbol is emitted by DwarfWriter + // in BeginModule, and gpasm cribbs for that .text symbol. + TextSection = getOrCreateSection("", true, SectionKind::Text); + + + PIC16Section *ROSection = new PIC16Section(ReadOnlySection); + ROSections.push_back(ROSection); + + // FIXME: I don't know what the classification of these sections really is. + ExternalVarDecls = new PIC16Section(getOrCreateSection("ExternalVarDecls", + false, + SectionKind::Metadata)); + ExternalVarDefs = new PIC16Section(getOrCreateSection("ExternalVarDefs", + false, + SectionKind::Metadata)); +} + + +const Section * +PIC16TargetObjectFile::getBSSSectionForGlobal(const GlobalVariable *GV) const { + assert(GV->hasInitializer() && "This global doesn't need space"); + Constant *C = GV->getInitializer(); + assert(C->isNullValue() && "Unitialized globals has non-zero initializer"); + + // Find how much space this global needs. + const TargetData *TD = TM.getTargetData(); + const Type *Ty = C->getType(); + unsigned ValSize = TD->getTypeAllocSize(Ty); + + // Go through all BSS Sections and assign this variable + // to the first available section having enough space. + PIC16Section *FoundBSS = NULL; + for (unsigned i = 0; i < BSSSections.size(); i++) { + if (DataBankSize - BSSSections[i]->Size >= ValSize) { + FoundBSS = BSSSections[i]; + break; + } + } + + // No BSS section spacious enough was found. Crate a new one. + if (!FoundBSS) { + std::string name = PAN::getUdataSectionName(BSSSections.size()); + const Section *NewSection = getOrCreateSection(name.c_str(), false, + // FIXME. + SectionKind::Metadata); + + FoundBSS = new PIC16Section(NewSection); + + // Add this newly created BSS section to the list of BSSSections. + BSSSections.push_back(FoundBSS); + } + + // Insert the GV into this BSS. + FoundBSS->Items.push_back(GV); + FoundBSS->Size += ValSize; + return FoundBSS->S_; +} + +const Section * +PIC16TargetObjectFile::getIDATASectionForGlobal(const GlobalVariable *GV) const{ + assert(GV->hasInitializer() && "This global doesn't need space"); + Constant *C = GV->getInitializer(); + assert(!C->isNullValue() && "initialized globals has zero initializer"); + assert(GV->getType()->getAddressSpace() == PIC16ISD::RAM_SPACE && + "can split initialized RAM data only"); + + // Find how much space this global needs. + const TargetData *TD = TM.getTargetData(); + const Type *Ty = C->getType(); + unsigned ValSize = TD->getTypeAllocSize(Ty); + + // Go through all IDATA Sections and assign this variable + // to the first available section having enough space. + PIC16Section *FoundIDATA = NULL; + for (unsigned i = 0; i < IDATASections.size(); i++) { + if (DataBankSize - IDATASections[i]->Size >= ValSize) { + FoundIDATA = IDATASections[i]; + break; + } + } + + // No IDATA section spacious enough was found. Crate a new one. + if (!FoundIDATA) { + std::string name = PAN::getIdataSectionName(IDATASections.size()); + const Section *NewSection = getOrCreateSection(name.c_str(), + false, + // FIXME. + SectionKind::Metadata); + + FoundIDATA = new PIC16Section(NewSection); + + // Add this newly created IDATA section to the list of IDATASections. + IDATASections.push_back(FoundIDATA); + } + + // Insert the GV into this IDATA. + FoundIDATA->Items.push_back(GV); + FoundIDATA->Size += ValSize; + return FoundIDATA->S_; +} + +// Get the section for an automatic variable of a function. +// For PIC16 they are globals only with mangled names. +const Section * +PIC16TargetObjectFile::getSectionForAuto(const GlobalVariable *GV) const { + + const std::string name = PAN::getSectionNameForSym(GV->getName()); + + // Go through all Auto Sections and assign this variable + // to the appropriate section. + PIC16Section *FoundAutoSec = NULL; + for (unsigned i = 0; i < AutosSections.size(); i++) { + if (AutosSections[i]->S_->getName() == name) { + FoundAutoSec = AutosSections[i]; + break; + } + } + + // No Auto section was found. Crate a new one. + if (!FoundAutoSec) { + const Section *NewSection = getOrCreateSection(name.c_str(), + // FIXME. + false, + SectionKind::Metadata); + + FoundAutoSec = new PIC16Section(NewSection); + + // Add this newly created autos section to the list of AutosSections. + AutosSections.push_back(FoundAutoSec); + } + + // Insert the auto into this section. + FoundAutoSec->Items.push_back(GV); + + return FoundAutoSec->S_; +} + + +// Override default implementation to put the true globals into +// multiple data sections if required. +const Section* +PIC16TargetObjectFile::SelectSectionForGlobal(const GlobalValue *GV1, + SectionKind Kind, + const TargetMachine &TM) const { + // We select the section based on the initializer here, so it really + // has to be a GlobalVariable. + const GlobalVariable *GV = dyn_cast(GV1); + if (!GV) + return TargetLoweringObjectFile::SelectSectionForGlobal(GV1, Kind, TM); + + // Record External Var Decls. + if (GV->isDeclaration()) { + ExternalVarDecls->Items.push_back(GV); + return ExternalVarDecls->S_; + } + + assert(GV->hasInitializer() && "A def without initializer?"); + + // First, if this is an automatic variable for a function, get the section + // name for it and return. + std::string name = GV->getName(); + if (PAN::isLocalName(name)) + return getSectionForAuto(GV); + + // Record Exteranl Var Defs. + if (GV->hasExternalLinkage() || GV->hasCommonLinkage()) + ExternalVarDefs->Items.push_back(GV); + + // See if this is an uninitialized global. + const Constant *C = GV->getInitializer(); + if (C->isNullValue()) + return getBSSSectionForGlobal(GV); + + // If this is initialized data in RAM. Put it in the correct IDATA section. + if (GV->getType()->getAddressSpace() == PIC16ISD::RAM_SPACE) + return getIDATASectionForGlobal(GV); + + // This is initialized data in rom, put it in the readonly section. + if (GV->getType()->getAddressSpace() == PIC16ISD::ROM_SPACE) + return getROSectionForGlobal(GV); + + // Else let the default implementation take care of it. + return TargetLoweringObjectFile::SelectSectionForGlobal(GV, Kind, TM); +} + +PIC16TargetObjectFile::~PIC16TargetObjectFile() { + for (unsigned i = 0; i < BSSSections.size(); i++) + delete BSSSections[i]; + for (unsigned i = 0; i < IDATASections.size(); i++) + delete IDATASections[i]; + for (unsigned i = 0; i < AutosSections.size(); i++) + delete AutosSections[i]; + for (unsigned i = 0; i < ROSections.size(); i++) + delete ROSections[i]; + delete ExternalVarDecls; + delete ExternalVarDefs; +} + + +/// getSpecialCasedSectionGlobals - Allow the target to completely override +/// section assignment of a global. +const Section * +PIC16TargetObjectFile::getSpecialCasedSectionGlobals(const GlobalValue *GV, + SectionKind Kind) const { + // If GV has a sectin name or section address create that section now. + if (GV->hasSection()) { + if (const GlobalVariable *GVar = cast(GV)) { + std::string SectName = GVar->getSection(); + // If address for a variable is specified, get the address and create + // section. + std::string AddrStr = "Address="; + if (SectName.compare(0, AddrStr.length(), AddrStr) == 0) { + std::string SectAddr = SectName.substr(AddrStr.length()); + return CreateSectionForGlobal(GVar, SectAddr); + } + + // Create the section specified with section attribute. + return CreateSectionForGlobal(GVar); + } + } + + return 0; +} + +// Create a new section for global variable. If Addr is given then create +// section at that address else create by name. +const Section * +PIC16TargetObjectFile::CreateSectionForGlobal(const GlobalVariable *GV, + const std::string &Addr) const { + // See if this is an uninitialized global. + const Constant *C = GV->getInitializer(); + if (C->isNullValue()) + return CreateBSSSectionForGlobal(GV, Addr); + + // If this is initialized data in RAM. Put it in the correct IDATA section. + if (GV->getType()->getAddressSpace() == PIC16ISD::RAM_SPACE) + return CreateIDATASectionForGlobal(GV, Addr); + + // This is initialized data in rom, put it in the readonly section. + if (GV->getType()->getAddressSpace() == PIC16ISD::ROM_SPACE) + return CreateROSectionForGlobal(GV, Addr); + + // Else let the default implementation take care of it. + return TargetLoweringObjectFile::SectionForGlobal(GV, TM); +} + +// Create uninitialized section for a variable. +const Section * +PIC16TargetObjectFile::CreateBSSSectionForGlobal(const GlobalVariable *GV, + std::string Addr) const { + assert(GV->hasInitializer() && "This global doesn't need space"); + assert(GV->getInitializer()->isNullValue() && + "Unitialized global has non-zero initializer"); + std::string Name; + // If address is given then create a section at that address else create a + // section by section name specified in GV. + PIC16Section *FoundBSS = NULL; + if (Addr.empty()) { + Name = GV->getSection() + " UDATA"; + for (unsigned i = 0; i < BSSSections.size(); i++) { + if (BSSSections[i]->S_->getName() == Name) { + FoundBSS = BSSSections[i]; + break; + } + } + } else { + std::string Prefix = GV->getNameStr() + "." + Addr + "."; + Name = PAN::getUdataSectionName(BSSSections.size(), Prefix) + " " + Addr; + } + + PIC16Section *NewBSS = FoundBSS; + if (NewBSS == NULL) { + const Section *NewSection = getOrCreateSection(Name.c_str(), + false, SectionKind::BSS); + NewBSS = new PIC16Section(NewSection); + BSSSections.push_back(NewBSS); + } + + // Insert the GV into this BSS. + NewBSS->Items.push_back(GV); + + // We do not want to put any GV without explicit section into this section + // so set its size to DatabankSize. + NewBSS->Size = DataBankSize; + return NewBSS->S_; +} + +// Get rom section for a variable. Currently there can be only one rom section +// unless a variable explicitly requests a section. +const Section * +PIC16TargetObjectFile::getROSectionForGlobal(const GlobalVariable *GV) const { + ROSections[0]->Items.push_back(GV); + return ROSections[0]->S_; +} + +// Create initialized data section for a variable. +const Section * +PIC16TargetObjectFile::CreateIDATASectionForGlobal(const GlobalVariable *GV, + std::string Addr) const { + assert(GV->hasInitializer() && "This global doesn't need space"); + assert(!GV->getInitializer()->isNullValue() && + "initialized global has zero initializer"); + assert(GV->getType()->getAddressSpace() == PIC16ISD::RAM_SPACE && + "can be used for initialized RAM data only"); + + std::string Name; + // If address is given then create a section at that address else create a + // section by section name specified in GV. + PIC16Section *FoundIDATASec = NULL; + if (Addr.empty()) { + Name = GV->getSection() + " IDATA"; + for (unsigned i = 0; i < IDATASections.size(); i++) { + if (IDATASections[i]->S_->getName() == Name) { + FoundIDATASec = IDATASections[i]; + break; + } + } + } else { + std::string Prefix = GV->getNameStr() + "." + Addr + "."; + Name = PAN::getIdataSectionName(IDATASections.size(), Prefix) + " " + Addr; + } + + PIC16Section *NewIDATASec = FoundIDATASec; + if (NewIDATASec == NULL) { + const Section *NewSection = getOrCreateSection(Name.c_str(), + false, + // FIXME: + SectionKind::Metadata); + NewIDATASec = new PIC16Section(NewSection); + IDATASections.push_back(NewIDATASec); + } + // Insert the GV into this IDATA Section. + NewIDATASec->Items.push_back(GV); + // We do not want to put any GV without explicit section into this section + // so set its size to DatabankSize. + NewIDATASec->Size = DataBankSize; + return NewIDATASec->S_; +} + +// Create a section in rom for a variable. +const Section * +PIC16TargetObjectFile::CreateROSectionForGlobal(const GlobalVariable *GV, + std::string Addr) const { + assert(GV->getType()->getAddressSpace() == PIC16ISD::ROM_SPACE && + "can be used for ROM data only"); + + std::string Name; + // If address is given then create a section at that address else create a + // section by section name specified in GV. + PIC16Section *FoundROSec = NULL; + if (Addr.empty()) { + Name = GV->getSection() + " ROMDATA"; + for (unsigned i = 1; i < ROSections.size(); i++) { + if (ROSections[i]->S_->getName() == Name) { + FoundROSec = ROSections[i]; + break; + } + } + } else { + std::string Prefix = GV->getNameStr() + "." + Addr + "."; + Name = PAN::getRomdataSectionName(ROSections.size(), Prefix) + " " + Addr; + } + + PIC16Section *NewRomSec = FoundROSec; + if (NewRomSec == NULL) { + const Section *NewSection = getOrCreateSection(Name.c_str(), + false, + SectionKind::ReadOnly); + NewRomSec = new PIC16Section(NewSection); + ROSections.push_back(NewRomSec); + } + + // Insert the GV into this ROM Section. + NewRomSec->Items.push_back(GV); + return NewRomSec->S_; +} + Added: llvm/trunk/lib/Target/PIC16/PIC16TargetObjectFile.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PIC16/PIC16TargetObjectFile.h?rev=77294&view=auto ============================================================================== --- llvm/trunk/lib/Target/PIC16/PIC16TargetObjectFile.h (added) +++ llvm/trunk/lib/Target/PIC16/PIC16TargetObjectFile.h Mon Jul 27 22:13:23 2009 @@ -0,0 +1,100 @@ +//===-- PIC16TargetObjectFile.h - PIC16 Object Info -------------*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#ifndef LLVM_TARGET_PIC16_TARGETOBJECTFILE_H +#define LLVM_TARGET_PIC16_TARGETOBJECTFILE_H + +#include "llvm/Target/TargetLoweringObjectFile.h" +#include + +namespace llvm { + class GlobalVariable; + class Module; + class PIC16TargetMachine; + + enum { DataBankSize = 80 }; + + /// PIC16 Splits the global data into mulitple udata and idata sections. + /// Each udata and idata section needs to contain a list of globals that + /// they contain, in order to avoid scanning over all the global values + /// again and printing only those that match the current section. + /// Keeping values inside the sections make printing a section much easier. + /// + /// FIXME: Reimplement by inheriting from MCSection. + /// + struct PIC16Section { + const Section *S_; // Connection to actual Section. + unsigned Size; // Total size of the objects contained. + bool SectionPrinted; + std::vector Items; + + PIC16Section(const Section *s) { + S_ = s; + Size = 0; + SectionPrinted = false; + } + bool isPrinted() const { return SectionPrinted; } + void setPrintedStatus(bool status) { SectionPrinted = status; } + }; + + class PIC16TargetObjectFile : public TargetLoweringObjectFile { + const PIC16TargetMachine &TM; + public: + mutable std::vector BSSSections; + mutable std::vector IDATASections; + mutable std::vector AutosSections; + mutable std::vector ROSections; + mutable PIC16Section *ExternalVarDecls; + mutable PIC16Section *ExternalVarDefs; + + PIC16TargetObjectFile(const PIC16TargetMachine &TM); + ~PIC16TargetObjectFile(); + + /// getSpecialCasedSectionGlobals - Allow the target to completely override + /// section assignment of a global. + virtual const Section * + getSpecialCasedSectionGlobals(const GlobalValue *GV, + SectionKind Kind) const; + virtual const Section *SelectSectionForGlobal(const GlobalValue *GV, + SectionKind Kind, + const TargetMachine&) const; + private: + std::string getSectionNameForSym(const std::string &Sym) const; + + const Section *getBSSSectionForGlobal(const GlobalVariable *GV) const; + const Section *getIDATASectionForGlobal(const GlobalVariable *GV) const; + const Section *getSectionForAuto(const GlobalVariable *GV) const; + const Section *CreateBSSSectionForGlobal(const GlobalVariable *GV, + std::string Addr = "") const; + const Section *CreateIDATASectionForGlobal(const GlobalVariable *GV, + std::string Addr = "") const; + const Section *getROSectionForGlobal(const GlobalVariable *GV) const; + const Section *CreateROSectionForGlobal(const GlobalVariable *GV, + std::string Addr = "") const; + const Section *CreateSectionForGlobal(const GlobalVariable *GV, + const std::string &Addr = "") const; + public: + void SetSectionForGVs(Module &M); + const std::vector &getBSSSections() const { + return BSSSections; + } + const std::vector &getIDATASections() const { + return IDATASections; + } + const std::vector &getAutosSections() const { + return AutosSections; + } + const std::vector &getROSections() const { + return ROSections; + } + + }; +} // end namespace llvm + +#endif Modified: llvm/trunk/lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp?rev=77294&r1=77293&r2=77294&view=diff ============================================================================== --- llvm/trunk/lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp (original) +++ llvm/trunk/lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp Mon Jul 27 22:13:23 2009 @@ -40,6 +40,7 @@ #include "llvm/Support/Compiler.h" #include "llvm/Support/FormattedStream.h" #include "llvm/Target/TargetAsmInfo.h" +#include "llvm/Target/TargetLoweringObjectFile.h" #include "llvm/Target/TargetRegisterInfo.h" #include "llvm/Target/TargetInstrInfo.h" #include "llvm/Target/TargetOptions.h" @@ -590,7 +591,7 @@ // Print out labels for the function. const Function *F = MF.getFunction(); - SwitchToSection(TAI->SectionForGlobal(F)); + SwitchToSection(getObjFileLowering().SectionForGlobal(F, TM)); switch (F->getLinkage()) { default: llvm_unreachable("Unknown linkage type!"); @@ -639,7 +640,7 @@ // Print out jump tables referenced by the function. EmitJumpTableInfo(MF.getJumpTableInfo(), MF); - SwitchToSection(TAI->SectionForGlobal(F)); + SwitchToSection(getObjFileLowering().SectionForGlobal(F, TM)); // Emit post-function debug information. DW->EndFunction(&MF); @@ -681,7 +682,7 @@ unsigned Size = TD->getTypeAllocSize(Type); unsigned Align = TD->getPreferredAlignmentLog(GVar); - SwitchToSection(TAI->SectionForGlobal(GVar)); + SwitchToSection(getObjFileLowering().SectionForGlobal(GVar, TM)); if (C->isNullValue() && /* FIXME: Verify correct */ !GVar->hasSection() && @@ -762,7 +763,7 @@ // Print out labels for the function. const Function *F = MF.getFunction(); - SwitchToSection(TAI->SectionForGlobal(F)); + SwitchToSection(getObjFileLowering().SectionForGlobal(F, TM)); switch (F->getLinkage()) { default: llvm_unreachable("Unknown linkage type!"); @@ -861,7 +862,7 @@ SwitchToTextSection("\t.section __TEXT,__symbol_stub1,symbol_stubs," "pure_instructions,16"); } - SwitchToSection(TAI->getTextSection()); + SwitchToSection(getObjFileLowering().getTextSection()); return Result; } @@ -891,7 +892,7 @@ unsigned Size = TD->getTypeAllocSize(Type); unsigned Align = TD->getPreferredAlignmentLog(GVar); - const Section *TheSection = TAI->SectionForGlobal(GVar); + const Section *TheSection = getObjFileLowering().SectionForGlobal(GVar, TM); SwitchToSection(TheSection); if (C->isNullValue() && /* FIXME: Verify correct */ @@ -1051,7 +1052,7 @@ } if (!HiddenGVStubs.empty()) { - SwitchToSection(TAI->getDataSection()); + SwitchToSection(getObjFileLowering().getDataSection()); EmitAlignment(isPPC64 ? 3 : 2); for (StringMap::iterator I = HiddenGVStubs.begin(), E = HiddenGVStubs.end(); I != E; ++I) { Modified: llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp?rev=77294&r1=77293&r2=77294&view=diff ============================================================================== --- llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp (original) +++ llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp Mon Jul 27 22:13:23 2009 @@ -31,6 +31,7 @@ #include "llvm/Intrinsics.h" #include "llvm/Support/MathExtras.h" #include "llvm/Target/TargetOptions.h" +#include "llvm/Target/TargetLoweringObjectFile.h" #include "llvm/Support/CommandLine.h" #include "llvm/Support/ErrorHandling.h" #include "llvm/Support/raw_ostream.h" @@ -56,8 +57,15 @@ cl::desc("enable preincrement load/store generation on PPC (experimental)"), cl::Hidden); +static TargetLoweringObjectFile *CreateTLOF(const PPCTargetMachine &TM) { + if (TM.getSubtargetImpl()->isDarwin()) + return new TargetLoweringObjectFileMachO(); + return new TargetLoweringObjectFileELF(false, true); +} + + PPCTargetLowering::PPCTargetLowering(PPCTargetMachine &TM) - : TargetLowering(TM), PPCSubTarget(*TM.getSubtargetImpl()) { + : TargetLowering(TM, CreateTLOF(TM)), PPCSubTarget(*TM.getSubtargetImpl()) { setPow2DivIsCheap(); Modified: llvm/trunk/lib/Target/PowerPC/PPCTargetAsmInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/PPCTargetAsmInfo.cpp?rev=77294&r1=77293&r2=77294&view=diff ============================================================================== --- llvm/trunk/lib/Target/PowerPC/PPCTargetAsmInfo.cpp (original) +++ llvm/trunk/lib/Target/PowerPC/PPCTargetAsmInfo.cpp Mon Jul 27 22:13:23 2009 @@ -70,9 +70,6 @@ WeakRefDirective = "\t.weak\t"; BSSSection = "\t.section\t\".sbss\",\"aw\", at nobits"; - // PPC/Linux normally uses named section for BSS. - BSSSection_ = getOrCreateSection("\t.bss", true, SectionKind::BSS); - // Debug Information AbsoluteDebugSectionOffsets = true; SupportsDebugInformation = true; Modified: llvm/trunk/lib/Target/Sparc/AsmPrinter/SparcAsmPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Sparc/AsmPrinter/SparcAsmPrinter.cpp?rev=77294&r1=77293&r2=77294&view=diff ============================================================================== --- llvm/trunk/lib/Target/Sparc/AsmPrinter/SparcAsmPrinter.cpp (original) +++ llvm/trunk/lib/Target/Sparc/AsmPrinter/SparcAsmPrinter.cpp Mon Jul 27 22:13:23 2009 @@ -26,6 +26,7 @@ #include "llvm/CodeGen/MachineConstantPool.h" #include "llvm/CodeGen/MachineInstr.h" #include "llvm/Target/TargetAsmInfo.h" +#include "llvm/Target/TargetLoweringObjectFile.h" #include "llvm/Target/TargetRegistry.h" #include "llvm/Support/ErrorHandling.h" #include "llvm/Support/FormattedStream.h" @@ -95,7 +96,7 @@ // Print out the label for the function. const Function *F = MF.getFunction(); - SwitchToSection(TAI->SectionForGlobal(F)); + SwitchToSection(getObjFileLowering().SectionForGlobal(F, TM)); EmitAlignment(MF.getAlignment(), F); O << "\t.globl\t" << CurrentFnName << '\n'; @@ -229,7 +230,7 @@ printVisibility(name, GVar->getVisibility()); - SwitchToSection(TAI->SectionForGlobal(GVar)); + SwitchToSection(getObjFileLowering().SectionForGlobal(GVar, TM)); if (C->isNullValue() && !GVar->hasSection()) { if (!GVar->isThreadLocal() && Modified: llvm/trunk/lib/Target/Sparc/SparcISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Sparc/SparcISelLowering.cpp?rev=77294&r1=77293&r2=77294&view=diff ============================================================================== --- llvm/trunk/lib/Target/Sparc/SparcISelLowering.cpp (original) +++ llvm/trunk/lib/Target/Sparc/SparcISelLowering.cpp Mon Jul 27 22:13:23 2009 @@ -21,6 +21,7 @@ #include "llvm/CodeGen/MachineInstrBuilder.h" #include "llvm/CodeGen/MachineRegisterInfo.h" #include "llvm/CodeGen/SelectionDAG.h" +#include "llvm/Target/TargetLoweringObjectFile.h" #include "llvm/ADT/VectorExtras.h" #include "llvm/Support/ErrorHandling.h" using namespace llvm; @@ -548,9 +549,31 @@ } } +class TargetLoweringObjectFileSparc : public TargetLoweringObjectFileELF { +public: + void getSectionFlagsAsString(SectionKind Kind, + SmallVectorImpl &Str) const { + if (Kind.isMergeableConst() || Kind.isMergeableCString()) + return TargetLoweringObjectFileELF::getSectionFlagsAsString(Kind, Str); + + // FIXME: Inefficient. + std::string Res; + if (!Kind.isMetadata()) + Res += ",#alloc"; + if (Kind.isText()) + Res += ",#execinstr"; + if (Kind.isWriteable()) + Res += ",#write"; + if (Kind.isThreadLocal()) + Res += ",#tls"; + + Str.append(Res.begin(), Res.end()); + } +}; + SparcTargetLowering::SparcTargetLowering(TargetMachine &TM) - : TargetLowering(TM) { + : TargetLowering(TM, new TargetLoweringObjectFileSparc()) { // Set up the register classes. addRegisterClass(MVT::i32, SP::IntRegsRegisterClass); Modified: llvm/trunk/lib/Target/Sparc/SparcTargetAsmInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Sparc/SparcTargetAsmInfo.cpp?rev=77294&r1=77293&r2=77294&view=diff ============================================================================== --- llvm/trunk/lib/Target/Sparc/SparcTargetAsmInfo.cpp (original) +++ llvm/trunk/lib/Target/Sparc/SparcTargetAsmInfo.cpp Mon Jul 27 22:13:23 2009 @@ -25,27 +25,6 @@ ConstantPoolSection = "\t.section \".rodata\",#alloc\n"; COMMDirectiveTakesAlignment = true; CStringSection=".rodata.str"; - - // Sparc normally uses named section for BSS. - BSSSection_ = getOrCreateSection("\t.bss", true, SectionKind::BSS); } -void SparcELFTargetAsmInfo::getSectionFlagsAsString(SectionKind Kind, - SmallVectorImpl &Str) const { - if (Kind.isMergeableConst() || Kind.isMergeableCString()) - return ELFTargetAsmInfo::getSectionFlagsAsString(Kind, Str); - - // FIXME: Inefficient. - std::string Res; - if (!Kind.isMetadata()) - Res += ",#alloc"; - if (Kind.isText()) - Res += ",#execinstr"; - if (Kind.isWriteable()) - Res += ",#write"; - if (Kind.isThreadLocal()) - Res += ",#tls"; - - Str.append(Res.begin(), Res.end()); -} Modified: llvm/trunk/lib/Target/Sparc/SparcTargetAsmInfo.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Sparc/SparcTargetAsmInfo.h?rev=77294&r1=77293&r2=77294&view=diff ============================================================================== --- llvm/trunk/lib/Target/Sparc/SparcTargetAsmInfo.h (original) +++ llvm/trunk/lib/Target/Sparc/SparcTargetAsmInfo.h Mon Jul 27 22:13:23 2009 @@ -23,10 +23,6 @@ struct SparcELFTargetAsmInfo : public ELFTargetAsmInfo { explicit SparcELFTargetAsmInfo(const TargetMachine &TM); - - virtual void getSectionFlagsAsString(SectionKind Kind, - SmallVectorImpl &Str) const; - }; } // namespace llvm Modified: llvm/trunk/lib/Target/SystemZ/AsmPrinter/SystemZAsmPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/SystemZ/AsmPrinter/SystemZAsmPrinter.cpp?rev=77294&r1=77293&r2=77294&view=diff ============================================================================== --- llvm/trunk/lib/Target/SystemZ/AsmPrinter/SystemZAsmPrinter.cpp (original) +++ llvm/trunk/lib/Target/SystemZ/AsmPrinter/SystemZAsmPrinter.cpp Mon Jul 27 22:13:23 2009 @@ -27,6 +27,7 @@ #include "llvm/CodeGen/MachineInstr.h" #include "llvm/Target/TargetAsmInfo.h" #include "llvm/Target/TargetData.h" +#include "llvm/Target/TargetLoweringObjectFile.h" #include "llvm/Target/TargetRegistry.h" #include "llvm/ADT/Statistic.h" #include "llvm/Support/Compiler.h" @@ -82,7 +83,7 @@ unsigned FnAlign = MF.getAlignment(); const Function *F = MF.getFunction(); - SwitchToSection(TAI->SectionForGlobal(F)); + SwitchToSection(getObjFileLowering().SectionForGlobal(F, TM)); EmitAlignment(FnAlign, F); @@ -330,7 +331,7 @@ O << "\t.type\t" << name << ", at object\n"; - SwitchToSection(TAI->SectionForGlobal(GVar)); + SwitchToSection(getObjFileLowering().SectionForGlobal(GVar, TM)); if (C->isNullValue() && !GVar->hasSection() && !GVar->isThreadLocal() && Modified: llvm/trunk/lib/Target/SystemZ/SystemZISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/SystemZ/SystemZISelLowering.cpp?rev=77294&r1=77293&r2=77294&view=diff ============================================================================== --- llvm/trunk/lib/Target/SystemZ/SystemZISelLowering.cpp (original) +++ llvm/trunk/lib/Target/SystemZ/SystemZISelLowering.cpp Mon Jul 27 22:13:23 2009 @@ -31,13 +31,15 @@ #include "llvm/CodeGen/PseudoSourceValue.h" #include "llvm/CodeGen/SelectionDAGISel.h" #include "llvm/CodeGen/ValueTypes.h" -#include "llvm/Support/Debug.h" #include "llvm/Target/TargetOptions.h" +#include "llvm/Target/TargetLoweringObjectFile.h" +#include "llvm/Support/Debug.h" #include "llvm/ADT/VectorExtras.h" using namespace llvm; SystemZTargetLowering::SystemZTargetLowering(SystemZTargetMachine &tm) : - TargetLowering(tm), Subtarget(*tm.getSubtargetImpl()), TM(tm) { + TargetLowering(tm, new TargetLoweringObjectFileELF()), + Subtarget(*tm.getSubtargetImpl()), TM(tm) { RegInfo = TM.getRegisterInfo(); Modified: llvm/trunk/lib/Target/SystemZ/SystemZTargetAsmInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/SystemZ/SystemZTargetAsmInfo.cpp?rev=77294&r1=77293&r2=77294&view=diff ============================================================================== --- llvm/trunk/lib/Target/SystemZ/SystemZTargetAsmInfo.cpp (original) +++ llvm/trunk/lib/Target/SystemZ/SystemZTargetAsmInfo.cpp Mon Jul 27 22:13:23 2009 @@ -27,6 +27,4 @@ PCSymbol = "."; NonexecutableStackDirective = "\t.section\t.note.GNU-stack,\"\", at progbits"; - - BSSSection_ = getOrCreateSection("\t.bss", true, SectionKind::BSS); } Modified: llvm/trunk/lib/Target/TargetAsmInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/TargetAsmInfo.cpp?rev=77294&r1=77293&r2=77294&view=diff ============================================================================== --- llvm/trunk/lib/Target/TargetAsmInfo.cpp (original) +++ llvm/trunk/lib/Target/TargetAsmInfo.cpp Mon Jul 27 22:13:23 2009 @@ -30,10 +30,6 @@ TargetAsmInfo::TargetAsmInfo(const TargetMachine &tm) : TM(tm) { BSSSection = "\t.bss"; - BSSSection_ = 0; - ReadOnlySection = 0; - TLSDataSection = 0; - TLSBSSSection = 0; ZeroFillDirective = 0; NonexecutableStackDirective = 0; NeedsSet = false; @@ -78,7 +74,6 @@ JumpTableDataSection = "\t.section .rodata"; JumpTableDirective = 0; CStringSection = 0; - CStringSection_ = 0; // FIXME: Flags are ELFish - replace with normal section stuff. StaticCtorsSection = "\t.section .ctors,\"aw\", at progbits"; StaticDtorsSection = "\t.section .dtors,\"aw\", at progbits"; @@ -158,219 +153,6 @@ return dwarf::DW_EH_PE_absptr; } -static bool isSuitableForBSS(const GlobalVariable *GV) { - Constant *C = GV->getInitializer(); - - // Must have zero initializer. - if (!C->isNullValue()) - return false; - - // Leave constant zeros in readonly constant sections, so they can be shared. - if (GV->isConstant()) - return false; - - // If the global has an explicit section specified, don't put it in BSS. - if (!GV->getSection().empty()) - return false; - - // If -nozero-initialized-in-bss is specified, don't ever use BSS. - if (NoZerosInBSS) - return false; - - // Otherwise, put it in BSS! - return true; -} - -static bool isConstantString(const Constant *C) { - // First check: is we have constant array of i8 terminated with zero - const ConstantArray *CVA = dyn_cast(C); - // Check, if initializer is a null-terminated string - if (CVA && CVA->isCString()) - return true; - - // Another possibility: [1 x i8] zeroinitializer - if (isa(C)) - if (const ArrayType *Ty = dyn_cast(C->getType())) - return (Ty->getElementType() == Type::Int8Ty && - Ty->getNumElements() == 1); - - return false; -} - -static SectionKind::Kind SectionKindForGlobal(const GlobalValue *GV, - const TargetMachine &TM) { - Reloc::Model ReloModel = TM.getRelocationModel(); - - // Early exit - functions should be always in text sections. - const GlobalVariable *GVar = dyn_cast(GV); - if (GVar == 0) - return SectionKind::Text; - - - // Handle thread-local data first. - if (GVar->isThreadLocal()) { - if (isSuitableForBSS(GVar)) - return SectionKind::ThreadBSS; - return SectionKind::ThreadData; - } - - // Variable can be easily put to BSS section. - if (isSuitableForBSS(GVar)) - return SectionKind::BSS; - - Constant *C = GVar->getInitializer(); - - // If the global is marked constant, we can put it into a mergable section, - // a mergable string section, or general .data if it contains relocations. - if (GVar->isConstant()) { - // If the initializer for the global contains something that requires a - // relocation, then we may have to drop this into a wriable data section - // even though it is marked const. - switch (C->getRelocationInfo()) { - default: llvm_unreachable("unknown relocation info kind"); - case Constant::NoRelocation: - // If initializer is a null-terminated string, put it in a "cstring" - // section if the target has it. - if (isConstantString(C)) - return SectionKind::MergeableCString; - - // Otherwise, just drop it into a mergable constant section. If we have - // a section for this size, use it, otherwise use the arbitrary sized - // mergable section. - switch (TM.getTargetData()->getTypeAllocSize(C->getType())) { - case 4: return SectionKind::MergeableConst4; - case 8: return SectionKind::MergeableConst8; - case 16: return SectionKind::MergeableConst16; - default: return SectionKind::MergeableConst; - } - - case Constant::LocalRelocation: - // In static relocation model, the linker will resolve all addresses, so - // the relocation entries will actually be constants by the time the app - // starts up. However, we can't put this into a mergable section, because - // the linker doesn't take relocations into consideration when it tries to - // merge entries in the section. - if (ReloModel == Reloc::Static) - return SectionKind::ReadOnly; - - // Otherwise, the dynamic linker needs to fix it up, put it in the - // writable data.rel.local section. - return SectionKind::ReadOnlyWithRelLocal; - - case Constant::GlobalRelocations: - // In static relocation model, the linker will resolve all addresses, so - // the relocation entries will actually be constants by the time the app - // starts up. However, we can't put this into a mergable section, because - // the linker doesn't take relocations into consideration when it tries to - // merge entries in the section. - if (ReloModel == Reloc::Static) - return SectionKind::ReadOnly; - - // Otherwise, the dynamic linker needs to fix it up, put it in the - // writable data.rel section. - return SectionKind::ReadOnlyWithRel; - } - } - - // Okay, this isn't a constant. If the initializer for the global is going - // to require a runtime relocation by the dynamic linker, put it into a more - // specific section to improve startup time of the app. This coalesces these - // globals together onto fewer pages, improving the locality of the dynamic - // linker. - if (ReloModel == Reloc::Static) - return SectionKind::DataNoRel; - - switch (C->getRelocationInfo()) { - default: llvm_unreachable("unknown relocation info kind"); - case Constant::NoRelocation: - return SectionKind::DataNoRel; - case Constant::LocalRelocation: - return SectionKind::DataRelLocal; - case Constant::GlobalRelocations: - return SectionKind::DataRel; - } -} - -/// SectionForGlobal - This method computes the appropriate section to emit -/// the specified global variable or function definition. This should not -/// be passed external (or available externally) globals. -const Section *TargetAsmInfo::SectionForGlobal(const GlobalValue *GV) const { - assert(!GV->isDeclaration() && !GV->hasAvailableExternallyLinkage() && - "Can only be used for global definitions"); - - SectionKind::Kind GVKind = SectionKindForGlobal(GV, TM); - - SectionKind Kind = SectionKind::get(GVKind, GV->isWeakForLinker(), - GV->hasSection()); - - - // Select section name. - if (GV->hasSection()) { - // If the target has special section hacks for specifically named globals, - // return them now. - if (const Section *TS = getSpecialCasedSectionGlobals(GV, Kind)) - return TS; - - // If the target has magic semantics for certain section names, make sure to - // pick up the flags. This allows the user to write things with attribute - // section and still get the appropriate section flags printed. - GVKind = getKindForNamedSection(GV->getSection().c_str(), GVKind); - - return getOrCreateSection(GV->getSection().c_str(), false, GVKind); - } - - - // Use default section depending on the 'type' of global - return SelectSectionForGlobal(GV, Kind); -} - -// Lame default implementation. Calculate the section name for global. -const Section* -TargetAsmInfo::SelectSectionForGlobal(const GlobalValue *GV, - SectionKind Kind) const { - assert(!Kind.isThreadLocal() && "Doesn't support TLS"); - - if (Kind.isText()) - return getTextSection(); - - if (Kind.isBSS()) - if (const Section *S = getBSSSection_()) - return S; - - if (Kind.isReadOnly()) - if (const Section *S = getReadOnlySection()) - return S; - - return getDataSection(); -} - -/// getSectionForMergableConstant - Given a mergable constant with the -/// specified size and relocation information, return a section that it -/// should be placed in. -const Section * -TargetAsmInfo::getSectionForMergeableConstant(SectionKind Kind) const { - if (Kind.isReadOnly()) - if (const Section *S = getReadOnlySection()) - return S; - - return getDataSection(); -} - - -const Section *TargetAsmInfo::getOrCreateSection(const char *Name, - bool isDirective, - SectionKind::Kind Kind) const { - Section &S = Sections[Name]; - - // This is newly-created section, set it up properly. - if (S.Name.empty()) { - S.Kind = SectionKind::get(Kind, false /*weak*/, !isDirective); - S.Name = Name; - } - - return &S; -} - unsigned TargetAsmInfo::getULEB128Size(unsigned Value) { unsigned Size = 0; do { Added: llvm/trunk/lib/Target/TargetLoweringObjectFile.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/TargetLoweringObjectFile.cpp?rev=77294&view=auto ============================================================================== --- llvm/trunk/lib/Target/TargetLoweringObjectFile.cpp (added) +++ llvm/trunk/lib/Target/TargetLoweringObjectFile.cpp Mon Jul 27 22:13:23 2009 @@ -0,0 +1,647 @@ +//===-- llvm/Target/TargetLoweringObjectFile.cpp - Object File Info -------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// This file implements classes used to handle lowerings specific to common +// object file formats. +// +//===----------------------------------------------------------------------===// + +#include "llvm/Target/TargetLoweringObjectFile.h" +#include "llvm/Constants.h" +#include "llvm/DerivedTypes.h" +#include "llvm/GlobalVariable.h" +#include "llvm/Target/TargetMachine.h" +#include "llvm/Target/TargetData.h" +#include "llvm/Target/TargetOptions.h" +#include "llvm/ADT/StringExtras.h" +using namespace llvm; + +//===----------------------------------------------------------------------===// +// Generic Code +//===----------------------------------------------------------------------===// + +TargetLoweringObjectFile::TargetLoweringObjectFile() { + TextSection = 0; + DataSection = 0; + BSSSection_ = 0; + ReadOnlySection = 0; + TLSDataSection = 0; + TLSBSSSection = 0; + CStringSection_ = 0; +} + +TargetLoweringObjectFile::~TargetLoweringObjectFile() { +} + +static bool isSuitableForBSS(const GlobalVariable *GV) { + Constant *C = GV->getInitializer(); + + // Must have zero initializer. + if (!C->isNullValue()) + return false; + + // Leave constant zeros in readonly constant sections, so they can be shared. + if (GV->isConstant()) + return false; + + // If the global has an explicit section specified, don't put it in BSS. + if (!GV->getSection().empty()) + return false; + + // If -nozero-initialized-in-bss is specified, don't ever use BSS. + if (NoZerosInBSS) + return false; + + // Otherwise, put it in BSS! + return true; +} + +static bool isConstantString(const Constant *C) { + // First check: is we have constant array of i8 terminated with zero + const ConstantArray *CVA = dyn_cast(C); + // Check, if initializer is a null-terminated string + if (CVA && CVA->isCString()) + return true; + + // Another possibility: [1 x i8] zeroinitializer + if (isa(C)) + if (const ArrayType *Ty = dyn_cast(C->getType())) + return (Ty->getElementType() == Type::Int8Ty && + Ty->getNumElements() == 1); + + return false; +} + +static SectionKind::Kind SectionKindForGlobal(const GlobalValue *GV, + const TargetMachine &TM) { + Reloc::Model ReloModel = TM.getRelocationModel(); + + // Early exit - functions should be always in text sections. + const GlobalVariable *GVar = dyn_cast(GV); + if (GVar == 0) + return SectionKind::Text; + + + // Handle thread-local data first. + if (GVar->isThreadLocal()) { + if (isSuitableForBSS(GVar)) + return SectionKind::ThreadBSS; + return SectionKind::ThreadData; + } + + // Variable can be easily put to BSS section. + if (isSuitableForBSS(GVar)) + return SectionKind::BSS; + + Constant *C = GVar->getInitializer(); + + // If the global is marked constant, we can put it into a mergable section, + // a mergable string section, or general .data if it contains relocations. + if (GVar->isConstant()) { + // If the initializer for the global contains something that requires a + // relocation, then we may have to drop this into a wriable data section + // even though it is marked const. + switch (C->getRelocationInfo()) { + default: llvm_unreachable("unknown relocation info kind"); + case Constant::NoRelocation: + // If initializer is a null-terminated string, put it in a "cstring" + // section if the target has it. + if (isConstantString(C)) + return SectionKind::MergeableCString; + + // Otherwise, just drop it into a mergable constant section. If we have + // a section for this size, use it, otherwise use the arbitrary sized + // mergable section. + switch (TM.getTargetData()->getTypeAllocSize(C->getType())) { + case 4: return SectionKind::MergeableConst4; + case 8: return SectionKind::MergeableConst8; + case 16: return SectionKind::MergeableConst16; + default: return SectionKind::MergeableConst; + } + + case Constant::LocalRelocation: + // In static relocation model, the linker will resolve all addresses, so + // the relocation entries will actually be constants by the time the app + // starts up. However, we can't put this into a mergable section, because + // the linker doesn't take relocations into consideration when it tries to + // merge entries in the section. + if (ReloModel == Reloc::Static) + return SectionKind::ReadOnly; + + // Otherwise, the dynamic linker needs to fix it up, put it in the + // writable data.rel.local section. + return SectionKind::ReadOnlyWithRelLocal; + + case Constant::GlobalRelocations: + // In static relocation model, the linker will resolve all addresses, so + // the relocation entries will actually be constants by the time the app + // starts up. However, we can't put this into a mergable section, because + // the linker doesn't take relocations into consideration when it tries to + // merge entries in the section. + if (ReloModel == Reloc::Static) + return SectionKind::ReadOnly; + + // Otherwise, the dynamic linker needs to fix it up, put it in the + // writable data.rel section. + return SectionKind::ReadOnlyWithRel; + } + } + + // Okay, this isn't a constant. If the initializer for the global is going + // to require a runtime relocation by the dynamic linker, put it into a more + // specific section to improve startup time of the app. This coalesces these + // globals together onto fewer pages, improving the locality of the dynamic + // linker. + if (ReloModel == Reloc::Static) + return SectionKind::DataNoRel; + + switch (C->getRelocationInfo()) { + default: llvm_unreachable("unknown relocation info kind"); + case Constant::NoRelocation: + return SectionKind::DataNoRel; + case Constant::LocalRelocation: + return SectionKind::DataRelLocal; + case Constant::GlobalRelocations: + return SectionKind::DataRel; + } +} + +/// SectionForGlobal - This method computes the appropriate section to emit +/// the specified global variable or function definition. This should not +/// be passed external (or available externally) globals. +const Section *TargetLoweringObjectFile:: +SectionForGlobal(const GlobalValue *GV, const TargetMachine &TM) const { + assert(!GV->isDeclaration() && !GV->hasAvailableExternallyLinkage() && + "Can only be used for global definitions"); + + SectionKind::Kind GVKind = SectionKindForGlobal(GV, TM); + + SectionKind Kind = SectionKind::get(GVKind, GV->isWeakForLinker(), + GV->hasSection()); + + + // Select section name. + if (GV->hasSection()) { + // If the target has special section hacks for specifically named globals, + // return them now. + if (const Section *TS = getSpecialCasedSectionGlobals(GV, Kind)) + return TS; + + // If the target has magic semantics for certain section names, make sure to + // pick up the flags. This allows the user to write things with attribute + // section and still get the appropriate section flags printed. + GVKind = getKindForNamedSection(GV->getSection().c_str(), GVKind); + + return getOrCreateSection(GV->getSection().c_str(), false, GVKind); + } + + + // Use default section depending on the 'type' of global + return SelectSectionForGlobal(GV, Kind, TM); +} + +// Lame default implementation. Calculate the section name for global. +const Section* +TargetLoweringObjectFile::SelectSectionForGlobal(const GlobalValue *GV, + SectionKind Kind, + const TargetMachine &TM) const{ + assert(!Kind.isThreadLocal() && "Doesn't support TLS"); + + if (Kind.isText()) + return getTextSection(); + + if (Kind.isBSS() && BSSSection_ != 0) + return BSSSection_; + + if (Kind.isReadOnly() && ReadOnlySection != 0) + return ReadOnlySection; + + return getDataSection(); +} + +/// getSectionForMergableConstant - Given a mergable constant with the +/// specified size and relocation information, return a section that it +/// should be placed in. +const Section * +TargetLoweringObjectFile:: +getSectionForMergeableConstant(SectionKind Kind) const { + if (Kind.isReadOnly() && ReadOnlySection != 0) + return ReadOnlySection; + + return DataSection; +} + + +const Section *TargetLoweringObjectFile:: +getOrCreateSection(const char *Name, bool isDirective, + SectionKind::Kind Kind) const { + Section &S = Sections[Name]; + + // This is newly-created section, set it up properly. + if (S.Name.empty()) { + S.Kind = SectionKind::get(Kind, false /*weak*/, !isDirective); + S.Name = Name; + } + + return &S; +} + + + +//===----------------------------------------------------------------------===// +// ELF +//===----------------------------------------------------------------------===// + +TargetLoweringObjectFileELF::TargetLoweringObjectFileELF(bool atIsCommentChar, + bool HasCrazyBSS) + : AtIsCommentChar(atIsCommentChar) { + + if (!HasCrazyBSS) + BSSSection_ = getOrCreateSection("\t.bss", true, SectionKind::BSS); + else + // PPC/Linux doesn't support the .bss directive, it needs .section .bss. + // FIXME: Does .section .bss work everywhere?? + BSSSection_ = getOrCreateSection("\t.bss", false, SectionKind::BSS); + + + TextSection = getOrCreateSection("\t.text", true, SectionKind::Text); + DataSection = getOrCreateSection("\t.data", true, SectionKind::DataRel); + ReadOnlySection = + getOrCreateSection("\t.rodata", false, SectionKind::ReadOnly); + TLSDataSection = + getOrCreateSection("\t.tdata", false, SectionKind::ThreadData); + CStringSection_ = getOrCreateSection("\t.rodata.str", true, + SectionKind::MergeableCString); + + TLSBSSSection = getOrCreateSection("\t.tbss", false, SectionKind::ThreadBSS); + + DataRelSection = getOrCreateSection("\t.data.rel", false, + SectionKind::DataRel); + DataRelLocalSection = getOrCreateSection("\t.data.rel.local", false, + SectionKind::DataRelLocal); + DataRelROSection = getOrCreateSection("\t.data.rel.ro", false, + SectionKind::ReadOnlyWithRel); + DataRelROLocalSection = + getOrCreateSection("\t.data.rel.ro.local", false, + SectionKind::ReadOnlyWithRelLocal); + + MergeableConst4Section = getOrCreateSection(".rodata.cst4", false, + SectionKind::MergeableConst4); + MergeableConst8Section = getOrCreateSection(".rodata.cst8", false, + SectionKind::MergeableConst8); + MergeableConst16Section = getOrCreateSection(".rodata.cst16", false, + SectionKind::MergeableConst16); +} + + +SectionKind::Kind TargetLoweringObjectFileELF:: +getKindForNamedSection(const char *Name, SectionKind::Kind K) const { + if (Name[0] != '.') return K; + + // Some lame default implementation based on some magic section names. + if (strncmp(Name, ".gnu.linkonce.b.", 16) == 0 || + strncmp(Name, ".llvm.linkonce.b.", 17) == 0 || + strncmp(Name, ".gnu.linkonce.sb.", 17) == 0 || + strncmp(Name, ".llvm.linkonce.sb.", 18) == 0) + return SectionKind::BSS; + + if (strcmp(Name, ".tdata") == 0 || + strncmp(Name, ".tdata.", 7) == 0 || + strncmp(Name, ".gnu.linkonce.td.", 17) == 0 || + strncmp(Name, ".llvm.linkonce.td.", 18) == 0) + return SectionKind::ThreadData; + + if (strcmp(Name, ".tbss") == 0 || + strncmp(Name, ".tbss.", 6) == 0 || + strncmp(Name, ".gnu.linkonce.tb.", 17) == 0 || + strncmp(Name, ".llvm.linkonce.tb.", 18) == 0) + return SectionKind::ThreadBSS; + + return K; +} + +void TargetLoweringObjectFileELF:: +getSectionFlagsAsString(SectionKind Kind, SmallVectorImpl &Str) const { + Str.push_back(','); + Str.push_back('"'); + + if (!Kind.isMetadata()) + Str.push_back('a'); + if (Kind.isText()) + Str.push_back('x'); + if (Kind.isWriteable()) + Str.push_back('w'); + if (Kind.isMergeableConst() || Kind.isMergeableCString()) + Str.push_back('M'); + if (Kind.isMergeableCString()) + Str.push_back('S'); + if (Kind.isThreadLocal()) + Str.push_back('T'); + + Str.push_back('"'); + Str.push_back(','); + + // If comment string is '@', e.g. as on ARM - use '%' instead + if (AtIsCommentChar) + Str.push_back('%'); + else + Str.push_back('@'); + + const char *KindStr; + if (Kind.isBSS()) + KindStr = "nobits"; + else + KindStr = "progbits"; + + Str.append(KindStr, KindStr+strlen(KindStr)); + + if (Kind.isMergeableCString()) { + // TODO: Eventually handle multiple byte character strings. For now, all + // mergable C strings are single byte. + Str.push_back(','); + Str.push_back('1'); + } else if (Kind.isMergeableConst4()) { + Str.push_back(','); + Str.push_back('4'); + } else if (Kind.isMergeableConst8()) { + Str.push_back(','); + Str.push_back('8'); + } else if (Kind.isMergeableConst16()) { + Str.push_back(','); + Str.push_back('1'); + Str.push_back('6'); + } +} + + +static const char *getSectionPrefixForUniqueGlobal(SectionKind Kind) { + if (Kind.isText()) return ".gnu.linkonce.t."; + if (Kind.isReadOnly()) return ".gnu.linkonce.r."; + + if (Kind.isThreadData()) return ".gnu.linkonce.td."; + if (Kind.isThreadBSS()) return ".gnu.linkonce.tb."; + + if (Kind.isBSS()) return ".gnu.linkonce.b."; + if (Kind.isDataNoRel()) return ".gnu.linkonce.d."; + if (Kind.isDataRelLocal()) return ".gnu.linkonce.d.rel.local."; + if (Kind.isDataRel()) return ".gnu.linkonce.d.rel."; + if (Kind.isReadOnlyWithRelLocal()) return ".gnu.linkonce.d.rel.ro.local."; + + assert(Kind.isReadOnlyWithRel() && "Unknown section kind"); + return ".gnu.linkonce.d.rel.ro."; +} + +const Section *TargetLoweringObjectFileELF:: +SelectSectionForGlobal(const GlobalValue *GV, SectionKind Kind, + const TargetMachine &TM) const { + + // If this global is linkonce/weak and the target handles this by emitting it + // into a 'uniqued' section name, create and return the section now. + if (Kind.isWeak()) { + const char *Prefix = getSectionPrefixForUniqueGlobal(Kind); + // FIXME: Use mangler interface (PR4584). + std::string Name = Prefix+GV->getNameStr(); + return getOrCreateSection(Name.c_str(), false, Kind.getKind()); + } + + if (Kind.isText()) return TextSection; + if (Kind.isMergeableCString()) { + Constant *C = cast(GV)->getInitializer(); + + // FIXME: This is completely wrong. Why is it comparing the size of the + // character type to 1? + /// cast(C->getType())->getNumElements(); + uint64_t Size = 1; + if (Size <= 16) { + assert(CStringSection_ && "Should have string section prefix"); + + // We also need alignment here. + // FIXME: this is getting the alignment of the character, not the + // alignment of the global! + unsigned Align = + TM.getTargetData()->getPreferredAlignment(cast(GV)); + + std::string Name = CStringSection_->getName() + utostr(Size) + '.' + + utostr(Align); + return getOrCreateSection(Name.c_str(), false, + SectionKind::MergeableCString); + } + + return ReadOnlySection; + } + + if (Kind.isMergeableConst()) { + if (Kind.isMergeableConst4()) + return MergeableConst4Section; + if (Kind.isMergeableConst8()) + return MergeableConst8Section; + if (Kind.isMergeableConst16()) + return MergeableConst16Section; + return ReadOnlySection; // .const + } + + if (Kind.isReadOnly()) return ReadOnlySection; + + if (Kind.isThreadData()) return TLSDataSection; + if (Kind.isThreadBSS()) return TLSBSSSection; + + if (Kind.isBSS()) return BSSSection_; + + if (Kind.isDataNoRel()) return DataSection; + if (Kind.isDataRelLocal()) return DataRelLocalSection; + if (Kind.isDataRel()) return DataRelSection; + if (Kind.isReadOnlyWithRelLocal()) return DataRelROLocalSection; + + assert(Kind.isReadOnlyWithRel() && "Unknown section kind"); + return DataRelROSection; +} + +/// getSectionForMergeableConstant - Given a mergeable constant with the +/// specified size and relocation information, return a section that it +/// should be placed in. +const Section *TargetLoweringObjectFileELF:: +getSectionForMergeableConstant(SectionKind Kind) const { + if (Kind.isMergeableConst4()) + return MergeableConst4Section; + if (Kind.isMergeableConst8()) + return MergeableConst8Section; + if (Kind.isMergeableConst16()) + return MergeableConst16Section; + if (Kind.isReadOnly()) + return ReadOnlySection; + + if (Kind.isReadOnlyWithRelLocal()) return DataRelROLocalSection; + assert(Kind.isReadOnlyWithRel() && "Unknown section kind"); + return DataRelROSection; +} + +//===----------------------------------------------------------------------===// +// MachO +//===----------------------------------------------------------------------===// + +TargetLoweringObjectFileMachO:: +TargetLoweringObjectFileMachO() { + TextSection = getOrCreateSection("\t.text", true, SectionKind::Text); + DataSection = getOrCreateSection("\t.data", true, SectionKind::DataRel); + + CStringSection_ = getOrCreateSection("\t.cstring", true, + SectionKind::MergeableCString); + FourByteConstantSection = getOrCreateSection("\t.literal4\n", true, + SectionKind::MergeableConst4); + EightByteConstantSection = getOrCreateSection("\t.literal8\n", true, + SectionKind::MergeableConst8); + SixteenByteConstantSection = + getOrCreateSection("\t.literal16\n", true, SectionKind::MergeableConst16); + + ReadOnlySection = getOrCreateSection("\t.const", true, SectionKind::ReadOnly); + + TextCoalSection = + getOrCreateSection("\t__TEXT,__textcoal_nt,coalesced,pure_instructions", + false, SectionKind::Text); + ConstTextCoalSection = getOrCreateSection("\t__TEXT,__const_coal,coalesced", + false, SectionKind::Text); + ConstDataCoalSection = getOrCreateSection("\t__DATA,__const_coal,coalesced", + false, SectionKind::Text); + ConstDataSection = getOrCreateSection("\t.const_data", true, + SectionKind::ReadOnlyWithRel); + DataCoalSection = getOrCreateSection("\t__DATA,__datacoal_nt,coalesced", + false, SectionKind::DataRel); +} + +const Section * +TargetLoweringObjectFileMachO::SelectSectionForGlobal(const GlobalValue *GV, + SectionKind Kind, + const TargetMachine &TM) const { + assert(!Kind.isThreadLocal() && "Darwin doesn't support TLS"); + + if (Kind.isText()) + return Kind.isWeak() ? TextCoalSection : TextSection; + + // If this is weak/linkonce, put this in a coalescable section, either in text + // or data depending on if it is writable. + if (Kind.isWeak()) { + if (Kind.isReadOnly()) + return ConstTextCoalSection; + return DataCoalSection; + } + + // FIXME: Alignment check should be handled by section classifier. + if (Kind.isMergeableCString()) { + Constant *C = cast(GV)->getInitializer(); + const Type *Ty = cast(C->getType())->getElementType(); + const TargetData &TD = *TM.getTargetData(); + unsigned Size = TD.getTypeAllocSize(Ty); + if (Size) { + unsigned Align = TD.getPreferredAlignment(cast(GV)); + if (Align <= 32) + return CStringSection_; + } + + return ReadOnlySection; + } + + if (Kind.isMergeableConst()) { + if (Kind.isMergeableConst4()) + return FourByteConstantSection; + if (Kind.isMergeableConst8()) + return EightByteConstantSection; + if (Kind.isMergeableConst16()) + return SixteenByteConstantSection; + return ReadOnlySection; // .const + } + + // FIXME: ROData -> const in -static mode that is relocatable but they happen + // by the static linker. Why not mergeable? + if (Kind.isReadOnly()) + return ReadOnlySection; + + // If this is marked const, put it into a const section. But if the dynamic + // linker needs to write to it, put it in the data segment. + if (Kind.isReadOnlyWithRel()) + return ConstDataSection; + + // Otherwise, just drop the variable in the normal data section. + return DataSection; +} + +const Section * +TargetLoweringObjectFileMachO:: +getSectionForMergeableConstant(SectionKind Kind) const { + // If this constant requires a relocation, we have to put it in the data + // segment, not in the text segment. + if (Kind.isDataRel()) + return ConstDataSection; + + if (Kind.isMergeableConst4()) + return FourByteConstantSection; + if (Kind.isMergeableConst8()) + return EightByteConstantSection; + if (Kind.isMergeableConst16()) + return SixteenByteConstantSection; + return ReadOnlySection; // .const +} + +//===----------------------------------------------------------------------===// +// COFF +//===----------------------------------------------------------------------===// + +TargetLoweringObjectFileCOFF::TargetLoweringObjectFileCOFF() { + TextSection = getOrCreateSection("_text", true, SectionKind::Text); + DataSection = getOrCreateSection("_data", true, SectionKind::DataRel); +} + +void TargetLoweringObjectFileCOFF:: +getSectionFlagsAsString(SectionKind Kind, SmallVectorImpl &Str) const { + // FIXME: Inefficient. + std::string Res = ",\""; + if (Kind.isText()) + Res += 'x'; + if (Kind.isWriteable()) + Res += 'w'; + Res += "\""; + + Str.append(Res.begin(), Res.end()); +} + +static const char *getCOFFSectionPrefixForUniqueGlobal(SectionKind Kind) { + if (Kind.isText()) + return ".text$linkonce"; + if (Kind.isWriteable()) + return ".data$linkonce"; + return ".rdata$linkonce"; +} + + +const Section *TargetLoweringObjectFileCOFF:: +SelectSectionForGlobal(const GlobalValue *GV, SectionKind Kind, + const TargetMachine &TM) const { + assert(!Kind.isThreadLocal() && "Doesn't support TLS"); + + // If this global is linkonce/weak and the target handles this by emitting it + // into a 'uniqued' section name, create and return the section now. + if (Kind.isWeak()) { + const char *Prefix = getCOFFSectionPrefixForUniqueGlobal(Kind); + // FIXME: Use mangler interface (PR4584). + std::string Name = Prefix+GV->getNameStr(); + return getOrCreateSection(Name.c_str(), false, Kind.getKind()); + } + + if (Kind.isText()) + return getTextSection(); + + if (Kind.isBSS()) + if (const Section *S = BSSSection_) + return S; + + if (Kind.isReadOnly() && ReadOnlySection != 0) + return ReadOnlySection; + + return getDataSection(); +} + Modified: llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp?rev=77294&r1=77293&r2=77294&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp (original) +++ llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp Mon Jul 27 22:13:23 2009 @@ -37,6 +37,7 @@ #include "llvm/Support/FormattedStream.h" #include "llvm/Support/Mangler.h" #include "llvm/Target/TargetAsmInfo.h" +#include "llvm/Target/TargetLoweringObjectFile.h" #include "llvm/Target/TargetOptions.h" using namespace llvm; @@ -166,7 +167,7 @@ if (Subtarget->isTargetCygMing()) DecorateCygMingName(CurrentFnName, F); - SwitchToSection(TAI->SectionForGlobal(F)); + SwitchToSection(getObjFileLowering().SectionForGlobal(F, TM)); switch (F->getLinkage()) { default: llvm_unreachable("Unknown linkage type!"); case Function::InternalLinkage: // Symbols default to internal. @@ -782,7 +783,7 @@ if (Subtarget->isTargetELF()) O << "\t.type\t" << name << ", at object\n"; - const Section *TheSection = TAI->SectionForGlobal(GVar); + const Section *TheSection = getObjFileLowering().SectionForGlobal(GVar, TM); SwitchToSection(TheSection); if (C->isNullValue() && !GVar->hasSection() && @@ -931,7 +932,7 @@ } if (!HiddenGVStubs.empty()) { - SwitchToSection(TAI->getDataSection()); + SwitchToSection(getObjFileLowering().getDataSection()); EmitAlignment(2); for (StringMap::iterator I = HiddenGVStubs.begin(), E = HiddenGVStubs.end(); I != E; ++I) Modified: llvm/trunk/lib/Target/X86/AsmPrinter/X86IntelAsmPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/AsmPrinter/X86IntelAsmPrinter.cpp?rev=77294&r1=77293&r2=77294&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/AsmPrinter/X86IntelAsmPrinter.cpp (original) +++ llvm/trunk/lib/Target/X86/AsmPrinter/X86IntelAsmPrinter.cpp Mon Jul 27 22:13:23 2009 @@ -29,6 +29,7 @@ #include "llvm/Support/ErrorHandling.h" #include "llvm/Support/Mangler.h" #include "llvm/Target/TargetAsmInfo.h" +#include "llvm/Target/TargetLoweringObjectFile.h" #include "llvm/Target/TargetOptions.h" using namespace llvm; @@ -513,7 +514,7 @@ O << "\tpublic " << name << "\n"; // FALL THROUGH case GlobalValue::InternalLinkage: - SwitchToSection(TAI->getDataSection()); + SwitchToSection(getObjFileLowering().getDataSection()); break; default: llvm_unreachable("Unknown linkage type!"); Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.cpp?rev=77294&r1=77293&r2=77294&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original) +++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Mon Jul 27 22:13:23 2009 @@ -36,6 +36,7 @@ #include "llvm/Support/MathExtras.h" #include "llvm/Support/Debug.h" #include "llvm/Support/ErrorHandling.h" +#include "llvm/Target/TargetLoweringObjectFile.h" #include "llvm/Target/TargetOptions.h" #include "llvm/ADT/SmallSet.h" #include "llvm/ADT/StringExtras.h" @@ -50,8 +51,23 @@ static SDValue getMOVL(SelectionDAG &DAG, DebugLoc dl, MVT VT, SDValue V1, SDValue V2); +static TargetLoweringObjectFile *createTLOF(X86TargetMachine &TM) { + switch (TM.getSubtarget().TargetType) { + default: llvm_unreachable("unknown subtarget type"); + case X86Subtarget::isDarwin: + return new TargetLoweringObjectFileMachO(); + case X86Subtarget::isELF: + return new TargetLoweringObjectFileELF(); + case X86Subtarget::isMingw: + case X86Subtarget::isCygwin: + case X86Subtarget::isWindows: + return new TargetLoweringObjectFileCOFF(); + } + +} + X86TargetLowering::X86TargetLowering(X86TargetMachine &TM) - : TargetLowering(TM) { + : TargetLowering(TM, createTLOF(TM)) { Subtarget = &TM.getSubtarget(); X86ScalarSSEf64 = Subtarget->hasSSE2(); X86ScalarSSEf32 = Subtarget->hasSSE1(); Modified: llvm/trunk/lib/Target/X86/X86TargetAsmInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86TargetAsmInfo.cpp?rev=77294&r1=77293&r2=77294&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86TargetAsmInfo.cpp (original) +++ llvm/trunk/lib/Target/X86/X86TargetAsmInfo.cpp Mon Jul 27 22:13:23 2009 @@ -121,8 +121,6 @@ // Set up DWARF directives HasLEB128 = true; // Target asm supports leb128 directives (little-endian) - BSSSection_ = getOrCreateSection("\t.bss", true, SectionKind::BSS); - // Debug Information AbsoluteDebugSectionOffsets = true; SupportsDebugInformation = true; @@ -252,9 +250,6 @@ AlignmentIsInBytes = true; - TextSection = getOrCreateSection("_text", true, SectionKind::Text); - DataSection = getOrCreateSection("_data", true, SectionKind::DataRel); - JumpTableDataSection = NULL; SwitchToSectionDirective = ""; TextSectionStartSuffix = "\tSEGMENT PARA 'CODE'"; Modified: llvm/trunk/lib/Target/X86/X86TargetAsmInfo.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86TargetAsmInfo.h?rev=77294&r1=77293&r2=77294&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86TargetAsmInfo.h (original) +++ llvm/trunk/lib/Target/X86/X86TargetAsmInfo.h Mon Jul 27 22:13:23 2009 @@ -33,8 +33,6 @@ } }; - typedef X86TargetAsmInfo X86GenericTargetAsmInfo; - EXTERN_TEMPLATE_INSTANTIATION(class X86TargetAsmInfo); struct X86DarwinTargetAsmInfo : public X86TargetAsmInfo { @@ -58,7 +56,7 @@ }; - struct X86WinTargetAsmInfo : public X86GenericTargetAsmInfo { + struct X86WinTargetAsmInfo : public X86TargetAsmInfo { explicit X86WinTargetAsmInfo(const X86TargetMachine &TM); }; Modified: llvm/trunk/lib/Target/X86/X86TargetMachine.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86TargetMachine.cpp?rev=77294&r1=77293&r2=77294&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86TargetMachine.cpp (original) +++ llvm/trunk/lib/Target/X86/X86TargetMachine.cpp Mon Jul 27 22:13:23 2009 @@ -32,20 +32,18 @@ const TargetAsmInfo *X86TargetMachine::createTargetAsmInfo() const { if (Subtarget.isFlavorIntel()) return new X86WinTargetAsmInfo(*this); - else - switch (Subtarget.TargetType) { - case X86Subtarget::isDarwin: - return new X86DarwinTargetAsmInfo(*this); - case X86Subtarget::isELF: - return new X86ELFTargetAsmInfo(*this); - case X86Subtarget::isMingw: - case X86Subtarget::isCygwin: - return new X86COFFTargetAsmInfo(*this); - case X86Subtarget::isWindows: - return new X86WinTargetAsmInfo(*this); - default: - return new X86GenericTargetAsmInfo(*this); - } + switch (Subtarget.TargetType) { + default: llvm_unreachable("unknown subtarget type"); + case X86Subtarget::isDarwin: + return new X86DarwinTargetAsmInfo(*this); + case X86Subtarget::isELF: + return new X86ELFTargetAsmInfo(*this); + case X86Subtarget::isMingw: + case X86Subtarget::isCygwin: + return new X86COFFTargetAsmInfo(*this); + case X86Subtarget::isWindows: + return new X86WinTargetAsmInfo(*this); + } } X86_32TargetMachine::X86_32TargetMachine(const Target &T, const Module &M, Modified: llvm/trunk/lib/Target/XCore/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/XCore/CMakeLists.txt?rev=77294&r1=77293&r2=77294&view=diff ============================================================================== --- llvm/trunk/lib/Target/XCore/CMakeLists.txt (original) +++ llvm/trunk/lib/Target/XCore/CMakeLists.txt Mon Jul 27 22:13:23 2009 @@ -20,4 +20,5 @@ XCoreSubtarget.cpp XCoreTargetAsmInfo.cpp XCoreTargetMachine.cpp + XCoreTargetObjectFile.cpp ) Modified: llvm/trunk/lib/Target/XCore/XCoreAsmPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/XCore/XCoreAsmPrinter.cpp?rev=77294&r1=77293&r2=77294&view=diff ============================================================================== --- llvm/trunk/lib/Target/XCore/XCoreAsmPrinter.cpp (original) +++ llvm/trunk/lib/Target/XCore/XCoreAsmPrinter.cpp Mon Jul 27 22:13:23 2009 @@ -28,6 +28,7 @@ #include "llvm/CodeGen/MachineInstr.h" #include "llvm/Target/TargetAsmInfo.h" #include "llvm/Target/TargetData.h" +#include "llvm/Target/TargetLoweringObjectFile.h" #include "llvm/Target/TargetRegistry.h" #include "llvm/Support/Mangler.h" #include "llvm/ADT/Statistic.h" @@ -133,7 +134,7 @@ const TargetData *TD = TM.getTargetData(); - SwitchToSection(TAI->SectionForGlobal(GV)); + SwitchToSection(getObjFileLowering().SectionForGlobal(GV, TM)); std::string name = Mang->getMangledName(GV); Constant *C = GV->getInitializer(); @@ -204,7 +205,7 @@ // Print out the label for the function. const Function *F = MF.getFunction(); - SwitchToSection(TAI->SectionForGlobal(F)); + SwitchToSection(getObjFileLowering().SectionForGlobal(F, TM)); // Mark the start of the function O << "\t.cc_top " << CurrentFnName << ".function," << CurrentFnName << "\n"; Modified: llvm/trunk/lib/Target/XCore/XCoreISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/XCore/XCoreISelLowering.cpp?rev=77294&r1=77293&r2=77294&view=diff ============================================================================== --- llvm/trunk/lib/Target/XCore/XCoreISelLowering.cpp (original) +++ llvm/trunk/lib/Target/XCore/XCoreISelLowering.cpp Mon Jul 27 22:13:23 2009 @@ -16,6 +16,7 @@ #include "XCoreISelLowering.h" #include "XCoreMachineFunctionInfo.h" #include "XCore.h" +#include "XCoreTargetObjectFile.h" #include "XCoreTargetMachine.h" #include "XCoreSubtarget.h" #include "llvm/DerivedTypes.h" @@ -55,7 +56,8 @@ } XCoreTargetLowering::XCoreTargetLowering(XCoreTargetMachine &XTM) - : TargetLowering(XTM), + : TargetLowering(XTM, + new XCoreTargetObjectFile(XTM.getSubtargetImpl()->isXS1A())), TM(XTM), Subtarget(*XTM.getSubtargetImpl()) { Modified: llvm/trunk/lib/Target/XCore/XCoreTargetAsmInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/XCore/XCoreTargetAsmInfo.cpp?rev=77294&r1=77293&r2=77294&view=diff ============================================================================== --- llvm/trunk/lib/Target/XCore/XCoreTargetAsmInfo.cpp (original) +++ llvm/trunk/lib/Target/XCore/XCoreTargetAsmInfo.cpp Mon Jul 27 22:13:23 2009 @@ -1,4 +1,4 @@ -//===-- XCoreTargetAsmInfo.cpp - XCore asm properties -----------*- C++ -*-===// +//===-- XCoreTargetAsmInfo.cpp - XCore asm properties ---------------------===// // // The LLVM Compiler Infrastructure // @@ -6,41 +6,13 @@ // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// -// -// This file contains the declarations of the XCoreTargetAsmInfo properties. -// We use the small section flag for the CP relative and DP relative -// flags. If a section is small and writable then it is DP relative. If a -// section is small and not writable then it is CP relative. -// -//===----------------------------------------------------------------------===// #include "XCoreTargetAsmInfo.h" -#include "XCoreTargetMachine.h" -#include "llvm/GlobalVariable.h" -#include "llvm/ADT/StringExtras.h" - using namespace llvm; -XCoreTargetAsmInfo::XCoreTargetAsmInfo(const XCoreTargetMachine &TM) +XCoreTargetAsmInfo::XCoreTargetAsmInfo(const TargetMachine &TM) : ELFTargetAsmInfo(TM) { SupportsDebugInformation = true; - TextSection = getOrCreateSection("\t.text", true, SectionKind::Text); - DataSection = getOrCreateSection("\t.dp.data", false, SectionKind::DataRel); - BSSSection_ = getOrCreateSection("\t.dp.bss", false, SectionKind::BSS); - - // TLS globals are lowered in the backend to arrays indexed by the current - // thread id. After lowering they require no special handling by the linker - // and can be placed in the standard data / bss sections. - TLSDataSection = DataSection; - TLSBSSSection = BSSSection_; - - if (TM.getSubtargetImpl()->isXS1A()) - // FIXME: Why is this writable??? - ReadOnlySection = getOrCreateSection("\t.dp.rodata", false, - SectionKind::DataRel); - else - ReadOnlySection = getOrCreateSection("\t.cp.rodata", false, - SectionKind::ReadOnly); Data16bitsDirective = "\t.short\t"; Data32bitsDirective = "\t.long\t"; Data64bitsDirective = 0; Modified: llvm/trunk/lib/Target/XCore/XCoreTargetAsmInfo.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/XCore/XCoreTargetAsmInfo.h?rev=77294&r1=77293&r2=77294&view=diff ============================================================================== --- llvm/trunk/lib/Target/XCore/XCoreTargetAsmInfo.h (original) +++ llvm/trunk/lib/Target/XCore/XCoreTargetAsmInfo.h Mon Jul 27 22:13:23 2009 @@ -18,13 +18,9 @@ namespace llvm { - // Forward declarations. - class XCoreTargetMachine; - class XCoreSubtarget; - class XCoreTargetAsmInfo : public ELFTargetAsmInfo { public: - explicit XCoreTargetAsmInfo(const XCoreTargetMachine &TM); + explicit XCoreTargetAsmInfo(const TargetMachine &TM); }; } // namespace llvm Added: llvm/trunk/lib/Target/XCore/XCoreTargetObjectFile.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/XCore/XCoreTargetObjectFile.cpp?rev=77294&view=auto ============================================================================== --- llvm/trunk/lib/Target/XCore/XCoreTargetObjectFile.cpp (added) +++ llvm/trunk/lib/Target/XCore/XCoreTargetObjectFile.cpp Mon Jul 27 22:13:23 2009 @@ -0,0 +1,32 @@ +//===-- XCoreTargetObjectFile.cpp - XCore object files --------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#include "XCoreTargetObjectFile.h" +using namespace llvm; + + +XCoreTargetObjectFile::XCoreTargetObjectFile(bool isXS1A) { + TextSection = getOrCreateSection("\t.text", true, SectionKind::Text); + DataSection = getOrCreateSection("\t.dp.data", false, SectionKind::DataRel); + BSSSection_ = getOrCreateSection("\t.dp.bss", false, SectionKind::BSS); + + // TLS globals are lowered in the backend to arrays indexed by the current + // thread id. After lowering they require no special handling by the linker + // and can be placed in the standard data / bss sections. + TLSDataSection = DataSection; + TLSBSSSection = BSSSection_; + + if (isXS1A) + // FIXME: Why is this writable ("datarel")??? + ReadOnlySection = getOrCreateSection("\t.dp.rodata", false, + SectionKind::DataRel); + else + ReadOnlySection = getOrCreateSection("\t.cp.rodata", false, + SectionKind::ReadOnly); +} \ No newline at end of file Added: llvm/trunk/lib/Target/XCore/XCoreTargetObjectFile.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/XCore/XCoreTargetObjectFile.h?rev=77294&view=auto ============================================================================== --- llvm/trunk/lib/Target/XCore/XCoreTargetObjectFile.h (added) +++ llvm/trunk/lib/Target/XCore/XCoreTargetObjectFile.h Mon Jul 27 22:13:23 2009 @@ -0,0 +1,25 @@ +//===-- llvm/Target/XCoreTargetObjectFile.h - XCore Object Info -*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#ifndef LLVM_TARGET_XCORE_TARGETOBJECTFILE_H +#define LLVM_TARGET_XCORE_TARGETOBJECTFILE_H + +#include "llvm/Target/TargetLoweringObjectFile.h" + +namespace llvm { + + class XCoreTargetObjectFile : public TargetLoweringObjectFileELF { + public: + XCoreTargetObjectFile(bool isXS1A); + + // TODO: Classify globals as xcore wishes. + }; +} // end namespace llvm + +#endif From sabre at nondot.org Mon Jul 27 22:20:35 2009 From: sabre at nondot.org (Chris Lattner) Date: Tue, 28 Jul 2009 03:20:35 -0000 Subject: [llvm-commits] [llvm] r77295 - /llvm/trunk/lib/Target/PIC16/PIC16AsmPrinter.cpp Message-ID: <200907280320.n6S3KZWn000502@zion.cs.uiuc.edu> Author: lattner Date: Mon Jul 27 22:20:34 2009 New Revision: 77295 URL: http://llvm.org/viewvc/llvm-project?rev=77295&view=rev Log: fix a casting problem on the llvm-x86_64-linux tester Modified: llvm/trunk/lib/Target/PIC16/PIC16AsmPrinter.cpp Modified: llvm/trunk/lib/Target/PIC16/PIC16AsmPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PIC16/PIC16AsmPrinter.cpp?rev=77295&r1=77294&r2=77295&view=diff ============================================================================== --- llvm/trunk/lib/Target/PIC16/PIC16AsmPrinter.cpp (original) +++ llvm/trunk/lib/Target/PIC16/PIC16AsmPrinter.cpp Mon Jul 27 22:20:34 2009 @@ -36,7 +36,7 @@ : AsmPrinter(O, TM, T, V), DbgInfo(O, T) { PTLI = static_cast(TM.getTargetLowering()); PTAI = static_cast(T); - PTOF = static_cast(&PTLI->getObjFileLowering()); + PTOF = (PIC16TargetObjectFile*)&PTLI->getObjFileLowering(); } bool PIC16AsmPrinter::printMachineInstruction(const MachineInstr *MI) { From evan.cheng at apple.com Tue Jul 28 00:48:47 2009 From: evan.cheng at apple.com (Evan Cheng) Date: Tue, 28 Jul 2009 05:48:47 -0000 Subject: [llvm-commits] [llvm] r77300 - in /llvm/trunk: lib/Target/ARM/ test/CodeGen/Thumb2/ Message-ID: <200907280548.n6S5mlPn004799@zion.cs.uiuc.edu> Author: evancheng Date: Tue Jul 28 00:48:47 2009 New Revision: 77300 URL: http://llvm.org/viewvc/llvm-project?rev=77300&view=rev Log: - More refactoring. This gets rid of all of the getOpcode calls. - This change also makes it possible to switch between ARM / Thumb on a per-function basis. - Fixed thumb2 routine which expand reg + arbitrary immediate. It was using using ARM so_imm logic. - Use movw and movt to do reg + imm when profitable. - Other code clean ups and minor optimizations. Added: llvm/trunk/test/CodeGen/Thumb2/large-stack.ll Modified: llvm/trunk/lib/Target/ARM/ARMAddressingModes.h llvm/trunk/lib/Target/ARM/ARMBaseInstrInfo.cpp llvm/trunk/lib/Target/ARM/ARMBaseInstrInfo.h llvm/trunk/lib/Target/ARM/ARMBaseRegisterInfo.cpp llvm/trunk/lib/Target/ARM/ARMBaseRegisterInfo.h llvm/trunk/lib/Target/ARM/ARMInstrInfo.cpp llvm/trunk/lib/Target/ARM/ARMInstrInfo.h llvm/trunk/lib/Target/ARM/ARMInstrThumb2.td llvm/trunk/lib/Target/ARM/Thumb1InstrInfo.cpp llvm/trunk/lib/Target/ARM/Thumb1InstrInfo.h llvm/trunk/lib/Target/ARM/Thumb1RegisterInfo.cpp llvm/trunk/lib/Target/ARM/Thumb1RegisterInfo.h llvm/trunk/lib/Target/ARM/Thumb2InstrInfo.cpp llvm/trunk/lib/Target/ARM/Thumb2InstrInfo.h llvm/trunk/lib/Target/ARM/Thumb2RegisterInfo.cpp llvm/trunk/lib/Target/ARM/Thumb2RegisterInfo.h Modified: llvm/trunk/lib/Target/ARM/ARMAddressingModes.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMAddressingModes.h?rev=77300&r1=77299&r2=77300&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMAddressingModes.h (original) +++ llvm/trunk/lib/Target/ARM/ARMAddressingModes.h Tue Jul 28 00:48:47 2009 @@ -274,6 +274,7 @@ return V >> getThumbImmValShift(V); } + /// getT2SOImmValSplat - Return the 12-bit encoded representation /// if the specified value can be obtained by splatting the low 8 bits /// into every other byte or every byte of a 32-bit value. i.e., @@ -283,7 +284,7 @@ /// abcdefgh abcdefgh abcdefgh abcdefgh control = 3 /// Return -1 if none of the above apply. /// See ARM Reference Manual A6.3.2. - static inline int getT2SOImmValSplat(unsigned V) { + static inline int getT2SOImmValSplatVal(unsigned V) { unsigned u, Vs, Imm; // control = 0 if ((V & 0xffffff00) == 0) @@ -307,11 +308,11 @@ return -1; } - /// getT2SOImmValRotate - Return the 12-bit encoded representation if the + /// getT2SOImmValRotateVal - Return the 12-bit encoded representation if the /// specified value is a rotated 8-bit value. Return -1 if no rotation /// encoding is possible. /// See ARM Reference Manual A6.3.2. - static inline int getT2SOImmValRotate (unsigned V) { + static inline int getT2SOImmValRotateVal(unsigned V) { unsigned RotAmt = CountLeadingZeros_32(V); if (RotAmt >= 24) return -1; @@ -329,12 +330,12 @@ /// See ARM Reference Manual A6.3.2. static inline int getT2SOImmVal(unsigned Arg) { // If 'Arg' is an 8-bit splat, then get the encoded value. - int Splat = getT2SOImmValSplat(Arg); + int Splat = getT2SOImmValSplatVal(Arg); if (Splat != -1) return Splat; // If 'Arg' can be handled with a single shifter_op return the value. - int Rot = getT2SOImmValRotate(Arg); + int Rot = getT2SOImmValRotateVal(Arg); if (Rot != -1) return Rot; Modified: llvm/trunk/lib/Target/ARM/ARMBaseInstrInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMBaseInstrInfo.cpp?rev=77300&r1=77299&r2=77300&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMBaseInstrInfo.cpp (original) +++ llvm/trunk/lib/Target/ARM/ARMBaseInstrInfo.cpp Tue Jul 28 00:48:47 2009 @@ -31,8 +31,7 @@ cl::desc("Enable ARM 2-addr to 3-addr conv")); ARMBaseInstrInfo::ARMBaseInstrInfo(const ARMSubtarget &sti) - : TargetInstrInfoImpl(ARMInsts, array_lengthof(ARMInsts)), - STI(sti) { + : TargetInstrInfoImpl(ARMInsts, array_lengthof(ARMInsts)) { } MachineInstr * @@ -290,10 +289,12 @@ const SmallVectorImpl &Cond) const { // FIXME this should probably have a DebugLoc argument DebugLoc dl = DebugLoc::getUnknownLoc(); - int BOpc = !STI.isThumb() - ? ARM::B : (STI.isThumb2() ? ARM::t2B : ARM::tB); - int BccOpc = !STI.isThumb() - ? ARM::Bcc : (STI.isThumb2() ? ARM::t2Bcc : ARM::tBcc); + + ARMFunctionInfo *AFI = MBB.getParent()->getInfo(); + int BOpc = !AFI->isThumbFunction() + ? ARM::B : (AFI->isThumb2Function() ? ARM::t2B : ARM::tB); + int BccOpc = !AFI->isThumbFunction() + ? ARM::Bcc : (AFI->isThumb2Function() ? ARM::t2Bcc : ARM::tBcc); // Shouldn't be a fall through. assert(TBB && "InsertBranch must not be told to insert a fallthrough"); @@ -785,7 +786,7 @@ return false; } -int ARMBaseInstrInfo::getMatchingCondBranchOpcode(int Opc) const { +int llvm::getMatchingCondBranchOpcode(int Opc) { if (Opc == ARM::B) return ARM::Bcc; else if (Opc == ARM::tB) @@ -797,3 +798,146 @@ return 0; } + +void llvm::emitARMRegPlusImmediate(MachineBasicBlock &MBB, + MachineBasicBlock::iterator &MBBI, DebugLoc dl, + unsigned DestReg, unsigned BaseReg, int NumBytes, + ARMCC::CondCodes Pred, unsigned PredReg, + const ARMBaseInstrInfo &TII) { + bool isSub = NumBytes < 0; + if (isSub) NumBytes = -NumBytes; + + while (NumBytes) { + unsigned RotAmt = ARM_AM::getSOImmValRotate(NumBytes); + unsigned ThisVal = NumBytes & ARM_AM::rotr32(0xFF, RotAmt); + assert(ThisVal && "Didn't extract field correctly"); + + // We will handle these bits from offset, clear them. + NumBytes &= ~ThisVal; + + assert(ARM_AM::getSOImmVal(ThisVal) != -1 && "Bit extraction didn't work?"); + + // Build the new ADD / SUB. + unsigned Opc = isSub ? ARM::SUBri : ARM::ADDri; + BuildMI(MBB, MBBI, dl, TII.get(Opc), DestReg) + .addReg(BaseReg, RegState::Kill).addImm(ThisVal) + .addImm((unsigned)Pred).addReg(PredReg).addReg(0); + BaseReg = DestReg; + } +} + +int llvm::rewriteARMFrameIndex(MachineInstr &MI, unsigned FrameRegIdx, + unsigned FrameReg, int Offset, + const ARMBaseInstrInfo &TII) { + unsigned Opcode = MI.getOpcode(); + const TargetInstrDesc &Desc = MI.getDesc(); + unsigned AddrMode = (Desc.TSFlags & ARMII::AddrModeMask); + bool isSub = false; + + // Memory operands in inline assembly always use AddrMode2. + if (Opcode == ARM::INLINEASM) + AddrMode = ARMII::AddrMode2; + + if (Opcode == ARM::ADDri) { + Offset += MI.getOperand(FrameRegIdx+1).getImm(); + if (Offset == 0) { + // Turn it into a move. + MI.setDesc(TII.get(ARM::MOVr)); + MI.getOperand(FrameRegIdx).ChangeToRegister(FrameReg, false); + MI.RemoveOperand(FrameRegIdx+1); + return 0; + } else if (Offset < 0) { + Offset = -Offset; + isSub = true; + MI.setDesc(TII.get(ARM::SUBri)); + } + + // Common case: small offset, fits into instruction. + if (ARM_AM::getSOImmVal(Offset) != -1) { + // Replace the FrameIndex with sp / fp + MI.getOperand(FrameRegIdx).ChangeToRegister(FrameReg, false); + MI.getOperand(FrameRegIdx+1).ChangeToImmediate(Offset); + return 0; + } + + // Otherwise, pull as much of the immedidate into this ADDri/SUBri + // as possible. + unsigned RotAmt = ARM_AM::getSOImmValRotate(Offset); + unsigned ThisImmVal = Offset & ARM_AM::rotr32(0xFF, RotAmt); + + // We will handle these bits from offset, clear them. + Offset &= ~ThisImmVal; + + // Get the properly encoded SOImmVal field. + assert(ARM_AM::getSOImmVal(ThisImmVal) != -1 && + "Bit extraction didn't work?"); + MI.getOperand(FrameRegIdx+1).ChangeToImmediate(ThisImmVal); + } else { + unsigned ImmIdx = 0; + int InstrOffs = 0; + unsigned NumBits = 0; + unsigned Scale = 1; + switch (AddrMode) { + case ARMII::AddrMode2: { + ImmIdx = FrameRegIdx+2; + InstrOffs = ARM_AM::getAM2Offset(MI.getOperand(ImmIdx).getImm()); + if (ARM_AM::getAM2Op(MI.getOperand(ImmIdx).getImm()) == ARM_AM::sub) + InstrOffs *= -1; + NumBits = 12; + break; + } + case ARMII::AddrMode3: { + ImmIdx = FrameRegIdx+2; + InstrOffs = ARM_AM::getAM3Offset(MI.getOperand(ImmIdx).getImm()); + if (ARM_AM::getAM3Op(MI.getOperand(ImmIdx).getImm()) == ARM_AM::sub) + InstrOffs *= -1; + NumBits = 8; + break; + } + case ARMII::AddrMode5: { + ImmIdx = FrameRegIdx+1; + InstrOffs = ARM_AM::getAM5Offset(MI.getOperand(ImmIdx).getImm()); + if (ARM_AM::getAM5Op(MI.getOperand(ImmIdx).getImm()) == ARM_AM::sub) + InstrOffs *= -1; + NumBits = 8; + Scale = 4; + break; + } + default: + llvm_unreachable("Unsupported addressing mode!"); + break; + } + + Offset += InstrOffs * Scale; + assert((Offset & (Scale-1)) == 0 && "Can't encode this offset!"); + if (Offset < 0) { + Offset = -Offset; + isSub = true; + } + + // Attempt to fold address comp. if opcode has offset bits + if (NumBits > 0) { + // Common case: small offset, fits into instruction. + MachineOperand &ImmOp = MI.getOperand(ImmIdx); + int ImmedOffset = Offset / Scale; + unsigned Mask = (1 << NumBits) - 1; + if ((unsigned)Offset <= Mask * Scale) { + // Replace the FrameIndex with sp + MI.getOperand(FrameRegIdx).ChangeToRegister(FrameReg, false); + if (isSub) + ImmedOffset |= 1 << NumBits; + ImmOp.ChangeToImmediate(ImmedOffset); + return 0; + } + + // Otherwise, it didn't fit. Pull in what we can to simplify the immed. + ImmedOffset = ImmedOffset & Mask; + if (isSub) + ImmedOffset |= 1 << NumBits; + ImmOp.ChangeToImmediate(ImmedOffset); + Offset &= ~(Mask*Scale); + } + } + + return (isSub) ? -Offset : Offset; +} Modified: llvm/trunk/lib/Target/ARM/ARMBaseInstrInfo.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMBaseInstrInfo.h?rev=77300&r1=77299&r2=77300&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMBaseInstrInfo.h (original) +++ llvm/trunk/lib/Target/ARM/ARMBaseInstrInfo.h Tue Jul 28 00:48:47 2009 @@ -155,37 +155,9 @@ I_BitShift = 25, CondShift = 28 }; - - /// ARMII::Op - Holds all of the instruction types required by - /// target specific instruction and register code. ARMBaseInstrInfo - /// and subclasses should return a specific opcode that implements - /// the instruction type. - /// - enum Op { - ADDri, - MOVr, - SUBri - }; -} - -static inline -const MachineInstrBuilder &AddDefaultPred(const MachineInstrBuilder &MIB) { - return MIB.addImm((int64_t)ARMCC::AL).addReg(0); -} - -static inline -const MachineInstrBuilder &AddDefaultCC(const MachineInstrBuilder &MIB) { - return MIB.addReg(0); -} - -static inline -const MachineInstrBuilder &AddDefaultT1CC(const MachineInstrBuilder &MIB) { - return MIB.addReg(ARM::CPSR); } class ARMBaseInstrInfo : public TargetInstrInfoImpl { - const ARMSubtarget &STI; - protected: // Can be only subclassed. explicit ARMBaseInstrInfo(const ARMSubtarget &sti); @@ -194,9 +166,6 @@ // if there is not such an opcode. virtual unsigned getUnindexedOpcode(unsigned Opc) const =0; - // Return the opcode that implements 'Op', or 0 if no opcode - virtual unsigned getOpcode(ARMII::Op Op) const =0; - // Return true if the block does not fall through. virtual bool BlockHasNoFallThrough(const MachineBasicBlock &MBB) const =0; @@ -286,22 +255,68 @@ const SmallVectorImpl &Ops, MachineInstr* LoadMI) const; -private: - bool isUncondBranchOpcode(int Opc) const { - return Opc == ARM::B || Opc == ARM::tB || Opc == ARM::t2B; - } +}; - bool isCondBranchOpcode(int Opc) const { - return Opc == ARM::Bcc || Opc == ARM::tBcc || Opc == ARM::t2Bcc; - } +static inline +const MachineInstrBuilder &AddDefaultPred(const MachineInstrBuilder &MIB) { + return MIB.addImm((int64_t)ARMCC::AL).addReg(0); +} - bool isJumpTableBranchOpcode(int Opc) const { - return Opc == ARM::BR_JTr || Opc == ARM::BR_JTm || Opc == ARM::BR_JTadd || - Opc == ARM::tBR_JTr || Opc == ARM::t2BR_JT; - } +static inline +const MachineInstrBuilder &AddDefaultCC(const MachineInstrBuilder &MIB) { + return MIB.addReg(0); +} - int getMatchingCondBranchOpcode(int Opc) const; -}; +static inline +const MachineInstrBuilder &AddDefaultT1CC(const MachineInstrBuilder &MIB) { + return MIB.addReg(ARM::CPSR); } +static inline +bool isUncondBranchOpcode(int Opc) { + return Opc == ARM::B || Opc == ARM::tB || Opc == ARM::t2B; +} + +static inline +bool isCondBranchOpcode(int Opc) { + return Opc == ARM::Bcc || Opc == ARM::tBcc || Opc == ARM::t2Bcc; +} + +static inline +bool isJumpTableBranchOpcode(int Opc) { + return Opc == ARM::BR_JTr || Opc == ARM::BR_JTm || Opc == ARM::BR_JTadd || + Opc == ARM::tBR_JTr || Opc == ARM::t2BR_JT; +} + +int getMatchingCondBranchOpcode(int Opc); + +/// emitARMRegPlusImmediate / emitT2RegPlusImmediate - Emits a series of +/// instructions to materializea destreg = basereg + immediate in ARM / Thumb2 +/// code. +void emitARMRegPlusImmediate(MachineBasicBlock &MBB, + MachineBasicBlock::iterator &MBBI, DebugLoc dl, + unsigned DestReg, unsigned BaseReg, int NumBytes, + ARMCC::CondCodes Pred, unsigned PredReg, + const ARMBaseInstrInfo &TII); + +void emitT2RegPlusImmediate(MachineBasicBlock &MBB, + MachineBasicBlock::iterator &MBBI, DebugLoc dl, + unsigned DestReg, unsigned BaseReg, int NumBytes, + ARMCC::CondCodes Pred, unsigned PredReg, + const ARMBaseInstrInfo &TII); + + +/// rewriteARMFrameIndex / rewriteT2FrameIndex - +/// Rewrite MI to access 'Offset' bytes from the FP. Return the offset that +/// could not be handled directly in MI. +int rewriteARMFrameIndex(MachineInstr &MI, unsigned FrameRegIdx, + unsigned FrameReg, int Offset, + const ARMBaseInstrInfo &TII); + +int rewriteT2FrameIndex(MachineInstr &MI, unsigned FrameRegIdx, + unsigned FrameReg, int Offset, + const ARMBaseInstrInfo &TII); + +} // End llvm namespace + #endif Modified: llvm/trunk/lib/Target/ARM/ARMBaseRegisterInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMBaseRegisterInfo.cpp?rev=77300&r1=77299&r2=77300&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMBaseRegisterInfo.cpp (original) +++ llvm/trunk/lib/Target/ARM/ARMBaseRegisterInfo.cpp Tue Jul 28 00:48:47 2009 @@ -137,11 +137,6 @@ FramePtr((STI.isTargetDarwin() || STI.isThumb()) ? ARM::R7 : ARM::R11) { } -unsigned ARMBaseRegisterInfo:: -getOpcode(int Op) const { - return TII.getOpcode((ARMII::Op)Op); -} - const unsigned* ARMBaseRegisterInfo::getCalleeSavedRegs(const MachineFunction *MF) const { static const unsigned CalleeSavedRegs[] = { @@ -881,17 +876,6 @@ return 0; } -// FIXME: Dup in ARMBaseInstrInfo.cpp -static inline -const MachineInstrBuilder &AddDefaultPred(const MachineInstrBuilder &MIB) { - return MIB.addImm((int64_t)ARMCC::AL).addReg(0); -} - -static inline -const MachineInstrBuilder &AddDefaultCC(const MachineInstrBuilder &MIB) { - return MIB.addReg(0); -} - /// emitLoadConstPool - Emits a load from constpool to materialize the /// specified immediate. void ARMBaseRegisterInfo:: @@ -936,46 +920,21 @@ return !MF.getFrameInfo()->hasVarSizedObjects(); } -/// emitARMRegPlusImmediate - Emits a series of instructions to materialize -/// a destreg = basereg + immediate in ARM code. -static -void emitARMRegPlusImmediate(MachineBasicBlock &MBB, - MachineBasicBlock::iterator &MBBI, - unsigned DestReg, unsigned BaseReg, int NumBytes, - ARMCC::CondCodes Pred, unsigned PredReg, - const ARMBaseInstrInfo &TII, - DebugLoc dl) { - bool isSub = NumBytes < 0; - if (isSub) NumBytes = -NumBytes; - - while (NumBytes) { - unsigned RotAmt = ARM_AM::getSOImmValRotate(NumBytes); - unsigned ThisVal = NumBytes & ARM_AM::rotr32(0xFF, RotAmt); - assert(ThisVal && "Didn't extract field correctly"); - - // We will handle these bits from offset, clear them. - NumBytes &= ~ThisVal; - - assert(ARM_AM::getSOImmVal(ThisVal) != -1 && "Bit extraction didn't work?"); - - // Build the new ADD / SUB. - unsigned Opc = TII.getOpcode(isSub ? ARMII::SUBri : ARMII::ADDri); - BuildMI(MBB, MBBI, dl, TII.get(Opc), DestReg) - .addReg(BaseReg, RegState::Kill).addImm(ThisVal) - .addImm((unsigned)Pred).addReg(PredReg).addReg(0); - BaseReg = DestReg; - } -} - static void -emitSPUpdate(MachineBasicBlock &MBB, MachineBasicBlock::iterator &MBBI, - const ARMBaseInstrInfo &TII, DebugLoc dl, +emitSPUpdate(bool isARM, + MachineBasicBlock &MBB, MachineBasicBlock::iterator &MBBI, + DebugLoc dl, const ARMBaseInstrInfo &TII, int NumBytes, ARMCC::CondCodes Pred = ARMCC::AL, unsigned PredReg = 0) { - emitARMRegPlusImmediate(MBB, MBBI, ARM::SP, ARM::SP, NumBytes, - Pred, PredReg, TII, dl); + if (isARM) + emitARMRegPlusImmediate(MBB, MBBI, dl, ARM::SP, ARM::SP, NumBytes, + Pred, PredReg, TII); + else + emitT2RegPlusImmediate(MBB, MBBI, dl, ARM::SP, ARM::SP, NumBytes, + Pred, PredReg, TII); } + void ARMBaseRegisterInfo:: eliminateCallFramePseudoInstr(MachineFunction &MF, MachineBasicBlock &MBB, MachineBasicBlock::iterator I) const { @@ -993,18 +952,24 @@ unsigned Align = MF.getTarget().getFrameInfo()->getStackAlignment(); Amount = (Amount+Align-1)/Align*Align; + ARMFunctionInfo *AFI = MF.getInfo(); + assert(!AFI->isThumb1OnlyFunction() && + "This eliminateCallFramePseudoInstr does not suppor Thumb1!"); + bool isARM = !AFI->isThumbFunction(); + // Replace the pseudo instruction with a new instruction... unsigned Opc = Old->getOpcode(); ARMCC::CondCodes Pred = (ARMCC::CondCodes)Old->getOperand(1).getImm(); + // FIXME: Thumb2 version of ADJCALLSTACKUP and ADJCALLSTACKDOWN? if (Opc == ARM::ADJCALLSTACKDOWN || Opc == ARM::tADJCALLSTACKDOWN) { // Note: PredReg is operand 2 for ADJCALLSTACKDOWN. unsigned PredReg = Old->getOperand(2).getReg(); - emitSPUpdate(MBB, I, TII, dl, -Amount, Pred, PredReg); + emitSPUpdate(isARM, MBB, I, dl, TII, -Amount, Pred, PredReg); } else { // Note: PredReg is operand 3 for ADJCALLSTACKUP. unsigned PredReg = Old->getOperand(3).getReg(); assert(Opc == ARM::ADJCALLSTACKUP || Opc == ARM::tADJCALLSTACKUP); - emitSPUpdate(MBB, I, TII, dl, Amount, Pred, PredReg); + emitSPUpdate(isARM, MBB, I, dl, TII, Amount, Pred, PredReg); } } } @@ -1018,7 +983,7 @@ unsigned findScratchRegister(RegScavenger *RS, const TargetRegisterClass *RC, ARMFunctionInfo *AFI) { unsigned Reg = RS ? RS->FindUnusedReg(RC, true) : (unsigned) ARM::R12; - assert (!AFI->isThumb1OnlyFunction()); + assert(!AFI->isThumb1OnlyFunction()); if (Reg == 0) // Try a already spilled CS register. Reg = RS->FindUnusedReg(RC, AFI->getSpilledCSRegisters()); @@ -1026,134 +991,16 @@ return Reg; } -int ARMBaseRegisterInfo:: -rewriteFrameIndex(MachineInstr &MI, unsigned FrameRegIdx, - unsigned MOVOpc, unsigned ADDriOpc, unsigned SUBriOpc, - unsigned FrameReg, int Offset) const -{ - unsigned Opcode = MI.getOpcode(); - const TargetInstrDesc &Desc = MI.getDesc(); - unsigned AddrMode = (Desc.TSFlags & ARMII::AddrModeMask); - bool isSub = false; - - // Memory operands in inline assembly always use AddrMode2. - if (Opcode == ARM::INLINEASM) - AddrMode = ARMII::AddrMode2; - - if (Opcode == ADDriOpc) { - Offset += MI.getOperand(FrameRegIdx+1).getImm(); - if (Offset == 0) { - // Turn it into a move. - MI.setDesc(TII.get(MOVOpc)); - MI.getOperand(FrameRegIdx).ChangeToRegister(FrameReg, false); - MI.RemoveOperand(FrameRegIdx+1); - return 0; - } else if (Offset < 0) { - Offset = -Offset; - isSub = true; - MI.setDesc(TII.get(SUBriOpc)); - } - - // Common case: small offset, fits into instruction. - if (ARM_AM::getSOImmVal(Offset) != -1) { - // Replace the FrameIndex with sp / fp - MI.getOperand(FrameRegIdx).ChangeToRegister(FrameReg, false); - MI.getOperand(FrameRegIdx+1).ChangeToImmediate(Offset); - return 0; - } - - // Otherwise, pull as much of the immedidate into this ADDri/SUBri - // as possible. - unsigned RotAmt = ARM_AM::getSOImmValRotate(Offset); - unsigned ThisImmVal = Offset & ARM_AM::rotr32(0xFF, RotAmt); - - // We will handle these bits from offset, clear them. - Offset &= ~ThisImmVal; - - // Get the properly encoded SOImmVal field. - assert(ARM_AM::getSOImmVal(ThisImmVal) != -1 && - "Bit extraction didn't work?"); - MI.getOperand(FrameRegIdx+1).ChangeToImmediate(ThisImmVal); - } else { - unsigned ImmIdx = 0; - int InstrOffs = 0; - unsigned NumBits = 0; - unsigned Scale = 1; - switch (AddrMode) { - case ARMII::AddrMode2: { - ImmIdx = FrameRegIdx+2; - InstrOffs = ARM_AM::getAM2Offset(MI.getOperand(ImmIdx).getImm()); - if (ARM_AM::getAM2Op(MI.getOperand(ImmIdx).getImm()) == ARM_AM::sub) - InstrOffs *= -1; - NumBits = 12; - break; - } - case ARMII::AddrMode3: { - ImmIdx = FrameRegIdx+2; - InstrOffs = ARM_AM::getAM3Offset(MI.getOperand(ImmIdx).getImm()); - if (ARM_AM::getAM3Op(MI.getOperand(ImmIdx).getImm()) == ARM_AM::sub) - InstrOffs *= -1; - NumBits = 8; - break; - } - case ARMII::AddrMode5: { - ImmIdx = FrameRegIdx+1; - InstrOffs = ARM_AM::getAM5Offset(MI.getOperand(ImmIdx).getImm()); - if (ARM_AM::getAM5Op(MI.getOperand(ImmIdx).getImm()) == ARM_AM::sub) - InstrOffs *= -1; - NumBits = 8; - Scale = 4; - break; - } - default: - llvm_unreachable("Unsupported addressing mode!"); - break; - } - - Offset += InstrOffs * Scale; - assert((Offset & (Scale-1)) == 0 && "Can't encode this offset!"); - if (Offset < 0) { - Offset = -Offset; - isSub = true; - } - - // Attempt to fold address comp. if opcode has offset bits - if (NumBits > 0) { - // Common case: small offset, fits into instruction. - MachineOperand &ImmOp = MI.getOperand(ImmIdx); - int ImmedOffset = Offset / Scale; - unsigned Mask = (1 << NumBits) - 1; - if ((unsigned)Offset <= Mask * Scale) { - // Replace the FrameIndex with sp - MI.getOperand(FrameRegIdx).ChangeToRegister(FrameReg, false); - if (isSub) - ImmedOffset |= 1 << NumBits; - ImmOp.ChangeToImmediate(ImmedOffset); - return 0; - } - - // Otherwise, it didn't fit. Pull in what we can to simplify the immed. - ImmedOffset = ImmedOffset & Mask; - if (isSub) - ImmedOffset |= 1 << NumBits; - ImmOp.ChangeToImmediate(ImmedOffset); - Offset &= ~(Mask*Scale); - } - } - - return (isSub) ? -Offset : Offset; -} - -void ARMBaseRegisterInfo:: -eliminateFrameIndexImpl(MachineBasicBlock::iterator II, - unsigned MOVOpc, unsigned ADDriOpc, unsigned SUBriOpc, - int SPAdj, RegScavenger *RS) const { +void +ARMBaseRegisterInfo::eliminateFrameIndex(MachineBasicBlock::iterator II, + int SPAdj, RegScavenger *RS) const { unsigned i = 0; MachineInstr &MI = *II; MachineBasicBlock &MBB = *MI.getParent(); MachineFunction &MF = *MBB.getParent(); ARMFunctionInfo *AFI = MF.getInfo(); - DebugLoc dl = MI.getDebugLoc(); + assert(!AFI->isThumb1OnlyFunction() && + "This eliminateFrameIndex does not suppor Thumb1!"); while (!MI.getOperand(i).isFI()) { ++i; @@ -1180,7 +1027,12 @@ } // modify MI as necessary to handle as much of 'Offset' as possible - Offset = rewriteFrameIndex(MI, i, MOVOpc,ADDriOpc,SUBriOpc, FrameReg, Offset); + if (!AFI->isThumbFunction()) + Offset = rewriteARMFrameIndex(MI, i, FrameReg, Offset, TII); + else { + assert(AFI->isThumb2Function()); + Offset = rewriteT2FrameIndex(MI, i, FrameReg, Offset, TII); + } if (Offset == 0) return; @@ -1201,8 +1053,14 @@ ARMCC::CondCodes Pred = (PIdx == -1) ? ARMCC::AL : (ARMCC::CondCodes)MI.getOperand(PIdx).getImm(); unsigned PredReg = (PIdx == -1) ? 0 : MI.getOperand(PIdx+1).getReg(); - emitARMRegPlusImmediate(MBB, II, ScratchReg, FrameReg, - Offset, Pred, PredReg, TII, dl); + if (!AFI->isThumbFunction()) + emitARMRegPlusImmediate(MBB, II, MI.getDebugLoc(), ScratchReg, FrameReg, + Offset, Pred, PredReg, TII); + else { + assert(AFI->isThumb2Function()); + emitT2RegPlusImmediate(MBB, II, MI.getDebugLoc(), ScratchReg, FrameReg, + Offset, Pred, PredReg, TII); + } MI.getOperand(i).ChangeToRegister(ScratchReg, false, false, true); } @@ -1249,6 +1107,9 @@ MachineBasicBlock::iterator MBBI = MBB.begin(); MachineFrameInfo *MFI = MF.getFrameInfo(); ARMFunctionInfo *AFI = MF.getInfo(); + assert(!AFI->isThumb1OnlyFunction() && + "This emitPrologue does not suppor Thumb1!"); + bool isARM = !AFI->isThumbFunction(); unsigned VARegSaveSize = AFI->getVarArgsRegSaveSize(); unsigned NumBytes = MFI->getStackSize(); const std::vector &CSI = MFI->getCalleeSavedInfo(); @@ -1261,11 +1122,11 @@ int FramePtrSpillFI = 0; if (VARegSaveSize) - emitSPUpdate(MBB, MBBI, TII, dl, -VARegSaveSize); + emitSPUpdate(isARM, MBB, MBBI, dl, TII, -VARegSaveSize); if (!AFI->hasStackFrame()) { if (NumBytes != 0) - emitSPUpdate(MBB, MBBI, TII, dl, -NumBytes); + emitSPUpdate(isARM, MBB, MBBI, dl, TII, -NumBytes); return; } @@ -1304,24 +1165,25 @@ } // Build the new SUBri to adjust SP for integer callee-save spill area 1. - emitSPUpdate(MBB, MBBI, TII, dl, -GPRCS1Size); + emitSPUpdate(isARM, MBB, MBBI, dl, TII, -GPRCS1Size); movePastCSLoadStoreOps(MBB, MBBI, ARM::STR, ARM::t2STRi12, 1, STI); // Darwin ABI requires FP to point to the stack slot that contains the // previous FP. if (STI.isTargetDarwin() || hasFP(MF)) { + unsigned ADDriOpc = !AFI->isThumbFunction() ? ARM::ADDri : ARM::t2ADDri; MachineInstrBuilder MIB = - BuildMI(MBB, MBBI, dl, TII.get(getOpcode(ARMII::ADDri)), FramePtr) + BuildMI(MBB, MBBI, dl, TII.get(ADDriOpc), FramePtr) .addFrameIndex(FramePtrSpillFI).addImm(0); AddDefaultCC(AddDefaultPred(MIB)); } // Build the new SUBri to adjust SP for integer callee-save spill area 2. - emitSPUpdate(MBB, MBBI, TII, dl, -GPRCS2Size); + emitSPUpdate(isARM, MBB, MBBI, dl, TII, -GPRCS2Size); // Build the new SUBri to adjust SP for FP callee-save spill area. movePastCSLoadStoreOps(MBB, MBBI, ARM::STR, ARM::t2STRi12, 2, STI); - emitSPUpdate(MBB, MBBI, TII, dl, -DPRCSSize); + emitSPUpdate(isARM, MBB, MBBI, dl, TII, -DPRCSSize); // Determine starting offsets of spill areas. unsigned DPRCSOffset = NumBytes - (GPRCS1Size + GPRCS2Size + DPRCSSize); @@ -1336,7 +1198,7 @@ if (NumBytes) { // Insert it after all the callee-save spills. movePastCSLoadStoreOps(MBB, MBBI, ARM::FSTD, 0, 3, STI); - emitSPUpdate(MBB, MBBI, TII, dl, -NumBytes); + emitSPUpdate(isARM, MBB, MBBI, dl, TII, -NumBytes); } if (STI.isTargetELF() && hasFP(MF)) { @@ -1368,21 +1230,22 @@ void ARMBaseRegisterInfo:: emitEpilogue(MachineFunction &MF, MachineBasicBlock &MBB) const { - assert(!STI.isThumb1Only() && - "This emitEpilogue should not be executed for Thumb1!"); - MachineBasicBlock::iterator MBBI = prior(MBB.end()); assert(MBBI->getDesc().isReturn() && "Can only insert epilog into returning blocks"); DebugLoc dl = MBBI->getDebugLoc(); MachineFrameInfo *MFI = MF.getFrameInfo(); ARMFunctionInfo *AFI = MF.getInfo(); + assert(!AFI->isThumb1OnlyFunction() && + "This emitEpilogue does not suppor Thumb1!"); + bool isARM = !AFI->isThumbFunction(); + unsigned VARegSaveSize = AFI->getVarArgsRegSaveSize(); int NumBytes = (int)MFI->getStackSize(); if (!AFI->hasStackFrame()) { if (NumBytes != 0) - emitSPUpdate(MBB, MBBI, TII, dl, NumBytes); + emitSPUpdate(isARM, MBB, MBBI, dl, TII, NumBytes); } else { // Unwind MBBI to point to first LDR / FLDD. const unsigned *CSRegs = getCalleeSavedRegs(); @@ -1409,36 +1272,38 @@ AFI->getDPRCalleeSavedAreaSize() || AFI->getDPRCalleeSavedAreaOffset()|| hasFP(MF)) { - if (NumBytes) - BuildMI(MBB, MBBI, dl, TII.get(getOpcode(ARMII::SUBri)), ARM::SP) + if (NumBytes) { + unsigned SUBriOpc = isARM ? ARM::SUBri : ARM::t2SUBri; + BuildMI(MBB, MBBI, dl, TII.get(SUBriOpc), ARM::SP) .addReg(FramePtr) .addImm(NumBytes) .addImm((unsigned)ARMCC::AL).addReg(0).addReg(0); - else - BuildMI(MBB, MBBI, dl, TII.get(getOpcode(ARMII::MOVr)), ARM::SP) + } else { + // Thumb2 or ARM. + unsigned MOVrOpc = isARM ? ARM::MOVr : ARM::t2MOVr; + BuildMI(MBB, MBBI, dl, TII.get(MOVrOpc), ARM::SP) .addReg(FramePtr) .addImm((unsigned)ARMCC::AL).addReg(0).addReg(0); + } } - } else if (NumBytes) { - emitSPUpdate(MBB, MBBI, TII, dl, NumBytes); - } + } else if (NumBytes) + emitSPUpdate(isARM, MBB, MBBI, dl, TII, NumBytes); // Move SP to start of integer callee save spill area 2. movePastCSLoadStoreOps(MBB, MBBI, ARM::FLDD, 0, 3, STI); - emitSPUpdate(MBB, MBBI, TII, dl, AFI->getDPRCalleeSavedAreaSize()); + emitSPUpdate(isARM, MBB, MBBI, dl, TII, AFI->getDPRCalleeSavedAreaSize()); // Move SP to start of integer callee save spill area 1. movePastCSLoadStoreOps(MBB, MBBI, ARM::LDR, ARM::t2LDRi12, 2, STI); - emitSPUpdate(MBB, MBBI, TII, dl, AFI->getGPRCalleeSavedArea2Size()); + emitSPUpdate(isARM, MBB, MBBI, dl, TII, AFI->getGPRCalleeSavedArea2Size()); // Move SP to SP upon entry to the function. movePastCSLoadStoreOps(MBB, MBBI, ARM::LDR, ARM::t2LDRi12, 1, STI); - emitSPUpdate(MBB, MBBI, TII, dl, AFI->getGPRCalleeSavedArea1Size()); + emitSPUpdate(isARM, MBB, MBBI, dl, TII, AFI->getGPRCalleeSavedArea1Size()); } if (VARegSaveSize) - emitSPUpdate(MBB, MBBI, TII, dl, VARegSaveSize); - + emitSPUpdate(isARM, MBB, MBBI, dl, TII, VARegSaveSize); } #include "ARMGenRegisterInfo.inc" Modified: llvm/trunk/lib/Target/ARM/ARMBaseRegisterInfo.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMBaseRegisterInfo.h?rev=77300&r1=77299&r2=77300&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMBaseRegisterInfo.h (original) +++ llvm/trunk/lib/Target/ARM/ARMBaseRegisterInfo.h Tue Jul 28 00:48:47 2009 @@ -126,28 +126,12 @@ MachineBasicBlock &MBB, MachineBasicBlock::iterator I) const; - // rewrite MI to access 'Offset' bytes from the FP. Return the offset that - // could not be handled directly in MI. - virtual int - rewriteFrameIndex(MachineInstr &MI, unsigned FrameRegIdx, - unsigned MOVOpc, unsigned ADDriOpc, unsigned SUBriOpc, - unsigned FrameReg, int Offset) const; - - virtual void - eliminateFrameIndex(MachineBasicBlock::iterator II, - int SPAdj, RegScavenger *RS = NULL) const { - eliminateFrameIndexImpl(II, ARM::MOVr, ARM::ADDri, ARM::SUBri, SPAdj, RS); - } + virtual void eliminateFrameIndex(MachineBasicBlock::iterator II, + int SPAdj, RegScavenger *RS = NULL) const; virtual void emitPrologue(MachineFunction &MF) const; virtual void emitEpilogue(MachineFunction &MF, MachineBasicBlock &MBB) const; -protected: - void - eliminateFrameIndexImpl(MachineBasicBlock::iterator II, - unsigned MOVOpc, unsigned ADDriOpc, unsigned SUBriOpc, - int SPAdj, RegScavenger *RS = NULL) const; - private: unsigned getRegisterPairEven(unsigned Reg, const MachineFunction &MF) const; Modified: llvm/trunk/lib/Target/ARM/ARMInstrInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMInstrInfo.cpp?rev=77300&r1=77299&r2=77300&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMInstrInfo.cpp (original) +++ llvm/trunk/lib/Target/ARM/ARMInstrInfo.cpp Tue Jul 28 00:48:47 2009 @@ -62,19 +62,6 @@ return 0; } -unsigned ARMInstrInfo:: -getOpcode(ARMII::Op Op) const { - switch (Op) { - case ARMII::ADDri: return ARM::ADDri; - case ARMII::MOVr: return ARM::MOVr; - case ARMII::SUBri: return ARM::SUBri; - default: - break; - } - - return 0; -} - bool ARMInstrInfo:: BlockHasNoFallThrough(const MachineBasicBlock &MBB) const { if (MBB.empty()) return false; Modified: llvm/trunk/lib/Target/ARM/ARMInstrInfo.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMInstrInfo.h?rev=77300&r1=77299&r2=77300&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMInstrInfo.h (original) +++ llvm/trunk/lib/Target/ARM/ARMInstrInfo.h Tue Jul 28 00:48:47 2009 @@ -32,9 +32,6 @@ // if there is not such an opcode. unsigned getUnindexedOpcode(unsigned Opc) const; - // Return the opcode that implements 'Op', or 0 if no opcode - unsigned getOpcode(ARMII::Op Op) const; - // Return true if the block does not fall through. bool BlockHasNoFallThrough(const MachineBasicBlock &MBB) const; Modified: llvm/trunk/lib/Target/ARM/ARMInstrThumb2.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMInstrThumb2.td?rev=77300&r1=77299&r2=77300&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMInstrThumb2.td (original) +++ llvm/trunk/lib/Target/ARM/ARMInstrThumb2.td Tue Jul 28 00:48:47 2009 @@ -428,21 +428,6 @@ (ins i32imm:$label, i32imm:$id, pred:$p), "adr$p.w $dst, #${label}_${id:no_hash}", []>; -// ADD rd, sp, #so_imm -def t2ADDrSPi : T2XI<(outs GPR:$dst), (ins GPR:$sp, t2_so_imm:$imm), - "add.w $dst, $sp, $imm", - []>; - -// ADD rd, sp, #imm12 -def t2ADDrSPi12 : T2XI<(outs GPR:$dst), (ins GPR:$sp, i32imm:$imm), - "addw $dst, $sp, $imm", - []>; - -def t2ADDrSPs : T2XI<(outs GPR:$dst), (ins GPR:$sp, t2_so_reg:$rhs), - "addw $dst, $sp, $rhs", - []>; - - //===----------------------------------------------------------------------===// // Load / store Instructions. // Modified: llvm/trunk/lib/Target/ARM/Thumb1InstrInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/Thumb1InstrInfo.cpp?rev=77300&r1=77299&r2=77300&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/Thumb1InstrInfo.cpp (original) +++ llvm/trunk/lib/Target/ARM/Thumb1InstrInfo.cpp Tue Jul 28 00:48:47 2009 @@ -30,18 +30,6 @@ return 0; } -unsigned Thumb1InstrInfo::getOpcode(ARMII::Op Op) const { - switch (Op) { - case ARMII::ADDri: return ARM::tADDi8; - case ARMII::MOVr: return ARM::tMOVr; - case ARMII::SUBri: return ARM::tSUBi8; - default: - break; - } - - return 0; -} - bool Thumb1InstrInfo::BlockHasNoFallThrough(const MachineBasicBlock &MBB) const { if (MBB.empty()) return false; Modified: llvm/trunk/lib/Target/ARM/Thumb1InstrInfo.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/Thumb1InstrInfo.h?rev=77300&r1=77299&r2=77300&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/Thumb1InstrInfo.h (original) +++ llvm/trunk/lib/Target/ARM/Thumb1InstrInfo.h Tue Jul 28 00:48:47 2009 @@ -31,9 +31,6 @@ // if there is not such an opcode. unsigned getUnindexedOpcode(unsigned Opc) const; - // Return the opcode that implements 'Op', or 0 if no opcode - unsigned getOpcode(ARMII::Op Op) const; - // Return true if the block does not fall through. bool BlockHasNoFallThrough(const MachineBasicBlock &MBB) const; Modified: llvm/trunk/lib/Target/ARM/Thumb1RegisterInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/Thumb1RegisterInfo.cpp?rev=77300&r1=77299&r2=77300&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/Thumb1RegisterInfo.cpp (original) +++ llvm/trunk/lib/Target/ARM/Thumb1RegisterInfo.cpp Tue Jul 28 00:48:47 2009 @@ -388,8 +388,8 @@ int Thumb1RegisterInfo:: rewriteFrameIndex(MachineInstr &MI, unsigned FrameRegIdx, - unsigned MOVOpc, unsigned ADDriOpc, unsigned SUBriOpc, - unsigned FrameReg, int Offset) const + unsigned FrameReg, int Offset, + unsigned MOVOpc, unsigned ADDriOpc, unsigned SUBriOpc) const { // if/when eliminateFrameIndex() conforms with ARMBaseRegisterInfo // version then can pull out Thumb1 specific parts here Modified: llvm/trunk/lib/Target/ARM/Thumb1RegisterInfo.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/Thumb1RegisterInfo.h?rev=77300&r1=77299&r2=77300&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/Thumb1RegisterInfo.h (original) +++ llvm/trunk/lib/Target/ARM/Thumb1RegisterInfo.h Tue Jul 28 00:48:47 2009 @@ -51,8 +51,8 @@ // rewrite MI to access 'Offset' bytes from the FP. Return the offset that // could not be handled directly in MI. int rewriteFrameIndex(MachineInstr &MI, unsigned FrameRegIdx, - unsigned MOVOpc, unsigned ADDriOpc, unsigned SUBriOpc, - unsigned FrameReg, int Offset) const; + unsigned FrameReg, int Offset, + unsigned MOVOpc, unsigned ADDriOpc, unsigned SUBriOpc) const; void eliminateFrameIndex(MachineBasicBlock::iterator II, int SPAdj, RegScavenger *RS = NULL) const; Modified: llvm/trunk/lib/Target/ARM/Thumb2InstrInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/Thumb2InstrInfo.cpp?rev=77300&r1=77299&r2=77300&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/Thumb2InstrInfo.cpp (original) +++ llvm/trunk/lib/Target/ARM/Thumb2InstrInfo.cpp Tue Jul 28 00:48:47 2009 @@ -13,6 +13,7 @@ #include "ARMInstrInfo.h" #include "ARM.h" +#include "ARMAddressingModes.h" #include "ARMGenInstrInfo.inc" #include "ARMMachineFunctionInfo.h" #include "llvm/CodeGen/MachineFrameInfo.h" @@ -31,18 +32,6 @@ return 0; } -unsigned Thumb2InstrInfo::getOpcode(ARMII::Op Op) const { - switch (Op) { - case ARMII::ADDri: return ARM::t2ADDri; - case ARMII::MOVr: return ARM::t2MOVr; - case ARMII::SUBri: return ARM::t2SUBri; - default: - break; - } - - return 0; -} - bool Thumb2InstrInfo::BlockHasNoFallThrough(const MachineBasicBlock &MBB) const { if (MBB.empty()) return false; @@ -124,3 +113,319 @@ ARMBaseInstrInfo::loadRegFromStackSlot(MBB, I, DestReg, FI, RC); } + + +void llvm::emitT2RegPlusImmediate(MachineBasicBlock &MBB, + MachineBasicBlock::iterator &MBBI, DebugLoc dl, + unsigned DestReg, unsigned BaseReg, int NumBytes, + ARMCC::CondCodes Pred, unsigned PredReg, + const ARMBaseInstrInfo &TII) { + bool isSub = NumBytes < 0; + if (isSub) NumBytes = -NumBytes; + + // If profitable, use a movw or movt to materialize the offset. + // FIXME: Use the scavenger to grab a scratch register. + if (DestReg != ARM::SP && DestReg != BaseReg && + NumBytes >= 4096 && + ARM_AM::getT2SOImmVal(NumBytes) == -1) { + bool Fits = false; + if (NumBytes < 65536) { + // Use a movw to materialize the 16-bit constant. + BuildMI(MBB, MBBI, dl, TII.get(ARM::t2MOVi16), DestReg) + .addImm(NumBytes) + .addImm((unsigned)Pred).addReg(PredReg).addReg(0); + Fits = true; + } else if ((NumBytes & 0xffff) == 0) { + // Use a movt to materialize the 32-bit constant. + BuildMI(MBB, MBBI, dl, TII.get(ARM::t2MOVTi16), DestReg) + .addReg(DestReg) + .addImm(NumBytes >> 16) + .addImm((unsigned)Pred).addReg(PredReg).addReg(0); + Fits = true; + } + + if (Fits) { + if (isSub) { + BuildMI(MBB, MBBI, dl, TII.get(ARM::t2SUBrr), DestReg) + .addReg(BaseReg, RegState::Kill) + .addReg(DestReg, RegState::Kill) + .addImm((unsigned)Pred).addReg(PredReg).addReg(0); + } else { + BuildMI(MBB, MBBI, dl, TII.get(ARM::t2ADDrr), DestReg) + .addReg(DestReg, RegState::Kill) + .addReg(BaseReg, RegState::Kill) + .addImm((unsigned)Pred).addReg(PredReg).addReg(0); + } + return; + } + } + + while (NumBytes) { + unsigned Opc = isSub ? ARM::t2SUBri : ARM::t2ADDri; + unsigned ThisVal = NumBytes; + if (ARM_AM::getT2SOImmVal(NumBytes) != -1) { + NumBytes = 0; + } else if (ThisVal < 4096) { + Opc = isSub ? ARM::t2SUBri12 : ARM::t2ADDri12; + NumBytes = 0; + } else { + // FIXME: Move this to ARMAddressingModes.h? + unsigned RotAmt = CountLeadingZeros_32(ThisVal); + ThisVal = ThisVal & ARM_AM::rotr32(0xff000000U, RotAmt); + NumBytes &= ~ThisVal; + assert(ARM_AM::getT2SOImmVal(ThisVal) != -1 && + "Bit extraction didn't work?"); + } + + // Build the new ADD / SUB. + BuildMI(MBB, MBBI, dl, TII.get(Opc), DestReg) + .addReg(BaseReg, RegState::Kill).addImm(ThisVal) + .addImm((unsigned)Pred).addReg(PredReg).addReg(0); + BaseReg = DestReg; + } +} + +static unsigned +negativeOffsetOpcode(unsigned opcode) +{ + switch (opcode) { + case ARM::t2LDRi12: return ARM::t2LDRi8; + case ARM::t2LDRHi12: return ARM::t2LDRHi8; + case ARM::t2LDRBi12: return ARM::t2LDRBi8; + case ARM::t2LDRSHi12: return ARM::t2LDRSHi8; + case ARM::t2LDRSBi12: return ARM::t2LDRSBi8; + case ARM::t2STRi12: return ARM::t2STRi8; + case ARM::t2STRBi12: return ARM::t2STRBi8; + case ARM::t2STRHi12: return ARM::t2STRHi8; + + case ARM::t2LDRi8: + case ARM::t2LDRHi8: + case ARM::t2LDRBi8: + case ARM::t2LDRSHi8: + case ARM::t2LDRSBi8: + case ARM::t2STRi8: + case ARM::t2STRBi8: + case ARM::t2STRHi8: + return opcode; + + default: + break; + } + + return 0; +} + +static unsigned +positiveOffsetOpcode(unsigned opcode) +{ + switch (opcode) { + case ARM::t2LDRi8: return ARM::t2LDRi12; + case ARM::t2LDRHi8: return ARM::t2LDRHi12; + case ARM::t2LDRBi8: return ARM::t2LDRBi12; + case ARM::t2LDRSHi8: return ARM::t2LDRSHi12; + case ARM::t2LDRSBi8: return ARM::t2LDRSBi12; + case ARM::t2STRi8: return ARM::t2STRi12; + case ARM::t2STRBi8: return ARM::t2STRBi12; + case ARM::t2STRHi8: return ARM::t2STRHi12; + + case ARM::t2LDRi12: + case ARM::t2LDRHi12: + case ARM::t2LDRBi12: + case ARM::t2LDRSHi12: + case ARM::t2LDRSBi12: + case ARM::t2STRi12: + case ARM::t2STRBi12: + case ARM::t2STRHi12: + return opcode; + + default: + break; + } + + return 0; +} + +static unsigned +immediateOffsetOpcode(unsigned opcode) +{ + switch (opcode) { + case ARM::t2LDRs: return ARM::t2LDRi12; + case ARM::t2LDRHs: return ARM::t2LDRHi12; + case ARM::t2LDRBs: return ARM::t2LDRBi12; + case ARM::t2LDRSHs: return ARM::t2LDRSHi12; + case ARM::t2LDRSBs: return ARM::t2LDRSBi12; + case ARM::t2STRs: return ARM::t2STRi12; + case ARM::t2STRBs: return ARM::t2STRBi12; + case ARM::t2STRHs: return ARM::t2STRHi12; + + case ARM::t2LDRi12: + case ARM::t2LDRHi12: + case ARM::t2LDRBi12: + case ARM::t2LDRSHi12: + case ARM::t2LDRSBi12: + case ARM::t2STRi12: + case ARM::t2STRBi12: + case ARM::t2STRHi12: + case ARM::t2LDRi8: + case ARM::t2LDRHi8: + case ARM::t2LDRBi8: + case ARM::t2LDRSHi8: + case ARM::t2LDRSBi8: + case ARM::t2STRi8: + case ARM::t2STRBi8: + case ARM::t2STRHi8: + return opcode; + + default: + break; + } + + return 0; +} + +int llvm::rewriteT2FrameIndex(MachineInstr &MI, unsigned FrameRegIdx, + unsigned FrameReg, int Offset, + const ARMBaseInstrInfo &TII) { + unsigned Opcode = MI.getOpcode(); + unsigned NewOpc = Opcode; + const TargetInstrDesc &Desc = MI.getDesc(); + unsigned AddrMode = (Desc.TSFlags & ARMII::AddrModeMask); + bool isSub = false; + + // Memory operands in inline assembly always use AddrModeT2_i12. + if (Opcode == ARM::INLINEASM) + AddrMode = ARMII::AddrModeT2_i12; // FIXME. mode for thumb2? + + if (Opcode == ARM::t2ADDri || Opcode == ARM::t2ADDri12) { + Offset += MI.getOperand(FrameRegIdx+1).getImm(); + if (Offset == 0) { + // Turn it into a move. + MI.setDesc(TII.get(ARM::t2MOVr)); + MI.getOperand(FrameRegIdx).ChangeToRegister(FrameReg, false); + MI.RemoveOperand(FrameRegIdx+1); + return 0; + } + + if (Offset < 0) { + Offset = -Offset; + isSub = true; + MI.setDesc(TII.get(ARM::t2SUBri)); + } + + // Common case: small offset, fits into instruction. + if (ARM_AM::getT2SOImmVal(Offset) != -1) { + NewOpc = isSub ? ARM::t2SUBri : ARM::t2ADDri; + if (NewOpc != Opcode) + MI.setDesc(TII.get(NewOpc)); + MI.getOperand(FrameRegIdx).ChangeToRegister(FrameReg, false); + MI.getOperand(FrameRegIdx+1).ChangeToImmediate(Offset); + return 0; + } + // Another common case: imm12. + if (Offset < 4096) { + NewOpc = isSub ? ARM::t2SUBri12 : ARM::t2ADDri12; + if (NewOpc != Opcode) + MI.setDesc(TII.get(NewOpc)); + MI.getOperand(FrameRegIdx).ChangeToRegister(FrameReg, false); + MI.getOperand(FrameRegIdx+1).ChangeToImmediate(Offset); + return 0; + } + + // Otherwise, extract 8 adjacent bits from the immediate into this + // t2ADDri/t2SUBri. + unsigned RotAmt = CountLeadingZeros_32(Offset); + unsigned ThisImmVal = Offset & ARM_AM::rotr32(0xff000000U, RotAmt); + + // We will handle these bits from offset, clear them. + Offset &= ~ThisImmVal; + + assert(ARM_AM::getT2SOImmVal(ThisImmVal) != -1 && + "Bit extraction didn't work?"); + MI.getOperand(FrameRegIdx+1).ChangeToImmediate(ThisImmVal); + } else { + // AddrModeT2_so cannot handle any offset. If there is no offset + // register then we change to an immediate version. + NewOpc = Opcode; + if (AddrMode == ARMII::AddrModeT2_so) { + unsigned OffsetReg = MI.getOperand(FrameRegIdx+1).getReg(); + if (OffsetReg != 0) { + MI.getOperand(FrameRegIdx).ChangeToRegister(FrameReg, false); + return Offset; + } + + MI.RemoveOperand(FrameRegIdx+1); + MI.getOperand(FrameRegIdx+1).ChangeToImmediate(0); + NewOpc = immediateOffsetOpcode(Opcode); + AddrMode = ARMII::AddrModeT2_i12; + } + + unsigned NumBits = 0; + unsigned Scale = 1; + if (AddrMode == ARMII::AddrModeT2_i8 || AddrMode == ARMII::AddrModeT2_i12) { + // i8 supports only negative, and i12 supports only positive, so + // based on Offset sign convert Opcode to the appropriate + // instruction + Offset += MI.getOperand(FrameRegIdx+1).getImm(); + if (Offset < 0) { + NewOpc = negativeOffsetOpcode(Opcode); + NumBits = 8; + isSub = true; + Offset = -Offset; + } else { + NewOpc = positiveOffsetOpcode(Opcode); + NumBits = 12; + } + } else { + // VFP address modes. + assert(AddrMode == ARMII::AddrMode5); + int InstrOffs=ARM_AM::getAM5Offset(MI.getOperand(FrameRegIdx+1).getImm()); + if (ARM_AM::getAM5Op(MI.getOperand(FrameRegIdx+1).getImm()) ==ARM_AM::sub) + InstrOffs *= -1; + NumBits = 8; + Scale = 4; + Offset += InstrOffs * 4; + assert((Offset & (Scale-1)) == 0 && "Can't encode this offset!"); + if (Offset < 0) { + Offset = -Offset; + isSub = true; + } + } + + if (NewOpc != Opcode) + MI.setDesc(TII.get(NewOpc)); + + MachineOperand &ImmOp = MI.getOperand(FrameRegIdx+1); + + // Attempt to fold address computation + // Common case: small offset, fits into instruction. + int ImmedOffset = Offset / Scale; + unsigned Mask = (1 << NumBits) - 1; + if ((unsigned)Offset <= Mask * Scale) { + // Replace the FrameIndex with fp/sp + MI.getOperand(FrameRegIdx).ChangeToRegister(FrameReg, false); + if (isSub) { + if (AddrMode == ARMII::AddrMode5) + // FIXME: Not consistent. + ImmedOffset |= 1 << NumBits; + else + ImmedOffset = -ImmedOffset; + } + ImmOp.ChangeToImmediate(ImmedOffset); + return 0; + } + + // Otherwise, offset doesn't fit. Pull in what we can to simplify + ImmedOffset = Offset & Mask; + if (isSub) { + if (AddrMode == ARMII::AddrMode5) + // FIXME: Not consistent. + ImmedOffset |= 1 << NumBits; + else + ImmedOffset = -ImmedOffset; + } + ImmOp.ChangeToImmediate(ImmedOffset); + Offset &= ~(Mask*Scale); + } + + return (isSub) ? -Offset : Offset; +} Modified: llvm/trunk/lib/Target/ARM/Thumb2InstrInfo.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/Thumb2InstrInfo.h?rev=77300&r1=77299&r2=77300&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/Thumb2InstrInfo.h (original) +++ llvm/trunk/lib/Target/ARM/Thumb2InstrInfo.h Tue Jul 28 00:48:47 2009 @@ -31,9 +31,6 @@ // if there is not such an opcode. unsigned getUnindexedOpcode(unsigned Opc) const; - // Return the opcode that implements 'Op', or 0 if no opcode - unsigned getOpcode(ARMII::Op Op) const; - // Return true if the block does not fall through. bool BlockHasNoFallThrough(const MachineBasicBlock &MBB) const; Modified: llvm/trunk/lib/Target/ARM/Thumb2RegisterInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/Thumb2RegisterInfo.cpp?rev=77300&r1=77299&r2=77300&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/Thumb2RegisterInfo.cpp (original) +++ llvm/trunk/lib/Target/ARM/Thumb2RegisterInfo.cpp Tue Jul 28 00:48:47 2009 @@ -60,218 +60,7 @@ .addConstantPoolIndex(Idx).addImm((int64_t)ARMCC::AL).addReg(0); } -static unsigned -negativeOffsetOpcode(unsigned opcode) -{ - switch (opcode) { - case ARM::t2LDRi12: return ARM::t2LDRi8; - case ARM::t2LDRHi12: return ARM::t2LDRHi8; - case ARM::t2LDRBi12: return ARM::t2LDRBi8; - case ARM::t2LDRSHi12: return ARM::t2LDRSHi8; - case ARM::t2LDRSBi12: return ARM::t2LDRSBi8; - case ARM::t2STRi12: return ARM::t2STRi8; - case ARM::t2STRBi12: return ARM::t2STRBi8; - case ARM::t2STRHi12: return ARM::t2STRHi8; - - case ARM::t2LDRi8: - case ARM::t2LDRHi8: - case ARM::t2LDRBi8: - case ARM::t2LDRSHi8: - case ARM::t2LDRSBi8: - case ARM::t2STRi8: - case ARM::t2STRBi8: - case ARM::t2STRHi8: - return opcode; - - default: - break; - } - - return 0; -} - -static unsigned -positiveOffsetOpcode(unsigned opcode) -{ - switch (opcode) { - case ARM::t2LDRi8: return ARM::t2LDRi12; - case ARM::t2LDRHi8: return ARM::t2LDRHi12; - case ARM::t2LDRBi8: return ARM::t2LDRBi12; - case ARM::t2LDRSHi8: return ARM::t2LDRSHi12; - case ARM::t2LDRSBi8: return ARM::t2LDRSBi12; - case ARM::t2STRi8: return ARM::t2STRi12; - case ARM::t2STRBi8: return ARM::t2STRBi12; - case ARM::t2STRHi8: return ARM::t2STRHi12; - - case ARM::t2LDRi12: - case ARM::t2LDRHi12: - case ARM::t2LDRBi12: - case ARM::t2LDRSHi12: - case ARM::t2LDRSBi12: - case ARM::t2STRi12: - case ARM::t2STRBi12: - case ARM::t2STRHi12: - return opcode; - - default: - break; - } - - return 0; -} - -static unsigned -immediateOffsetOpcode(unsigned opcode) -{ - switch (opcode) { - case ARM::t2LDRs: return ARM::t2LDRi12; - case ARM::t2LDRHs: return ARM::t2LDRHi12; - case ARM::t2LDRBs: return ARM::t2LDRBi12; - case ARM::t2LDRSHs: return ARM::t2LDRSHi12; - case ARM::t2LDRSBs: return ARM::t2LDRSBi12; - case ARM::t2STRs: return ARM::t2STRi12; - case ARM::t2STRBs: return ARM::t2STRBi12; - case ARM::t2STRHs: return ARM::t2STRHi12; - - case ARM::t2LDRi12: - case ARM::t2LDRHi12: - case ARM::t2LDRBi12: - case ARM::t2LDRSHi12: - case ARM::t2LDRSBi12: - case ARM::t2STRi12: - case ARM::t2STRBi12: - case ARM::t2STRHi12: - case ARM::t2LDRi8: - case ARM::t2LDRHi8: - case ARM::t2LDRBi8: - case ARM::t2LDRSHi8: - case ARM::t2LDRSBi8: - case ARM::t2STRi8: - case ARM::t2STRBi8: - case ARM::t2STRHi8: - return opcode; - - default: - break; - } - - return 0; -} - bool Thumb2RegisterInfo:: requiresRegisterScavenging(const MachineFunction &MF) const { return true; } - -int Thumb2RegisterInfo:: -rewriteFrameIndex(MachineInstr &MI, unsigned FrameRegIdx, - unsigned MOVOpc, unsigned ADDriOpc, unsigned SUBriOpc, - unsigned FrameReg, int Offset) const -{ - unsigned Opcode = MI.getOpcode(); - const TargetInstrDesc &Desc = MI.getDesc(); - unsigned AddrMode = (Desc.TSFlags & ARMII::AddrModeMask); - bool isSub = false; - - // Memory operands in inline assembly always use AddrModeT2_i12 - if (Opcode == ARM::INLINEASM) - AddrMode = ARMII::AddrModeT2_i12; // FIXME. mode for thumb2? - - if (Opcode == ADDriOpc) { - Offset += MI.getOperand(FrameRegIdx+1).getImm(); - if (Offset == 0) { - // Turn it into a move. - MI.setDesc(TII.get(MOVOpc)); - MI.getOperand(FrameRegIdx).ChangeToRegister(FrameReg, false); - MI.RemoveOperand(FrameRegIdx+1); - return 0; - } else if (Offset < 0) { - Offset = -Offset; - isSub = true; - MI.setDesc(TII.get(SUBriOpc)); - } - - // Common case: small offset, fits into instruction. - if (ARM_AM::getT2SOImmVal(Offset) != -1) { - // Replace the FrameIndex with sp / fp - MI.getOperand(FrameRegIdx).ChangeToRegister(FrameReg, false); - MI.getOperand(FrameRegIdx+1).ChangeToImmediate(Offset); - return 0; - } - - // Otherwise, extract 8 adjacent bits from the immediate into this - // t2ADDri/t2SUBri. - unsigned RotAmt = CountLeadingZeros_32(Offset); - if (RotAmt > 24) - RotAmt = 24; - unsigned ThisImmVal = Offset & ARM_AM::rotr32(0xff000000U, RotAmt); - - // We will handle these bits from offset, clear them. - Offset &= ~ThisImmVal; - - assert(ARM_AM::getT2SOImmVal(ThisImmVal) != -1 && - "Bit extraction didn't work?"); - MI.getOperand(FrameRegIdx+1).ChangeToImmediate(ThisImmVal); - } else { - // AddrModeT2_so cannot handle any offset. If there is no offset - // register then we change to an immediate version. - if (AddrMode == ARMII::AddrModeT2_so) { - unsigned OffsetReg = MI.getOperand(FrameRegIdx+1).getReg(); - if (OffsetReg != 0) { - MI.getOperand(FrameRegIdx).ChangeToRegister(FrameReg, false); - return Offset; - } - - MI.RemoveOperand(FrameRegIdx+1); - MI.getOperand(FrameRegIdx+1).ChangeToImmediate(0); - Opcode = immediateOffsetOpcode(Opcode); - AddrMode = ARMII::AddrModeT2_i12; - } - - // Neon and FP address modes are handled by the base ARM version... - if ((AddrMode != ARMII::AddrModeT2_i8) && - (AddrMode != ARMII::AddrModeT2_i12)) { - return ARMBaseRegisterInfo::rewriteFrameIndex(MI, FrameRegIdx, - ARM::t2MOVr, ARM::t2ADDri, ARM::t2SUBri, FrameReg, Offset); - } - - unsigned NumBits = 0; - Offset += MI.getOperand(FrameRegIdx+1).getImm(); - - // i8 supports only negative, and i12 supports only positive, so - // based on Offset sign convert Opcode to the appropriate - // instruction - if (Offset < 0) { - Opcode = negativeOffsetOpcode(Opcode); - NumBits = 8; - isSub = true; - Offset = -Offset; - } - else { - Opcode = positiveOffsetOpcode(Opcode); - NumBits = 12; - } - - if (Opcode) { - MI.setDesc(TII.get(Opcode)); - MachineOperand &ImmOp = MI.getOperand(FrameRegIdx+1); - - // Attempt to fold address computation - // Common case: small offset, fits into instruction. - unsigned Mask = (1 << NumBits) - 1; - if ((unsigned)Offset <= Mask) { - // Replace the FrameIndex with fp/sp - MI.getOperand(FrameRegIdx).ChangeToRegister(FrameReg, false); - ImmOp.ChangeToImmediate((isSub) ? -Offset : Offset); - return 0; - } - - // Otherwise, offset doesn't fit. Pull in what we can to simplify - unsigned ImmedOffset = Offset & Mask; - ImmOp.ChangeToImmediate((isSub) ? -ImmedOffset : ImmedOffset); - Offset &= ~Mask; - } - } - - return (isSub) ? -Offset : Offset; -} Modified: llvm/trunk/lib/Target/ARM/Thumb2RegisterInfo.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/Thumb2RegisterInfo.h?rev=77300&r1=77299&r2=77300&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/Thumb2RegisterInfo.h (original) +++ llvm/trunk/lib/Target/ARM/Thumb2RegisterInfo.h Tue Jul 28 00:48:47 2009 @@ -37,19 +37,6 @@ unsigned PredReg = 0) const; bool requiresRegisterScavenging(const MachineFunction &MF) const; - - // rewrite MI to access 'Offset' bytes from the FP. Return the offset that - // could not be handled directly in MI. - virtual int - rewriteFrameIndex(MachineInstr &MI, unsigned FrameRegIdx, - unsigned MOVOpc, unsigned ADDriOpc, unsigned SUBriOpc, - unsigned FrameReg, int Offset) const; - - void eliminateFrameIndex(MachineBasicBlock::iterator II, - int SPAdj, RegScavenger *RS = NULL) const { - ARMBaseRegisterInfo::eliminateFrameIndexImpl(II, ARM::t2MOVr, ARM::t2ADDri, - ARM::t2SUBri, SPAdj, RS); - } }; } Added: llvm/trunk/test/CodeGen/Thumb2/large-stack.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Thumb2/large-stack.ll?rev=77300&view=auto ============================================================================== --- llvm/trunk/test/CodeGen/Thumb2/large-stack.ll (added) +++ llvm/trunk/test/CodeGen/Thumb2/large-stack.ll Tue Jul 28 00:48:47 2009 @@ -0,0 +1,28 @@ +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | FileCheck %s + +define void @test1() { +; CHECK: test1: +; CHECK: sub.w sp, sp, #256 + %tmp = alloca [ 64 x i32 ] , align 4 + ret void +} + +define void @test2() { +; CHECK: test2: +; CHECK: sub.w sp, sp, #4160 +; CHECK: sub.w sp, sp, #8 + %tmp = alloca [ 4168 x i8 ] , align 4 + ret void +} + +define i32 @test3() { +; CHECK: test3: +; CHECK: sub.w sp, sp, #805306368 +; CHECK: sub.w sp, sp, #16 + %retval = alloca i32, align 4 + %tmp = alloca i32, align 4 + %a = alloca [805306369 x i8], align 16 + store i32 0, i32* %tmp + %tmp1 = load i32* %tmp + ret i32 %tmp1 +} From evan.cheng at apple.com Tue Jul 28 00:51:33 2009 From: evan.cheng at apple.com (Evan Cheng) Date: Mon, 27 Jul 2009 22:51:33 -0700 Subject: [llvm-commits] [PATCH] Analog Devices Blackfin back-end In-Reply-To: <764D793B-7F49-46C2-8063-4CE1D054EA31@2pi.dk> References: <764D793B-7F49-46C2-8063-4CE1D054EA31@2pi.dk> Message-ID: <601FEF27-B417-4526-AB77-599B64B5B51C@apple.com> Hi Jakob, Sorry I haven't found the time to look at the patch. Things have been crazy. I'll try to get to it soon. If not, please ping me again in a few days. :-) Evan On Jul 23, 2009, at 11:48 PM, Jakob Stoklund Olesen wrote: > Hi, > > Finally my blackfin back-end is ready to be included in the main > tree. It is still experimental. I have compiled most of CodeGen/ > Generic as well as my own test cases. The blackfin assembler (bfin- > elf-as) is happy with the output, but I have not yet tested it on > real hardware. I have access to blackfin hardware, so I can do that > later. There is a GNU tool-chain at http://blackfin.uclinux.org/ > > I have some XFAIL test cases. They are: > > - RegisterScavenger asserts caused by the heavy use if sub-registers. > - Readcyclecounter failing because it wants to return an illegal i64. > - Illegal i16 logic operations introduced after LegalizeOps. > > These issues will be easier to fix after the back-end goes in. Then > I can make test cases at the same time. > > The Blackfin DSP has some features that have stressed the code > generator quite a bit: > > - It has more register classes that any other target. Fortunately > register class support has improved a lot since 2.5. > - Some register class constraints are not yet supported. For > instance there are two ADD variants: D=D+D and P=P+P. > - The legal types are i16 and i32, but i16 is quite limited in the > number of supported operations. This has caused a lot of fun with > the DAG combiner. > - Sub-register operations are used a lot more than on X86. > > Some things are simply not implemented yet, like hardware loops and > circular buffer addressing. > > I hope you will consider this for inclusion in the tree. > > Best regards, > /jakob > > blackfin.patch>_______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From evan.cheng at apple.com Tue Jul 28 01:24:13 2009 From: evan.cheng at apple.com (Evan Cheng) Date: Tue, 28 Jul 2009 06:24:13 -0000 Subject: [llvm-commits] [llvm] r77301 - /llvm/trunk/lib/Target/ARM/ARMBaseRegisterInfo.cpp Message-ID: <200907280624.n6S6OD4A005754@zion.cs.uiuc.edu> Author: evancheng Date: Tue Jul 28 01:24:12 2009 New Revision: 77301 URL: http://llvm.org/viewvc/llvm-project?rev=77301&view=rev Log: Code clean up. No functionality changes. Modified: llvm/trunk/lib/Target/ARM/ARMBaseRegisterInfo.cpp Modified: llvm/trunk/lib/Target/ARM/ARMBaseRegisterInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMBaseRegisterInfo.cpp?rev=77301&r1=77300&r2=77301&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMBaseRegisterInfo.cpp (original) +++ llvm/trunk/lib/Target/ARM/ARMBaseRegisterInfo.cpp Tue Jul 28 01:24:12 2009 @@ -439,6 +439,7 @@ MFI->isFrameAddressTaken()); } +/// estimateStackSize - Estimate and return the size of the frame. static unsigned estimateStackSize(MachineFunction &MF, MachineFrameInfo *MFI) { const MachineFrameInfo *FFI = MF.getFrameInfo(); int Offset = 0; @@ -457,6 +458,36 @@ return (unsigned)Offset; } +/// estimateRSStackSizeLimit - Look at each instruction that references stack +/// frames and return the stack size limit beyond which some of these +/// instructions will require scratch register during their expansion later. +static unsigned estimateRSStackSizeLimit(MachineFunction &MF, + const ARMBaseInstrInfo &TII) { + unsigned Limit = (1 << 12) - 1; + for (MachineFunction::iterator BB = MF.begin(),E = MF.end();BB != E; ++BB) { + for (MachineBasicBlock::iterator I= BB->begin(); I != BB->end(); ++I) { + for (unsigned i = 0, e = I->getNumOperands(); i != e; ++i) + if (I->getOperand(i).isFI()) { + unsigned Opcode = I->getOpcode(); + const TargetInstrDesc &Desc = TII.get(Opcode); + unsigned AddrMode = (Desc.TSFlags & ARMII::AddrModeMask); + if (AddrMode == ARMII::AddrMode3 || + AddrMode == ARMII::AddrModeT2_i8) { + return (1 << 8) - 1; + } else if (AddrMode == ARMII::AddrMode5 || + AddrMode == ARMII::AddrModeT2_i8s4) { + unsigned ThisLimit = ((1 << 8) - 1) * 4; + if (ThisLimit < Limit) + Limit = ThisLimit; + } + break; // At most one FI per instruction + } + } + } + + return Limit; +} + void ARMBaseRegisterInfo::processFunctionBeforeCalleeSavedScan(MachineFunction &MF, RegScavenger *RS) const { @@ -609,27 +640,7 @@ // register scavenging. if (RS && !ExtraCSSpill && !AFI->isThumb1OnlyFunction()) { MachineFrameInfo *MFI = MF.getFrameInfo(); - unsigned Size = estimateStackSize(MF, MFI); - unsigned Limit = (1 << 12) - 1; - for (MachineFunction::iterator BB = MF.begin(),E = MF.end();BB != E; ++BB) - for (MachineBasicBlock::iterator I= BB->begin(); I != BB->end(); ++I) { - for (unsigned i = 0, e = I->getNumOperands(); i != e; ++i) - if (I->getOperand(i).isFI()) { - unsigned Opcode = I->getOpcode(); - const TargetInstrDesc &Desc = TII.get(Opcode); - unsigned AddrMode = (Desc.TSFlags & ARMII::AddrModeMask); - if (AddrMode == ARMII::AddrMode3) { - Limit = (1 << 8) - 1; - goto DoneEstimating; - } else if (AddrMode == ARMII::AddrMode5) { - unsigned ThisLimit = ((1 << 8) - 1) * 4; - if (ThisLimit < Limit) - Limit = ThisLimit; - } - } - } - DoneEstimating: - if (Size >= Limit) { + if (estimateStackSize(MF, MFI) >= estimateRSStackSizeLimit(MF, TII)) { // If any non-reserved CS register isn't spilled, just spill one or two // extra. That should take care of it! unsigned NumExtras = TargetAlign / 4; From stoklund at 2pi.dk Tue Jul 28 01:29:00 2009 From: stoklund at 2pi.dk (Jakob Stoklund Olesen) Date: Tue, 28 Jul 2009 08:29:00 +0200 Subject: [llvm-commits] [PATCH] Analog Devices Blackfin back-end In-Reply-To: <601FEF27-B417-4526-AB77-599B64B5B51C@apple.com> References: <764D793B-7F49-46C2-8063-4CE1D054EA31@2pi.dk> <601FEF27-B417-4526-AB77-599B64B5B51C@apple.com> Message-ID: <44CE24C5-DA8B-4B6A-AD00-205678E47CF1@2pi.dk> On 28/07/2009, at 07.51, Evan Cheng wrote: > Sorry I haven't found the time to look at the patch. Things have been > crazy. > > I'll try to get to it soon. If not, please ping me again in a few > days. :-) Not to worry. I won't let you forget ;-) Of course, immediately after I submitted the patch, the back-end API changed. Twice. I have attached a new patch that goes on top of the old one to deal with the new API. Let me know if you prefer a cumulative patch. It is 200K, so I will spare the list bandwidth for now. Thanks for taking the time to review this. /jakob -------------- next part -------------- A non-text attachment was scrubbed... Name: upd-blackfin.patch Type: application/octet-stream Size: 7848 bytes Desc: not available Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20090728/30d9e273/attachment.obj -------------- next part -------------- From nicholas at mxc.ca Tue Jul 28 01:53:50 2009 From: nicholas at mxc.ca (Nick Lewycky) Date: Tue, 28 Jul 2009 06:53:50 -0000 Subject: [llvm-commits] [llvm] r77304 - /llvm/trunk/tools/lto/LTOModule.cpp Message-ID: <200907280653.n6S6rok5006594@zion.cs.uiuc.edu> Author: nicholas Date: Tue Jul 28 01:53:50 2009 New Revision: 77304 URL: http://llvm.org/viewvc/llvm-project?rev=77304&view=rev Log: Remove memory corruption bug. string.c_str() was returning a temporary that was dead before we used it. 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=77304&r1=77303&r2=77304&view=diff ============================================================================== --- llvm/trunk/tools/lto/LTOModule.cpp (original) +++ llvm/trunk/tools/lto/LTOModule.cpp Tue Jul 28 01:53:50 2009 @@ -409,7 +409,7 @@ if (isa(decl)) return; - const char* name = mangler.getMangledName(decl).c_str(); + std::string name = mangler.getMangledName(decl); // we already have the symbol if (_undefines.find(name) != _undefines.end()) @@ -417,7 +417,7 @@ NameAndAttributes info; // string is owned by _undefines - info.name = ::strdup(name); + info.name = ::strdup(name.c_str()); if (decl->hasExternalWeakLinkage()) info.attributes = LTO_SYMBOL_DEFINITION_WEAKUNDEF; else From evan.cheng at apple.com Tue Jul 28 02:38:38 2009 From: evan.cheng at apple.com (Evan Cheng) Date: Tue, 28 Jul 2009 07:38:38 -0000 Subject: [llvm-commits] [llvm] r77305 - in /llvm/trunk: lib/Target/ARM/Thumb1RegisterInfo.cpp test/CodeGen/Thumb/2009-07-27-PEIAssert.ll Message-ID: <200907280738.n6S7cc4N009885@zion.cs.uiuc.edu> Author: evancheng Date: Tue Jul 28 02:38:35 2009 New Revision: 77305 URL: http://llvm.org/viewvc/llvm-project?rev=77305&view=rev Log: tADDrSPI doesn't have a predicate operand, but tADDhirr and tADDi3 have. Added: llvm/trunk/test/CodeGen/Thumb/2009-07-27-PEIAssert.ll Modified: llvm/trunk/lib/Target/ARM/Thumb1RegisterInfo.cpp Modified: llvm/trunk/lib/Target/ARM/Thumb1RegisterInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/Thumb1RegisterInfo.cpp?rev=77305&r1=77304&r2=77305&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/Thumb1RegisterInfo.cpp (original) +++ llvm/trunk/lib/Target/ARM/Thumb1RegisterInfo.cpp Tue Jul 28 02:38:35 2009 @@ -505,9 +505,14 @@ // r0 = -imm (this is then translated into a series of instructons) // r0 = add r0, sp emitThumbConstant(MBB, II, DestReg, Offset, TII, *this, dl); + MI.setDesc(TII.get(ARM::tADDhirr)); MI.getOperand(i).ChangeToRegister(DestReg, false, false, true); MI.getOperand(i+1).ChangeToRegister(FrameReg, false); + if (Opcode == ARM::tADDi3) { + MachineInstrBuilder MIB(&MI); + AddDefaultPred(MIB); + } } return; } else { Added: llvm/trunk/test/CodeGen/Thumb/2009-07-27-PEIAssert.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Thumb/2009-07-27-PEIAssert.ll?rev=77305&view=auto ============================================================================== --- llvm/trunk/test/CodeGen/Thumb/2009-07-27-PEIAssert.ll (added) +++ llvm/trunk/test/CodeGen/Thumb/2009-07-27-PEIAssert.ll Tue Jul 28 02:38:35 2009 @@ -0,0 +1,26 @@ +; RUN: llvm-as < %s | llc -mtriple=thumbv6-apple-darwin -relocation-model=pic -disable-fp-elim + + %struct.LinkList = type { i32, %struct.LinkList* } + %struct.List = type { i32, i32* } + at llvm.used = appending global [1 x i8*] [i8* bitcast (i32 ()* @main to i8*)], section "llvm.metadata" ; <[1 x i8*]*> [#uses=0] + +define arm_apcscc i32 @main() nounwind { +entry: + %ll = alloca %struct.LinkList*, align 4 ; <%struct.LinkList**> [#uses=1] + %0 = call arm_apcscc i32 @ReadList(%struct.LinkList** %ll, %struct.List** null) nounwind ; [#uses=1] + switch i32 %0, label %bb5 [ + i32 7, label %bb4 + i32 42, label %bb3 + ] + +bb3: ; preds = %entry + ret i32 1 + +bb4: ; preds = %entry + ret i32 0 + +bb5: ; preds = %entry + ret i32 1 +} + +declare arm_apcscc i32 @ReadList(%struct.LinkList** nocapture, %struct.List** nocapture) nounwind From benny.kra at googlemail.com Tue Jul 28 05:47:05 2009 From: benny.kra at googlemail.com (Benjamin Kramer) Date: Tue, 28 Jul 2009 12:47:05 +0200 Subject: [llvm-commits] [patch] make Program::FindProgramByName not look in "." unless it's in $PATH In-Reply-To: References: Message-ID: <4A6ED729.1080005@googlemail.com> Sorry, I've sent this to the wrong list. Dan Gohman writes: > The traditional behavior of sh(1) and friends is to use the given > path verbatim if it contains any slashes, not just if it's > absolute. Here's a patch which tries to match that behavior. I'm not touching windows though, cmd.exe assumes that "." is always in %PATH%. -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: programm-path-sh.patch Url: http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20090728/db9eb515/attachment.pl From stefanus.dutoit at rapidmind.com Tue Jul 28 08:41:32 2009 From: stefanus.dutoit at rapidmind.com (Stefanus Du Toit) Date: Tue, 28 Jul 2009 13:41:32 -0000 Subject: [llvm-commits] [llvm] r77317 - in /llvm/trunk/include/llvm/Support: DataTypes.h.cmake DataTypes.h.in Message-ID: <200907281341.n6SDfasF031265@zion.cs.uiuc.edu> Author: sdt Date: Tue Jul 28 08:41:07 2009 New Revision: 77317 URL: http://llvm.org/viewvc/llvm-project?rev=77317&view=rev Log: Include cmath/math.h in DataTypes.h regardless of whether MSVC is being used. Fixes MSVC build of LiveInterval.cpp. Patch by Nicolas Capens. Modified: llvm/trunk/include/llvm/Support/DataTypes.h.cmake llvm/trunk/include/llvm/Support/DataTypes.h.in Modified: llvm/trunk/include/llvm/Support/DataTypes.h.cmake URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/DataTypes.h.cmake?rev=77317&r1=77316&r2=77317&view=diff ============================================================================== --- llvm/trunk/include/llvm/Support/DataTypes.h.cmake (original) +++ llvm/trunk/include/llvm/Support/DataTypes.h.cmake Tue Jul 28 08:41:07 2009 @@ -30,6 +30,12 @@ // FIXME: UGLY HACK (Added by Kevin) #define HAVE_UINT64_T 1 +#ifdef __cplusplus +#include +#else +#include +#endif + #ifndef _MSC_VER // Note that this header's correct operation depends on __STDC_LIMIT_MACROS @@ -58,12 +64,6 @@ #include #endif -#ifdef __cplusplus -#include -#else -#include -#endif - #ifdef _AIX #include "llvm/Support/AIXDataTypesFix.h" #endif Modified: llvm/trunk/include/llvm/Support/DataTypes.h.in URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/DataTypes.h.in?rev=77317&r1=77316&r2=77317&view=diff ============================================================================== --- llvm/trunk/include/llvm/Support/DataTypes.h.in (original) +++ llvm/trunk/include/llvm/Support/DataTypes.h.in Tue Jul 28 08:41:07 2009 @@ -27,6 +27,12 @@ #undef HAVE_UINT64_T #undef HAVE_U_INT64_T +#ifdef __cplusplus +#include +#else +#include +#endif + #ifndef _MSC_VER // Note that this header's correct operation depends on __STDC_LIMIT_MACROS @@ -55,12 +61,6 @@ #include #endif -#ifdef __cplusplus -#include -#else -#include -#endif - #ifdef _AIX #include "llvm/Support/AIXDataTypesFix.h" #endif From daniel at zuster.org Tue Jul 28 11:08:38 2009 From: daniel at zuster.org (Daniel Dunbar) Date: Tue, 28 Jul 2009 16:08:38 -0000 Subject: [llvm-commits] [llvm] r77322 - in /llvm/trunk/tools/llvm-mc: AsmLexer.cpp AsmLexer.h AsmParser.cpp MC-X86Specific.cpp llvm-mc.cpp Message-ID: <200907281608.n6SG8ehH003184@zion.cs.uiuc.edu> Author: ddunbar Date: Tue Jul 28 11:08:33 2009 New Revision: 77322 URL: http://llvm.org/viewvc/llvm-project?rev=77322&view=rev Log: llvm-mc: Sink token enum into AsmToken. Modified: llvm/trunk/tools/llvm-mc/AsmLexer.cpp llvm/trunk/tools/llvm-mc/AsmLexer.h llvm/trunk/tools/llvm-mc/AsmParser.cpp llvm/trunk/tools/llvm-mc/MC-X86Specific.cpp llvm/trunk/tools/llvm-mc/llvm-mc.cpp Modified: llvm/trunk/tools/llvm-mc/AsmLexer.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-mc/AsmLexer.cpp?rev=77322&r1=77321&r2=77322&view=diff ============================================================================== --- llvm/trunk/tools/llvm-mc/AsmLexer.cpp (original) +++ llvm/trunk/tools/llvm-mc/AsmLexer.cpp Tue Jul 28 11:08:33 2009 @@ -24,7 +24,7 @@ CurBuffer = 0; CurBuf = SrcMgr.getMemoryBuffer(CurBuffer); CurPtr = CurBuf->getBufferStart(); - CurTok = AsmToken(asmtok::Error, StringRef(CurPtr, 0)); + CurTok = AsmToken(AsmToken::Error, StringRef(CurPtr, 0)); TokStart = 0; } @@ -41,10 +41,10 @@ } /// ReturnError - Set the error to the specified string at the specified -/// location. This is defined to always return asmtok::Error. +/// location. This is defined to always return AsmToken::Error. AsmToken AsmLexer::ReturnError(const char *Loc, const std::string &Msg) { SrcMgr.PrintMessage(SMLoc::getFromPointer(Loc), Msg, "error"); - return AsmToken(asmtok::Error, StringRef(Loc, 0)); + return AsmToken(AsmToken::Error, StringRef(Loc, 0)); } /// EnterIncludeFile - Enter the specified file. This prints an error and @@ -99,18 +99,18 @@ while (isalnum(*CurPtr) || *CurPtr == '_' || *CurPtr == '$' || *CurPtr == '.' || *CurPtr == '@') ++CurPtr; - return AsmToken(asmtok::Identifier, StringRef(TokStart, CurPtr - TokStart)); + return AsmToken(AsmToken::Identifier, StringRef(TokStart, CurPtr - TokStart)); } /// LexPercent: Register: %[a-zA-Z0-9]+ AsmToken AsmLexer::LexPercent() { if (!isalnum(*CurPtr)) - return AsmToken(asmtok::Percent, StringRef(CurPtr, 1)); // Single %. + return AsmToken(AsmToken::Percent, StringRef(CurPtr, 1)); // Single %. while (isalnum(*CurPtr)) ++CurPtr; - return AsmToken(asmtok::Register, StringRef(TokStart, CurPtr - TokStart)); + return AsmToken(AsmToken::Register, StringRef(TokStart, CurPtr - TokStart)); } /// LexSlash: Slash: / @@ -119,7 +119,7 @@ switch (*CurPtr) { case '*': break; // C style comment. case '/': return ++CurPtr, LexLineComment(); - default: return AsmToken(asmtok::Slash, StringRef(CurPtr, 1)); + default: return AsmToken(AsmToken::Slash, StringRef(CurPtr, 1)); } // C Style comment. @@ -149,8 +149,8 @@ CurChar = getNextChar(); if (CurChar == EOF) - return AsmToken(asmtok::Eof, StringRef(CurPtr, 0)); - return AsmToken(asmtok::EndOfStatement, StringRef(CurPtr, 0)); + return AsmToken(AsmToken::Eof, StringRef(CurPtr, 0)); + return AsmToken(AsmToken::EndOfStatement, StringRef(CurPtr, 0)); } @@ -172,7 +172,7 @@ if (CurPtr[-1] != '0') { while (isdigit(*CurPtr)) ++CurPtr; - return AsmToken(asmtok::IntVal, StringRef(TokStart, CurPtr - TokStart), + return AsmToken(AsmToken::Integer, StringRef(TokStart, CurPtr - TokStart), strtoll(TokStart, 0, 10)); } @@ -185,7 +185,7 @@ // Requires at least one binary digit. if (CurPtr == NumStart) return ReturnError(CurPtr-2, "Invalid binary number"); - return AsmToken(asmtok::IntVal, StringRef(TokStart, CurPtr - TokStart), + return AsmToken(AsmToken::Integer, StringRef(TokStart, CurPtr - TokStart), strtoll(NumStart, 0, 2)); } @@ -209,14 +209,14 @@ if (errno == ERANGE) return ReturnError(CurPtr-2, "Hexadecimal number out of range"); } - return AsmToken(asmtok::IntVal, StringRef(TokStart, CurPtr - TokStart), + return AsmToken(AsmToken::Integer, StringRef(TokStart, CurPtr - TokStart), (int64_t) strtoull(NumStart, 0, 16)); } // Must be an octal number, it starts with 0. while (*CurPtr >= '0' && *CurPtr <= '7') ++CurPtr; - return AsmToken(asmtok::IntVal, StringRef(TokStart, CurPtr - TokStart), + return AsmToken(AsmToken::Integer, StringRef(TokStart, CurPtr - TokStart), strtoll(TokStart, 0, 8)); } @@ -236,7 +236,7 @@ CurChar = getNextChar(); } - return AsmToken(asmtok::String, StringRef(TokStart, CurPtr - TokStart)); + return AsmToken(AsmToken::String, StringRef(TokStart, CurPtr - TokStart)); } @@ -253,7 +253,7 @@ // Unknown character, emit an error. return ReturnError(TokStart, "invalid character in input"); - case EOF: return AsmToken(asmtok::Eof, StringRef(TokStart, 0)); + case EOF: return AsmToken(AsmToken::Eof, StringRef(TokStart, 0)); case 0: case ' ': case '\t': @@ -261,33 +261,33 @@ return LexToken(); case '\n': // FALL THROUGH. case '\r': // FALL THROUGH. - case ';': return AsmToken(asmtok::EndOfStatement, StringRef(TokStart, 1)); - case ':': return AsmToken(asmtok::Colon, StringRef(TokStart, 1)); - case '+': return AsmToken(asmtok::Plus, StringRef(TokStart, 1)); - case '-': return AsmToken(asmtok::Minus, StringRef(TokStart, 1)); - case '~': return AsmToken(asmtok::Tilde, StringRef(TokStart, 1)); - case '(': return AsmToken(asmtok::LParen, StringRef(TokStart, 1)); - case ')': return AsmToken(asmtok::RParen, StringRef(TokStart, 1)); - case '*': return AsmToken(asmtok::Star, StringRef(TokStart, 1)); - case ',': return AsmToken(asmtok::Comma, StringRef(TokStart, 1)); - case '$': return AsmToken(asmtok::Dollar, StringRef(TokStart, 1)); + case ';': return AsmToken(AsmToken::EndOfStatement, StringRef(TokStart, 1)); + case ':': return AsmToken(AsmToken::Colon, StringRef(TokStart, 1)); + case '+': return AsmToken(AsmToken::Plus, StringRef(TokStart, 1)); + case '-': return AsmToken(AsmToken::Minus, StringRef(TokStart, 1)); + case '~': return AsmToken(AsmToken::Tilde, StringRef(TokStart, 1)); + case '(': return AsmToken(AsmToken::LParen, StringRef(TokStart, 1)); + case ')': return AsmToken(AsmToken::RParen, StringRef(TokStart, 1)); + case '*': return AsmToken(AsmToken::Star, StringRef(TokStart, 1)); + case ',': return AsmToken(AsmToken::Comma, StringRef(TokStart, 1)); + case '$': return AsmToken(AsmToken::Dollar, StringRef(TokStart, 1)); case '=': if (*CurPtr == '=') - return ++CurPtr, AsmToken(asmtok::EqualEqual, StringRef(TokStart, 2)); - return AsmToken(asmtok::Equal, StringRef(TokStart, 1)); + return ++CurPtr, AsmToken(AsmToken::EqualEqual, StringRef(TokStart, 2)); + return AsmToken(AsmToken::Equal, StringRef(TokStart, 1)); case '|': if (*CurPtr == '|') - return ++CurPtr, AsmToken(asmtok::PipePipe, StringRef(TokStart, 2)); - return AsmToken(asmtok::Pipe, StringRef(TokStart, 1)); - case '^': return AsmToken(asmtok::Caret, StringRef(TokStart, 1)); + return ++CurPtr, AsmToken(AsmToken::PipePipe, StringRef(TokStart, 2)); + return AsmToken(AsmToken::Pipe, StringRef(TokStart, 1)); + case '^': return AsmToken(AsmToken::Caret, StringRef(TokStart, 1)); case '&': if (*CurPtr == '&') - return ++CurPtr, AsmToken(asmtok::AmpAmp, StringRef(TokStart, 2)); - return AsmToken(asmtok::Amp, StringRef(TokStart, 1)); + return ++CurPtr, AsmToken(AsmToken::AmpAmp, StringRef(TokStart, 2)); + return AsmToken(AsmToken::Amp, StringRef(TokStart, 1)); case '!': if (*CurPtr == '=') - return ++CurPtr, AsmToken(asmtok::ExclaimEqual, StringRef(TokStart, 2)); - return AsmToken(asmtok::Exclaim, StringRef(TokStart, 1)); + return ++CurPtr, AsmToken(AsmToken::ExclaimEqual, StringRef(TokStart, 2)); + return AsmToken(AsmToken::Exclaim, StringRef(TokStart, 1)); case '%': return LexPercent(); case '/': return LexSlash(); case '#': return LexLineComment(); @@ -297,21 +297,21 @@ return LexDigit(); case '<': switch (*CurPtr) { - case '<': return ++CurPtr, AsmToken(asmtok::LessLess, + case '<': return ++CurPtr, AsmToken(AsmToken::LessLess, StringRef(TokStart, 2)); - case '=': return ++CurPtr, AsmToken(asmtok::LessEqual, + case '=': return ++CurPtr, AsmToken(AsmToken::LessEqual, StringRef(TokStart, 2)); - case '>': return ++CurPtr, AsmToken(asmtok::LessGreater, + case '>': return ++CurPtr, AsmToken(AsmToken::LessGreater, StringRef(TokStart, 2)); - default: return AsmToken(asmtok::Less, StringRef(TokStart, 1)); + default: return AsmToken(AsmToken::Less, StringRef(TokStart, 1)); } case '>': switch (*CurPtr) { - case '>': return ++CurPtr, AsmToken(asmtok::GreaterGreater, + case '>': return ++CurPtr, AsmToken(AsmToken::GreaterGreater, StringRef(TokStart, 2)); - case '=': return ++CurPtr, AsmToken(asmtok::GreaterEqual, + case '=': return ++CurPtr, AsmToken(AsmToken::GreaterEqual, StringRef(TokStart, 2)); - default: return AsmToken(asmtok::Greater, StringRef(TokStart, 1)); + default: return AsmToken(AsmToken::Greater, StringRef(TokStart, 1)); } // TODO: Quoted identifiers (objc methods etc) Modified: llvm/trunk/tools/llvm-mc/AsmLexer.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-mc/AsmLexer.h?rev=77322&r1=77321&r2=77322&view=diff ============================================================================== --- llvm/trunk/tools/llvm-mc/AsmLexer.h (original) +++ llvm/trunk/tools/llvm-mc/AsmLexer.h Tue Jul 28 11:08:33 2009 @@ -25,8 +25,9 @@ class SourceMgr; class SMLoc; -namespace asmtok { - enum TokKind { +/// AsmToken - Target independent representation for an assembler token. +struct AsmToken { + enum TokenKind { // Markers Eof, Error, @@ -36,7 +37,7 @@ String, // Integer values. - IntVal, + Integer, // No-value. EndOfStatement, @@ -51,11 +52,8 @@ Less, LessEqual, LessLess, LessGreater, Greater, GreaterEqual, GreaterGreater }; -} -/// AsmToken - Target independent representation for an assembler token. -struct AsmToken { - asmtok::TokKind Kind; + TokenKind Kind; /// A reference to the entire token contents; this is always a pointer into /// a memory buffer owned by the source manager. @@ -65,19 +63,22 @@ public: AsmToken() {} - AsmToken(asmtok::TokKind _Kind, const StringRef &_Str, int64_t _IntVal = 0) + AsmToken(TokenKind _Kind, const StringRef &_Str, int64_t _IntVal = 0) : Kind(_Kind), Str(_Str), IntVal(_IntVal) {} - asmtok::TokKind getKind() const { return Kind; } - bool is(asmtok::TokKind K) const { return Kind == K; } - bool isNot(asmtok::TokKind K) const { return Kind != K; } + TokenKind getKind() const { return Kind; } + bool is(TokenKind K) const { return Kind == K; } + bool isNot(TokenKind K) const { return Kind != K; } SMLoc getLoc() const; StringRef getString() const { return Str; } + // FIXME: Don't compute this in advance, it makes every token larger, and is + // also not generally what we want (it is nicer for recovery etc. to lex 123br + // as a single token, then diagnose as an invalid number). int64_t getIntVal() const { - assert(Kind == asmtok::IntVal && "This token isn't an integer"); + assert(Kind == Integer && "This token isn't an integer"); return IntVal; } }; @@ -104,13 +105,13 @@ AsmLexer(SourceMgr &SrcMgr); ~AsmLexer(); - asmtok::TokKind Lex() { + AsmToken::TokenKind Lex() { return CurTok = LexToken(), getKind(); } - asmtok::TokKind getKind() const { return CurTok.getKind(); } - bool is(asmtok::TokKind K) const { return CurTok.is(K); } - bool isNot(asmtok::TokKind K) const { return CurTok.isNot(K); } + AsmToken::TokenKind getKind() const { return CurTok.getKind(); } + bool is(AsmToken::TokenKind K) const { return CurTok.is(K); } + bool isNot(AsmToken::TokenKind K) const { return CurTok.isNot(K); } /// getCurStrVal - Get the string for the current token, this includes all /// characters (for example, the quotes on strings) in the token. @@ -125,6 +126,8 @@ } SMLoc getLoc() const; + + const AsmToken &getTok() const; /// EnterIncludeFile - Enter the specified file. This returns true on failure. bool EnterIncludeFile(const std::string &Filename); Modified: llvm/trunk/tools/llvm-mc/AsmParser.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-mc/AsmParser.cpp?rev=77322&r1=77321&r2=77322&view=diff ============================================================================== --- llvm/trunk/tools/llvm-mc/AsmParser.cpp (original) +++ llvm/trunk/tools/llvm-mc/AsmParser.cpp Tue Jul 28 11:08:33 2009 @@ -45,7 +45,7 @@ bool HadError = false; // While we have input, parse each statement. - while (Lexer.isNot(asmtok::Eof)) { + while (Lexer.isNot(AsmToken::Eof)) { if (!ParseStatement()) continue; // If we had an error, remember it and recover by skipping to the next line. @@ -58,12 +58,12 @@ /// EatToEndOfStatement - Throw away the rest of the line for testing purposes. void AsmParser::EatToEndOfStatement() { - while (Lexer.isNot(asmtok::EndOfStatement) && - Lexer.isNot(asmtok::Eof)) + while (Lexer.isNot(AsmToken::EndOfStatement) && + Lexer.isNot(AsmToken::Eof)) Lexer.Lex(); // Eat EOL. - if (Lexer.is(asmtok::EndOfStatement)) + if (Lexer.is(AsmToken::EndOfStatement)) Lexer.Lex(); } @@ -75,7 +75,7 @@ /// bool AsmParser::ParseParenExpr(AsmExpr *&Res) { if (ParseExpression(Res)) return true; - if (Lexer.isNot(asmtok::RParen)) + if (Lexer.isNot(AsmToken::RParen)) return TokError("expected ')' in parentheses expression"); Lexer.Lex(); return false; @@ -90,13 +90,13 @@ switch (Lexer.getKind()) { default: return TokError("unknown token in expression"); - case asmtok::Exclaim: + case AsmToken::Exclaim: Lexer.Lex(); // Eat the operator. if (ParsePrimaryExpr(Res)) return true; Res = new AsmUnaryExpr(AsmUnaryExpr::LNot, Res); return false; - case asmtok::Identifier: { + case AsmToken::Identifier: { // This is a label, this should be parsed as part of an expression, to // handle things like LFOO+4. MCSymbol *Sym = Ctx.GetOrCreateSymbol(Lexer.getCurStrVal()); @@ -109,26 +109,26 @@ Lexer.Lex(); // Eat identifier. return false; } - case asmtok::IntVal: + case AsmToken::Integer: Res = new AsmConstantExpr(Lexer.getCurIntVal()); Lexer.Lex(); // Eat identifier. return false; - case asmtok::LParen: + case AsmToken::LParen: Lexer.Lex(); // Eat the '('. return ParseParenExpr(Res); - case asmtok::Minus: + case AsmToken::Minus: Lexer.Lex(); // Eat the operator. if (ParsePrimaryExpr(Res)) return true; Res = new AsmUnaryExpr(AsmUnaryExpr::Minus, Res); return false; - case asmtok::Plus: + case AsmToken::Plus: Lexer.Lex(); // Eat the operator. if (ParsePrimaryExpr(Res)) return true; Res = new AsmUnaryExpr(AsmUnaryExpr::Plus, Res); return false; - case asmtok::Tilde: + case AsmToken::Tilde: Lexer.Lex(); // Eat the operator. if (ParsePrimaryExpr(Res)) return true; @@ -189,73 +189,73 @@ return false; } -static unsigned getBinOpPrecedence(asmtok::TokKind K, +static unsigned getBinOpPrecedence(AsmToken::TokenKind K, AsmBinaryExpr::Opcode &Kind) { switch (K) { default: return 0; // not a binop. // Lowest Precedence: &&, || - case asmtok::AmpAmp: + case AsmToken::AmpAmp: Kind = AsmBinaryExpr::LAnd; return 1; - case asmtok::PipePipe: + case AsmToken::PipePipe: Kind = AsmBinaryExpr::LOr; return 1; // Low Precedence: +, -, ==, !=, <>, <, <=, >, >= - case asmtok::Plus: + case AsmToken::Plus: Kind = AsmBinaryExpr::Add; return 2; - case asmtok::Minus: + case AsmToken::Minus: Kind = AsmBinaryExpr::Sub; return 2; - case asmtok::EqualEqual: + case AsmToken::EqualEqual: Kind = AsmBinaryExpr::EQ; return 2; - case asmtok::ExclaimEqual: - case asmtok::LessGreater: + case AsmToken::ExclaimEqual: + case AsmToken::LessGreater: Kind = AsmBinaryExpr::NE; return 2; - case asmtok::Less: + case AsmToken::Less: Kind = AsmBinaryExpr::LT; return 2; - case asmtok::LessEqual: + case AsmToken::LessEqual: Kind = AsmBinaryExpr::LTE; return 2; - case asmtok::Greater: + case AsmToken::Greater: Kind = AsmBinaryExpr::GT; return 2; - case asmtok::GreaterEqual: + case AsmToken::GreaterEqual: Kind = AsmBinaryExpr::GTE; return 2; // Intermediate Precedence: |, &, ^ // // FIXME: gas seems to support '!' as an infix operator? - case asmtok::Pipe: + case AsmToken::Pipe: Kind = AsmBinaryExpr::Or; return 3; - case asmtok::Caret: + case AsmToken::Caret: Kind = AsmBinaryExpr::Xor; return 3; - case asmtok::Amp: + case AsmToken::Amp: Kind = AsmBinaryExpr::And; return 3; // Highest Precedence: *, /, %, <<, >> - case asmtok::Star: + case AsmToken::Star: Kind = AsmBinaryExpr::Mul; return 4; - case asmtok::Slash: + case AsmToken::Slash: Kind = AsmBinaryExpr::Div; return 4; - case asmtok::Percent: + case AsmToken::Percent: Kind = AsmBinaryExpr::Mod; return 4; - case asmtok::LessLess: + case AsmToken::LessLess: Kind = AsmBinaryExpr::Shl; return 4; - case asmtok::GreaterGreater: + case AsmToken::GreaterGreater: Kind = AsmBinaryExpr::Shr; return 4; } @@ -304,10 +304,10 @@ switch (Lexer.getKind()) { default: return TokError("unexpected token at start of statement"); - case asmtok::EndOfStatement: + case AsmToken::EndOfStatement: Lexer.Lex(); return false; - case asmtok::Identifier: + case AsmToken::Identifier: break; // TODO: Recurse on local labels etc. } @@ -318,7 +318,7 @@ // Consume the identifier, see what is after it. switch (Lexer.Lex()) { - case asmtok::Colon: { + case AsmToken::Colon: { // identifier ':' -> Label. Lexer.Lex(); @@ -341,7 +341,7 @@ return ParseStatement(); } - case asmtok::Equal: + case AsmToken::Equal: // identifier '=' ... -> assignment statement Lexer.Lex(); @@ -554,7 +554,7 @@ getTargetParser().ParseInstruction(*this, IDVal, Inst)) return true; - if (Lexer.isNot(asmtok::EndOfStatement)) + if (Lexer.isNot(AsmToken::EndOfStatement)) return TokError("unexpected token in argument list"); // Eat the end of statement marker. @@ -575,7 +575,7 @@ if (ParseRelocatableExpression(Value)) return true; - if (Lexer.isNot(asmtok::EndOfStatement)) + if (Lexer.isNot(AsmToken::EndOfStatement)) return TokError("unexpected token in assignment"); // Eat the end of statement marker. @@ -603,12 +603,12 @@ /// ParseDirectiveSet: /// ::= .set identifier ',' expression bool AsmParser::ParseDirectiveSet() { - if (Lexer.isNot(asmtok::Identifier)) + if (Lexer.isNot(AsmToken::Identifier)) return TokError("expected identifier after '.set' directive"); StringRef Name = Lexer.getCurStrVal(); - if (Lexer.Lex() != asmtok::Comma) + if (Lexer.Lex() != AsmToken::Comma) return TokError("unexpected token in '.set'"); Lexer.Lex(); @@ -620,24 +620,24 @@ /// FIXME: This should actually parse out the segment, section, attributes and /// sizeof_stub fields. bool AsmParser::ParseDirectiveDarwinSection() { - if (Lexer.isNot(asmtok::Identifier)) + if (Lexer.isNot(AsmToken::Identifier)) return TokError("expected identifier after '.section' directive"); std::string Section = Lexer.getCurStrVal(); Lexer.Lex(); // Accept a comma separated list of modifiers. - while (Lexer.is(asmtok::Comma)) { + while (Lexer.is(AsmToken::Comma)) { Lexer.Lex(); - if (Lexer.isNot(asmtok::Identifier)) + if (Lexer.isNot(AsmToken::Identifier)) return TokError("expected identifier in '.section' directive"); Section += ','; Section += Lexer.getCurStrVal().str(); Lexer.Lex(); } - if (Lexer.isNot(asmtok::EndOfStatement)) + if (Lexer.isNot(AsmToken::EndOfStatement)) return TokError("unexpected token in '.section' directive"); Lexer.Lex(); @@ -647,7 +647,7 @@ bool AsmParser::ParseDirectiveSectionSwitch(const char *Section, const char *Directives) { - if (Lexer.isNot(asmtok::EndOfStatement)) + if (Lexer.isNot(AsmToken::EndOfStatement)) return TokError("unexpected token in section switching directive"); Lexer.Lex(); @@ -664,9 +664,9 @@ /// ParseDirectiveAscii: /// ::= ( .ascii | .asciz ) [ "string" ( , "string" )* ] bool AsmParser::ParseDirectiveAscii(bool ZeroTerminated) { - if (Lexer.isNot(asmtok::EndOfStatement)) { + if (Lexer.isNot(AsmToken::EndOfStatement)) { for (;;) { - if (Lexer.isNot(asmtok::String)) + if (Lexer.isNot(AsmToken::String)) return TokError("expected string in '.ascii' or '.asciz' directive"); // FIXME: This shouldn't use a const char* + strlen, the string could have @@ -679,10 +679,10 @@ Lexer.Lex(); - if (Lexer.is(asmtok::EndOfStatement)) + if (Lexer.is(AsmToken::EndOfStatement)) break; - if (Lexer.isNot(asmtok::Comma)) + if (Lexer.isNot(AsmToken::Comma)) return TokError("unexpected token in '.ascii' or '.asciz' directive"); Lexer.Lex(); } @@ -695,7 +695,7 @@ /// ParseDirectiveValue /// ::= (.byte | .short | ... ) [ expression (, expression)* ] bool AsmParser::ParseDirectiveValue(unsigned Size) { - if (Lexer.isNot(asmtok::EndOfStatement)) { + if (Lexer.isNot(AsmToken::EndOfStatement)) { for (;;) { MCValue Expr; if (ParseRelocatableExpression(Expr)) @@ -703,11 +703,11 @@ Out.EmitValue(Expr, Size); - if (Lexer.is(asmtok::EndOfStatement)) + if (Lexer.is(AsmToken::EndOfStatement)) break; // FIXME: Improve diagnostic. - if (Lexer.isNot(asmtok::Comma)) + if (Lexer.isNot(AsmToken::Comma)) return TokError("unexpected token in directive"); Lexer.Lex(); } @@ -726,8 +726,8 @@ int64_t FillExpr = 0; bool HasFillExpr = false; - if (Lexer.isNot(asmtok::EndOfStatement)) { - if (Lexer.isNot(asmtok::Comma)) + if (Lexer.isNot(AsmToken::EndOfStatement)) { + if (Lexer.isNot(AsmToken::Comma)) return TokError("unexpected token in '.space' directive"); Lexer.Lex(); @@ -736,7 +736,7 @@ HasFillExpr = true; - if (Lexer.isNot(asmtok::EndOfStatement)) + if (Lexer.isNot(AsmToken::EndOfStatement)) return TokError("unexpected token in '.space' directive"); } @@ -759,7 +759,7 @@ if (ParseAbsoluteExpression(NumValues)) return true; - if (Lexer.isNot(asmtok::Comma)) + if (Lexer.isNot(AsmToken::Comma)) return TokError("unexpected token in '.fill' directive"); Lexer.Lex(); @@ -767,7 +767,7 @@ if (ParseAbsoluteExpression(FillSize)) return true; - if (Lexer.isNot(asmtok::Comma)) + if (Lexer.isNot(AsmToken::Comma)) return TokError("unexpected token in '.fill' directive"); Lexer.Lex(); @@ -775,7 +775,7 @@ if (ParseAbsoluteExpression(FillExpr)) return true; - if (Lexer.isNot(asmtok::EndOfStatement)) + if (Lexer.isNot(AsmToken::EndOfStatement)) return TokError("unexpected token in '.fill' directive"); Lexer.Lex(); @@ -798,15 +798,15 @@ // Parse optional fill expression. int64_t FillExpr = 0; - if (Lexer.isNot(asmtok::EndOfStatement)) { - if (Lexer.isNot(asmtok::Comma)) + if (Lexer.isNot(AsmToken::EndOfStatement)) { + if (Lexer.isNot(AsmToken::Comma)) return TokError("unexpected token in '.org' directive"); Lexer.Lex(); if (ParseAbsoluteExpression(FillExpr)) return true; - if (Lexer.isNot(asmtok::EndOfStatement)) + if (Lexer.isNot(AsmToken::EndOfStatement)) return TokError("unexpected token in '.org' directive"); } @@ -830,22 +830,22 @@ bool HasFillExpr = false; int64_t FillExpr = 0; int64_t MaxBytesToFill = 0; - if (Lexer.isNot(asmtok::EndOfStatement)) { - if (Lexer.isNot(asmtok::Comma)) + if (Lexer.isNot(AsmToken::EndOfStatement)) { + if (Lexer.isNot(AsmToken::Comma)) return TokError("unexpected token in directive"); Lexer.Lex(); // The fill expression can be omitted while specifying a maximum number of // alignment bytes, e.g: // .align 3,,4 - if (Lexer.isNot(asmtok::Comma)) { + if (Lexer.isNot(AsmToken::Comma)) { HasFillExpr = true; if (ParseAbsoluteExpression(FillExpr)) return true; } - if (Lexer.isNot(asmtok::EndOfStatement)) { - if (Lexer.isNot(asmtok::Comma)) + if (Lexer.isNot(AsmToken::EndOfStatement)) { + if (Lexer.isNot(AsmToken::Comma)) return TokError("unexpected token in directive"); Lexer.Lex(); @@ -853,7 +853,7 @@ if (ParseAbsoluteExpression(MaxBytesToFill)) return true; - if (Lexer.isNot(asmtok::EndOfStatement)) + if (Lexer.isNot(AsmToken::EndOfStatement)) return TokError("unexpected token in directive"); } } @@ -895,9 +895,9 @@ /// ParseDirectiveSymbolAttribute /// ::= { ".globl", ".weak", ... } [ identifier ( , identifier )* ] bool AsmParser::ParseDirectiveSymbolAttribute(MCStreamer::SymbolAttr Attr) { - if (Lexer.isNot(asmtok::EndOfStatement)) { + if (Lexer.isNot(AsmToken::EndOfStatement)) { for (;;) { - if (Lexer.isNot(asmtok::Identifier)) + if (Lexer.isNot(AsmToken::Identifier)) return TokError("expected identifier in directive"); MCSymbol *Sym = Ctx.GetOrCreateSymbol(Lexer.getCurStrVal()); @@ -909,10 +909,10 @@ Out.EmitSymbolAttribute(Sym, Attr); - if (Lexer.is(asmtok::EndOfStatement)) + if (Lexer.is(AsmToken::EndOfStatement)) break; - if (Lexer.isNot(asmtok::Comma)) + if (Lexer.isNot(AsmToken::Comma)) return TokError("unexpected token in directive"); Lexer.Lex(); } @@ -925,7 +925,7 @@ /// ParseDirectiveDarwinSymbolDesc /// ::= .desc identifier , expression bool AsmParser::ParseDirectiveDarwinSymbolDesc() { - if (Lexer.isNot(asmtok::Identifier)) + if (Lexer.isNot(AsmToken::Identifier)) return TokError("expected identifier in directive"); // handle the identifier as the key symbol. @@ -933,7 +933,7 @@ MCSymbol *Sym = Ctx.GetOrCreateSymbol(Lexer.getCurStrVal()); Lexer.Lex(); - if (Lexer.isNot(asmtok::Comma)) + if (Lexer.isNot(AsmToken::Comma)) return TokError("unexpected token in '.desc' directive"); Lexer.Lex(); @@ -942,7 +942,7 @@ if (ParseAbsoluteExpression(DescValue)) return true; - if (Lexer.isNot(asmtok::EndOfStatement)) + if (Lexer.isNot(AsmToken::EndOfStatement)) return TokError("unexpected token in '.desc' directive"); Lexer.Lex(); @@ -956,7 +956,7 @@ /// ParseDirectiveComm /// ::= ( .comm | .lcomm ) identifier , size_expression [ , align_expression ] bool AsmParser::ParseDirectiveComm(bool IsLocal) { - if (Lexer.isNot(asmtok::Identifier)) + if (Lexer.isNot(AsmToken::Identifier)) return TokError("expected identifier in directive"); // handle the identifier as the key symbol. @@ -964,7 +964,7 @@ MCSymbol *Sym = Ctx.GetOrCreateSymbol(Lexer.getCurStrVal()); Lexer.Lex(); - if (Lexer.isNot(asmtok::Comma)) + if (Lexer.isNot(AsmToken::Comma)) return TokError("unexpected token in directive"); Lexer.Lex(); @@ -975,14 +975,14 @@ int64_t Pow2Alignment = 0; SMLoc Pow2AlignmentLoc; - if (Lexer.is(asmtok::Comma)) { + if (Lexer.is(AsmToken::Comma)) { Lexer.Lex(); Pow2AlignmentLoc = Lexer.getLoc(); if (ParseAbsoluteExpression(Pow2Alignment)) return true; } - if (Lexer.isNot(asmtok::EndOfStatement)) + if (Lexer.isNot(AsmToken::EndOfStatement)) return TokError("unexpected token in '.comm' or '.lcomm' directive"); Lexer.Lex(); @@ -1014,17 +1014,17 @@ /// ::= .zerofill segname , sectname [, identifier , size_expression [ /// , align_expression ]] bool AsmParser::ParseDirectiveDarwinZerofill() { - if (Lexer.isNot(asmtok::Identifier)) + if (Lexer.isNot(AsmToken::Identifier)) return TokError("expected segment name after '.zerofill' directive"); std::string Section = Lexer.getCurStrVal(); Lexer.Lex(); - if (Lexer.isNot(asmtok::Comma)) + if (Lexer.isNot(AsmToken::Comma)) return TokError("unexpected token in directive"); Section += ','; Lexer.Lex(); - if (Lexer.isNot(asmtok::Identifier)) + if (Lexer.isNot(AsmToken::Identifier)) return TokError("expected section name after comma in '.zerofill' " "directive"); Section += Lexer.getCurStrVal().str(); @@ -1040,17 +1040,17 @@ // If this is the end of the line all that was wanted was to create the // the section but with no symbol. - if (Lexer.is(asmtok::EndOfStatement)) { + if (Lexer.is(AsmToken::EndOfStatement)) { // Create the zerofill section but no symbol Out.EmitZerofill(Ctx.GetSection(Section.c_str())); return false; } - if (Lexer.isNot(asmtok::Comma)) + if (Lexer.isNot(AsmToken::Comma)) return TokError("unexpected token in directive"); Lexer.Lex(); - if (Lexer.isNot(asmtok::Identifier)) + if (Lexer.isNot(AsmToken::Identifier)) return TokError("expected identifier in directive"); // handle the identifier as the key symbol. @@ -1058,7 +1058,7 @@ MCSymbol *Sym = Ctx.GetOrCreateSymbol(Lexer.getCurStrVal()); Lexer.Lex(); - if (Lexer.isNot(asmtok::Comma)) + if (Lexer.isNot(AsmToken::Comma)) return TokError("unexpected token in directive"); Lexer.Lex(); @@ -1069,14 +1069,14 @@ int64_t Pow2Alignment = 0; SMLoc Pow2AlignmentLoc; - if (Lexer.is(asmtok::Comma)) { + if (Lexer.is(AsmToken::Comma)) { Lexer.Lex(); Pow2AlignmentLoc = Lexer.getLoc(); if (ParseAbsoluteExpression(Pow2Alignment)) return true; } - if (Lexer.isNot(asmtok::EndOfStatement)) + if (Lexer.isNot(AsmToken::EndOfStatement)) return TokError("unexpected token in '.zerofill' directive"); Lexer.Lex(); @@ -1105,7 +1105,7 @@ /// ParseDirectiveDarwinSubsectionsViaSymbols /// ::= .subsections_via_symbols bool AsmParser::ParseDirectiveDarwinSubsectionsViaSymbols() { - if (Lexer.isNot(asmtok::EndOfStatement)) + if (Lexer.isNot(AsmToken::EndOfStatement)) return TokError("unexpected token in '.subsections_via_symbols' directive"); Lexer.Lex(); @@ -1122,8 +1122,8 @@ SMLoc Loc = Lexer.getLoc(); StringRef Str = ""; - if (Lexer.isNot(asmtok::EndOfStatement)) { - if (Lexer.isNot(asmtok::String)) + if (Lexer.isNot(AsmToken::EndOfStatement)) { + if (Lexer.isNot(AsmToken::String)) return TokError("expected string in '.abort' directive"); Str = Lexer.getCurStrVal(); @@ -1131,7 +1131,7 @@ Lexer.Lex(); } - if (Lexer.isNot(asmtok::EndOfStatement)) + if (Lexer.isNot(AsmToken::EndOfStatement)) return TokError("unexpected token in '.abort' directive"); Lexer.Lex(); @@ -1148,7 +1148,7 @@ /// ParseDirectiveLsym /// ::= .lsym identifier , expression bool AsmParser::ParseDirectiveDarwinLsym() { - if (Lexer.isNot(asmtok::Identifier)) + if (Lexer.isNot(AsmToken::Identifier)) return TokError("expected identifier in directive"); // handle the identifier as the key symbol. @@ -1156,7 +1156,7 @@ MCSymbol *Sym = Ctx.GetOrCreateSymbol(Lexer.getCurStrVal()); Lexer.Lex(); - if (Lexer.isNot(asmtok::Comma)) + if (Lexer.isNot(AsmToken::Comma)) return TokError("unexpected token in '.lsym' directive"); Lexer.Lex(); @@ -1164,7 +1164,7 @@ if (ParseRelocatableExpression(Expr)) return true; - if (Lexer.isNot(asmtok::EndOfStatement)) + if (Lexer.isNot(AsmToken::EndOfStatement)) return TokError("unexpected token in '.lsym' directive"); Lexer.Lex(); @@ -1178,14 +1178,14 @@ /// ParseDirectiveInclude /// ::= .include "filename" bool AsmParser::ParseDirectiveInclude() { - if (Lexer.isNot(asmtok::String)) + if (Lexer.isNot(AsmToken::String)) return TokError("expected string in '.include' directive"); std::string Filename = Lexer.getCurStrVal(); SMLoc IncludeLoc = Lexer.getLoc(); Lexer.Lex(); - if (Lexer.isNot(asmtok::EndOfStatement)) + if (Lexer.isNot(AsmToken::EndOfStatement)) return TokError("unexpected token in '.include' directive"); // Strip the quotes. @@ -1206,14 +1206,14 @@ /// ParseDirectiveDarwinDumpOrLoad /// ::= ( .dump | .load ) "filename" bool AsmParser::ParseDirectiveDarwinDumpOrLoad(SMLoc IDLoc, bool IsDump) { - if (Lexer.isNot(asmtok::String)) + if (Lexer.isNot(AsmToken::String)) return TokError("expected string in '.dump' or '.load' directive"); Lexer.getCurStrVal(); Lexer.Lex(); - if (Lexer.isNot(asmtok::EndOfStatement)) + if (Lexer.isNot(AsmToken::EndOfStatement)) return TokError("unexpected token in '.dump' or '.load' directive"); Lexer.Lex(); Modified: llvm/trunk/tools/llvm-mc/MC-X86Specific.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-mc/MC-X86Specific.cpp?rev=77322&r1=77321&r2=77322&view=diff ============================================================================== --- llvm/trunk/tools/llvm-mc/MC-X86Specific.cpp (original) +++ llvm/trunk/tools/llvm-mc/MC-X86Specific.cpp Tue Jul 28 11:08:33 2009 @@ -81,7 +81,7 @@ }; bool AsmParser::ParseX86Register(X86Operand &Op) { - assert(Lexer.getKind() == asmtok::Register && "Invalid token kind!"); + assert(Lexer.getKind() == AsmToken::Register && "Invalid token kind!"); // FIXME: Decode register number. Op = X86Operand::CreateReg(123); @@ -94,11 +94,11 @@ switch (Lexer.getKind()) { default: return ParseX86MemOperand(Op); - case asmtok::Register: + case AsmToken::Register: // FIXME: if a segment register, this could either be just the seg reg, or // the start of a memory operand. return ParseX86Register(Op); - case asmtok::Dollar: { + case AsmToken::Dollar: { // $42 -> immediate. Lexer.Lex(); MCValue Val; @@ -107,10 +107,10 @@ Op = X86Operand::CreateImm(Val); return false; } - case asmtok::Star: { + case AsmToken::Star: { Lexer.Lex(); // Eat the star. - if (Lexer.is(asmtok::Register)) { + if (Lexer.is(AsmToken::Register)) { if (ParseX86Register(Op)) return true; } else if (ParseX86MemOperand(Op)) @@ -132,12 +132,12 @@ // only way to do this without lookahead is to eat the ( and see what is after // it. MCValue Disp = MCValue::get(0, 0, 0); - if (Lexer.isNot(asmtok::LParen)) { + if (Lexer.isNot(AsmToken::LParen)) { if (ParseRelocatableExpression(Disp)) return true; // After parsing the base expression we could either have a parenthesized // memory address or not. If not, return now. If so, eat the (. - if (Lexer.isNot(asmtok::LParen)) { + if (Lexer.isNot(AsmToken::LParen)) { Op = X86Operand::CreateMem(SegReg, Disp, 0, 0, 0); return false; } @@ -149,7 +149,7 @@ // so we have to eat the ( to see beyond it. Lexer.Lex(); // Eat the '('. - if (Lexer.is(asmtok::Register) || Lexer.is(asmtok::Comma)) { + if (Lexer.is(AsmToken::Register) || Lexer.is(AsmToken::Comma)) { // Nothing to do here, fall into the code below with the '(' part of the // memory operand consumed. } else { @@ -159,7 +159,7 @@ // After parsing the base expression we could either have a parenthesized // memory address or not. If not, return now. If so, eat the (. - if (Lexer.isNot(asmtok::LParen)) { + if (Lexer.isNot(AsmToken::LParen)) { Op = X86Operand::CreateMem(SegReg, Disp, 0, 0, 0); return false; } @@ -173,13 +173,13 @@ // the rest of the memory operand. unsigned BaseReg = 0, IndexReg = 0, Scale = 0; - if (Lexer.is(asmtok::Register)) { + if (Lexer.is(AsmToken::Register)) { if (ParseX86Register(Op)) return true; BaseReg = Op.getReg(); } - if (Lexer.is(asmtok::Comma)) { + if (Lexer.is(AsmToken::Comma)) { Lexer.Lex(); // Eat the comma. // Following the comma we should have either an index register, or a scale @@ -188,20 +188,20 @@ // // Not that even though it would be completely consistent to support syntax // like "1(%eax,,1)", the assembler doesn't. - if (Lexer.is(asmtok::Register)) { + if (Lexer.is(AsmToken::Register)) { if (ParseX86Register(Op)) return true; IndexReg = Op.getReg(); Scale = 1; // If not specified, the scale defaults to 1. - if (Lexer.isNot(asmtok::RParen)) { + if (Lexer.isNot(AsmToken::RParen)) { // Parse the scale amount: // ::= ',' [scale-expression] - if (Lexer.isNot(asmtok::Comma)) + if (Lexer.isNot(AsmToken::Comma)) return true; Lexer.Lex(); // Eat the comma. - if (Lexer.isNot(asmtok::RParen)) { + if (Lexer.isNot(AsmToken::RParen)) { int64_t ScaleVal; if (ParseAbsoluteExpression(ScaleVal)) return true; @@ -212,7 +212,7 @@ Scale = (unsigned)ScaleVal; } } - } else if (Lexer.isNot(asmtok::RParen)) { + } else if (Lexer.isNot(AsmToken::RParen)) { // Otherwise we have the unsupported form of a scale amount without an // index. SMLoc Loc = Lexer.getLoc(); @@ -226,7 +226,7 @@ } // Ok, we've eaten the memory operand, verify we have a ')' and eat it too. - if (Lexer.isNot(asmtok::RParen)) + if (Lexer.isNot(AsmToken::RParen)) return TokError("unexpected token in memory operand"); Lexer.Lex(); // Eat the ')'. @@ -247,13 +247,13 @@ bool AsmParser::ParseX86InstOperands(const StringRef &InstName, MCInst &Inst) { llvm::SmallVector Operands; - if (Lexer.isNot(asmtok::EndOfStatement)) { + if (Lexer.isNot(AsmToken::EndOfStatement)) { // Read the first operand. Operands.push_back(X86Operand()); if (ParseX86Operand(Operands.back())) return true; - while (Lexer.is(asmtok::Comma)) { + while (Lexer.is(AsmToken::Comma)) { Lexer.Lex(); // Eat the comma. // Parse and remember the operand. Modified: llvm/trunk/tools/llvm-mc/llvm-mc.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-mc/llvm-mc.cpp?rev=77322&r1=77321&r2=77322&view=diff ============================================================================== --- llvm/trunk/tools/llvm-mc/llvm-mc.cpp (original) +++ llvm/trunk/tools/llvm-mc/llvm-mc.cpp Tue Jul 28 11:08:33 2009 @@ -83,58 +83,58 @@ bool Error = false; - asmtok::TokKind Tok = Lexer.Lex(); - while (Tok != asmtok::Eof) { + AsmToken::TokenKind Tok = Lexer.Lex(); + while (Tok != AsmToken::Eof) { switch (Tok) { default: Lexer.PrintMessage(Lexer.getLoc(), "unknown token", "warning"); Error = true; break; - case asmtok::Error: + case AsmToken::Error: Error = true; // error already printed. break; - case asmtok::Identifier: + case AsmToken::Identifier: outs() << "identifier: " << Lexer.getCurStrVal() << '\n'; break; - case asmtok::Register: + case AsmToken::Register: outs() << "register: " << Lexer.getCurStrVal() << '\n'; break; - case asmtok::String: + case AsmToken::String: outs() << "string: " << Lexer.getCurStrVal() << '\n'; break; - case asmtok::IntVal: + case AsmToken::Integer: outs() << "int: " << Lexer.getCurIntVal() << '\n'; break; - case asmtok::Amp: outs() << "Amp\n"; break; - case asmtok::AmpAmp: outs() << "AmpAmp\n"; break; - case asmtok::Caret: outs() << "Caret\n"; break; - case asmtok::Colon: outs() << "Colon\n"; break; - case asmtok::Comma: outs() << "Comma\n"; break; - case asmtok::Dollar: outs() << "Dollar\n"; break; - case asmtok::EndOfStatement: outs() << "EndOfStatement\n"; break; - case asmtok::Eof: outs() << "Eof\n"; break; - case asmtok::Equal: outs() << "Equal\n"; break; - case asmtok::EqualEqual: outs() << "EqualEqual\n"; break; - case asmtok::Exclaim: outs() << "Exclaim\n"; break; - case asmtok::ExclaimEqual: outs() << "ExclaimEqual\n"; break; - case asmtok::Greater: outs() << "Greater\n"; break; - case asmtok::GreaterEqual: outs() << "GreaterEqual\n"; break; - case asmtok::GreaterGreater: outs() << "GreaterGreater\n"; break; - case asmtok::LParen: outs() << "LParen\n"; break; - case asmtok::Less: outs() << "Less\n"; break; - case asmtok::LessEqual: outs() << "LessEqual\n"; break; - case asmtok::LessGreater: outs() << "LessGreater\n"; break; - case asmtok::LessLess: outs() << "LessLess\n"; break; - case asmtok::Minus: outs() << "Minus\n"; break; - case asmtok::Percent: outs() << "Percent\n"; break; - case asmtok::Pipe: outs() << "Pipe\n"; break; - case asmtok::PipePipe: outs() << "PipePipe\n"; break; - case asmtok::Plus: outs() << "Plus\n"; break; - case asmtok::RParen: outs() << "RParen\n"; break; - case asmtok::Slash: outs() << "Slash\n"; break; - case asmtok::Star: outs() << "Star\n"; break; - case asmtok::Tilde: outs() << "Tilde\n"; break; + case AsmToken::Amp: outs() << "Amp\n"; break; + case AsmToken::AmpAmp: outs() << "AmpAmp\n"; break; + case AsmToken::Caret: outs() << "Caret\n"; break; + case AsmToken::Colon: outs() << "Colon\n"; break; + case AsmToken::Comma: outs() << "Comma\n"; break; + case AsmToken::Dollar: outs() << "Dollar\n"; break; + case AsmToken::EndOfStatement: outs() << "EndOfStatement\n"; break; + case AsmToken::Eof: outs() << "Eof\n"; break; + case AsmToken::Equal: outs() << "Equal\n"; break; + case AsmToken::EqualEqual: outs() << "EqualEqual\n"; break; + case AsmToken::Exclaim: outs() << "Exclaim\n"; break; + case AsmToken::ExclaimEqual: outs() << "ExclaimEqual\n"; break; + case AsmToken::Greater: outs() << "Greater\n"; break; + case AsmToken::GreaterEqual: outs() << "GreaterEqual\n"; break; + case AsmToken::GreaterGreater: outs() << "GreaterGreater\n"; break; + case AsmToken::LParen: outs() << "LParen\n"; break; + case AsmToken::Less: outs() << "Less\n"; break; + case AsmToken::LessEqual: outs() << "LessEqual\n"; break; + case AsmToken::LessGreater: outs() << "LessGreater\n"; break; + case AsmToken::LessLess: outs() << "LessLess\n"; break; + case AsmToken::Minus: outs() << "Minus\n"; break; + case AsmToken::Percent: outs() << "Percent\n"; break; + case AsmToken::Pipe: outs() << "Pipe\n"; break; + case AsmToken::PipePipe: outs() << "PipePipe\n"; break; + case AsmToken::Plus: outs() << "Plus\n"; break; + case AsmToken::RParen: outs() << "RParen\n"; break; + case AsmToken::Slash: outs() << "Slash\n"; break; + case AsmToken::Star: outs() << "Star\n"; break; + case AsmToken::Tilde: outs() << "Tilde\n"; break; } Tok = Lexer.Lex(); From daniel at zuster.org Tue Jul 28 11:38:45 2009 From: daniel at zuster.org (Daniel Dunbar) Date: Tue, 28 Jul 2009 16:38:45 -0000 Subject: [llvm-commits] [llvm] r77323 - in /llvm/trunk/tools/llvm-mc: AsmLexer.cpp AsmLexer.h AsmParser.cpp llvm-mc.cpp Message-ID: <200907281638.n6SGckuV004344@zion.cs.uiuc.edu> Author: ddunbar Date: Tue Jul 28 11:38:40 2009 New Revision: 77323 URL: http://llvm.org/viewvc/llvm-project?rev=77323&view=rev Log: Drop some AsmLexer methods in favor of their AsmToken equivalents. Modified: llvm/trunk/tools/llvm-mc/AsmLexer.cpp llvm/trunk/tools/llvm-mc/AsmLexer.h llvm/trunk/tools/llvm-mc/AsmParser.cpp llvm/trunk/tools/llvm-mc/llvm-mc.cpp Modified: llvm/trunk/tools/llvm-mc/AsmLexer.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-mc/AsmLexer.cpp?rev=77323&r1=77322&r2=77323&view=diff ============================================================================== --- llvm/trunk/tools/llvm-mc/AsmLexer.cpp (original) +++ llvm/trunk/tools/llvm-mc/AsmLexer.cpp Tue Jul 28 11:38:40 2009 @@ -35,6 +35,10 @@ return SMLoc::getFromPointer(TokStart); } +SMLoc AsmToken::getLoc() const { + return SMLoc::getFromPointer(Str.data()); +} + void AsmLexer::PrintMessage(SMLoc Loc, const std::string &Msg, const char *Type) const { SrcMgr.PrintMessage(Loc, Msg, Type); Modified: llvm/trunk/tools/llvm-mc/AsmLexer.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-mc/AsmLexer.h?rev=77323&r1=77322&r2=77323&view=diff ============================================================================== --- llvm/trunk/tools/llvm-mc/AsmLexer.h (original) +++ llvm/trunk/tools/llvm-mc/AsmLexer.h Tue Jul 28 11:38:40 2009 @@ -72,6 +72,11 @@ SMLoc getLoc() const; + /// getString - Get the string for the current token, this includes all + /// characters (for example, the quotes on strings) in the token. + /// + /// The returned StringRef points into the source manager's memory buffer, and + /// is safe to store across calls to Lex(). StringRef getString() const { return Str; } // FIXME: Don't compute this in advance, it makes every token larger, and is @@ -113,21 +118,10 @@ bool is(AsmToken::TokenKind K) const { return CurTok.is(K); } bool isNot(AsmToken::TokenKind K) const { return CurTok.isNot(K); } - /// getCurStrVal - Get the string for the current token, this includes all - /// characters (for example, the quotes on strings) in the token. - /// - /// The returned StringRef points into the source manager's memory buffer, and - /// is safe to store across calls to Lex(). - StringRef getCurStrVal() const { - return CurTok.getString(); - } - int64_t getCurIntVal() const { - return CurTok.getIntVal(); - } - SMLoc getLoc() const; - - const AsmToken &getTok() const; + + /// getTok - Return a reference to the current (last) lexed token. + const AsmToken &getTok() const { return CurTok; } /// EnterIncludeFile - Enter the specified file. This returns true on failure. bool EnterIncludeFile(const std::string &Filename); Modified: llvm/trunk/tools/llvm-mc/AsmParser.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-mc/AsmParser.cpp?rev=77323&r1=77322&r2=77323&view=diff ============================================================================== --- llvm/trunk/tools/llvm-mc/AsmParser.cpp (original) +++ llvm/trunk/tools/llvm-mc/AsmParser.cpp Tue Jul 28 11:38:40 2009 @@ -99,7 +99,7 @@ case AsmToken::Identifier: { // This is a label, this should be parsed as part of an expression, to // handle things like LFOO+4. - MCSymbol *Sym = Ctx.GetOrCreateSymbol(Lexer.getCurStrVal()); + MCSymbol *Sym = Ctx.GetOrCreateSymbol(Lexer.getTok().getString()); // If this is use of an undefined symbol then mark it external. if (!Sym->getSection() && !Ctx.GetSymbolValue(Sym)) @@ -110,7 +110,7 @@ return false; } case AsmToken::Integer: - Res = new AsmConstantExpr(Lexer.getCurIntVal()); + Res = new AsmConstantExpr(Lexer.getTok().getIntVal()); Lexer.Lex(); // Eat identifier. return false; case AsmToken::LParen: @@ -313,8 +313,9 @@ } // If we have an identifier, handle it as the key symbol. - SMLoc IDLoc = Lexer.getLoc(); - StringRef IDVal = Lexer.getCurStrVal(); + AsmToken ID = Lexer.getTok(); + SMLoc IDLoc = ID.getLoc(); + StringRef IDVal = ID.getString(); // Consume the identifier, see what is after it. switch (Lexer.Lex()) { @@ -606,7 +607,7 @@ if (Lexer.isNot(AsmToken::Identifier)) return TokError("expected identifier after '.set' directive"); - StringRef Name = Lexer.getCurStrVal(); + StringRef Name = Lexer.getTok().getString(); if (Lexer.Lex() != AsmToken::Comma) return TokError("unexpected token in '.set'"); @@ -623,7 +624,7 @@ if (Lexer.isNot(AsmToken::Identifier)) return TokError("expected identifier after '.section' directive"); - std::string Section = Lexer.getCurStrVal(); + std::string Section = Lexer.getTok().getString(); Lexer.Lex(); // Accept a comma separated list of modifiers. @@ -633,7 +634,7 @@ if (Lexer.isNot(AsmToken::Identifier)) return TokError("expected identifier in '.section' directive"); Section += ','; - Section += Lexer.getCurStrVal().str(); + Section += Lexer.getTok().getString().str(); Lexer.Lex(); } @@ -672,7 +673,7 @@ // FIXME: This shouldn't use a const char* + strlen, the string could have // embedded nulls. // FIXME: Should have accessor for getting string contents. - StringRef Str = Lexer.getCurStrVal(); + StringRef Str = Lexer.getTok().getString(); Out.EmitBytes(Str.substr(1, Str.size() - 2)); if (ZeroTerminated) Out.EmitBytes(StringRef("\0", 1)); @@ -900,7 +901,7 @@ if (Lexer.isNot(AsmToken::Identifier)) return TokError("expected identifier in directive"); - MCSymbol *Sym = Ctx.GetOrCreateSymbol(Lexer.getCurStrVal()); + MCSymbol *Sym = Ctx.GetOrCreateSymbol(Lexer.getTok().getString()); Lexer.Lex(); // If this is use of an undefined symbol then mark it external. @@ -930,7 +931,7 @@ // handle the identifier as the key symbol. SMLoc IDLoc = Lexer.getLoc(); - MCSymbol *Sym = Ctx.GetOrCreateSymbol(Lexer.getCurStrVal()); + MCSymbol *Sym = Ctx.GetOrCreateSymbol(Lexer.getTok().getString()); Lexer.Lex(); if (Lexer.isNot(AsmToken::Comma)) @@ -961,7 +962,7 @@ // handle the identifier as the key symbol. SMLoc IDLoc = Lexer.getLoc(); - MCSymbol *Sym = Ctx.GetOrCreateSymbol(Lexer.getCurStrVal()); + MCSymbol *Sym = Ctx.GetOrCreateSymbol(Lexer.getTok().getString()); Lexer.Lex(); if (Lexer.isNot(AsmToken::Comma)) @@ -1016,7 +1017,7 @@ bool AsmParser::ParseDirectiveDarwinZerofill() { if (Lexer.isNot(AsmToken::Identifier)) return TokError("expected segment name after '.zerofill' directive"); - std::string Section = Lexer.getCurStrVal(); + std::string Section = Lexer.getTok().getString(); Lexer.Lex(); if (Lexer.isNot(AsmToken::Comma)) @@ -1027,7 +1028,7 @@ if (Lexer.isNot(AsmToken::Identifier)) return TokError("expected section name after comma in '.zerofill' " "directive"); - Section += Lexer.getCurStrVal().str(); + Section += Lexer.getTok().getString().str(); Lexer.Lex(); // FIXME: we will need to tell GetSection() that this is to be created with or @@ -1055,7 +1056,7 @@ // handle the identifier as the key symbol. SMLoc IDLoc = Lexer.getLoc(); - MCSymbol *Sym = Ctx.GetOrCreateSymbol(Lexer.getCurStrVal()); + MCSymbol *Sym = Ctx.GetOrCreateSymbol(Lexer.getTok().getString()); Lexer.Lex(); if (Lexer.isNot(AsmToken::Comma)) @@ -1126,7 +1127,7 @@ if (Lexer.isNot(AsmToken::String)) return TokError("expected string in '.abort' directive"); - Str = Lexer.getCurStrVal(); + Str = Lexer.getTok().getString(); Lexer.Lex(); } @@ -1153,7 +1154,7 @@ // handle the identifier as the key symbol. SMLoc IDLoc = Lexer.getLoc(); - MCSymbol *Sym = Ctx.GetOrCreateSymbol(Lexer.getCurStrVal()); + MCSymbol *Sym = Ctx.GetOrCreateSymbol(Lexer.getTok().getString()); Lexer.Lex(); if (Lexer.isNot(AsmToken::Comma)) @@ -1181,7 +1182,7 @@ if (Lexer.isNot(AsmToken::String)) return TokError("expected string in '.include' directive"); - std::string Filename = Lexer.getCurStrVal(); + std::string Filename = Lexer.getTok().getString(); SMLoc IncludeLoc = Lexer.getLoc(); Lexer.Lex(); @@ -1209,8 +1210,6 @@ if (Lexer.isNot(AsmToken::String)) return TokError("expected string in '.dump' or '.load' directive"); - Lexer.getCurStrVal(); - Lexer.Lex(); if (Lexer.isNot(AsmToken::EndOfStatement)) Modified: llvm/trunk/tools/llvm-mc/llvm-mc.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-mc/llvm-mc.cpp?rev=77323&r1=77322&r2=77323&view=diff ============================================================================== --- llvm/trunk/tools/llvm-mc/llvm-mc.cpp (original) +++ llvm/trunk/tools/llvm-mc/llvm-mc.cpp Tue Jul 28 11:38:40 2009 @@ -94,16 +94,16 @@ Error = true; // error already printed. break; case AsmToken::Identifier: - outs() << "identifier: " << Lexer.getCurStrVal() << '\n'; + outs() << "identifier: " << Lexer.getTok().getString() << '\n'; break; case AsmToken::Register: - outs() << "register: " << Lexer.getCurStrVal() << '\n'; + outs() << "register: " << Lexer.getTok().getString() << '\n'; break; case AsmToken::String: - outs() << "string: " << Lexer.getCurStrVal() << '\n'; + outs() << "string: " << Lexer.getTok().getString() << '\n'; break; case AsmToken::Integer: - outs() << "int: " << Lexer.getCurIntVal() << '\n'; + outs() << "int: " << Lexer.getTok().getString() << '\n'; break; case AsmToken::Amp: outs() << "Amp\n"; break; From nlewycky at google.com Tue Jul 28 11:48:05 2009 From: nlewycky at google.com (Nick Lewycky) Date: Tue, 28 Jul 2009 09:48:05 -0700 Subject: [llvm-commits] [llvm] r77170 - in /llvm/trunk/tools/lto: LTOCodeGenerator.cpp LTOModule.cpp In-Reply-To: <9B684429-0A62-4A8F-A3FF-67B9DC926544@apple.com> References: <200907262216.n6QMGfTB032208@zion.cs.uiuc.edu> <9B684429-0A62-4A8F-A3FF-67B9DC926544@apple.com> Message-ID: 2009/7/27 Dan Gohman > > On Jul 26, 2009, at 3:16 PM, Nick Lewycky wrote: > > > * flush the formatted_raw_ostream& or else not all of the assembly > > will make > > it to the .s file. (It doesn't do this in its destructor?!) > > Hi Nick, this sounds like a bug. raw_ostream's subclasses should > flush the buffer in their destructors. Or is the raw_ostream > destructor not getting called? I didn't investigate why. llc has the same code in it, copying it to lto fixed my problem. Monkey see, monkey do. I agree this is very likely a bug though. Can you reproduce it with llc if you pull out the flush at the end (use a helloworld.bc built with -g)? Is it a mac vs. linux issue? Nick -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20090728/2746377a/attachment.html From sabre at nondot.org Tue Jul 28 11:49:23 2009 From: sabre at nondot.org (Chris Lattner) Date: Tue, 28 Jul 2009 16:49:23 -0000 Subject: [llvm-commits] [llvm] r77326 - /llvm/trunk/lib/Target/TargetLoweringObjectFile.cpp Message-ID: <200907281649.n6SGnPkQ004686@zion.cs.uiuc.edu> Author: lattner Date: Tue Jul 28 11:49:19 2009 New Revision: 77326 URL: http://llvm.org/viewvc/llvm-project?rev=77326&view=rev Log: fix unused variable warning Modified: llvm/trunk/lib/Target/TargetLoweringObjectFile.cpp Modified: llvm/trunk/lib/Target/TargetLoweringObjectFile.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/TargetLoweringObjectFile.cpp?rev=77326&r1=77325&r2=77326&view=diff ============================================================================== --- llvm/trunk/lib/Target/TargetLoweringObjectFile.cpp (original) +++ llvm/trunk/lib/Target/TargetLoweringObjectFile.cpp Tue Jul 28 11:49:19 2009 @@ -412,7 +412,7 @@ if (Kind.isText()) return TextSection; if (Kind.isMergeableCString()) { - Constant *C = cast(GV)->getInitializer(); + //Constant *C = cast(GV)->getInitializer(); // FIXME: This is completely wrong. Why is it comparing the size of the // character type to 1? From greened at obbligato.org Tue Jul 28 11:49:24 2009 From: greened at obbligato.org (David Greene) Date: Tue, 28 Jul 2009 16:49:24 -0000 Subject: [llvm-commits] [llvm] r77327 - /llvm/trunk/lib/CodeGen/VirtRegRewriter.cpp Message-ID: <200907281649.n6SGnPRv004695@zion.cs.uiuc.edu> Author: greened Date: Tue Jul 28 11:49:24 2009 New Revision: 77327 URL: http://llvm.org/viewvc/llvm-project?rev=77327&view=rev Log: Add reload and remat backscheduling. This is disabled by default. Use -schedule-spills=true to enable. Modified: llvm/trunk/lib/CodeGen/VirtRegRewriter.cpp Modified: llvm/trunk/lib/CodeGen/VirtRegRewriter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/VirtRegRewriter.cpp?rev=77327&r1=77326&r2=77327&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/VirtRegRewriter.cpp (original) +++ llvm/trunk/lib/CodeGen/VirtRegRewriter.cpp Tue Jul 28 11:49:24 2009 @@ -12,6 +12,7 @@ #include "llvm/Support/Compiler.h" #include "llvm/Support/ErrorHandling.h" #include "llvm/Support/raw_ostream.h" +#include "llvm/Target/TargetLowering.h" #include "llvm/ADT/DepthFirstIterator.h" #include "llvm/ADT/Statistic.h" #include "llvm/ADT/STLExtras.h" @@ -47,10 +48,14 @@ clEnumValEnd), cl::init(local)); +cl::opt +ScheduleSpills("schedule-spills", + cl::desc("Schedule spill code"), + cl::init(false)); + VirtRegRewriter::~VirtRegRewriter() {} - /// This class is intended for use with the new spilling framework only. It /// rewrites vreg def/uses to use the assigned preg, but does not insert any /// spill code. @@ -61,6 +66,10 @@ DOUT << "********** REWRITE MACHINE CODE **********\n"; DEBUG(errs() << "********** Function: " << MF.getFunction()->getName() << '\n'); + DOUT << "**** Machine Instrs" + << "(NOTE! Does not include spills and reloads!) ****\n"; + DEBUG(MF.dump()); + MachineRegisterInfo *mri = &MF.getRegInfo(); bool changed = false; @@ -82,6 +91,10 @@ } } } + + + DOUT << "**** Post Machine Instrs ****\n"; + DEBUG(MF.dump()); return changed; } @@ -214,6 +227,76 @@ // ************************************************************************ // +// Given a location where a reload of a spilled register or a remat of +// a constant is to be inserted, attempt to find a safe location to +// insert the load at an earlier point in the basic-block, to hide +// latency of the load and to avoid address-generation interlock +// issues. +static MachineBasicBlock::iterator +ComputeReloadLoc(MachineBasicBlock::iterator const InsertLoc, + MachineBasicBlock::iterator const Begin, + unsigned PhysReg, + const TargetRegisterInfo *TRI, + bool DoReMat, + int SSorRMId, + const TargetInstrInfo *TII, + const MachineFunction &MF) +{ + if (!ScheduleSpills) + return InsertLoc; + + // Spill backscheduling is of primary interest to addresses, so + // don't do anything if the register isn't in the register class + // used for pointers. + + const TargetLowering *TL = MF.getTarget().getTargetLowering(); + + if (!TL->isTypeLegal(TL->getPointerTy())) + // Believe it or not, this is true on PIC16. + return InsertLoc; + + const TargetRegisterClass *ptrRegClass = + TL->getRegClassFor(TL->getPointerTy()); + if (!ptrRegClass->contains(PhysReg)) + return InsertLoc; + + // Scan upwards through the preceding instructions. If an instruction doesn't + // reference the stack slot or the register we're loading, we can + // backschedule the reload up past it. + MachineBasicBlock::iterator NewInsertLoc = InsertLoc; + while (NewInsertLoc != Begin) { + MachineBasicBlock::iterator Prev = prior(NewInsertLoc); + for (unsigned i = 0; i < Prev->getNumOperands(); ++i) { + MachineOperand &Op = Prev->getOperand(i); + if (!DoReMat && Op.isFI() && Op.getIndex() == SSorRMId) + goto stop; + } + if (Prev->findRegisterUseOperandIdx(PhysReg) != -1 || + Prev->findRegisterDefOperand(PhysReg)) + goto stop; + for (const unsigned *Alias = TRI->getAliasSet(PhysReg); *Alias; ++Alias) + if (Prev->findRegisterUseOperandIdx(*Alias) != -1 || + Prev->findRegisterDefOperand(*Alias)) + goto stop; + NewInsertLoc = Prev; + } +stop:; + + // If we made it to the beginning of the block, turn around and move back + // down just past any existing reloads. They're likely to be reloads/remats + // for instructions earlier than what our current reload/remat is for, so + // they should be scheduled earlier. + if (NewInsertLoc == Begin) { + int FrameIdx; + while (InsertLoc != NewInsertLoc && + (TII->isLoadFromStackSlot(NewInsertLoc, FrameIdx) || + TII->isTriviallyReMaterializable(NewInsertLoc))) + ++NewInsertLoc; + } + + return NewInsertLoc; +} + // ReusedOp - For each reused operand, we keep track of a bit of information, // in case we need to rollback upon processing a new operand. See comments // below. @@ -717,14 +800,23 @@ unsigned NewPhysReg = GetRegForReload(RC, NewOp.AssignedPhysReg, MF, MI, Spills, MaybeDeadStores, Rejected, RegKills, KillOps, VRM); - - MachineBasicBlock::iterator MII = MI; - if (NewOp.StackSlotOrReMat > VirtRegMap::MAX_STACK_SLOT) { - ReMaterialize(*MBB, MII, NewPhysReg, NewOp.VirtReg, TII, TRI,VRM); - } else { - TII->loadRegFromStackSlot(*MBB, MII, NewPhysReg, + + bool DoReMat = NewOp.StackSlotOrReMat > VirtRegMap::MAX_STACK_SLOT; + int SSorRMId = DoReMat + ? VRM.getReMatId(NewOp.VirtReg) : NewOp.StackSlotOrReMat; + + // Back-schedule reloads and remats. + MachineBasicBlock::iterator InsertLoc = + ComputeReloadLoc(MI, MBB->begin(), PhysReg, TRI, + DoReMat, SSorRMId, TII, MF); + + if (DoReMat) { + ReMaterialize(*MBB, InsertLoc, NewPhysReg, NewOp.VirtReg, TII, + TRI, VRM); + } else { + TII->loadRegFromStackSlot(*MBB, InsertLoc, NewPhysReg, NewOp.StackSlotOrReMat, AliasRC); - MachineInstr *LoadMI = prior(MII); + MachineInstr *LoadMI = prior(InsertLoc); VRM.addSpillSlotUse(NewOp.StackSlotOrReMat, LoadMI); // Any stores to this stack slot are not dead anymore. MaybeDeadStores[NewOp.StackSlotOrReMat] = NULL; @@ -739,9 +831,8 @@ MI->getOperand(NewOp.Operand).setSubReg(0); Spills.addAvailable(NewOp.StackSlotOrReMat, NewPhysReg); - --MII; - UpdateKills(*MII, TRI, RegKills, KillOps); - DOUT << '\t' << *MII; + UpdateKills(*prior(InsertLoc), TRI, RegKills, KillOps); + DOUT << '\t' << *prior(InsertLoc); DOUT << "Reuse undone!\n"; --NumReused; @@ -1003,6 +1094,10 @@ if (!FoldsStackSlotModRef(*NextMII, SS, PhysReg, TII, TRI, VRM)) return false; + // Back-schedule reloads and remats. + MachineBasicBlock::iterator InsertLoc = + ComputeReloadLoc(MII, MBB.begin(), PhysReg, TRI, false, SS, TII, MF); + // Load from SS to the spare physical register. TII->loadRegFromStackSlot(MBB, MII, PhysReg, SS, RC); // This invalidates Phys. @@ -1469,8 +1564,15 @@ TII->storeRegToStackSlot(MBB, MII, PhysReg, true, SS, RC); MachineInstr *StoreMI = prior(MII); VRM.addSpillSlotUse(SS, StoreMI); - TII->loadRegFromStackSlot(MBB, next(MII), PhysReg, SS, RC); - MachineInstr *LoadMI = next(MII); + + // Back-schedule reloads and remats. + MachineBasicBlock::iterator InsertLoc = + ComputeReloadLoc(next(MII), MBB.begin(), PhysReg, TRI, false, + SS, TII, MF); + + TII->loadRegFromStackSlot(MBB, InsertLoc, PhysReg, SS, RC); + + MachineInstr *LoadMI = prior(InsertLoc); VRM.addSpillSlotUse(SS, LoadMI); ++NumPSpills; } @@ -1527,7 +1629,13 @@ // If the reloaded / remat value is available in another register, // copy it to the desired register. - TII->copyRegToReg(MBB, &MI, Phys, InReg, RC, RC); + + // Back-schedule reloads and remats. + MachineBasicBlock::iterator InsertLoc = + ComputeReloadLoc(MII, MBB.begin(), Phys, TRI, DoReMat, + SSorRMId, TII, MF); + + TII->copyRegToReg(MBB, InsertLoc, Phys, InReg, RC, RC); // This invalidates Phys. Spills.ClobberPhysReg(Phys); @@ -1535,7 +1643,7 @@ Spills.addAvailable(SSorRMId, Phys); // Mark is killed. - MachineInstr *CopyMI = prior(MII); + MachineInstr *CopyMI = prior(InsertLoc); MachineOperand *KillOpnd = CopyMI->findRegisterUseOperand(InReg); KillOpnd->setIsKill(); UpdateKills(*CopyMI, TRI, RegKills, KillOps); @@ -1545,12 +1653,17 @@ continue; } + // Back-schedule reloads and remats. + MachineBasicBlock::iterator InsertLoc = + ComputeReloadLoc(MII, MBB.begin(), Phys, TRI, DoReMat, + SSorRMId, TII, MF); + if (VRM.isReMaterialized(VirtReg)) { - ReMaterialize(MBB, MII, Phys, VirtReg, TII, TRI, VRM); + ReMaterialize(MBB, InsertLoc, Phys, VirtReg, TII, TRI, VRM); } else { const TargetRegisterClass* RC = RegInfo->getRegClass(VirtReg); - TII->loadRegFromStackSlot(MBB, &MI, Phys, SSorRMId, RC); - MachineInstr *LoadMI = prior(MII); + TII->loadRegFromStackSlot(MBB, InsertLoc, Phys, SSorRMId, RC); + MachineInstr *LoadMI = prior(InsertLoc); VRM.addSpillSlotUse(SSorRMId, LoadMI); ++NumLoads; } @@ -1560,7 +1673,7 @@ // Remember it's available. Spills.addAvailable(SSorRMId, Phys); - UpdateKills(*prior(MII), TRI, RegKills, KillOps); + UpdateKills(*prior(InsertLoc), TRI, RegKills, KillOps); DOUT << '\t' << *prior(MII); } } @@ -1798,9 +1911,15 @@ const TargetRegisterClass* RC = RegInfo->getRegClass(VirtReg); RegInfo->setPhysRegUsed(DesignatedReg); ReusedOperands.markClobbered(DesignatedReg); - TII->copyRegToReg(MBB, &MI, DesignatedReg, PhysReg, RC, RC); - MachineInstr *CopyMI = prior(MII); + // Back-schedule reloads and remats. + MachineBasicBlock::iterator InsertLoc = + ComputeReloadLoc(&MI, MBB.begin(), PhysReg, TRI, DoReMat, + SSorRMId, TII, MF); + + TII->copyRegToReg(MBB, InsertLoc, DesignatedReg, PhysReg, RC, RC); + + MachineInstr *CopyMI = prior(InsertLoc); UpdateKills(*CopyMI, TRI, RegKills, KillOps); // This invalidates DesignatedReg. @@ -1833,12 +1952,17 @@ if (AvoidReload) ++NumAvoided; else { + // Back-schedule reloads and remats. + MachineBasicBlock::iterator InsertLoc = + ComputeReloadLoc(MII, MBB.begin(), PhysReg, TRI, DoReMat, + SSorRMId, TII, MF); + if (DoReMat) { - ReMaterialize(MBB, MII, PhysReg, VirtReg, TII, TRI, VRM); + ReMaterialize(MBB, InsertLoc, PhysReg, VirtReg, TII, TRI, VRM); } else { const TargetRegisterClass* RC = RegInfo->getRegClass(VirtReg); - TII->loadRegFromStackSlot(MBB, &MI, PhysReg, SSorRMId, RC); - MachineInstr *LoadMI = prior(MII); + TII->loadRegFromStackSlot(MBB, InsertLoc, PhysReg, SSorRMId, RC); + MachineInstr *LoadMI = prior(InsertLoc); VRM.addSpillSlotUse(SSorRMId, LoadMI); ++NumLoads; } @@ -1857,8 +1981,8 @@ KilledMIRegs.insert(VirtReg); } - UpdateKills(*prior(MII), TRI, RegKills, KillOps); - DOUT << '\t' << *prior(MII); + UpdateKills(*prior(InsertLoc), TRI, RegKills, KillOps); + DOUT << '\t' << *prior(InsertLoc); } unsigned RReg = SubIdx ? TRI->getSubReg(PhysReg, SubIdx) : PhysReg; MI.getOperand(i).setReg(RReg); From greened at obbligato.org Tue Jul 28 11:52:59 2009 From: greened at obbligato.org (David A. Greene) Date: Tue, 28 Jul 2009 11:52:59 -0500 Subject: [llvm-commits] [llvm] r76910 - in /llvm/trunk: include/llvm/Support/FormattedStream.h lib/Support/FormattedStream.cpp In-Reply-To: <8FE84457-ED22-4423-BE95-8552A0CD225B@apple.com> References: <200907232321.n6NNLlYR010481@zion.cs.uiuc.edu> <8FE84457-ED22-4423-BE95-8552A0CD225B@apple.com> Message-ID: <200907281153.00746.greened@obbligato.org> On Thursday 23 July 2009 18:44, Chris Lattner wrote: > On Jul 23, 2009, at 4:21 PM, David Greene wrote: > > URL: http://llvm.org/viewvc/llvm-project?rev=76910&view=rev > > Log: > > Write space padding as one string to speed up comment printing. > > Hi David, > > > + // Keep a buffer of spaces handy to speed up processing. > > + static char Spaces[MAX_COLUMN_PAD]; > > + static bool Initialized = false; > > + if (!Initialized) { > > This won't work because it isn't thread safe. Why not just use: Why isn't it thread safe? Multiple threads might enter the then-clause but they're all doing the same thing and it's an idempotent operation. > const char *Spaces = " .... "; > write(Spaces, num); That's better. -Dave From daniel at zuster.org Tue Jul 28 11:56:45 2009 From: daniel at zuster.org (Daniel Dunbar) Date: Tue, 28 Jul 2009 16:56:45 -0000 Subject: [llvm-commits] [llvm] r77328 - in /llvm/trunk/tools/llvm-mc: AsmLexer.h AsmParser.cpp llvm-mc.cpp Message-ID: <200907281656.n6SGukmN004971@zion.cs.uiuc.edu> Author: ddunbar Date: Tue Jul 28 11:56:42 2009 New Revision: 77328 URL: http://llvm.org/viewvc/llvm-project?rev=77328&view=rev Log: Switch AsmLexer::Lex to returning a reference to the current token. Modified: llvm/trunk/tools/llvm-mc/AsmLexer.h llvm/trunk/tools/llvm-mc/AsmParser.cpp llvm/trunk/tools/llvm-mc/llvm-mc.cpp Modified: llvm/trunk/tools/llvm-mc/AsmLexer.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-mc/AsmLexer.h?rev=77328&r1=77327&r2=77328&view=diff ============================================================================== --- llvm/trunk/tools/llvm-mc/AsmLexer.h (original) +++ llvm/trunk/tools/llvm-mc/AsmLexer.h Tue Jul 28 11:56:42 2009 @@ -110,8 +110,8 @@ AsmLexer(SourceMgr &SrcMgr); ~AsmLexer(); - AsmToken::TokenKind Lex() { - return CurTok = LexToken(), getKind(); + const AsmToken &Lex() { + return CurTok = LexToken(); } AsmToken::TokenKind getKind() const { return CurTok.getKind(); } Modified: llvm/trunk/tools/llvm-mc/AsmParser.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-mc/AsmParser.cpp?rev=77328&r1=77327&r2=77328&view=diff ============================================================================== --- llvm/trunk/tools/llvm-mc/AsmParser.cpp (original) +++ llvm/trunk/tools/llvm-mc/AsmParser.cpp Tue Jul 28 11:56:42 2009 @@ -318,7 +318,7 @@ StringRef IDVal = ID.getString(); // Consume the identifier, see what is after it. - switch (Lexer.Lex()) { + switch (Lexer.Lex().getKind()) { case AsmToken::Colon: { // identifier ':' -> Label. Lexer.Lex(); @@ -609,7 +609,7 @@ StringRef Name = Lexer.getTok().getString(); - if (Lexer.Lex() != AsmToken::Comma) + if (Lexer.Lex().isNot(AsmToken::Comma)) return TokError("unexpected token in '.set'"); Lexer.Lex(); Modified: llvm/trunk/tools/llvm-mc/llvm-mc.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-mc/llvm-mc.cpp?rev=77328&r1=77327&r2=77328&view=diff ============================================================================== --- llvm/trunk/tools/llvm-mc/llvm-mc.cpp (original) +++ llvm/trunk/tools/llvm-mc/llvm-mc.cpp Tue Jul 28 11:56:42 2009 @@ -83,9 +83,8 @@ bool Error = false; - AsmToken::TokenKind Tok = Lexer.Lex(); - while (Tok != AsmToken::Eof) { - switch (Tok) { + while (Lexer.Lex().isNot(AsmToken::Eof)) { + switch (Lexer.getKind()) { default: Lexer.PrintMessage(Lexer.getLoc(), "unknown token", "warning"); Error = true; @@ -136,8 +135,6 @@ case AsmToken::Star: outs() << "Star\n"; break; case AsmToken::Tilde: outs() << "Tilde\n"; break; } - - Tok = Lexer.Lex(); } return Error; From david_goodwin at apple.com Tue Jul 28 12:06:56 2009 From: david_goodwin at apple.com (David Goodwin) Date: Tue, 28 Jul 2009 17:06:56 -0000 Subject: [llvm-commits] [llvm] r77329 - in /llvm/trunk: lib/Target/ARM/ARMInstrThumb2.td test/CodeGen/Thumb2/thumb2-lsr3.ll Message-ID: <200907281706.n6SH6vAZ005466@zion.cs.uiuc.edu> Author: david_goodwin Date: Tue Jul 28 12:06:49 2009 New Revision: 77329 URL: http://llvm.org/viewvc/llvm-project?rev=77329&view=rev Log: Add Thumb-2 patterns for ARMsrl_flag and ARMsra_flag. Added: llvm/trunk/test/CodeGen/Thumb2/thumb2-lsr3.ll Modified: llvm/trunk/lib/Target/ARM/ARMInstrThumb2.td Modified: llvm/trunk/lib/Target/ARM/ARMInstrThumb2.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMInstrThumb2.td?rev=77329&r1=77328&r2=77329&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMInstrThumb2.td (original) +++ llvm/trunk/lib/Target/ARM/ARMInstrThumb2.td Tue Jul 28 12:06:49 2009 @@ -715,9 +715,18 @@ defm t2ROR : T2I_sh_ir<"ror", BinOpFrag<(rotr node:$LHS, node:$RHS)>>; def t2MOVrx : T2sI<(outs GPR:$dst), (ins GPR:$src), - "mov", " $dst, $src, rrx", + "rrx", " $dst, $src", [(set GPR:$dst, (ARMrrx GPR:$src))]>; +let Defs = [CPSR] in { +def t2MOVsrl_flag : T2XI<(outs GPR:$dst), (ins GPR:$src), + "lsrs.w $dst, $src, #1", + [(set GPR:$dst, (ARMsrl_flag GPR:$src))]>; +def t2MOVsra_flag : T2XI<(outs GPR:$dst), (ins GPR:$src), + "asrs.w $dst, $src, #1", + [(set GPR:$dst, (ARMsra_flag GPR:$src))]>; +} + //===----------------------------------------------------------------------===// // Bitwise Instructions. // Added: llvm/trunk/test/CodeGen/Thumb2/thumb2-lsr3.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Thumb2/thumb2-lsr3.ll?rev=77329&view=auto ============================================================================== --- llvm/trunk/test/CodeGen/Thumb2/thumb2-lsr3.ll (added) +++ llvm/trunk/test/CodeGen/Thumb2/thumb2-lsr3.ll Tue Jul 28 12:06:49 2009 @@ -0,0 +1,19 @@ +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 + +define i1 @test1(i64 %poscnt, i32 %work) { +entry: +; CHECK: rrx r0, r0 +; CHECK: lsrs.w r1, r1, #1 + %0 = lshr i64 %poscnt, 1 + %1 = icmp eq i64 %0, 0 + ret i1 %1 +} + +define i1 @test2(i64 %poscnt, i32 %work) { +entry: +; CHECK: rrx r0, r0 +; CHECK: asrs.w r1, r1, #1 + %0 = ashr i64 %poscnt, 1 + %1 = icmp eq i64 %0, 0 + ret i1 %1 +} From clattner at apple.com Tue Jul 28 12:24:33 2009 From: clattner at apple.com (Chris Lattner) Date: Tue, 28 Jul 2009 10:24:33 -0700 Subject: [llvm-commits] [llvm] r77204 - in /llvm/trunk: include/llvm/Target/COFFTargetAsmInfo.h include/llvm/Target/ELFTargetAsmInfo.h lib/Target/COFFTargetAsmInfo.cpp lib/Target/X86/X86TargetAsmInfo.cpp lib/Target/X86/X86TargetAsmInfo.h In-Reply-To: References: <200907271646.n6RGk16h012710@zion.cs.uiuc.edu> Message-ID: <3F42C733-A438-432D-BB04-DAC5C3D1D468@apple.com> On Jul 27, 2009, at 6:26 PM, Howard Su wrote: > PIC16 is also using COFF as its target. PIC16 doesn't share any code with COFF. If it does, it would be really nice for someone who knows stuff about PIC16 to make it use the various COFF classes I just put in. -Chris From clattner at apple.com Tue Jul 28 12:26:29 2009 From: clattner at apple.com (Chris Lattner) Date: Tue, 28 Jul 2009 10:26:29 -0700 Subject: [llvm-commits] [llvm-gcc-4.2] r77276 - /llvm-gcc-4.2/trunk/gcc/objc/objc-act.c In-Reply-To: <200907272350.n6RNow4H026564@zion.cs.uiuc.edu> References: <200907272350.n6RNow4H026564@zion.cs.uiuc.edu> Message-ID: <206FF0C9-90BD-4993-91C9-1376F7F1AFF4@apple.com> On Jul 27, 2009, at 4:50 PM, Bill Wendling wrote: > Author: void > Date: Mon Jul 27 18:50:57 2009 > New Revision: 77276 > > URL: http://llvm.org/viewvc/llvm-project?rev=77276&view=rev > Log: > LTO was stripping some Objective-C metadata symbols because IPSCCP > thought that > they were dead. They weren't in the llvm.used list. Mark them as > "preserve" so > that they're placed into the list. > > The testcase for this is the SingleSource/UnitTests/ObjC/protocols.m > file in > the test suite. Thanks Bill. At some point, we have to get objc metadata into llvm.used.compiler instead of llvm.used. Out of curiosity, is this on your todo list? :) -Chris From daniel at zuster.org Tue Jul 28 12:34:57 2009 From: daniel at zuster.org (Daniel Dunbar) Date: Tue, 28 Jul 2009 17:34:57 -0000 Subject: [llvm-commits] [llvm] r77331 - /llvm/trunk/utils/emacs/emacs.el Message-ID: <200907281734.n6SHYvhG006268@zion.cs.uiuc.edu> Author: ddunbar Date: Tue Jul 28 12:34:57 2009 New Revision: 77331 URL: http://llvm.org/viewvc/llvm-project?rev=77331&view=rev Log: Tweak LLVM emacs style to make default namespace indentation closer to style guide. Modified: llvm/trunk/utils/emacs/emacs.el Modified: llvm/trunk/utils/emacs/emacs.el URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/emacs/emacs.el?rev=77331&r1=77330&r2=77331&view=diff ============================================================================== --- llvm/trunk/utils/emacs/emacs.el (original) +++ llvm/trunk/utils/emacs/emacs.el Tue Jul 28 12:34:57 2009 @@ -1,6 +1,6 @@ ;; LLVM coding style guidelines in emacs ;; Maintainer: LLVM Team, http://llvm.org/ -;; Modified: 2005-04-24 +;; Modified: 2009-07-28 ;; Max 80 cols per line, indent by two spaces, no tabs. ;; Apparently, this does not affect tabs in Makefiles. @@ -17,7 +17,9 @@ '((fill-column . 80) (c++-indent-level . 2) (c-basic-offset . 2) - (indent-tabs-mode . nil))) + (indent-tabs-mode . nil) + (c-offsets-alist . ((innamespace 0))))) + (add-hook 'c-mode-hook (function (lambda nil @@ -26,6 +28,7 @@ (c-set-style "llvm.org") ) )))) + (add-hook 'c++-mode-hook (function (lambda nil From sabre at nondot.org Tue Jul 28 12:50:29 2009 From: sabre at nondot.org (Chris Lattner) Date: Tue, 28 Jul 2009 17:50:29 -0000 Subject: [llvm-commits] [llvm] r77334 - in /llvm/trunk: include/llvm/Target/TargetLoweringObjectFile.h lib/Target/ARM/ARMISelLowering.cpp lib/Target/PowerPC/PPCISelLowering.cpp lib/Target/TargetLoweringObjectFile.cpp lib/Target/X86/X86ISelLowering.cpp Message-ID: <200907281750.n6SHoT8d006753@zion.cs.uiuc.edu> Author: lattner Date: Tue Jul 28 12:50:28 2009 New Revision: 77334 URL: http://llvm.org/viewvc/llvm-project?rev=77334&view=rev Log: the apple "ld_classic" linker doesn't support .literal16 in 32-bit mode, and "ld64" (the default linker) falls back to it in -static mode. Modified: llvm/trunk/include/llvm/Target/TargetLoweringObjectFile.h llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp llvm/trunk/lib/Target/TargetLoweringObjectFile.cpp llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Modified: llvm/trunk/include/llvm/Target/TargetLoweringObjectFile.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetLoweringObjectFile.h?rev=77334&r1=77333&r2=77334&view=diff ============================================================================== --- llvm/trunk/include/llvm/Target/TargetLoweringObjectFile.h (original) +++ llvm/trunk/include/llvm/Target/TargetLoweringObjectFile.h Tue Jul 28 12:50:28 2009 @@ -160,7 +160,7 @@ const Section *EightByteConstantSection; const Section *SixteenByteConstantSection; public: - TargetLoweringObjectFileMachO(); + TargetLoweringObjectFileMachO(const TargetMachine &TM); virtual const Section *SelectSectionForGlobal(const GlobalValue *GV, SectionKind Kind, const TargetMachine &TM) const; Modified: llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp?rev=77334&r1=77333&r2=77334&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp (original) +++ llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp Tue Jul 28 12:50:28 2009 @@ -106,7 +106,7 @@ static TargetLoweringObjectFile *createTLOF(TargetMachine &TM) { if (TM.getSubtarget().isTargetDarwin()) - return new TargetLoweringObjectFileMachO(); + return new TargetLoweringObjectFileMachO(TM); return new TargetLoweringObjectFileELF(true); } Modified: llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp?rev=77334&r1=77333&r2=77334&view=diff ============================================================================== --- llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp (original) +++ llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp Tue Jul 28 12:50:28 2009 @@ -59,7 +59,7 @@ static TargetLoweringObjectFile *CreateTLOF(const PPCTargetMachine &TM) { if (TM.getSubtargetImpl()->isDarwin()) - return new TargetLoweringObjectFileMachO(); + return new TargetLoweringObjectFileMachO(TM); return new TargetLoweringObjectFileELF(false, true); } Modified: llvm/trunk/lib/Target/TargetLoweringObjectFile.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/TargetLoweringObjectFile.cpp?rev=77334&r1=77333&r2=77334&view=diff ============================================================================== --- llvm/trunk/lib/Target/TargetLoweringObjectFile.cpp (original) +++ llvm/trunk/lib/Target/TargetLoweringObjectFile.cpp Tue Jul 28 12:50:28 2009 @@ -486,7 +486,7 @@ //===----------------------------------------------------------------------===// TargetLoweringObjectFileMachO:: -TargetLoweringObjectFileMachO() { +TargetLoweringObjectFileMachO(const TargetMachine &TM) { TextSection = getOrCreateSection("\t.text", true, SectionKind::Text); DataSection = getOrCreateSection("\t.data", true, SectionKind::DataRel); @@ -496,8 +496,15 @@ SectionKind::MergeableConst4); EightByteConstantSection = getOrCreateSection("\t.literal8\n", true, SectionKind::MergeableConst8); - SixteenByteConstantSection = - getOrCreateSection("\t.literal16\n", true, SectionKind::MergeableConst16); + + // ld_classic doesn't support .literal16 in 32-bit mode, and ld64 falls back + // to using it in -static mode. + if (TM.getRelocationModel() != Reloc::Static && + TM.getTargetData()->getPointerSize() == 32) + SixteenByteConstantSection = + getOrCreateSection("\t.literal16\n", true, SectionKind::MergeableConst16); + else + SixteenByteConstantSection = 0; ReadOnlySection = getOrCreateSection("\t.const", true, SectionKind::ReadOnly); @@ -551,7 +558,7 @@ return FourByteConstantSection; if (Kind.isMergeableConst8()) return EightByteConstantSection; - if (Kind.isMergeableConst16()) + if (Kind.isMergeableConst16() && SixteenByteConstantSection) return SixteenByteConstantSection; return ReadOnlySection; // .const } @@ -582,7 +589,7 @@ return FourByteConstantSection; if (Kind.isMergeableConst8()) return EightByteConstantSection; - if (Kind.isMergeableConst16()) + if (Kind.isMergeableConst16() && SixteenByteConstantSection) return SixteenByteConstantSection; return ReadOnlySection; // .const } Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.cpp?rev=77334&r1=77333&r2=77334&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original) +++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Tue Jul 28 12:50:28 2009 @@ -55,7 +55,7 @@ switch (TM.getSubtarget().TargetType) { default: llvm_unreachable("unknown subtarget type"); case X86Subtarget::isDarwin: - return new TargetLoweringObjectFileMachO(); + return new TargetLoweringObjectFileMachO(TM); case X86Subtarget::isELF: return new TargetLoweringObjectFileELF(); case X86Subtarget::isMingw: From sabre at nondot.org Tue Jul 28 12:57:51 2009 From: sabre at nondot.org (Chris Lattner) Date: Tue, 28 Jul 2009 17:57:51 -0000 Subject: [llvm-commits] [llvm] r77336 - in /llvm/trunk: lib/Target/TargetLoweringObjectFile.cpp test/CodeGen/X86/global-sections-tls.ll Message-ID: <200907281757.n6SHvqiB006997@zion.cs.uiuc.edu> Author: lattner Date: Tue Jul 28 12:57:51 2009 New Revision: 77336 URL: http://llvm.org/viewvc/llvm-project?rev=77336&view=rev Log: Fix PR4639, a ELF-TLS regression from some of my refactoring. Added: llvm/trunk/test/CodeGen/X86/global-sections-tls.ll Modified: llvm/trunk/lib/Target/TargetLoweringObjectFile.cpp Modified: llvm/trunk/lib/Target/TargetLoweringObjectFile.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/TargetLoweringObjectFile.cpp?rev=77336&r1=77335&r2=77336&view=diff ============================================================================== --- llvm/trunk/lib/Target/TargetLoweringObjectFile.cpp (original) +++ llvm/trunk/lib/Target/TargetLoweringObjectFile.cpp Tue Jul 28 12:57:51 2009 @@ -354,7 +354,7 @@ Str.push_back('@'); const char *KindStr; - if (Kind.isBSS()) + if (Kind.isBSS() || Kind.isThreadBSS()) KindStr = "nobits"; else KindStr = "progbits"; Added: llvm/trunk/test/CodeGen/X86/global-sections-tls.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/global-sections-tls.ll?rev=77336&view=auto ============================================================================== --- llvm/trunk/test/CodeGen/X86/global-sections-tls.ll (added) +++ llvm/trunk/test/CodeGen/X86/global-sections-tls.ll Tue Jul 28 12:57:51 2009 @@ -0,0 +1,14 @@ +; RUN: llvm-as < %s | llc -mtriple=i386-unknown-linux-gnu | FileCheck %s -check-prefix=LINUX + +; PR4639 + at G1 = internal thread_local global i32 0 ; [#uses=1] +; LINUX: .section .tbss,"awT", at nobits +; LINUX: G1: + + +define i32* @foo() nounwind readnone { +entry: + ret i32* @G1 +} + + From daniel at zuster.org Tue Jul 28 12:58:44 2009 From: daniel at zuster.org (Daniel Dunbar) Date: Tue, 28 Jul 2009 17:58:44 -0000 Subject: [llvm-commits] [llvm] r77337 - in /llvm/trunk: include/llvm/MC/MCAsmLexer.h lib/MC/MCAsmLexer.cpp tools/llvm-mc/AsmLexer.cpp tools/llvm-mc/AsmLexer.h Message-ID: <200907281758.n6SHwj23007062@zion.cs.uiuc.edu> Author: ddunbar Date: Tue Jul 28 12:58:44 2009 New Revision: 77337 URL: http://llvm.org/viewvc/llvm-project?rev=77337&view=rev Log: Expose Tokens to target specific assembly parsers. Modified: llvm/trunk/include/llvm/MC/MCAsmLexer.h llvm/trunk/lib/MC/MCAsmLexer.cpp llvm/trunk/tools/llvm-mc/AsmLexer.cpp llvm/trunk/tools/llvm-mc/AsmLexer.h Modified: llvm/trunk/include/llvm/MC/MCAsmLexer.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCAsmLexer.h?rev=77337&r1=77336&r2=77337&view=diff ============================================================================== --- llvm/trunk/include/llvm/MC/MCAsmLexer.h (original) +++ llvm/trunk/include/llvm/MC/MCAsmLexer.h Tue Jul 28 12:58:44 2009 @@ -10,21 +10,114 @@ #ifndef LLVM_MC_MCASMLEXER_H #define LLVM_MC_MCASMLEXER_H +#include "llvm/ADT/StringRef.h" + namespace llvm { class MCAsmLexer; class MCInst; +class SMLoc; class Target; +/// AsmToken - Target independent representation for an assembler token. +struct AsmToken { + enum TokenKind { + // Markers + Eof, Error, + + // String values. + Identifier, + Register, + String, + + // Integer values. + Integer, + + // No-value. + EndOfStatement, + Colon, + Plus, Minus, Tilde, + Slash, // '/' + LParen, RParen, + Star, Comma, Dollar, Equal, EqualEqual, + + Pipe, PipePipe, Caret, + Amp, AmpAmp, Exclaim, ExclaimEqual, Percent, + Less, LessEqual, LessLess, LessGreater, + Greater, GreaterEqual, GreaterGreater + }; + + TokenKind Kind; + + /// A reference to the entire token contents; this is always a pointer into + /// a memory buffer owned by the source manager. + StringRef Str; + + int64_t IntVal; + +public: + AsmToken() {} + AsmToken(TokenKind _Kind, const StringRef &_Str, int64_t _IntVal = 0) + : Kind(_Kind), Str(_Str), IntVal(_IntVal) {} + + TokenKind getKind() const { return Kind; } + bool is(TokenKind K) const { return Kind == K; } + bool isNot(TokenKind K) const { return Kind != K; } + + SMLoc getLoc() const; + + /// getString - Get the string for the current token, this includes all + /// characters (for example, the quotes on strings) in the token. + /// + /// The returned StringRef points into the source manager's memory buffer, and + /// is safe to store across calls to Lex(). + StringRef getString() const { return Str; } + + // FIXME: Don't compute this in advance, it makes every token larger, and is + // also not generally what we want (it is nicer for recovery etc. to lex 123br + // as a single token, then diagnose as an invalid number). + int64_t getIntVal() const { + assert(Kind == Integer && "This token isn't an integer"); + return IntVal; + } +}; + /// MCAsmLexer - Generic assembler lexer interface, for use by target specific /// assembly lexers. class MCAsmLexer { + /// The current token, stored in the base class for faster access. + AsmToken CurTok; + MCAsmLexer(const MCAsmLexer &); // DO NOT IMPLEMENT void operator=(const MCAsmLexer &); // DO NOT IMPLEMENT protected: // Can only create subclasses. MCAsmLexer(); - + + virtual AsmToken LexToken() = 0; + public: virtual ~MCAsmLexer(); + + /// Lex - Consume the next token from the input stream and return it. + /// + /// The lexer will continuosly return the end-of-file token once the end of + /// the main input file has been reached. + const AsmToken &Lex() { + return CurTok = LexToken(); + } + + /// getTok - Get the current (last) lexed token. + const AsmToken &getTok() { + return CurTok; + } + + /// getKind - Get the kind of current token. + AsmToken::TokenKind getKind() const { return CurTok.getKind(); } + + /// is - Check if the current token has kind \arg K. + bool is(AsmToken::TokenKind K) const { return CurTok.is(K); } + + /// isNot - Check if the current token has kind \arg K. + bool isNot(AsmToken::TokenKind K) const { return CurTok.isNot(K); } }; } // End llvm namespace Modified: llvm/trunk/lib/MC/MCAsmLexer.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCAsmLexer.cpp?rev=77337&r1=77336&r2=77337&view=diff ============================================================================== --- llvm/trunk/lib/MC/MCAsmLexer.cpp (original) +++ llvm/trunk/lib/MC/MCAsmLexer.cpp Tue Jul 28 12:58:44 2009 @@ -11,7 +11,7 @@ using namespace llvm; -MCAsmLexer::MCAsmLexer() { +MCAsmLexer::MCAsmLexer() : CurTok(AsmToken::Error, StringRef()) { } MCAsmLexer::~MCAsmLexer() { Modified: llvm/trunk/tools/llvm-mc/AsmLexer.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-mc/AsmLexer.cpp?rev=77337&r1=77336&r2=77337&view=diff ============================================================================== --- llvm/trunk/tools/llvm-mc/AsmLexer.cpp (original) +++ llvm/trunk/tools/llvm-mc/AsmLexer.cpp Tue Jul 28 12:58:44 2009 @@ -24,7 +24,6 @@ CurBuffer = 0; CurBuf = SrcMgr.getMemoryBuffer(CurBuffer); CurPtr = CurBuf->getBufferStart(); - CurTok = AsmToken(AsmToken::Error, StringRef(CurPtr, 0)); TokStart = 0; } Modified: llvm/trunk/tools/llvm-mc/AsmLexer.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-mc/AsmLexer.h?rev=77337&r1=77336&r2=77337&view=diff ============================================================================== --- llvm/trunk/tools/llvm-mc/AsmLexer.h (original) +++ llvm/trunk/tools/llvm-mc/AsmLexer.h Tue Jul 28 12:58:44 2009 @@ -25,69 +25,6 @@ class SourceMgr; class SMLoc; -/// AsmToken - Target independent representation for an assembler token. -struct AsmToken { - enum TokenKind { - // Markers - Eof, Error, - - // String values. - Identifier, - Register, - String, - - // Integer values. - Integer, - - // No-value. - EndOfStatement, - Colon, - Plus, Minus, Tilde, - Slash, // '/' - LParen, RParen, - Star, Comma, Dollar, Equal, EqualEqual, - - Pipe, PipePipe, Caret, - Amp, AmpAmp, Exclaim, ExclaimEqual, Percent, - Less, LessEqual, LessLess, LessGreater, - Greater, GreaterEqual, GreaterGreater - }; - - TokenKind Kind; - - /// A reference to the entire token contents; this is always a pointer into - /// a memory buffer owned by the source manager. - StringRef Str; - - int64_t IntVal; - -public: - AsmToken() {} - AsmToken(TokenKind _Kind, const StringRef &_Str, int64_t _IntVal = 0) - : Kind(_Kind), Str(_Str), IntVal(_IntVal) {} - - TokenKind getKind() const { return Kind; } - bool is(TokenKind K) const { return Kind == K; } - bool isNot(TokenKind K) const { return Kind != K; } - - SMLoc getLoc() const; - - /// getString - Get the string for the current token, this includes all - /// characters (for example, the quotes on strings) in the token. - /// - /// The returned StringRef points into the source manager's memory buffer, and - /// is safe to store across calls to Lex(). - StringRef getString() const { return Str; } - - // FIXME: Don't compute this in advance, it makes every token larger, and is - // also not generally what we want (it is nicer for recovery etc. to lex 123br - // as a single token, then diagnose as an invalid number). - int64_t getIntVal() const { - assert(Kind == Integer && "This token isn't an integer"); - return IntVal; - } -}; - /// AsmLexer - Lexer class for assembly files. class AsmLexer : public MCAsmLexer { SourceMgr &SrcMgr; @@ -97,32 +34,23 @@ const char *TokStart; - /// The current token. - AsmToken CurTok; - /// This is the current buffer index we're lexing from as managed by the /// SourceMgr object. int CurBuffer; void operator=(const AsmLexer&); // DO NOT IMPLEMENT AsmLexer(const AsmLexer&); // DO NOT IMPLEMENT + +protected: + /// LexToken - Read the next token and return its code. + virtual AsmToken LexToken(); + public: AsmLexer(SourceMgr &SrcMgr); ~AsmLexer(); - const AsmToken &Lex() { - return CurTok = LexToken(); - } - - AsmToken::TokenKind getKind() const { return CurTok.getKind(); } - bool is(AsmToken::TokenKind K) const { return CurTok.is(K); } - bool isNot(AsmToken::TokenKind K) const { return CurTok.isNot(K); } - SMLoc getLoc() const; - - /// getTok - Return a reference to the current (last) lexed token. - const AsmToken &getTok() const { return CurTok; } - + /// EnterIncludeFile - Enter the specified file. This returns true on failure. bool EnterIncludeFile(const std::string &Filename); @@ -132,8 +60,6 @@ int getNextChar(); AsmToken ReturnError(const char *Loc, const std::string &Msg); - /// LexToken - Read the next token and return its code. - AsmToken LexToken(); AsmToken LexIdentifier(); AsmToken LexPercent(); AsmToken LexSlash(); From sabre at nondot.org Tue Jul 28 13:04:18 2009 From: sabre at nondot.org (Chris Lattner) Date: Tue, 28 Jul 2009 18:04:18 -0000 Subject: [llvm-commits] [llvm] r77338 - /llvm/trunk/test/CodeGen/X86/global-sections.ll Message-ID: <200907281804.n6SI4Ipn007231@zion.cs.uiuc.edu> Author: lattner Date: Tue Jul 28 13:04:18 2009 New Revision: 77338 URL: http://llvm.org/viewvc/llvm-project?rev=77338&view=rev Log: fix testcase for previous patch. Modified: llvm/trunk/test/CodeGen/X86/global-sections.ll Modified: llvm/trunk/test/CodeGen/X86/global-sections.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/global-sections.ll?rev=77338&r1=77337&r2=77338&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/X86/global-sections.ll (original) +++ llvm/trunk/test/CodeGen/X86/global-sections.ll Tue Jul 28 13:04:18 2009 @@ -37,7 +37,7 @@ ; _Complex long long const G4 = 34; @G4 = constant {i64,i64} { i64 34, i64 0 } -; DARWIN: .literal16 +; DARWIN: .const ; DARWIN: _G4: ; DARWIN: .long 34 From david_goodwin at apple.com Tue Jul 28 13:15:38 2009 From: david_goodwin at apple.com (David Goodwin) Date: Tue, 28 Jul 2009 18:15:38 -0000 Subject: [llvm-commits] [llvm] r77340 - in /llvm/trunk: lib/Target/ARM/ARMInstrThumb2.td test/CodeGen/Thumb2/thumb2-lsr3.ll Message-ID: <200907281815.n6SIFctv007606@zion.cs.uiuc.edu> Author: david_goodwin Date: Tue Jul 28 13:15:38 2009 New Revision: 77340 URL: http://llvm.org/viewvc/llvm-project?rev=77340&view=rev Log: Add workaround for . Modified: llvm/trunk/lib/Target/ARM/ARMInstrThumb2.td llvm/trunk/test/CodeGen/Thumb2/thumb2-lsr3.ll Modified: llvm/trunk/lib/Target/ARM/ARMInstrThumb2.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMInstrThumb2.td?rev=77340&r1=77339&r2=77340&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMInstrThumb2.td (original) +++ llvm/trunk/lib/Target/ARM/ARMInstrThumb2.td Tue Jul 28 13:15:38 2009 @@ -714,8 +714,9 @@ defm t2ASR : T2I_sh_ir<"asr", BinOpFrag<(sra node:$LHS, node:$RHS)>>; defm t2ROR : T2I_sh_ir<"ror", BinOpFrag<(rotr node:$LHS, node:$RHS)>>; +// FIXME should be "rrx $dst,$src" once is fixed def t2MOVrx : T2sI<(outs GPR:$dst), (ins GPR:$src), - "rrx", " $dst, $src", + "mov", ".w $dst, $src, rrx", [(set GPR:$dst, (ARMrrx GPR:$src))]>; let Defs = [CPSR] in { Modified: llvm/trunk/test/CodeGen/Thumb2/thumb2-lsr3.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Thumb2/thumb2-lsr3.ll?rev=77340&r1=77339&r2=77340&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/Thumb2/thumb2-lsr3.ll (original) +++ llvm/trunk/test/CodeGen/Thumb2/thumb2-lsr3.ll Tue Jul 28 13:15:38 2009 @@ -2,7 +2,7 @@ define i1 @test1(i64 %poscnt, i32 %work) { entry: -; CHECK: rrx r0, r0 +; CHECK: mov.w r0, r0, rrx ; CHECK: lsrs.w r1, r1, #1 %0 = lshr i64 %poscnt, 1 %1 = icmp eq i64 %0, 0 @@ -11,7 +11,7 @@ define i1 @test2(i64 %poscnt, i32 %work) { entry: -; CHECK: rrx r0, r0 +; CHECK: mov.w r0, r0, rrx ; CHECK: asrs.w r1, r1, #1 %0 = ashr i64 %poscnt, 1 %1 = icmp eq i64 %0, 0 From daniel at zuster.org Tue Jul 28 13:17:27 2009 From: daniel at zuster.org (Daniel Dunbar) Date: Tue, 28 Jul 2009 18:17:27 -0000 Subject: [llvm-commits] [llvm] r77341 - /llvm/trunk/tools/llvm-mc/MC-X86Specific.cpp Message-ID: <200907281817.n6SIHR4t007684@zion.cs.uiuc.edu> Author: ddunbar Date: Tue Jul 28 13:17:26 2009 New Revision: 77341 URL: http://llvm.org/viewvc/llvm-project?rev=77341&view=rev Log: Switch X86 assembly parser to using the generic lexer interface. Modified: llvm/trunk/tools/llvm-mc/MC-X86Specific.cpp Modified: llvm/trunk/tools/llvm-mc/MC-X86Specific.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-mc/MC-X86Specific.cpp?rev=77341&r1=77340&r2=77341&view=diff ============================================================================== --- llvm/trunk/tools/llvm-mc/MC-X86Specific.cpp (original) +++ llvm/trunk/tools/llvm-mc/MC-X86Specific.cpp Tue Jul 28 13:17:26 2009 @@ -81,17 +81,17 @@ }; bool AsmParser::ParseX86Register(X86Operand &Op) { - assert(Lexer.getKind() == AsmToken::Register && "Invalid token kind!"); + assert(getLexer().is(AsmToken::Register) && "Invalid token kind!"); // FIXME: Decode register number. Op = X86Operand::CreateReg(123); - Lexer.Lex(); // Eat register token. + getLexer().Lex(); // Eat register token. return false; } bool AsmParser::ParseX86Operand(X86Operand &Op) { - switch (Lexer.getKind()) { + switch (getLexer().getKind()) { default: return ParseX86MemOperand(Op); case AsmToken::Register: @@ -100,7 +100,7 @@ return ParseX86Register(Op); case AsmToken::Dollar: { // $42 -> immediate. - Lexer.Lex(); + getLexer().Lex(); MCValue Val; if (ParseRelocatableExpression(Val)) return true; @@ -108,9 +108,9 @@ return false; } case AsmToken::Star: { - Lexer.Lex(); // Eat the star. + getLexer().Lex(); // Eat the star. - if (Lexer.is(AsmToken::Register)) { + if (getLexer().is(AsmToken::Register)) { if (ParseX86Register(Op)) return true; } else if (ParseX86MemOperand(Op)) @@ -132,24 +132,24 @@ // only way to do this without lookahead is to eat the ( and see what is after // it. MCValue Disp = MCValue::get(0, 0, 0); - if (Lexer.isNot(AsmToken::LParen)) { + if (getLexer().isNot(AsmToken::LParen)) { if (ParseRelocatableExpression(Disp)) return true; // After parsing the base expression we could either have a parenthesized // memory address or not. If not, return now. If so, eat the (. - if (Lexer.isNot(AsmToken::LParen)) { + if (getLexer().isNot(AsmToken::LParen)) { Op = X86Operand::CreateMem(SegReg, Disp, 0, 0, 0); return false; } // Eat the '('. - Lexer.Lex(); + getLexer().Lex(); } else { // Okay, we have a '('. We don't know if this is an expression or not, but // so we have to eat the ( to see beyond it. - Lexer.Lex(); // Eat the '('. + getLexer().Lex(); // Eat the '('. - if (Lexer.is(AsmToken::Register) || Lexer.is(AsmToken::Comma)) { + if (getLexer().is(AsmToken::Register) || getLexer().is(AsmToken::Comma)) { // Nothing to do here, fall into the code below with the '(' part of the // memory operand consumed. } else { @@ -159,13 +159,13 @@ // After parsing the base expression we could either have a parenthesized // memory address or not. If not, return now. If so, eat the (. - if (Lexer.isNot(AsmToken::LParen)) { + if (getLexer().isNot(AsmToken::LParen)) { Op = X86Operand::CreateMem(SegReg, Disp, 0, 0, 0); return false; } // Eat the '('. - Lexer.Lex(); + getLexer().Lex(); } } @@ -173,14 +173,14 @@ // the rest of the memory operand. unsigned BaseReg = 0, IndexReg = 0, Scale = 0; - if (Lexer.is(AsmToken::Register)) { + if (getLexer().is(AsmToken::Register)) { if (ParseX86Register(Op)) return true; BaseReg = Op.getReg(); } - if (Lexer.is(AsmToken::Comma)) { - Lexer.Lex(); // Eat the comma. + if (getLexer().is(AsmToken::Comma)) { + getLexer().Lex(); // Eat the comma. // Following the comma we should have either an index register, or a scale // value. We don't support the later form, but we want to parse it @@ -188,20 +188,20 @@ // // Not that even though it would be completely consistent to support syntax // like "1(%eax,,1)", the assembler doesn't. - if (Lexer.is(AsmToken::Register)) { + if (getLexer().is(AsmToken::Register)) { if (ParseX86Register(Op)) return true; IndexReg = Op.getReg(); Scale = 1; // If not specified, the scale defaults to 1. - if (Lexer.isNot(AsmToken::RParen)) { + if (getLexer().isNot(AsmToken::RParen)) { // Parse the scale amount: // ::= ',' [scale-expression] - if (Lexer.isNot(AsmToken::Comma)) + if (getLexer().isNot(AsmToken::Comma)) return true; - Lexer.Lex(); // Eat the comma. + getLexer().Lex(); // Eat the comma. - if (Lexer.isNot(AsmToken::RParen)) { + if (getLexer().isNot(AsmToken::RParen)) { int64_t ScaleVal; if (ParseAbsoluteExpression(ScaleVal)) return true; @@ -212,10 +212,10 @@ Scale = (unsigned)ScaleVal; } } - } else if (Lexer.isNot(AsmToken::RParen)) { + } else if (getLexer().isNot(AsmToken::RParen)) { // Otherwise we have the unsupported form of a scale amount without an // index. - SMLoc Loc = Lexer.getLoc(); + SMLoc Loc = getLexer().getTok().getLoc(); int64_t Value; if (ParseAbsoluteExpression(Value)) @@ -226,9 +226,9 @@ } // Ok, we've eaten the memory operand, verify we have a ')' and eat it too. - if (Lexer.isNot(AsmToken::RParen)) + if (getLexer().isNot(AsmToken::RParen)) return TokError("unexpected token in memory operand"); - Lexer.Lex(); // Eat the ')'. + getLexer().Lex(); // Eat the ')'. Op = X86Operand::CreateMem(SegReg, Disp, BaseReg, IndexReg, Scale); return false; @@ -247,14 +247,14 @@ bool AsmParser::ParseX86InstOperands(const StringRef &InstName, MCInst &Inst) { llvm::SmallVector Operands; - if (Lexer.isNot(AsmToken::EndOfStatement)) { + if (getLexer().isNot(AsmToken::EndOfStatement)) { // Read the first operand. Operands.push_back(X86Operand()); if (ParseX86Operand(Operands.back())) return true; - while (Lexer.is(AsmToken::Comma)) { - Lexer.Lex(); // Eat the comma. + while (getLexer().is(AsmToken::Comma)) { + getLexer().Lex(); // Eat the comma. // Parse and remember the operand. Operands.push_back(X86Operand()); From bob.wilson at apple.com Tue Jul 28 13:28:22 2009 From: bob.wilson at apple.com (Bob Wilson) Date: Tue, 28 Jul 2009 18:28:22 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r77345 - /llvm-gcc-4.2/trunk/gcc/config/arm/neon-gen.ml Message-ID: <200907281828.n6SISMNI008090@zion.cs.uiuc.edu> Author: bwilson Date: Tue Jul 28 13:28:22 2009 New Revision: 77345 URL: http://llvm.org/viewvc/llvm-project?rev=77345&view=rev Log: Fix Neon macros so that they translate to expressions, not statements. Thanks for Sandeep Patel for pointing this out. Modified: llvm-gcc-4.2/trunk/gcc/config/arm/neon-gen.ml Modified: llvm-gcc-4.2/trunk/gcc/config/arm/neon-gen.ml URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/arm/neon-gen.ml?rev=77345&r1=77344&r2=77345&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/config/arm/neon-gen.ml (original) +++ llvm-gcc-4.2/trunk/gcc/config/arm/neon-gen.ml Tue Jul 28 13:28:22 2009 @@ -70,13 +70,27 @@ (* LLVM LOCAL begin Print macros instead of inline functions. This is needed so that immediate arguments (e.g., lane numbers, shift amounts, etc.) can be checked for validity. GCC can check them after - inlining, but LLVM does inlining separately. This is not ideal for - error messages. In the simple cases, llvm-gcc will use the GCC builtin - names instead of the user-visible ARM intrinsic names. In cases where - the macros convert arguments to/from scalars (where the GCC builtins - expect that for some reason), the error messages may not show any context - information at all. This could all be avoided if the compiler recognized - the intrinsics directly. *) + inlining, but LLVM does inlining separately. + + This is not ideal for error messages. In the simple cases, llvm-gcc will + use the GCC builtin names instead of the user-visible ARM intrinsic names. + In cases where the macros use unions to convert argument types, the error + messages may not show any context information at all. + + The problems with error messages could be avoided if the compiler + recognized the intrinsics directly, but that is not trivial. The + user-visible intrinsics need to use the types defined by ARM that + distinguish the vector element signedness, whereas the LLVM intrinsics do + not care about signedness and also use different struct types (multiple + fields instead of arrays) that match the capabilities of tablegen-defined + intrinsics. + + Some macros translate to simple intrinsic calls and should not end with + semicolons, but for others, which use GCC's statement-expressions to + include unions that convert argument and/or return types, the semicolons + need to be emitted after every statement. This is implemented by deferring + the emission of trailing semicolons so they are only added in the context + of statement-expressions. *) let print_function arity fnname body = let ffmt = start_function () in Format.printf "@[#define "; @@ -95,12 +109,12 @@ Format.printf " \\@,"; let rec print_lines = function [] -> () - | [line] -> Format.printf "%s \\" line - | line::lines -> Format.printf "%s \\@," line; print_lines lines in + | [line] -> Format.printf "%s; \\" line + | line::lines -> Format.printf "%s; \\@," line; print_lines lines in let print_macro_body = function [] -> () | [line] -> Format.printf "%s" line - | line::lines -> Format.printf "@[({ \\@,%s \\@," line; + | line::lines -> Format.printf "@[({ \\@,%s; \\@," line; print_lines lines; Format.printf "@]@, })" in print_macro_body body; @@ -150,7 +164,7 @@ (* Return a tuple of a list of declarations to go at the start of the function, and a list of statements needed to return THING. *) -(* LLVM LOCAL begin Remove "return" keywords since these are now macros. *) +(* LLVM LOCAL begin Omit "return" keywords and trailing semicolons. *) let return arity return_by_ptr thing = match arity with Arity0 (ret) | Arity1 (ret, _) | Arity2 (ret, _, _) | Arity3 (ret, _, _, _) @@ -159,15 +173,15 @@ T_arrayof (num, vec) -> if return_by_ptr then let sname = string_of_vectype ret in - [Printf.sprintf "%s __rv;" sname], - [thing ^ ";"; "__rv;"] + [Printf.sprintf "%s __rv" sname], + [thing; "__rv"] else let uname = union_string num vec "__rv" in - [uname ^ ";"], ["__rv.__o = " ^ thing ^ ";"; "__rv.__i;"] - | T_void -> [], [thing ^ ";"] + [uname], ["__rv.__o = " ^ thing; "__rv.__i"] + | T_void -> [], [thing] | _ -> - [], [(cast_for_return ret) ^ thing ^ ";"] -(* LLVM LOCAL end Remove "return" keywords since these are now macros. *) + [], [(cast_for_return ret) ^ thing] +(* LLVM LOCAL end Omit "return" keywords and trailing semicolons. *) let rec element_type ctype = match ctype with @@ -180,7 +194,8 @@ match t with T_arrayof (num, elts) -> let uname = union_string num elts (p ^ "u") in - let decl = Printf.sprintf "%s = { %s };" uname p in + (* LLVM LOCAL Omit trailing semicolon. *) + let decl = Printf.sprintf "%s = { %s }" uname p in pdecls := decl :: !pdecls; p ^ "u.__o" (* LLVM LOCAL Omit casts so so we get better error messages. *) From bob.wilson at apple.com Tue Jul 28 13:28:40 2009 From: bob.wilson at apple.com (Bob Wilson) Date: Tue, 28 Jul 2009 18:28:40 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r77346 - /llvm-gcc-4.2/trunk/gcc/config/arm/arm_neon.h Message-ID: <200907281828.n6SISfMO008114@zion.cs.uiuc.edu> Author: bwilson Date: Tue Jul 28 13:28:40 2009 New Revision: 77346 URL: http://llvm.org/viewvc/llvm-project?rev=77346&view=rev Log: Regenerate arm_neon.h. Modified: llvm-gcc-4.2/trunk/gcc/config/arm/arm_neon.h Modified: llvm-gcc-4.2/trunk/gcc/config/arm/arm_neon.h URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/arm/arm_neon.h?rev=77346&r1=77345&r2=77346&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/config/arm/arm_neon.h (original) +++ llvm-gcc-4.2/trunk/gcc/config/arm/arm_neon.h Tue Jul 28 13:28:40 2009 @@ -402,2854 +402,2854 @@ #define vadd_s8(__a, __b) \ - (int8x8_t)__builtin_neon_vaddv8qi (__a, __b, 1); + (int8x8_t)__builtin_neon_vaddv8qi (__a, __b, 1) #define vadd_s16(__a, __b) \ - (int16x4_t)__builtin_neon_vaddv4hi (__a, __b, 1); + (int16x4_t)__builtin_neon_vaddv4hi (__a, __b, 1) #define vadd_s32(__a, __b) \ - (int32x2_t)__builtin_neon_vaddv2si (__a, __b, 1); + (int32x2_t)__builtin_neon_vaddv2si (__a, __b, 1) #define vadd_s64(__a, __b) \ - (int64x1_t)__builtin_neon_vadddi (__a, __b, 1); + (int64x1_t)__builtin_neon_vadddi (__a, __b, 1) #define vadd_f32(__a, __b) \ - (float32x2_t)__builtin_neon_vaddv2sf (__a, __b, 5); + (float32x2_t)__builtin_neon_vaddv2sf (__a, __b, 5) #define vadd_u8(__a, __b) \ - (uint8x8_t)__builtin_neon_vaddv8qi (__a, __b, 0); + (uint8x8_t)__builtin_neon_vaddv8qi (__a, __b, 0) #define vadd_u16(__a, __b) \ - (uint16x4_t)__builtin_neon_vaddv4hi (__a, __b, 0); + (uint16x4_t)__builtin_neon_vaddv4hi (__a, __b, 0) #define vadd_u32(__a, __b) \ - (uint32x2_t)__builtin_neon_vaddv2si (__a, __b, 0); + (uint32x2_t)__builtin_neon_vaddv2si (__a, __b, 0) #define vadd_u64(__a, __b) \ - (uint64x1_t)__builtin_neon_vadddi (__a, __b, 0); + (uint64x1_t)__builtin_neon_vadddi (__a, __b, 0) #define vaddq_s8(__a, __b) \ - (int8x16_t)__builtin_neon_vaddv16qi (__a, __b, 1); + (int8x16_t)__builtin_neon_vaddv16qi (__a, __b, 1) #define vaddq_s16(__a, __b) \ - (int16x8_t)__builtin_neon_vaddv8hi (__a, __b, 1); + (int16x8_t)__builtin_neon_vaddv8hi (__a, __b, 1) #define vaddq_s32(__a, __b) \ - (int32x4_t)__builtin_neon_vaddv4si (__a, __b, 1); + (int32x4_t)__builtin_neon_vaddv4si (__a, __b, 1) #define vaddq_s64(__a, __b) \ - (int64x2_t)__builtin_neon_vaddv2di (__a, __b, 1); + (int64x2_t)__builtin_neon_vaddv2di (__a, __b, 1) #define vaddq_f32(__a, __b) \ - (float32x4_t)__builtin_neon_vaddv4sf (__a, __b, 5); + (float32x4_t)__builtin_neon_vaddv4sf (__a, __b, 5) #define vaddq_u8(__a, __b) \ - (uint8x16_t)__builtin_neon_vaddv16qi (__a, __b, 0); + (uint8x16_t)__builtin_neon_vaddv16qi (__a, __b, 0) #define vaddq_u16(__a, __b) \ - (uint16x8_t)__builtin_neon_vaddv8hi (__a, __b, 0); + (uint16x8_t)__builtin_neon_vaddv8hi (__a, __b, 0) #define vaddq_u32(__a, __b) \ - (uint32x4_t)__builtin_neon_vaddv4si (__a, __b, 0); + (uint32x4_t)__builtin_neon_vaddv4si (__a, __b, 0) #define vaddq_u64(__a, __b) \ - (uint64x2_t)__builtin_neon_vaddv2di (__a, __b, 0); + (uint64x2_t)__builtin_neon_vaddv2di (__a, __b, 0) #define vaddl_s8(__a, __b) \ - (int16x8_t)__builtin_neon_vaddlv8qi (__a, __b, 1); + (int16x8_t)__builtin_neon_vaddlv8qi (__a, __b, 1) #define vaddl_s16(__a, __b) \ - (int32x4_t)__builtin_neon_vaddlv4hi (__a, __b, 1); + (int32x4_t)__builtin_neon_vaddlv4hi (__a, __b, 1) #define vaddl_s32(__a, __b) \ - (int64x2_t)__builtin_neon_vaddlv2si (__a, __b, 1); + (int64x2_t)__builtin_neon_vaddlv2si (__a, __b, 1) #define vaddl_u8(__a, __b) \ - (uint16x8_t)__builtin_neon_vaddlv8qi (__a, __b, 0); + (uint16x8_t)__builtin_neon_vaddlv8qi (__a, __b, 0) #define vaddl_u16(__a, __b) \ - (uint32x4_t)__builtin_neon_vaddlv4hi (__a, __b, 0); + (uint32x4_t)__builtin_neon_vaddlv4hi (__a, __b, 0) #define vaddl_u32(__a, __b) \ - (uint64x2_t)__builtin_neon_vaddlv2si (__a, __b, 0); + (uint64x2_t)__builtin_neon_vaddlv2si (__a, __b, 0) #define vaddw_s8(__a, __b) \ - (int16x8_t)__builtin_neon_vaddwv8qi (__a, __b, 1); + (int16x8_t)__builtin_neon_vaddwv8qi (__a, __b, 1) #define vaddw_s16(__a, __b) \ - (int32x4_t)__builtin_neon_vaddwv4hi (__a, __b, 1); + (int32x4_t)__builtin_neon_vaddwv4hi (__a, __b, 1) #define vaddw_s32(__a, __b) \ - (int64x2_t)__builtin_neon_vaddwv2si (__a, __b, 1); + (int64x2_t)__builtin_neon_vaddwv2si (__a, __b, 1) #define vaddw_u8(__a, __b) \ - (uint16x8_t)__builtin_neon_vaddwv8qi (__a, __b, 0); + (uint16x8_t)__builtin_neon_vaddwv8qi (__a, __b, 0) #define vaddw_u16(__a, __b) \ - (uint32x4_t)__builtin_neon_vaddwv4hi (__a, __b, 0); + (uint32x4_t)__builtin_neon_vaddwv4hi (__a, __b, 0) #define vaddw_u32(__a, __b) \ - (uint64x2_t)__builtin_neon_vaddwv2si (__a, __b, 0); + (uint64x2_t)__builtin_neon_vaddwv2si (__a, __b, 0) #define vhadd_s8(__a, __b) \ - (int8x8_t)__builtin_neon_vhaddv8qi (__a, __b, 1); + (int8x8_t)__builtin_neon_vhaddv8qi (__a, __b, 1) #define vhadd_s16(__a, __b) \ - (int16x4_t)__builtin_neon_vhaddv4hi (__a, __b, 1); + (int16x4_t)__builtin_neon_vhaddv4hi (__a, __b, 1) #define vhadd_s32(__a, __b) \ - (int32x2_t)__builtin_neon_vhaddv2si (__a, __b, 1); + (int32x2_t)__builtin_neon_vhaddv2si (__a, __b, 1) #define vhadd_u8(__a, __b) \ - (uint8x8_t)__builtin_neon_vhaddv8qi (__a, __b, 0); + (uint8x8_t)__builtin_neon_vhaddv8qi (__a, __b, 0) #define vhadd_u16(__a, __b) \ - (uint16x4_t)__builtin_neon_vhaddv4hi (__a, __b, 0); + (uint16x4_t)__builtin_neon_vhaddv4hi (__a, __b, 0) #define vhadd_u32(__a, __b) \ - (uint32x2_t)__builtin_neon_vhaddv2si (__a, __b, 0); + (uint32x2_t)__builtin_neon_vhaddv2si (__a, __b, 0) #define vhaddq_s8(__a, __b) \ - (int8x16_t)__builtin_neon_vhaddv16qi (__a, __b, 1); + (int8x16_t)__builtin_neon_vhaddv16qi (__a, __b, 1) #define vhaddq_s16(__a, __b) \ - (int16x8_t)__builtin_neon_vhaddv8hi (__a, __b, 1); + (int16x8_t)__builtin_neon_vhaddv8hi (__a, __b, 1) #define vhaddq_s32(__a, __b) \ - (int32x4_t)__builtin_neon_vhaddv4si (__a, __b, 1); + (int32x4_t)__builtin_neon_vhaddv4si (__a, __b, 1) #define vhaddq_u8(__a, __b) \ - (uint8x16_t)__builtin_neon_vhaddv16qi (__a, __b, 0); + (uint8x16_t)__builtin_neon_vhaddv16qi (__a, __b, 0) #define vhaddq_u16(__a, __b) \ - (uint16x8_t)__builtin_neon_vhaddv8hi (__a, __b, 0); + (uint16x8_t)__builtin_neon_vhaddv8hi (__a, __b, 0) #define vhaddq_u32(__a, __b) \ - (uint32x4_t)__builtin_neon_vhaddv4si (__a, __b, 0); + (uint32x4_t)__builtin_neon_vhaddv4si (__a, __b, 0) #define vrhadd_s8(__a, __b) \ - (int8x8_t)__builtin_neon_vhaddv8qi (__a, __b, 3); + (int8x8_t)__builtin_neon_vhaddv8qi (__a, __b, 3) #define vrhadd_s16(__a, __b) \ - (int16x4_t)__builtin_neon_vhaddv4hi (__a, __b, 3); + (int16x4_t)__builtin_neon_vhaddv4hi (__a, __b, 3) #define vrhadd_s32(__a, __b) \ - (int32x2_t)__builtin_neon_vhaddv2si (__a, __b, 3); + (int32x2_t)__builtin_neon_vhaddv2si (__a, __b, 3) #define vrhadd_u8(__a, __b) \ - (uint8x8_t)__builtin_neon_vhaddv8qi (__a, __b, 2); + (uint8x8_t)__builtin_neon_vhaddv8qi (__a, __b, 2) #define vrhadd_u16(__a, __b) \ - (uint16x4_t)__builtin_neon_vhaddv4hi (__a, __b, 2); + (uint16x4_t)__builtin_neon_vhaddv4hi (__a, __b, 2) #define vrhadd_u32(__a, __b) \ - (uint32x2_t)__builtin_neon_vhaddv2si (__a, __b, 2); + (uint32x2_t)__builtin_neon_vhaddv2si (__a, __b, 2) #define vrhaddq_s8(__a, __b) \ - (int8x16_t)__builtin_neon_vhaddv16qi (__a, __b, 3); + (int8x16_t)__builtin_neon_vhaddv16qi (__a, __b, 3) #define vrhaddq_s16(__a, __b) \ - (int16x8_t)__builtin_neon_vhaddv8hi (__a, __b, 3); + (int16x8_t)__builtin_neon_vhaddv8hi (__a, __b, 3) #define vrhaddq_s32(__a, __b) \ - (int32x4_t)__builtin_neon_vhaddv4si (__a, __b, 3); + (int32x4_t)__builtin_neon_vhaddv4si (__a, __b, 3) #define vrhaddq_u8(__a, __b) \ - (uint8x16_t)__builtin_neon_vhaddv16qi (__a, __b, 2); + (uint8x16_t)__builtin_neon_vhaddv16qi (__a, __b, 2) #define vrhaddq_u16(__a, __b) \ - (uint16x8_t)__builtin_neon_vhaddv8hi (__a, __b, 2); + (uint16x8_t)__builtin_neon_vhaddv8hi (__a, __b, 2) #define vrhaddq_u32(__a, __b) \ - (uint32x4_t)__builtin_neon_vhaddv4si (__a, __b, 2); + (uint32x4_t)__builtin_neon_vhaddv4si (__a, __b, 2) #define vqadd_s8(__a, __b) \ - (int8x8_t)__builtin_neon_vqaddv8qi (__a, __b, 1); + (int8x8_t)__builtin_neon_vqaddv8qi (__a, __b, 1) #define vqadd_s16(__a, __b) \ - (int16x4_t)__builtin_neon_vqaddv4hi (__a, __b, 1); + (int16x4_t)__builtin_neon_vqaddv4hi (__a, __b, 1) #define vqadd_s32(__a, __b) \ - (int32x2_t)__builtin_neon_vqaddv2si (__a, __b, 1); + (int32x2_t)__builtin_neon_vqaddv2si (__a, __b, 1) #define vqadd_s64(__a, __b) \ - (int64x1_t)__builtin_neon_vqadddi (__a, __b, 1); + (int64x1_t)__builtin_neon_vqadddi (__a, __b, 1) #define vqadd_u8(__a, __b) \ - (uint8x8_t)__builtin_neon_vqaddv8qi (__a, __b, 0); + (uint8x8_t)__builtin_neon_vqaddv8qi (__a, __b, 0) #define vqadd_u16(__a, __b) \ - (uint16x4_t)__builtin_neon_vqaddv4hi (__a, __b, 0); + (uint16x4_t)__builtin_neon_vqaddv4hi (__a, __b, 0) #define vqadd_u32(__a, __b) \ - (uint32x2_t)__builtin_neon_vqaddv2si (__a, __b, 0); + (uint32x2_t)__builtin_neon_vqaddv2si (__a, __b, 0) #define vqadd_u64(__a, __b) \ - (uint64x1_t)__builtin_neon_vqadddi (__a, __b, 0); + (uint64x1_t)__builtin_neon_vqadddi (__a, __b, 0) #define vqaddq_s8(__a, __b) \ - (int8x16_t)__builtin_neon_vqaddv16qi (__a, __b, 1); + (int8x16_t)__builtin_neon_vqaddv16qi (__a, __b, 1) #define vqaddq_s16(__a, __b) \ - (int16x8_t)__builtin_neon_vqaddv8hi (__a, __b, 1); + (int16x8_t)__builtin_neon_vqaddv8hi (__a, __b, 1) #define vqaddq_s32(__a, __b) \ - (int32x4_t)__builtin_neon_vqaddv4si (__a, __b, 1); + (int32x4_t)__builtin_neon_vqaddv4si (__a, __b, 1) #define vqaddq_s64(__a, __b) \ - (int64x2_t)__builtin_neon_vqaddv2di (__a, __b, 1); + (int64x2_t)__builtin_neon_vqaddv2di (__a, __b, 1) #define vqaddq_u8(__a, __b) \ - (uint8x16_t)__builtin_neon_vqaddv16qi (__a, __b, 0); + (uint8x16_t)__builtin_neon_vqaddv16qi (__a, __b, 0) #define vqaddq_u16(__a, __b) \ - (uint16x8_t)__builtin_neon_vqaddv8hi (__a, __b, 0); + (uint16x8_t)__builtin_neon_vqaddv8hi (__a, __b, 0) #define vqaddq_u32(__a, __b) \ - (uint32x4_t)__builtin_neon_vqaddv4si (__a, __b, 0); + (uint32x4_t)__builtin_neon_vqaddv4si (__a, __b, 0) #define vqaddq_u64(__a, __b) \ - (uint64x2_t)__builtin_neon_vqaddv2di (__a, __b, 0); + (uint64x2_t)__builtin_neon_vqaddv2di (__a, __b, 0) #define vaddhn_s16(__a, __b) \ - (int8x8_t)__builtin_neon_vaddhnv8hi (__a, __b, 1); + (int8x8_t)__builtin_neon_vaddhnv8hi (__a, __b, 1) #define vaddhn_s32(__a, __b) \ - (int16x4_t)__builtin_neon_vaddhnv4si (__a, __b, 1); + (int16x4_t)__builtin_neon_vaddhnv4si (__a, __b, 1) #define vaddhn_s64(__a, __b) \ - (int32x2_t)__builtin_neon_vaddhnv2di (__a, __b, 1); + (int32x2_t)__builtin_neon_vaddhnv2di (__a, __b, 1) #define vaddhn_u16(__a, __b) \ - (uint8x8_t)__builtin_neon_vaddhnv8hi (__a, __b, 0); + (uint8x8_t)__builtin_neon_vaddhnv8hi (__a, __b, 0) #define vaddhn_u32(__a, __b) \ - (uint16x4_t)__builtin_neon_vaddhnv4si (__a, __b, 0); + (uint16x4_t)__builtin_neon_vaddhnv4si (__a, __b, 0) #define vaddhn_u64(__a, __b) \ - (uint32x2_t)__builtin_neon_vaddhnv2di (__a, __b, 0); + (uint32x2_t)__builtin_neon_vaddhnv2di (__a, __b, 0) #define vraddhn_s16(__a, __b) \ - (int8x8_t)__builtin_neon_vaddhnv8hi (__a, __b, 3); + (int8x8_t)__builtin_neon_vaddhnv8hi (__a, __b, 3) #define vraddhn_s32(__a, __b) \ - (int16x4_t)__builtin_neon_vaddhnv4si (__a, __b, 3); + (int16x4_t)__builtin_neon_vaddhnv4si (__a, __b, 3) #define vraddhn_s64(__a, __b) \ - (int32x2_t)__builtin_neon_vaddhnv2di (__a, __b, 3); + (int32x2_t)__builtin_neon_vaddhnv2di (__a, __b, 3) #define vraddhn_u16(__a, __b) \ - (uint8x8_t)__builtin_neon_vaddhnv8hi (__a, __b, 2); + (uint8x8_t)__builtin_neon_vaddhnv8hi (__a, __b, 2) #define vraddhn_u32(__a, __b) \ - (uint16x4_t)__builtin_neon_vaddhnv4si (__a, __b, 2); + (uint16x4_t)__builtin_neon_vaddhnv4si (__a, __b, 2) #define vraddhn_u64(__a, __b) \ - (uint32x2_t)__builtin_neon_vaddhnv2di (__a, __b, 2); + (uint32x2_t)__builtin_neon_vaddhnv2di (__a, __b, 2) #define vmul_s8(__a, __b) \ - (int8x8_t)__builtin_neon_vmulv8qi (__a, __b, 1); + (int8x8_t)__builtin_neon_vmulv8qi (__a, __b, 1) #define vmul_s16(__a, __b) \ - (int16x4_t)__builtin_neon_vmulv4hi (__a, __b, 1); + (int16x4_t)__builtin_neon_vmulv4hi (__a, __b, 1) #define vmul_s32(__a, __b) \ - (int32x2_t)__builtin_neon_vmulv2si (__a, __b, 1); + (int32x2_t)__builtin_neon_vmulv2si (__a, __b, 1) #define vmul_f32(__a, __b) \ - (float32x2_t)__builtin_neon_vmulv2sf (__a, __b, 5); + (float32x2_t)__builtin_neon_vmulv2sf (__a, __b, 5) #define vmul_u8(__a, __b) \ - (uint8x8_t)__builtin_neon_vmulv8qi (__a, __b, 0); + (uint8x8_t)__builtin_neon_vmulv8qi (__a, __b, 0) #define vmul_u16(__a, __b) \ - (uint16x4_t)__builtin_neon_vmulv4hi (__a, __b, 0); + (uint16x4_t)__builtin_neon_vmulv4hi (__a, __b, 0) #define vmul_u32(__a, __b) \ - (uint32x2_t)__builtin_neon_vmulv2si (__a, __b, 0); + (uint32x2_t)__builtin_neon_vmulv2si (__a, __b, 0) #define vmul_p8(__a, __b) \ - (poly8x8_t)__builtin_neon_vmulv8qi (__a, __b, 4); + (poly8x8_t)__builtin_neon_vmulv8qi (__a, __b, 4) #define vmulq_s8(__a, __b) \ - (int8x16_t)__builtin_neon_vmulv16qi (__a, __b, 1); + (int8x16_t)__builtin_neon_vmulv16qi (__a, __b, 1) #define vmulq_s16(__a, __b) \ - (int16x8_t)__builtin_neon_vmulv8hi (__a, __b, 1); + (int16x8_t)__builtin_neon_vmulv8hi (__a, __b, 1) #define vmulq_s32(__a, __b) \ - (int32x4_t)__builtin_neon_vmulv4si (__a, __b, 1); + (int32x4_t)__builtin_neon_vmulv4si (__a, __b, 1) #define vmulq_f32(__a, __b) \ - (float32x4_t)__builtin_neon_vmulv4sf (__a, __b, 5); + (float32x4_t)__builtin_neon_vmulv4sf (__a, __b, 5) #define vmulq_u8(__a, __b) \ - (uint8x16_t)__builtin_neon_vmulv16qi (__a, __b, 0); + (uint8x16_t)__builtin_neon_vmulv16qi (__a, __b, 0) #define vmulq_u16(__a, __b) \ - (uint16x8_t)__builtin_neon_vmulv8hi (__a, __b, 0); + (uint16x8_t)__builtin_neon_vmulv8hi (__a, __b, 0) #define vmulq_u32(__a, __b) \ - (uint32x4_t)__builtin_neon_vmulv4si (__a, __b, 0); + (uint32x4_t)__builtin_neon_vmulv4si (__a, __b, 0) #define vmulq_p8(__a, __b) \ - (poly8x16_t)__builtin_neon_vmulv16qi (__a, __b, 4); + (poly8x16_t)__builtin_neon_vmulv16qi (__a, __b, 4) #define vqdmulh_s16(__a, __b) \ - (int16x4_t)__builtin_neon_vqdmulhv4hi (__a, __b, 1); + (int16x4_t)__builtin_neon_vqdmulhv4hi (__a, __b, 1) #define vqdmulh_s32(__a, __b) \ - (int32x2_t)__builtin_neon_vqdmulhv2si (__a, __b, 1); + (int32x2_t)__builtin_neon_vqdmulhv2si (__a, __b, 1) #define vqdmulhq_s16(__a, __b) \ - (int16x8_t)__builtin_neon_vqdmulhv8hi (__a, __b, 1); + (int16x8_t)__builtin_neon_vqdmulhv8hi (__a, __b, 1) #define vqdmulhq_s32(__a, __b) \ - (int32x4_t)__builtin_neon_vqdmulhv4si (__a, __b, 1); + (int32x4_t)__builtin_neon_vqdmulhv4si (__a, __b, 1) #define vqrdmulh_s16(__a, __b) \ - (int16x4_t)__builtin_neon_vqdmulhv4hi (__a, __b, 3); + (int16x4_t)__builtin_neon_vqdmulhv4hi (__a, __b, 3) #define vqrdmulh_s32(__a, __b) \ - (int32x2_t)__builtin_neon_vqdmulhv2si (__a, __b, 3); + (int32x2_t)__builtin_neon_vqdmulhv2si (__a, __b, 3) #define vqrdmulhq_s16(__a, __b) \ - (int16x8_t)__builtin_neon_vqdmulhv8hi (__a, __b, 3); + (int16x8_t)__builtin_neon_vqdmulhv8hi (__a, __b, 3) #define vqrdmulhq_s32(__a, __b) \ - (int32x4_t)__builtin_neon_vqdmulhv4si (__a, __b, 3); + (int32x4_t)__builtin_neon_vqdmulhv4si (__a, __b, 3) #define vmull_s8(__a, __b) \ - (int16x8_t)__builtin_neon_vmullv8qi (__a, __b, 1); + (int16x8_t)__builtin_neon_vmullv8qi (__a, __b, 1) #define vmull_s16(__a, __b) \ - (int32x4_t)__builtin_neon_vmullv4hi (__a, __b, 1); + (int32x4_t)__builtin_neon_vmullv4hi (__a, __b, 1) #define vmull_s32(__a, __b) \ - (int64x2_t)__builtin_neon_vmullv2si (__a, __b, 1); + (int64x2_t)__builtin_neon_vmullv2si (__a, __b, 1) #define vmull_u8(__a, __b) \ - (uint16x8_t)__builtin_neon_vmullv8qi (__a, __b, 0); + (uint16x8_t)__builtin_neon_vmullv8qi (__a, __b, 0) #define vmull_u16(__a, __b) \ - (uint32x4_t)__builtin_neon_vmullv4hi (__a, __b, 0); + (uint32x4_t)__builtin_neon_vmullv4hi (__a, __b, 0) #define vmull_u32(__a, __b) \ - (uint64x2_t)__builtin_neon_vmullv2si (__a, __b, 0); + (uint64x2_t)__builtin_neon_vmullv2si (__a, __b, 0) #define vmull_p8(__a, __b) \ - (poly16x8_t)__builtin_neon_vmullv8qi (__a, __b, 4); + (poly16x8_t)__builtin_neon_vmullv8qi (__a, __b, 4) #define vqdmull_s16(__a, __b) \ - (int32x4_t)__builtin_neon_vqdmullv4hi (__a, __b, 1); + (int32x4_t)__builtin_neon_vqdmullv4hi (__a, __b, 1) #define vqdmull_s32(__a, __b) \ - (int64x2_t)__builtin_neon_vqdmullv2si (__a, __b, 1); + (int64x2_t)__builtin_neon_vqdmullv2si (__a, __b, 1) #define vmla_s8(__a, __b, __c) \ - (int8x8_t)__builtin_neon_vmlav8qi (__a, __b, __c, 1); + (int8x8_t)__builtin_neon_vmlav8qi (__a, __b, __c, 1) #define vmla_s16(__a, __b, __c) \ - (int16x4_t)__builtin_neon_vmlav4hi (__a, __b, __c, 1); + (int16x4_t)__builtin_neon_vmlav4hi (__a, __b, __c, 1) #define vmla_s32(__a, __b, __c) \ - (int32x2_t)__builtin_neon_vmlav2si (__a, __b, __c, 1); + (int32x2_t)__builtin_neon_vmlav2si (__a, __b, __c, 1) #define vmla_f32(__a, __b, __c) \ - (float32x2_t)__builtin_neon_vmlav2sf (__a, __b, __c, 5); + (float32x2_t)__builtin_neon_vmlav2sf (__a, __b, __c, 5) #define vmla_u8(__a, __b, __c) \ - (uint8x8_t)__builtin_neon_vmlav8qi (__a, __b, __c, 0); + (uint8x8_t)__builtin_neon_vmlav8qi (__a, __b, __c, 0) #define vmla_u16(__a, __b, __c) \ - (uint16x4_t)__builtin_neon_vmlav4hi (__a, __b, __c, 0); + (uint16x4_t)__builtin_neon_vmlav4hi (__a, __b, __c, 0) #define vmla_u32(__a, __b, __c) \ - (uint32x2_t)__builtin_neon_vmlav2si (__a, __b, __c, 0); + (uint32x2_t)__builtin_neon_vmlav2si (__a, __b, __c, 0) #define vmlaq_s8(__a, __b, __c) \ - (int8x16_t)__builtin_neon_vmlav16qi (__a, __b, __c, 1); + (int8x16_t)__builtin_neon_vmlav16qi (__a, __b, __c, 1) #define vmlaq_s16(__a, __b, __c) \ - (int16x8_t)__builtin_neon_vmlav8hi (__a, __b, __c, 1); + (int16x8_t)__builtin_neon_vmlav8hi (__a, __b, __c, 1) #define vmlaq_s32(__a, __b, __c) \ - (int32x4_t)__builtin_neon_vmlav4si (__a, __b, __c, 1); + (int32x4_t)__builtin_neon_vmlav4si (__a, __b, __c, 1) #define vmlaq_f32(__a, __b, __c) \ - (float32x4_t)__builtin_neon_vmlav4sf (__a, __b, __c, 5); + (float32x4_t)__builtin_neon_vmlav4sf (__a, __b, __c, 5) #define vmlaq_u8(__a, __b, __c) \ - (uint8x16_t)__builtin_neon_vmlav16qi (__a, __b, __c, 0); + (uint8x16_t)__builtin_neon_vmlav16qi (__a, __b, __c, 0) #define vmlaq_u16(__a, __b, __c) \ - (uint16x8_t)__builtin_neon_vmlav8hi (__a, __b, __c, 0); + (uint16x8_t)__builtin_neon_vmlav8hi (__a, __b, __c, 0) #define vmlaq_u32(__a, __b, __c) \ - (uint32x4_t)__builtin_neon_vmlav4si (__a, __b, __c, 0); + (uint32x4_t)__builtin_neon_vmlav4si (__a, __b, __c, 0) #define vmlal_s8(__a, __b, __c) \ - (int16x8_t)__builtin_neon_vmlalv8qi (__a, __b, __c, 1); + (int16x8_t)__builtin_neon_vmlalv8qi (__a, __b, __c, 1) #define vmlal_s16(__a, __b, __c) \ - (int32x4_t)__builtin_neon_vmlalv4hi (__a, __b, __c, 1); + (int32x4_t)__builtin_neon_vmlalv4hi (__a, __b, __c, 1) #define vmlal_s32(__a, __b, __c) \ - (int64x2_t)__builtin_neon_vmlalv2si (__a, __b, __c, 1); + (int64x2_t)__builtin_neon_vmlalv2si (__a, __b, __c, 1) #define vmlal_u8(__a, __b, __c) \ - (uint16x8_t)__builtin_neon_vmlalv8qi (__a, __b, __c, 0); + (uint16x8_t)__builtin_neon_vmlalv8qi (__a, __b, __c, 0) #define vmlal_u16(__a, __b, __c) \ - (uint32x4_t)__builtin_neon_vmlalv4hi (__a, __b, __c, 0); + (uint32x4_t)__builtin_neon_vmlalv4hi (__a, __b, __c, 0) #define vmlal_u32(__a, __b, __c) \ - (uint64x2_t)__builtin_neon_vmlalv2si (__a, __b, __c, 0); + (uint64x2_t)__builtin_neon_vmlalv2si (__a, __b, __c, 0) #define vqdmlal_s16(__a, __b, __c) \ - (int32x4_t)__builtin_neon_vqdmlalv4hi (__a, __b, __c, 1); + (int32x4_t)__builtin_neon_vqdmlalv4hi (__a, __b, __c, 1) #define vqdmlal_s32(__a, __b, __c) \ - (int64x2_t)__builtin_neon_vqdmlalv2si (__a, __b, __c, 1); + (int64x2_t)__builtin_neon_vqdmlalv2si (__a, __b, __c, 1) #define vmls_s8(__a, __b, __c) \ - (int8x8_t)__builtin_neon_vmlsv8qi (__a, __b, __c, 1); + (int8x8_t)__builtin_neon_vmlsv8qi (__a, __b, __c, 1) #define vmls_s16(__a, __b, __c) \ - (int16x4_t)__builtin_neon_vmlsv4hi (__a, __b, __c, 1); + (int16x4_t)__builtin_neon_vmlsv4hi (__a, __b, __c, 1) #define vmls_s32(__a, __b, __c) \ - (int32x2_t)__builtin_neon_vmlsv2si (__a, __b, __c, 1); + (int32x2_t)__builtin_neon_vmlsv2si (__a, __b, __c, 1) #define vmls_f32(__a, __b, __c) \ - (float32x2_t)__builtin_neon_vmlsv2sf (__a, __b, __c, 5); + (float32x2_t)__builtin_neon_vmlsv2sf (__a, __b, __c, 5) #define vmls_u8(__a, __b, __c) \ - (uint8x8_t)__builtin_neon_vmlsv8qi (__a, __b, __c, 0); + (uint8x8_t)__builtin_neon_vmlsv8qi (__a, __b, __c, 0) #define vmls_u16(__a, __b, __c) \ - (uint16x4_t)__builtin_neon_vmlsv4hi (__a, __b, __c, 0); + (uint16x4_t)__builtin_neon_vmlsv4hi (__a, __b, __c, 0) #define vmls_u32(__a, __b, __c) \ - (uint32x2_t)__builtin_neon_vmlsv2si (__a, __b, __c, 0); + (uint32x2_t)__builtin_neon_vmlsv2si (__a, __b, __c, 0) #define vmlsq_s8(__a, __b, __c) \ - (int8x16_t)__builtin_neon_vmlsv16qi (__a, __b, __c, 1); + (int8x16_t)__builtin_neon_vmlsv16qi (__a, __b, __c, 1) #define vmlsq_s16(__a, __b, __c) \ - (int16x8_t)__builtin_neon_vmlsv8hi (__a, __b, __c, 1); + (int16x8_t)__builtin_neon_vmlsv8hi (__a, __b, __c, 1) #define vmlsq_s32(__a, __b, __c) \ - (int32x4_t)__builtin_neon_vmlsv4si (__a, __b, __c, 1); + (int32x4_t)__builtin_neon_vmlsv4si (__a, __b, __c, 1) #define vmlsq_f32(__a, __b, __c) \ - (float32x4_t)__builtin_neon_vmlsv4sf (__a, __b, __c, 5); + (float32x4_t)__builtin_neon_vmlsv4sf (__a, __b, __c, 5) #define vmlsq_u8(__a, __b, __c) \ - (uint8x16_t)__builtin_neon_vmlsv16qi (__a, __b, __c, 0); + (uint8x16_t)__builtin_neon_vmlsv16qi (__a, __b, __c, 0) #define vmlsq_u16(__a, __b, __c) \ - (uint16x8_t)__builtin_neon_vmlsv8hi (__a, __b, __c, 0); + (uint16x8_t)__builtin_neon_vmlsv8hi (__a, __b, __c, 0) #define vmlsq_u32(__a, __b, __c) \ - (uint32x4_t)__builtin_neon_vmlsv4si (__a, __b, __c, 0); + (uint32x4_t)__builtin_neon_vmlsv4si (__a, __b, __c, 0) #define vmlsl_s8(__a, __b, __c) \ - (int16x8_t)__builtin_neon_vmlslv8qi (__a, __b, __c, 1); + (int16x8_t)__builtin_neon_vmlslv8qi (__a, __b, __c, 1) #define vmlsl_s16(__a, __b, __c) \ - (int32x4_t)__builtin_neon_vmlslv4hi (__a, __b, __c, 1); + (int32x4_t)__builtin_neon_vmlslv4hi (__a, __b, __c, 1) #define vmlsl_s32(__a, __b, __c) \ - (int64x2_t)__builtin_neon_vmlslv2si (__a, __b, __c, 1); + (int64x2_t)__builtin_neon_vmlslv2si (__a, __b, __c, 1) #define vmlsl_u8(__a, __b, __c) \ - (uint16x8_t)__builtin_neon_vmlslv8qi (__a, __b, __c, 0); + (uint16x8_t)__builtin_neon_vmlslv8qi (__a, __b, __c, 0) #define vmlsl_u16(__a, __b, __c) \ - (uint32x4_t)__builtin_neon_vmlslv4hi (__a, __b, __c, 0); + (uint32x4_t)__builtin_neon_vmlslv4hi (__a, __b, __c, 0) #define vmlsl_u32(__a, __b, __c) \ - (uint64x2_t)__builtin_neon_vmlslv2si (__a, __b, __c, 0); + (uint64x2_t)__builtin_neon_vmlslv2si (__a, __b, __c, 0) #define vqdmlsl_s16(__a, __b, __c) \ - (int32x4_t)__builtin_neon_vqdmlslv4hi (__a, __b, __c, 1); + (int32x4_t)__builtin_neon_vqdmlslv4hi (__a, __b, __c, 1) #define vqdmlsl_s32(__a, __b, __c) \ - (int64x2_t)__builtin_neon_vqdmlslv2si (__a, __b, __c, 1); + (int64x2_t)__builtin_neon_vqdmlslv2si (__a, __b, __c, 1) #define vsub_s8(__a, __b) \ - (int8x8_t)__builtin_neon_vsubv8qi (__a, __b, 1); + (int8x8_t)__builtin_neon_vsubv8qi (__a, __b, 1) #define vsub_s16(__a, __b) \ - (int16x4_t)__builtin_neon_vsubv4hi (__a, __b, 1); + (int16x4_t)__builtin_neon_vsubv4hi (__a, __b, 1) #define vsub_s32(__a, __b) \ - (int32x2_t)__builtin_neon_vsubv2si (__a, __b, 1); + (int32x2_t)__builtin_neon_vsubv2si (__a, __b, 1) #define vsub_s64(__a, __b) \ - (int64x1_t)__builtin_neon_vsubdi (__a, __b, 1); + (int64x1_t)__builtin_neon_vsubdi (__a, __b, 1) #define vsub_f32(__a, __b) \ - (float32x2_t)__builtin_neon_vsubv2sf (__a, __b, 5); + (float32x2_t)__builtin_neon_vsubv2sf (__a, __b, 5) #define vsub_u8(__a, __b) \ - (uint8x8_t)__builtin_neon_vsubv8qi (__a, __b, 0); + (uint8x8_t)__builtin_neon_vsubv8qi (__a, __b, 0) #define vsub_u16(__a, __b) \ - (uint16x4_t)__builtin_neon_vsubv4hi (__a, __b, 0); + (uint16x4_t)__builtin_neon_vsubv4hi (__a, __b, 0) #define vsub_u32(__a, __b) \ - (uint32x2_t)__builtin_neon_vsubv2si (__a, __b, 0); + (uint32x2_t)__builtin_neon_vsubv2si (__a, __b, 0) #define vsub_u64(__a, __b) \ - (uint64x1_t)__builtin_neon_vsubdi (__a, __b, 0); + (uint64x1_t)__builtin_neon_vsubdi (__a, __b, 0) #define vsubq_s8(__a, __b) \ - (int8x16_t)__builtin_neon_vsubv16qi (__a, __b, 1); + (int8x16_t)__builtin_neon_vsubv16qi (__a, __b, 1) #define vsubq_s16(__a, __b) \ - (int16x8_t)__builtin_neon_vsubv8hi (__a, __b, 1); + (int16x8_t)__builtin_neon_vsubv8hi (__a, __b, 1) #define vsubq_s32(__a, __b) \ - (int32x4_t)__builtin_neon_vsubv4si (__a, __b, 1); + (int32x4_t)__builtin_neon_vsubv4si (__a, __b, 1) #define vsubq_s64(__a, __b) \ - (int64x2_t)__builtin_neon_vsubv2di (__a, __b, 1); + (int64x2_t)__builtin_neon_vsubv2di (__a, __b, 1) #define vsubq_f32(__a, __b) \ - (float32x4_t)__builtin_neon_vsubv4sf (__a, __b, 5); + (float32x4_t)__builtin_neon_vsubv4sf (__a, __b, 5) #define vsubq_u8(__a, __b) \ - (uint8x16_t)__builtin_neon_vsubv16qi (__a, __b, 0); + (uint8x16_t)__builtin_neon_vsubv16qi (__a, __b, 0) #define vsubq_u16(__a, __b) \ - (uint16x8_t)__builtin_neon_vsubv8hi (__a, __b, 0); + (uint16x8_t)__builtin_neon_vsubv8hi (__a, __b, 0) #define vsubq_u32(__a, __b) \ - (uint32x4_t)__builtin_neon_vsubv4si (__a, __b, 0); + (uint32x4_t)__builtin_neon_vsubv4si (__a, __b, 0) #define vsubq_u64(__a, __b) \ - (uint64x2_t)__builtin_neon_vsubv2di (__a, __b, 0); + (uint64x2_t)__builtin_neon_vsubv2di (__a, __b, 0) #define vsubl_s8(__a, __b) \ - (int16x8_t)__builtin_neon_vsublv8qi (__a, __b, 1); + (int16x8_t)__builtin_neon_vsublv8qi (__a, __b, 1) #define vsubl_s16(__a, __b) \ - (int32x4_t)__builtin_neon_vsublv4hi (__a, __b, 1); + (int32x4_t)__builtin_neon_vsublv4hi (__a, __b, 1) #define vsubl_s32(__a, __b) \ - (int64x2_t)__builtin_neon_vsublv2si (__a, __b, 1); + (int64x2_t)__builtin_neon_vsublv2si (__a, __b, 1) #define vsubl_u8(__a, __b) \ - (uint16x8_t)__builtin_neon_vsublv8qi (__a, __b, 0); + (uint16x8_t)__builtin_neon_vsublv8qi (__a, __b, 0) #define vsubl_u16(__a, __b) \ - (uint32x4_t)__builtin_neon_vsublv4hi (__a, __b, 0); + (uint32x4_t)__builtin_neon_vsublv4hi (__a, __b, 0) #define vsubl_u32(__a, __b) \ - (uint64x2_t)__builtin_neon_vsublv2si (__a, __b, 0); + (uint64x2_t)__builtin_neon_vsublv2si (__a, __b, 0) #define vsubw_s8(__a, __b) \ - (int16x8_t)__builtin_neon_vsubwv8qi (__a, __b, 1); + (int16x8_t)__builtin_neon_vsubwv8qi (__a, __b, 1) #define vsubw_s16(__a, __b) \ - (int32x4_t)__builtin_neon_vsubwv4hi (__a, __b, 1); + (int32x4_t)__builtin_neon_vsubwv4hi (__a, __b, 1) #define vsubw_s32(__a, __b) \ - (int64x2_t)__builtin_neon_vsubwv2si (__a, __b, 1); + (int64x2_t)__builtin_neon_vsubwv2si (__a, __b, 1) #define vsubw_u8(__a, __b) \ - (uint16x8_t)__builtin_neon_vsubwv8qi (__a, __b, 0); + (uint16x8_t)__builtin_neon_vsubwv8qi (__a, __b, 0) #define vsubw_u16(__a, __b) \ - (uint32x4_t)__builtin_neon_vsubwv4hi (__a, __b, 0); + (uint32x4_t)__builtin_neon_vsubwv4hi (__a, __b, 0) #define vsubw_u32(__a, __b) \ - (uint64x2_t)__builtin_neon_vsubwv2si (__a, __b, 0); + (uint64x2_t)__builtin_neon_vsubwv2si (__a, __b, 0) #define vhsub_s8(__a, __b) \ - (int8x8_t)__builtin_neon_vhsubv8qi (__a, __b, 1); + (int8x8_t)__builtin_neon_vhsubv8qi (__a, __b, 1) #define vhsub_s16(__a, __b) \ - (int16x4_t)__builtin_neon_vhsubv4hi (__a, __b, 1); + (int16x4_t)__builtin_neon_vhsubv4hi (__a, __b, 1) #define vhsub_s32(__a, __b) \ - (int32x2_t)__builtin_neon_vhsubv2si (__a, __b, 1); + (int32x2_t)__builtin_neon_vhsubv2si (__a, __b, 1) #define vhsub_u8(__a, __b) \ - (uint8x8_t)__builtin_neon_vhsubv8qi (__a, __b, 0); + (uint8x8_t)__builtin_neon_vhsubv8qi (__a, __b, 0) #define vhsub_u16(__a, __b) \ - (uint16x4_t)__builtin_neon_vhsubv4hi (__a, __b, 0); + (uint16x4_t)__builtin_neon_vhsubv4hi (__a, __b, 0) #define vhsub_u32(__a, __b) \ - (uint32x2_t)__builtin_neon_vhsubv2si (__a, __b, 0); + (uint32x2_t)__builtin_neon_vhsubv2si (__a, __b, 0) #define vhsubq_s8(__a, __b) \ - (int8x16_t)__builtin_neon_vhsubv16qi (__a, __b, 1); + (int8x16_t)__builtin_neon_vhsubv16qi (__a, __b, 1) #define vhsubq_s16(__a, __b) \ - (int16x8_t)__builtin_neon_vhsubv8hi (__a, __b, 1); + (int16x8_t)__builtin_neon_vhsubv8hi (__a, __b, 1) #define vhsubq_s32(__a, __b) \ - (int32x4_t)__builtin_neon_vhsubv4si (__a, __b, 1); + (int32x4_t)__builtin_neon_vhsubv4si (__a, __b, 1) #define vhsubq_u8(__a, __b) \ - (uint8x16_t)__builtin_neon_vhsubv16qi (__a, __b, 0); + (uint8x16_t)__builtin_neon_vhsubv16qi (__a, __b, 0) #define vhsubq_u16(__a, __b) \ - (uint16x8_t)__builtin_neon_vhsubv8hi (__a, __b, 0); + (uint16x8_t)__builtin_neon_vhsubv8hi (__a, __b, 0) #define vhsubq_u32(__a, __b) \ - (uint32x4_t)__builtin_neon_vhsubv4si (__a, __b, 0); + (uint32x4_t)__builtin_neon_vhsubv4si (__a, __b, 0) #define vqsub_s8(__a, __b) \ - (int8x8_t)__builtin_neon_vqsubv8qi (__a, __b, 1); + (int8x8_t)__builtin_neon_vqsubv8qi (__a, __b, 1) #define vqsub_s16(__a, __b) \ - (int16x4_t)__builtin_neon_vqsubv4hi (__a, __b, 1); + (int16x4_t)__builtin_neon_vqsubv4hi (__a, __b, 1) #define vqsub_s32(__a, __b) \ - (int32x2_t)__builtin_neon_vqsubv2si (__a, __b, 1); + (int32x2_t)__builtin_neon_vqsubv2si (__a, __b, 1) #define vqsub_s64(__a, __b) \ - (int64x1_t)__builtin_neon_vqsubdi (__a, __b, 1); + (int64x1_t)__builtin_neon_vqsubdi (__a, __b, 1) #define vqsub_u8(__a, __b) \ - (uint8x8_t)__builtin_neon_vqsubv8qi (__a, __b, 0); + (uint8x8_t)__builtin_neon_vqsubv8qi (__a, __b, 0) #define vqsub_u16(__a, __b) \ - (uint16x4_t)__builtin_neon_vqsubv4hi (__a, __b, 0); + (uint16x4_t)__builtin_neon_vqsubv4hi (__a, __b, 0) #define vqsub_u32(__a, __b) \ - (uint32x2_t)__builtin_neon_vqsubv2si (__a, __b, 0); + (uint32x2_t)__builtin_neon_vqsubv2si (__a, __b, 0) #define vqsub_u64(__a, __b) \ - (uint64x1_t)__builtin_neon_vqsubdi (__a, __b, 0); + (uint64x1_t)__builtin_neon_vqsubdi (__a, __b, 0) #define vqsubq_s8(__a, __b) \ - (int8x16_t)__builtin_neon_vqsubv16qi (__a, __b, 1); + (int8x16_t)__builtin_neon_vqsubv16qi (__a, __b, 1) #define vqsubq_s16(__a, __b) \ - (int16x8_t)__builtin_neon_vqsubv8hi (__a, __b, 1); + (int16x8_t)__builtin_neon_vqsubv8hi (__a, __b, 1) #define vqsubq_s32(__a, __b) \ - (int32x4_t)__builtin_neon_vqsubv4si (__a, __b, 1); + (int32x4_t)__builtin_neon_vqsubv4si (__a, __b, 1) #define vqsubq_s64(__a, __b) \ - (int64x2_t)__builtin_neon_vqsubv2di (__a, __b, 1); + (int64x2_t)__builtin_neon_vqsubv2di (__a, __b, 1) #define vqsubq_u8(__a, __b) \ - (uint8x16_t)__builtin_neon_vqsubv16qi (__a, __b, 0); + (uint8x16_t)__builtin_neon_vqsubv16qi (__a, __b, 0) #define vqsubq_u16(__a, __b) \ - (uint16x8_t)__builtin_neon_vqsubv8hi (__a, __b, 0); + (uint16x8_t)__builtin_neon_vqsubv8hi (__a, __b, 0) #define vqsubq_u32(__a, __b) \ - (uint32x4_t)__builtin_neon_vqsubv4si (__a, __b, 0); + (uint32x4_t)__builtin_neon_vqsubv4si (__a, __b, 0) #define vqsubq_u64(__a, __b) \ - (uint64x2_t)__builtin_neon_vqsubv2di (__a, __b, 0); + (uint64x2_t)__builtin_neon_vqsubv2di (__a, __b, 0) #define vsubhn_s16(__a, __b) \ - (int8x8_t)__builtin_neon_vsubhnv8hi (__a, __b, 1); + (int8x8_t)__builtin_neon_vsubhnv8hi (__a, __b, 1) #define vsubhn_s32(__a, __b) \ - (int16x4_t)__builtin_neon_vsubhnv4si (__a, __b, 1); + (int16x4_t)__builtin_neon_vsubhnv4si (__a, __b, 1) #define vsubhn_s64(__a, __b) \ - (int32x2_t)__builtin_neon_vsubhnv2di (__a, __b, 1); + (int32x2_t)__builtin_neon_vsubhnv2di (__a, __b, 1) #define vsubhn_u16(__a, __b) \ - (uint8x8_t)__builtin_neon_vsubhnv8hi (__a, __b, 0); + (uint8x8_t)__builtin_neon_vsubhnv8hi (__a, __b, 0) #define vsubhn_u32(__a, __b) \ - (uint16x4_t)__builtin_neon_vsubhnv4si (__a, __b, 0); + (uint16x4_t)__builtin_neon_vsubhnv4si (__a, __b, 0) #define vsubhn_u64(__a, __b) \ - (uint32x2_t)__builtin_neon_vsubhnv2di (__a, __b, 0); + (uint32x2_t)__builtin_neon_vsubhnv2di (__a, __b, 0) #define vrsubhn_s16(__a, __b) \ - (int8x8_t)__builtin_neon_vsubhnv8hi (__a, __b, 3); + (int8x8_t)__builtin_neon_vsubhnv8hi (__a, __b, 3) #define vrsubhn_s32(__a, __b) \ - (int16x4_t)__builtin_neon_vsubhnv4si (__a, __b, 3); + (int16x4_t)__builtin_neon_vsubhnv4si (__a, __b, 3) #define vrsubhn_s64(__a, __b) \ - (int32x2_t)__builtin_neon_vsubhnv2di (__a, __b, 3); + (int32x2_t)__builtin_neon_vsubhnv2di (__a, __b, 3) #define vrsubhn_u16(__a, __b) \ - (uint8x8_t)__builtin_neon_vsubhnv8hi (__a, __b, 2); + (uint8x8_t)__builtin_neon_vsubhnv8hi (__a, __b, 2) #define vrsubhn_u32(__a, __b) \ - (uint16x4_t)__builtin_neon_vsubhnv4si (__a, __b, 2); + (uint16x4_t)__builtin_neon_vsubhnv4si (__a, __b, 2) #define vrsubhn_u64(__a, __b) \ - (uint32x2_t)__builtin_neon_vsubhnv2di (__a, __b, 2); + (uint32x2_t)__builtin_neon_vsubhnv2di (__a, __b, 2) #define vceq_s8(__a, __b) \ - (uint8x8_t)__builtin_neon_vceqv8qi (__a, __b, 1); + (uint8x8_t)__builtin_neon_vceqv8qi (__a, __b, 1) #define vceq_s16(__a, __b) \ - (uint16x4_t)__builtin_neon_vceqv4hi (__a, __b, 1); + (uint16x4_t)__builtin_neon_vceqv4hi (__a, __b, 1) #define vceq_s32(__a, __b) \ - (uint32x2_t)__builtin_neon_vceqv2si (__a, __b, 1); + (uint32x2_t)__builtin_neon_vceqv2si (__a, __b, 1) #define vceq_f32(__a, __b) \ - (uint32x2_t)__builtin_neon_vceqv2sf (__a, __b, 5); + (uint32x2_t)__builtin_neon_vceqv2sf (__a, __b, 5) #define vceq_u8(__a, __b) \ - (uint8x8_t)__builtin_neon_vceqv8qi (__a, __b, 0); + (uint8x8_t)__builtin_neon_vceqv8qi (__a, __b, 0) #define vceq_u16(__a, __b) \ - (uint16x4_t)__builtin_neon_vceqv4hi (__a, __b, 0); + (uint16x4_t)__builtin_neon_vceqv4hi (__a, __b, 0) #define vceq_u32(__a, __b) \ - (uint32x2_t)__builtin_neon_vceqv2si (__a, __b, 0); + (uint32x2_t)__builtin_neon_vceqv2si (__a, __b, 0) #define vceq_p8(__a, __b) \ - (uint8x8_t)__builtin_neon_vceqv8qi (__a, __b, 4); + (uint8x8_t)__builtin_neon_vceqv8qi (__a, __b, 4) #define vceqq_s8(__a, __b) \ - (uint8x16_t)__builtin_neon_vceqv16qi (__a, __b, 1); + (uint8x16_t)__builtin_neon_vceqv16qi (__a, __b, 1) #define vceqq_s16(__a, __b) \ - (uint16x8_t)__builtin_neon_vceqv8hi (__a, __b, 1); + (uint16x8_t)__builtin_neon_vceqv8hi (__a, __b, 1) #define vceqq_s32(__a, __b) \ - (uint32x4_t)__builtin_neon_vceqv4si (__a, __b, 1); + (uint32x4_t)__builtin_neon_vceqv4si (__a, __b, 1) #define vceqq_f32(__a, __b) \ - (uint32x4_t)__builtin_neon_vceqv4sf (__a, __b, 5); + (uint32x4_t)__builtin_neon_vceqv4sf (__a, __b, 5) #define vceqq_u8(__a, __b) \ - (uint8x16_t)__builtin_neon_vceqv16qi (__a, __b, 0); + (uint8x16_t)__builtin_neon_vceqv16qi (__a, __b, 0) #define vceqq_u16(__a, __b) \ - (uint16x8_t)__builtin_neon_vceqv8hi (__a, __b, 0); + (uint16x8_t)__builtin_neon_vceqv8hi (__a, __b, 0) #define vceqq_u32(__a, __b) \ - (uint32x4_t)__builtin_neon_vceqv4si (__a, __b, 0); + (uint32x4_t)__builtin_neon_vceqv4si (__a, __b, 0) #define vceqq_p8(__a, __b) \ - (uint8x16_t)__builtin_neon_vceqv16qi (__a, __b, 4); + (uint8x16_t)__builtin_neon_vceqv16qi (__a, __b, 4) #define vcge_s8(__a, __b) \ - (uint8x8_t)__builtin_neon_vcgev8qi (__a, __b, 1); + (uint8x8_t)__builtin_neon_vcgev8qi (__a, __b, 1) #define vcge_s16(__a, __b) \ - (uint16x4_t)__builtin_neon_vcgev4hi (__a, __b, 1); + (uint16x4_t)__builtin_neon_vcgev4hi (__a, __b, 1) #define vcge_s32(__a, __b) \ - (uint32x2_t)__builtin_neon_vcgev2si (__a, __b, 1); + (uint32x2_t)__builtin_neon_vcgev2si (__a, __b, 1) #define vcge_f32(__a, __b) \ - (uint32x2_t)__builtin_neon_vcgev2sf (__a, __b, 5); + (uint32x2_t)__builtin_neon_vcgev2sf (__a, __b, 5) #define vcge_u8(__a, __b) \ - (uint8x8_t)__builtin_neon_vcgev8qi (__a, __b, 0); + (uint8x8_t)__builtin_neon_vcgev8qi (__a, __b, 0) #define vcge_u16(__a, __b) \ - (uint16x4_t)__builtin_neon_vcgev4hi (__a, __b, 0); + (uint16x4_t)__builtin_neon_vcgev4hi (__a, __b, 0) #define vcge_u32(__a, __b) \ - (uint32x2_t)__builtin_neon_vcgev2si (__a, __b, 0); + (uint32x2_t)__builtin_neon_vcgev2si (__a, __b, 0) #define vcgeq_s8(__a, __b) \ - (uint8x16_t)__builtin_neon_vcgev16qi (__a, __b, 1); + (uint8x16_t)__builtin_neon_vcgev16qi (__a, __b, 1) #define vcgeq_s16(__a, __b) \ - (uint16x8_t)__builtin_neon_vcgev8hi (__a, __b, 1); + (uint16x8_t)__builtin_neon_vcgev8hi (__a, __b, 1) #define vcgeq_s32(__a, __b) \ - (uint32x4_t)__builtin_neon_vcgev4si (__a, __b, 1); + (uint32x4_t)__builtin_neon_vcgev4si (__a, __b, 1) #define vcgeq_f32(__a, __b) \ - (uint32x4_t)__builtin_neon_vcgev4sf (__a, __b, 5); + (uint32x4_t)__builtin_neon_vcgev4sf (__a, __b, 5) #define vcgeq_u8(__a, __b) \ - (uint8x16_t)__builtin_neon_vcgev16qi (__a, __b, 0); + (uint8x16_t)__builtin_neon_vcgev16qi (__a, __b, 0) #define vcgeq_u16(__a, __b) \ - (uint16x8_t)__builtin_neon_vcgev8hi (__a, __b, 0); + (uint16x8_t)__builtin_neon_vcgev8hi (__a, __b, 0) #define vcgeq_u32(__a, __b) \ - (uint32x4_t)__builtin_neon_vcgev4si (__a, __b, 0); + (uint32x4_t)__builtin_neon_vcgev4si (__a, __b, 0) #define vcle_s8(__a, __b) \ - (uint8x8_t)__builtin_neon_vcgev8qi (__b, __a, 1); + (uint8x8_t)__builtin_neon_vcgev8qi (__b, __a, 1) #define vcle_s16(__a, __b) \ - (uint16x4_t)__builtin_neon_vcgev4hi (__b, __a, 1); + (uint16x4_t)__builtin_neon_vcgev4hi (__b, __a, 1) #define vcle_s32(__a, __b) \ - (uint32x2_t)__builtin_neon_vcgev2si (__b, __a, 1); + (uint32x2_t)__builtin_neon_vcgev2si (__b, __a, 1) #define vcle_f32(__a, __b) \ - (uint32x2_t)__builtin_neon_vcgev2sf (__b, __a, 5); + (uint32x2_t)__builtin_neon_vcgev2sf (__b, __a, 5) #define vcle_u8(__a, __b) \ - (uint8x8_t)__builtin_neon_vcgev8qi (__b, __a, 0); + (uint8x8_t)__builtin_neon_vcgev8qi (__b, __a, 0) #define vcle_u16(__a, __b) \ - (uint16x4_t)__builtin_neon_vcgev4hi (__b, __a, 0); + (uint16x4_t)__builtin_neon_vcgev4hi (__b, __a, 0) #define vcle_u32(__a, __b) \ - (uint32x2_t)__builtin_neon_vcgev2si (__b, __a, 0); + (uint32x2_t)__builtin_neon_vcgev2si (__b, __a, 0) #define vcleq_s8(__a, __b) \ - (uint8x16_t)__builtin_neon_vcgev16qi (__b, __a, 1); + (uint8x16_t)__builtin_neon_vcgev16qi (__b, __a, 1) #define vcleq_s16(__a, __b) \ - (uint16x8_t)__builtin_neon_vcgev8hi (__b, __a, 1); + (uint16x8_t)__builtin_neon_vcgev8hi (__b, __a, 1) #define vcleq_s32(__a, __b) \ - (uint32x4_t)__builtin_neon_vcgev4si (__b, __a, 1); + (uint32x4_t)__builtin_neon_vcgev4si (__b, __a, 1) #define vcleq_f32(__a, __b) \ - (uint32x4_t)__builtin_neon_vcgev4sf (__b, __a, 5); + (uint32x4_t)__builtin_neon_vcgev4sf (__b, __a, 5) #define vcleq_u8(__a, __b) \ - (uint8x16_t)__builtin_neon_vcgev16qi (__b, __a, 0); + (uint8x16_t)__builtin_neon_vcgev16qi (__b, __a, 0) #define vcleq_u16(__a, __b) \ - (uint16x8_t)__builtin_neon_vcgev8hi (__b, __a, 0); + (uint16x8_t)__builtin_neon_vcgev8hi (__b, __a, 0) #define vcleq_u32(__a, __b) \ - (uint32x4_t)__builtin_neon_vcgev4si (__b, __a, 0); + (uint32x4_t)__builtin_neon_vcgev4si (__b, __a, 0) #define vcgt_s8(__a, __b) \ - (uint8x8_t)__builtin_neon_vcgtv8qi (__a, __b, 1); + (uint8x8_t)__builtin_neon_vcgtv8qi (__a, __b, 1) #define vcgt_s16(__a, __b) \ - (uint16x4_t)__builtin_neon_vcgtv4hi (__a, __b, 1); + (uint16x4_t)__builtin_neon_vcgtv4hi (__a, __b, 1) #define vcgt_s32(__a, __b) \ - (uint32x2_t)__builtin_neon_vcgtv2si (__a, __b, 1); + (uint32x2_t)__builtin_neon_vcgtv2si (__a, __b, 1) #define vcgt_f32(__a, __b) \ - (uint32x2_t)__builtin_neon_vcgtv2sf (__a, __b, 5); + (uint32x2_t)__builtin_neon_vcgtv2sf (__a, __b, 5) #define vcgt_u8(__a, __b) \ - (uint8x8_t)__builtin_neon_vcgtv8qi (__a, __b, 0); + (uint8x8_t)__builtin_neon_vcgtv8qi (__a, __b, 0) #define vcgt_u16(__a, __b) \ - (uint16x4_t)__builtin_neon_vcgtv4hi (__a, __b, 0); + (uint16x4_t)__builtin_neon_vcgtv4hi (__a, __b, 0) #define vcgt_u32(__a, __b) \ - (uint32x2_t)__builtin_neon_vcgtv2si (__a, __b, 0); + (uint32x2_t)__builtin_neon_vcgtv2si (__a, __b, 0) #define vcgtq_s8(__a, __b) \ - (uint8x16_t)__builtin_neon_vcgtv16qi (__a, __b, 1); + (uint8x16_t)__builtin_neon_vcgtv16qi (__a, __b, 1) #define vcgtq_s16(__a, __b) \ - (uint16x8_t)__builtin_neon_vcgtv8hi (__a, __b, 1); + (uint16x8_t)__builtin_neon_vcgtv8hi (__a, __b, 1) #define vcgtq_s32(__a, __b) \ - (uint32x4_t)__builtin_neon_vcgtv4si (__a, __b, 1); + (uint32x4_t)__builtin_neon_vcgtv4si (__a, __b, 1) #define vcgtq_f32(__a, __b) \ - (uint32x4_t)__builtin_neon_vcgtv4sf (__a, __b, 5); + (uint32x4_t)__builtin_neon_vcgtv4sf (__a, __b, 5) #define vcgtq_u8(__a, __b) \ - (uint8x16_t)__builtin_neon_vcgtv16qi (__a, __b, 0); + (uint8x16_t)__builtin_neon_vcgtv16qi (__a, __b, 0) #define vcgtq_u16(__a, __b) \ - (uint16x8_t)__builtin_neon_vcgtv8hi (__a, __b, 0); + (uint16x8_t)__builtin_neon_vcgtv8hi (__a, __b, 0) #define vcgtq_u32(__a, __b) \ - (uint32x4_t)__builtin_neon_vcgtv4si (__a, __b, 0); + (uint32x4_t)__builtin_neon_vcgtv4si (__a, __b, 0) #define vclt_s8(__a, __b) \ - (uint8x8_t)__builtin_neon_vcgtv8qi (__b, __a, 1); + (uint8x8_t)__builtin_neon_vcgtv8qi (__b, __a, 1) #define vclt_s16(__a, __b) \ - (uint16x4_t)__builtin_neon_vcgtv4hi (__b, __a, 1); + (uint16x4_t)__builtin_neon_vcgtv4hi (__b, __a, 1) #define vclt_s32(__a, __b) \ - (uint32x2_t)__builtin_neon_vcgtv2si (__b, __a, 1); + (uint32x2_t)__builtin_neon_vcgtv2si (__b, __a, 1) #define vclt_f32(__a, __b) \ - (uint32x2_t)__builtin_neon_vcgtv2sf (__b, __a, 5); + (uint32x2_t)__builtin_neon_vcgtv2sf (__b, __a, 5) #define vclt_u8(__a, __b) \ - (uint8x8_t)__builtin_neon_vcgtv8qi (__b, __a, 0); + (uint8x8_t)__builtin_neon_vcgtv8qi (__b, __a, 0) #define vclt_u16(__a, __b) \ - (uint16x4_t)__builtin_neon_vcgtv4hi (__b, __a, 0); + (uint16x4_t)__builtin_neon_vcgtv4hi (__b, __a, 0) #define vclt_u32(__a, __b) \ - (uint32x2_t)__builtin_neon_vcgtv2si (__b, __a, 0); + (uint32x2_t)__builtin_neon_vcgtv2si (__b, __a, 0) #define vcltq_s8(__a, __b) \ - (uint8x16_t)__builtin_neon_vcgtv16qi (__b, __a, 1); + (uint8x16_t)__builtin_neon_vcgtv16qi (__b, __a, 1) #define vcltq_s16(__a, __b) \ - (uint16x8_t)__builtin_neon_vcgtv8hi (__b, __a, 1); + (uint16x8_t)__builtin_neon_vcgtv8hi (__b, __a, 1) #define vcltq_s32(__a, __b) \ - (uint32x4_t)__builtin_neon_vcgtv4si (__b, __a, 1); + (uint32x4_t)__builtin_neon_vcgtv4si (__b, __a, 1) #define vcltq_f32(__a, __b) \ - (uint32x4_t)__builtin_neon_vcgtv4sf (__b, __a, 5); + (uint32x4_t)__builtin_neon_vcgtv4sf (__b, __a, 5) #define vcltq_u8(__a, __b) \ - (uint8x16_t)__builtin_neon_vcgtv16qi (__b, __a, 0); + (uint8x16_t)__builtin_neon_vcgtv16qi (__b, __a, 0) #define vcltq_u16(__a, __b) \ - (uint16x8_t)__builtin_neon_vcgtv8hi (__b, __a, 0); + (uint16x8_t)__builtin_neon_vcgtv8hi (__b, __a, 0) #define vcltq_u32(__a, __b) \ - (uint32x4_t)__builtin_neon_vcgtv4si (__b, __a, 0); + (uint32x4_t)__builtin_neon_vcgtv4si (__b, __a, 0) #define vcage_f32(__a, __b) \ - (uint32x2_t)__builtin_neon_vcagev2sf (__a, __b, 5); + (uint32x2_t)__builtin_neon_vcagev2sf (__a, __b, 5) #define vcageq_f32(__a, __b) \ - (uint32x4_t)__builtin_neon_vcagev4sf (__a, __b, 5); + (uint32x4_t)__builtin_neon_vcagev4sf (__a, __b, 5) #define vcale_f32(__a, __b) \ - (uint32x2_t)__builtin_neon_vcagev2sf (__b, __a, 5); + (uint32x2_t)__builtin_neon_vcagev2sf (__b, __a, 5) #define vcaleq_f32(__a, __b) \ - (uint32x4_t)__builtin_neon_vcagev4sf (__b, __a, 5); + (uint32x4_t)__builtin_neon_vcagev4sf (__b, __a, 5) #define vcagt_f32(__a, __b) \ - (uint32x2_t)__builtin_neon_vcagtv2sf (__a, __b, 5); + (uint32x2_t)__builtin_neon_vcagtv2sf (__a, __b, 5) #define vcagtq_f32(__a, __b) \ - (uint32x4_t)__builtin_neon_vcagtv4sf (__a, __b, 5); + (uint32x4_t)__builtin_neon_vcagtv4sf (__a, __b, 5) #define vcalt_f32(__a, __b) \ - (uint32x2_t)__builtin_neon_vcagtv2sf (__b, __a, 5); + (uint32x2_t)__builtin_neon_vcagtv2sf (__b, __a, 5) #define vcaltq_f32(__a, __b) \ - (uint32x4_t)__builtin_neon_vcagtv4sf (__b, __a, 5); + (uint32x4_t)__builtin_neon_vcagtv4sf (__b, __a, 5) #define vtst_s8(__a, __b) \ - (uint8x8_t)__builtin_neon_vtstv8qi (__a, __b, 1); + (uint8x8_t)__builtin_neon_vtstv8qi (__a, __b, 1) #define vtst_s16(__a, __b) \ - (uint16x4_t)__builtin_neon_vtstv4hi (__a, __b, 1); + (uint16x4_t)__builtin_neon_vtstv4hi (__a, __b, 1) #define vtst_s32(__a, __b) \ - (uint32x2_t)__builtin_neon_vtstv2si (__a, __b, 1); + (uint32x2_t)__builtin_neon_vtstv2si (__a, __b, 1) #define vtst_u8(__a, __b) \ - (uint8x8_t)__builtin_neon_vtstv8qi (__a, __b, 0); + (uint8x8_t)__builtin_neon_vtstv8qi (__a, __b, 0) #define vtst_u16(__a, __b) \ - (uint16x4_t)__builtin_neon_vtstv4hi (__a, __b, 0); + (uint16x4_t)__builtin_neon_vtstv4hi (__a, __b, 0) #define vtst_u32(__a, __b) \ - (uint32x2_t)__builtin_neon_vtstv2si (__a, __b, 0); + (uint32x2_t)__builtin_neon_vtstv2si (__a, __b, 0) #define vtst_p8(__a, __b) \ - (uint8x8_t)__builtin_neon_vtstv8qi (__a, __b, 4); + (uint8x8_t)__builtin_neon_vtstv8qi (__a, __b, 4) #define vtstq_s8(__a, __b) \ - (uint8x16_t)__builtin_neon_vtstv16qi (__a, __b, 1); + (uint8x16_t)__builtin_neon_vtstv16qi (__a, __b, 1) #define vtstq_s16(__a, __b) \ - (uint16x8_t)__builtin_neon_vtstv8hi (__a, __b, 1); + (uint16x8_t)__builtin_neon_vtstv8hi (__a, __b, 1) #define vtstq_s32(__a, __b) \ - (uint32x4_t)__builtin_neon_vtstv4si (__a, __b, 1); + (uint32x4_t)__builtin_neon_vtstv4si (__a, __b, 1) #define vtstq_u8(__a, __b) \ - (uint8x16_t)__builtin_neon_vtstv16qi (__a, __b, 0); + (uint8x16_t)__builtin_neon_vtstv16qi (__a, __b, 0) #define vtstq_u16(__a, __b) \ - (uint16x8_t)__builtin_neon_vtstv8hi (__a, __b, 0); + (uint16x8_t)__builtin_neon_vtstv8hi (__a, __b, 0) #define vtstq_u32(__a, __b) \ - (uint32x4_t)__builtin_neon_vtstv4si (__a, __b, 0); + (uint32x4_t)__builtin_neon_vtstv4si (__a, __b, 0) #define vtstq_p8(__a, __b) \ - (uint8x16_t)__builtin_neon_vtstv16qi (__a, __b, 4); + (uint8x16_t)__builtin_neon_vtstv16qi (__a, __b, 4) #define vabd_s8(__a, __b) \ - (int8x8_t)__builtin_neon_vabdv8qi (__a, __b, 1); + (int8x8_t)__builtin_neon_vabdv8qi (__a, __b, 1) #define vabd_s16(__a, __b) \ - (int16x4_t)__builtin_neon_vabdv4hi (__a, __b, 1); + (int16x4_t)__builtin_neon_vabdv4hi (__a, __b, 1) #define vabd_s32(__a, __b) \ - (int32x2_t)__builtin_neon_vabdv2si (__a, __b, 1); + (int32x2_t)__builtin_neon_vabdv2si (__a, __b, 1) #define vabd_f32(__a, __b) \ - (float32x2_t)__builtin_neon_vabdv2sf (__a, __b, 5); + (float32x2_t)__builtin_neon_vabdv2sf (__a, __b, 5) #define vabd_u8(__a, __b) \ - (uint8x8_t)__builtin_neon_vabdv8qi (__a, __b, 0); + (uint8x8_t)__builtin_neon_vabdv8qi (__a, __b, 0) #define vabd_u16(__a, __b) \ - (uint16x4_t)__builtin_neon_vabdv4hi (__a, __b, 0); + (uint16x4_t)__builtin_neon_vabdv4hi (__a, __b, 0) #define vabd_u32(__a, __b) \ - (uint32x2_t)__builtin_neon_vabdv2si (__a, __b, 0); + (uint32x2_t)__builtin_neon_vabdv2si (__a, __b, 0) #define vabdq_s8(__a, __b) \ - (int8x16_t)__builtin_neon_vabdv16qi (__a, __b, 1); + (int8x16_t)__builtin_neon_vabdv16qi (__a, __b, 1) #define vabdq_s16(__a, __b) \ - (int16x8_t)__builtin_neon_vabdv8hi (__a, __b, 1); + (int16x8_t)__builtin_neon_vabdv8hi (__a, __b, 1) #define vabdq_s32(__a, __b) \ - (int32x4_t)__builtin_neon_vabdv4si (__a, __b, 1); + (int32x4_t)__builtin_neon_vabdv4si (__a, __b, 1) #define vabdq_f32(__a, __b) \ - (float32x4_t)__builtin_neon_vabdv4sf (__a, __b, 5); + (float32x4_t)__builtin_neon_vabdv4sf (__a, __b, 5) #define vabdq_u8(__a, __b) \ - (uint8x16_t)__builtin_neon_vabdv16qi (__a, __b, 0); + (uint8x16_t)__builtin_neon_vabdv16qi (__a, __b, 0) #define vabdq_u16(__a, __b) \ - (uint16x8_t)__builtin_neon_vabdv8hi (__a, __b, 0); + (uint16x8_t)__builtin_neon_vabdv8hi (__a, __b, 0) #define vabdq_u32(__a, __b) \ - (uint32x4_t)__builtin_neon_vabdv4si (__a, __b, 0); + (uint32x4_t)__builtin_neon_vabdv4si (__a, __b, 0) #define vabdl_s8(__a, __b) \ - (int16x8_t)__builtin_neon_vabdlv8qi (__a, __b, 1); + (int16x8_t)__builtin_neon_vabdlv8qi (__a, __b, 1) #define vabdl_s16(__a, __b) \ - (int32x4_t)__builtin_neon_vabdlv4hi (__a, __b, 1); + (int32x4_t)__builtin_neon_vabdlv4hi (__a, __b, 1) #define vabdl_s32(__a, __b) \ - (int64x2_t)__builtin_neon_vabdlv2si (__a, __b, 1); + (int64x2_t)__builtin_neon_vabdlv2si (__a, __b, 1) #define vabdl_u8(__a, __b) \ - (uint16x8_t)__builtin_neon_vabdlv8qi (__a, __b, 0); + (uint16x8_t)__builtin_neon_vabdlv8qi (__a, __b, 0) #define vabdl_u16(__a, __b) \ - (uint32x4_t)__builtin_neon_vabdlv4hi (__a, __b, 0); + (uint32x4_t)__builtin_neon_vabdlv4hi (__a, __b, 0) #define vabdl_u32(__a, __b) \ - (uint64x2_t)__builtin_neon_vabdlv2si (__a, __b, 0); + (uint64x2_t)__builtin_neon_vabdlv2si (__a, __b, 0) #define vaba_s8(__a, __b, __c) \ - (int8x8_t)__builtin_neon_vabav8qi (__a, __b, __c, 1); + (int8x8_t)__builtin_neon_vabav8qi (__a, __b, __c, 1) #define vaba_s16(__a, __b, __c) \ - (int16x4_t)__builtin_neon_vabav4hi (__a, __b, __c, 1); + (int16x4_t)__builtin_neon_vabav4hi (__a, __b, __c, 1) #define vaba_s32(__a, __b, __c) \ - (int32x2_t)__builtin_neon_vabav2si (__a, __b, __c, 1); + (int32x2_t)__builtin_neon_vabav2si (__a, __b, __c, 1) #define vaba_u8(__a, __b, __c) \ - (uint8x8_t)__builtin_neon_vabav8qi (__a, __b, __c, 0); + (uint8x8_t)__builtin_neon_vabav8qi (__a, __b, __c, 0) #define vaba_u16(__a, __b, __c) \ - (uint16x4_t)__builtin_neon_vabav4hi (__a, __b, __c, 0); + (uint16x4_t)__builtin_neon_vabav4hi (__a, __b, __c, 0) #define vaba_u32(__a, __b, __c) \ - (uint32x2_t)__builtin_neon_vabav2si (__a, __b, __c, 0); + (uint32x2_t)__builtin_neon_vabav2si (__a, __b, __c, 0) #define vabaq_s8(__a, __b, __c) \ - (int8x16_t)__builtin_neon_vabav16qi (__a, __b, __c, 1); + (int8x16_t)__builtin_neon_vabav16qi (__a, __b, __c, 1) #define vabaq_s16(__a, __b, __c) \ - (int16x8_t)__builtin_neon_vabav8hi (__a, __b, __c, 1); + (int16x8_t)__builtin_neon_vabav8hi (__a, __b, __c, 1) #define vabaq_s32(__a, __b, __c) \ - (int32x4_t)__builtin_neon_vabav4si (__a, __b, __c, 1); + (int32x4_t)__builtin_neon_vabav4si (__a, __b, __c, 1) #define vabaq_u8(__a, __b, __c) \ - (uint8x16_t)__builtin_neon_vabav16qi (__a, __b, __c, 0); + (uint8x16_t)__builtin_neon_vabav16qi (__a, __b, __c, 0) #define vabaq_u16(__a, __b, __c) \ - (uint16x8_t)__builtin_neon_vabav8hi (__a, __b, __c, 0); + (uint16x8_t)__builtin_neon_vabav8hi (__a, __b, __c, 0) #define vabaq_u32(__a, __b, __c) \ - (uint32x4_t)__builtin_neon_vabav4si (__a, __b, __c, 0); + (uint32x4_t)__builtin_neon_vabav4si (__a, __b, __c, 0) #define vabal_s8(__a, __b, __c) \ - (int16x8_t)__builtin_neon_vabalv8qi (__a, __b, __c, 1); + (int16x8_t)__builtin_neon_vabalv8qi (__a, __b, __c, 1) #define vabal_s16(__a, __b, __c) \ - (int32x4_t)__builtin_neon_vabalv4hi (__a, __b, __c, 1); + (int32x4_t)__builtin_neon_vabalv4hi (__a, __b, __c, 1) #define vabal_s32(__a, __b, __c) \ - (int64x2_t)__builtin_neon_vabalv2si (__a, __b, __c, 1); + (int64x2_t)__builtin_neon_vabalv2si (__a, __b, __c, 1) #define vabal_u8(__a, __b, __c) \ - (uint16x8_t)__builtin_neon_vabalv8qi (__a, __b, __c, 0); + (uint16x8_t)__builtin_neon_vabalv8qi (__a, __b, __c, 0) #define vabal_u16(__a, __b, __c) \ - (uint32x4_t)__builtin_neon_vabalv4hi (__a, __b, __c, 0); + (uint32x4_t)__builtin_neon_vabalv4hi (__a, __b, __c, 0) #define vabal_u32(__a, __b, __c) \ - (uint64x2_t)__builtin_neon_vabalv2si (__a, __b, __c, 0); + (uint64x2_t)__builtin_neon_vabalv2si (__a, __b, __c, 0) #define vmax_s8(__a, __b) \ - (int8x8_t)__builtin_neon_vmaxv8qi (__a, __b, 1); + (int8x8_t)__builtin_neon_vmaxv8qi (__a, __b, 1) #define vmax_s16(__a, __b) \ - (int16x4_t)__builtin_neon_vmaxv4hi (__a, __b, 1); + (int16x4_t)__builtin_neon_vmaxv4hi (__a, __b, 1) #define vmax_s32(__a, __b) \ - (int32x2_t)__builtin_neon_vmaxv2si (__a, __b, 1); + (int32x2_t)__builtin_neon_vmaxv2si (__a, __b, 1) #define vmax_f32(__a, __b) \ - (float32x2_t)__builtin_neon_vmaxv2sf (__a, __b, 5); + (float32x2_t)__builtin_neon_vmaxv2sf (__a, __b, 5) #define vmax_u8(__a, __b) \ - (uint8x8_t)__builtin_neon_vmaxv8qi (__a, __b, 0); + (uint8x8_t)__builtin_neon_vmaxv8qi (__a, __b, 0) #define vmax_u16(__a, __b) \ - (uint16x4_t)__builtin_neon_vmaxv4hi (__a, __b, 0); + (uint16x4_t)__builtin_neon_vmaxv4hi (__a, __b, 0) #define vmax_u32(__a, __b) \ - (uint32x2_t)__builtin_neon_vmaxv2si (__a, __b, 0); + (uint32x2_t)__builtin_neon_vmaxv2si (__a, __b, 0) #define vmaxq_s8(__a, __b) \ - (int8x16_t)__builtin_neon_vmaxv16qi (__a, __b, 1); + (int8x16_t)__builtin_neon_vmaxv16qi (__a, __b, 1) #define vmaxq_s16(__a, __b) \ - (int16x8_t)__builtin_neon_vmaxv8hi (__a, __b, 1); + (int16x8_t)__builtin_neon_vmaxv8hi (__a, __b, 1) #define vmaxq_s32(__a, __b) \ - (int32x4_t)__builtin_neon_vmaxv4si (__a, __b, 1); + (int32x4_t)__builtin_neon_vmaxv4si (__a, __b, 1) #define vmaxq_f32(__a, __b) \ - (float32x4_t)__builtin_neon_vmaxv4sf (__a, __b, 5); + (float32x4_t)__builtin_neon_vmaxv4sf (__a, __b, 5) #define vmaxq_u8(__a, __b) \ - (uint8x16_t)__builtin_neon_vmaxv16qi (__a, __b, 0); + (uint8x16_t)__builtin_neon_vmaxv16qi (__a, __b, 0) #define vmaxq_u16(__a, __b) \ - (uint16x8_t)__builtin_neon_vmaxv8hi (__a, __b, 0); + (uint16x8_t)__builtin_neon_vmaxv8hi (__a, __b, 0) #define vmaxq_u32(__a, __b) \ - (uint32x4_t)__builtin_neon_vmaxv4si (__a, __b, 0); + (uint32x4_t)__builtin_neon_vmaxv4si (__a, __b, 0) #define vmin_s8(__a, __b) \ - (int8x8_t)__builtin_neon_vminv8qi (__a, __b, 1); + (int8x8_t)__builtin_neon_vminv8qi (__a, __b, 1) #define vmin_s16(__a, __b) \ - (int16x4_t)__builtin_neon_vminv4hi (__a, __b, 1); + (int16x4_t)__builtin_neon_vminv4hi (__a, __b, 1) #define vmin_s32(__a, __b) \ - (int32x2_t)__builtin_neon_vminv2si (__a, __b, 1); + (int32x2_t)__builtin_neon_vminv2si (__a, __b, 1) #define vmin_f32(__a, __b) \ - (float32x2_t)__builtin_neon_vminv2sf (__a, __b, 5); + (float32x2_t)__builtin_neon_vminv2sf (__a, __b, 5) #define vmin_u8(__a, __b) \ - (uint8x8_t)__builtin_neon_vminv8qi (__a, __b, 0); + (uint8x8_t)__builtin_neon_vminv8qi (__a, __b, 0) #define vmin_u16(__a, __b) \ - (uint16x4_t)__builtin_neon_vminv4hi (__a, __b, 0); + (uint16x4_t)__builtin_neon_vminv4hi (__a, __b, 0) #define vmin_u32(__a, __b) \ - (uint32x2_t)__builtin_neon_vminv2si (__a, __b, 0); + (uint32x2_t)__builtin_neon_vminv2si (__a, __b, 0) #define vminq_s8(__a, __b) \ - (int8x16_t)__builtin_neon_vminv16qi (__a, __b, 1); + (int8x16_t)__builtin_neon_vminv16qi (__a, __b, 1) #define vminq_s16(__a, __b) \ - (int16x8_t)__builtin_neon_vminv8hi (__a, __b, 1); + (int16x8_t)__builtin_neon_vminv8hi (__a, __b, 1) #define vminq_s32(__a, __b) \ - (int32x4_t)__builtin_neon_vminv4si (__a, __b, 1); + (int32x4_t)__builtin_neon_vminv4si (__a, __b, 1) #define vminq_f32(__a, __b) \ - (float32x4_t)__builtin_neon_vminv4sf (__a, __b, 5); + (float32x4_t)__builtin_neon_vminv4sf (__a, __b, 5) #define vminq_u8(__a, __b) \ - (uint8x16_t)__builtin_neon_vminv16qi (__a, __b, 0); + (uint8x16_t)__builtin_neon_vminv16qi (__a, __b, 0) #define vminq_u16(__a, __b) \ - (uint16x8_t)__builtin_neon_vminv8hi (__a, __b, 0); + (uint16x8_t)__builtin_neon_vminv8hi (__a, __b, 0) #define vminq_u32(__a, __b) \ - (uint32x4_t)__builtin_neon_vminv4si (__a, __b, 0); + (uint32x4_t)__builtin_neon_vminv4si (__a, __b, 0) #define vpadd_s8(__a, __b) \ - (int8x8_t)__builtin_neon_vpaddv8qi (__a, __b, 1); + (int8x8_t)__builtin_neon_vpaddv8qi (__a, __b, 1) #define vpadd_s16(__a, __b) \ - (int16x4_t)__builtin_neon_vpaddv4hi (__a, __b, 1); + (int16x4_t)__builtin_neon_vpaddv4hi (__a, __b, 1) #define vpadd_s32(__a, __b) \ - (int32x2_t)__builtin_neon_vpaddv2si (__a, __b, 1); + (int32x2_t)__builtin_neon_vpaddv2si (__a, __b, 1) #define vpadd_f32(__a, __b) \ - (float32x2_t)__builtin_neon_vpaddv2sf (__a, __b, 5); + (float32x2_t)__builtin_neon_vpaddv2sf (__a, __b, 5) #define vpadd_u8(__a, __b) \ - (uint8x8_t)__builtin_neon_vpaddv8qi (__a, __b, 0); + (uint8x8_t)__builtin_neon_vpaddv8qi (__a, __b, 0) #define vpadd_u16(__a, __b) \ - (uint16x4_t)__builtin_neon_vpaddv4hi (__a, __b, 0); + (uint16x4_t)__builtin_neon_vpaddv4hi (__a, __b, 0) #define vpadd_u32(__a, __b) \ - (uint32x2_t)__builtin_neon_vpaddv2si (__a, __b, 0); + (uint32x2_t)__builtin_neon_vpaddv2si (__a, __b, 0) #define vpaddl_s8(__a) \ - (int16x4_t)__builtin_neon_vpaddlv8qi (__a, 1); + (int16x4_t)__builtin_neon_vpaddlv8qi (__a, 1) #define vpaddl_s16(__a) \ - (int32x2_t)__builtin_neon_vpaddlv4hi (__a, 1); + (int32x2_t)__builtin_neon_vpaddlv4hi (__a, 1) #define vpaddl_s32(__a) \ - (int64x1_t)__builtin_neon_vpaddlv2si (__a, 1); + (int64x1_t)__builtin_neon_vpaddlv2si (__a, 1) #define vpaddl_u8(__a) \ - (uint16x4_t)__builtin_neon_vpaddlv8qi (__a, 0); + (uint16x4_t)__builtin_neon_vpaddlv8qi (__a, 0) #define vpaddl_u16(__a) \ - (uint32x2_t)__builtin_neon_vpaddlv4hi (__a, 0); + (uint32x2_t)__builtin_neon_vpaddlv4hi (__a, 0) #define vpaddl_u32(__a) \ - (uint64x1_t)__builtin_neon_vpaddlv2si (__a, 0); + (uint64x1_t)__builtin_neon_vpaddlv2si (__a, 0) #define vpaddlq_s8(__a) \ - (int16x8_t)__builtin_neon_vpaddlv16qi (__a, 1); + (int16x8_t)__builtin_neon_vpaddlv16qi (__a, 1) #define vpaddlq_s16(__a) \ - (int32x4_t)__builtin_neon_vpaddlv8hi (__a, 1); + (int32x4_t)__builtin_neon_vpaddlv8hi (__a, 1) #define vpaddlq_s32(__a) \ - (int64x2_t)__builtin_neon_vpaddlv4si (__a, 1); + (int64x2_t)__builtin_neon_vpaddlv4si (__a, 1) #define vpaddlq_u8(__a) \ - (uint16x8_t)__builtin_neon_vpaddlv16qi (__a, 0); + (uint16x8_t)__builtin_neon_vpaddlv16qi (__a, 0) #define vpaddlq_u16(__a) \ - (uint32x4_t)__builtin_neon_vpaddlv8hi (__a, 0); + (uint32x4_t)__builtin_neon_vpaddlv8hi (__a, 0) #define vpaddlq_u32(__a) \ - (uint64x2_t)__builtin_neon_vpaddlv4si (__a, 0); + (uint64x2_t)__builtin_neon_vpaddlv4si (__a, 0) #define vpadal_s8(__a, __b) \ - (int16x4_t)__builtin_neon_vpadalv8qi (__a, __b, 1); + (int16x4_t)__builtin_neon_vpadalv8qi (__a, __b, 1) #define vpadal_s16(__a, __b) \ - (int32x2_t)__builtin_neon_vpadalv4hi (__a, __b, 1); + (int32x2_t)__builtin_neon_vpadalv4hi (__a, __b, 1) #define vpadal_s32(__a, __b) \ - (int64x1_t)__builtin_neon_vpadalv2si (__a, __b, 1); + (int64x1_t)__builtin_neon_vpadalv2si (__a, __b, 1) #define vpadal_u8(__a, __b) \ - (uint16x4_t)__builtin_neon_vpadalv8qi (__a, __b, 0); + (uint16x4_t)__builtin_neon_vpadalv8qi (__a, __b, 0) #define vpadal_u16(__a, __b) \ - (uint32x2_t)__builtin_neon_vpadalv4hi (__a, __b, 0); + (uint32x2_t)__builtin_neon_vpadalv4hi (__a, __b, 0) #define vpadal_u32(__a, __b) \ - (uint64x1_t)__builtin_neon_vpadalv2si (__a, __b, 0); + (uint64x1_t)__builtin_neon_vpadalv2si (__a, __b, 0) #define vpadalq_s8(__a, __b) \ - (int16x8_t)__builtin_neon_vpadalv16qi (__a, __b, 1); + (int16x8_t)__builtin_neon_vpadalv16qi (__a, __b, 1) #define vpadalq_s16(__a, __b) \ - (int32x4_t)__builtin_neon_vpadalv8hi (__a, __b, 1); + (int32x4_t)__builtin_neon_vpadalv8hi (__a, __b, 1) #define vpadalq_s32(__a, __b) \ - (int64x2_t)__builtin_neon_vpadalv4si (__a, __b, 1); + (int64x2_t)__builtin_neon_vpadalv4si (__a, __b, 1) #define vpadalq_u8(__a, __b) \ - (uint16x8_t)__builtin_neon_vpadalv16qi (__a, __b, 0); + (uint16x8_t)__builtin_neon_vpadalv16qi (__a, __b, 0) #define vpadalq_u16(__a, __b) \ - (uint32x4_t)__builtin_neon_vpadalv8hi (__a, __b, 0); + (uint32x4_t)__builtin_neon_vpadalv8hi (__a, __b, 0) #define vpadalq_u32(__a, __b) \ - (uint64x2_t)__builtin_neon_vpadalv4si (__a, __b, 0); + (uint64x2_t)__builtin_neon_vpadalv4si (__a, __b, 0) #define vpmax_s8(__a, __b) \ - (int8x8_t)__builtin_neon_vpmaxv8qi (__a, __b, 1); + (int8x8_t)__builtin_neon_vpmaxv8qi (__a, __b, 1) #define vpmax_s16(__a, __b) \ - (int16x4_t)__builtin_neon_vpmaxv4hi (__a, __b, 1); + (int16x4_t)__builtin_neon_vpmaxv4hi (__a, __b, 1) #define vpmax_s32(__a, __b) \ - (int32x2_t)__builtin_neon_vpmaxv2si (__a, __b, 1); + (int32x2_t)__builtin_neon_vpmaxv2si (__a, __b, 1) #define vpmax_f32(__a, __b) \ - (float32x2_t)__builtin_neon_vpmaxv2sf (__a, __b, 5); + (float32x2_t)__builtin_neon_vpmaxv2sf (__a, __b, 5) #define vpmax_u8(__a, __b) \ - (uint8x8_t)__builtin_neon_vpmaxv8qi (__a, __b, 0); + (uint8x8_t)__builtin_neon_vpmaxv8qi (__a, __b, 0) #define vpmax_u16(__a, __b) \ - (uint16x4_t)__builtin_neon_vpmaxv4hi (__a, __b, 0); + (uint16x4_t)__builtin_neon_vpmaxv4hi (__a, __b, 0) #define vpmax_u32(__a, __b) \ - (uint32x2_t)__builtin_neon_vpmaxv2si (__a, __b, 0); + (uint32x2_t)__builtin_neon_vpmaxv2si (__a, __b, 0) #define vpmin_s8(__a, __b) \ - (int8x8_t)__builtin_neon_vpminv8qi (__a, __b, 1); + (int8x8_t)__builtin_neon_vpminv8qi (__a, __b, 1) #define vpmin_s16(__a, __b) \ - (int16x4_t)__builtin_neon_vpminv4hi (__a, __b, 1); + (int16x4_t)__builtin_neon_vpminv4hi (__a, __b, 1) #define vpmin_s32(__a, __b) \ - (int32x2_t)__builtin_neon_vpminv2si (__a, __b, 1); + (int32x2_t)__builtin_neon_vpminv2si (__a, __b, 1) #define vpmin_f32(__a, __b) \ - (float32x2_t)__builtin_neon_vpminv2sf (__a, __b, 5); + (float32x2_t)__builtin_neon_vpminv2sf (__a, __b, 5) #define vpmin_u8(__a, __b) \ - (uint8x8_t)__builtin_neon_vpminv8qi (__a, __b, 0); + (uint8x8_t)__builtin_neon_vpminv8qi (__a, __b, 0) #define vpmin_u16(__a, __b) \ - (uint16x4_t)__builtin_neon_vpminv4hi (__a, __b, 0); + (uint16x4_t)__builtin_neon_vpminv4hi (__a, __b, 0) #define vpmin_u32(__a, __b) \ - (uint32x2_t)__builtin_neon_vpminv2si (__a, __b, 0); + (uint32x2_t)__builtin_neon_vpminv2si (__a, __b, 0) #define vrecps_f32(__a, __b) \ - (float32x2_t)__builtin_neon_vrecpsv2sf (__a, __b, 5); + (float32x2_t)__builtin_neon_vrecpsv2sf (__a, __b, 5) #define vrecpsq_f32(__a, __b) \ - (float32x4_t)__builtin_neon_vrecpsv4sf (__a, __b, 5); + (float32x4_t)__builtin_neon_vrecpsv4sf (__a, __b, 5) #define vrsqrts_f32(__a, __b) \ - (float32x2_t)__builtin_neon_vrsqrtsv2sf (__a, __b, 5); + (float32x2_t)__builtin_neon_vrsqrtsv2sf (__a, __b, 5) #define vrsqrtsq_f32(__a, __b) \ - (float32x4_t)__builtin_neon_vrsqrtsv4sf (__a, __b, 5); + (float32x4_t)__builtin_neon_vrsqrtsv4sf (__a, __b, 5) #define vshl_s8(__a, __b) \ - (int8x8_t)__builtin_neon_vshlv8qi (__a, __b, 1); + (int8x8_t)__builtin_neon_vshlv8qi (__a, __b, 1) #define vshl_s16(__a, __b) \ - (int16x4_t)__builtin_neon_vshlv4hi (__a, __b, 1); + (int16x4_t)__builtin_neon_vshlv4hi (__a, __b, 1) #define vshl_s32(__a, __b) \ - (int32x2_t)__builtin_neon_vshlv2si (__a, __b, 1); + (int32x2_t)__builtin_neon_vshlv2si (__a, __b, 1) #define vshl_s64(__a, __b) \ - (int64x1_t)__builtin_neon_vshldi (__a, __b, 1); + (int64x1_t)__builtin_neon_vshldi (__a, __b, 1) #define vshl_u8(__a, __b) \ - (uint8x8_t)__builtin_neon_vshlv8qi (__a, __b, 0); + (uint8x8_t)__builtin_neon_vshlv8qi (__a, __b, 0) #define vshl_u16(__a, __b) \ - (uint16x4_t)__builtin_neon_vshlv4hi (__a, __b, 0); + (uint16x4_t)__builtin_neon_vshlv4hi (__a, __b, 0) #define vshl_u32(__a, __b) \ - (uint32x2_t)__builtin_neon_vshlv2si (__a, __b, 0); + (uint32x2_t)__builtin_neon_vshlv2si (__a, __b, 0) #define vshl_u64(__a, __b) \ - (uint64x1_t)__builtin_neon_vshldi (__a, __b, 0); + (uint64x1_t)__builtin_neon_vshldi (__a, __b, 0) #define vshlq_s8(__a, __b) \ - (int8x16_t)__builtin_neon_vshlv16qi (__a, __b, 1); + (int8x16_t)__builtin_neon_vshlv16qi (__a, __b, 1) #define vshlq_s16(__a, __b) \ - (int16x8_t)__builtin_neon_vshlv8hi (__a, __b, 1); + (int16x8_t)__builtin_neon_vshlv8hi (__a, __b, 1) #define vshlq_s32(__a, __b) \ - (int32x4_t)__builtin_neon_vshlv4si (__a, __b, 1); + (int32x4_t)__builtin_neon_vshlv4si (__a, __b, 1) #define vshlq_s64(__a, __b) \ - (int64x2_t)__builtin_neon_vshlv2di (__a, __b, 1); + (int64x2_t)__builtin_neon_vshlv2di (__a, __b, 1) #define vshlq_u8(__a, __b) \ - (uint8x16_t)__builtin_neon_vshlv16qi (__a, __b, 0); + (uint8x16_t)__builtin_neon_vshlv16qi (__a, __b, 0) #define vshlq_u16(__a, __b) \ - (uint16x8_t)__builtin_neon_vshlv8hi (__a, __b, 0); + (uint16x8_t)__builtin_neon_vshlv8hi (__a, __b, 0) #define vshlq_u32(__a, __b) \ - (uint32x4_t)__builtin_neon_vshlv4si (__a, __b, 0); + (uint32x4_t)__builtin_neon_vshlv4si (__a, __b, 0) #define vshlq_u64(__a, __b) \ - (uint64x2_t)__builtin_neon_vshlv2di (__a, __b, 0); + (uint64x2_t)__builtin_neon_vshlv2di (__a, __b, 0) #define vrshl_s8(__a, __b) \ - (int8x8_t)__builtin_neon_vshlv8qi (__a, __b, 3); + (int8x8_t)__builtin_neon_vshlv8qi (__a, __b, 3) #define vrshl_s16(__a, __b) \ - (int16x4_t)__builtin_neon_vshlv4hi (__a, __b, 3); + (int16x4_t)__builtin_neon_vshlv4hi (__a, __b, 3) #define vrshl_s32(__a, __b) \ - (int32x2_t)__builtin_neon_vshlv2si (__a, __b, 3); + (int32x2_t)__builtin_neon_vshlv2si (__a, __b, 3) #define vrshl_s64(__a, __b) \ - (int64x1_t)__builtin_neon_vshldi (__a, __b, 3); + (int64x1_t)__builtin_neon_vshldi (__a, __b, 3) #define vrshl_u8(__a, __b) \ - (uint8x8_t)__builtin_neon_vshlv8qi (__a, __b, 2); + (uint8x8_t)__builtin_neon_vshlv8qi (__a, __b, 2) #define vrshl_u16(__a, __b) \ - (uint16x4_t)__builtin_neon_vshlv4hi (__a, __b, 2); + (uint16x4_t)__builtin_neon_vshlv4hi (__a, __b, 2) #define vrshl_u32(__a, __b) \ - (uint32x2_t)__builtin_neon_vshlv2si (__a, __b, 2); + (uint32x2_t)__builtin_neon_vshlv2si (__a, __b, 2) #define vrshl_u64(__a, __b) \ - (uint64x1_t)__builtin_neon_vshldi (__a, __b, 2); + (uint64x1_t)__builtin_neon_vshldi (__a, __b, 2) #define vrshlq_s8(__a, __b) \ - (int8x16_t)__builtin_neon_vshlv16qi (__a, __b, 3); + (int8x16_t)__builtin_neon_vshlv16qi (__a, __b, 3) #define vrshlq_s16(__a, __b) \ - (int16x8_t)__builtin_neon_vshlv8hi (__a, __b, 3); + (int16x8_t)__builtin_neon_vshlv8hi (__a, __b, 3) #define vrshlq_s32(__a, __b) \ - (int32x4_t)__builtin_neon_vshlv4si (__a, __b, 3); + (int32x4_t)__builtin_neon_vshlv4si (__a, __b, 3) #define vrshlq_s64(__a, __b) \ - (int64x2_t)__builtin_neon_vshlv2di (__a, __b, 3); + (int64x2_t)__builtin_neon_vshlv2di (__a, __b, 3) #define vrshlq_u8(__a, __b) \ - (uint8x16_t)__builtin_neon_vshlv16qi (__a, __b, 2); + (uint8x16_t)__builtin_neon_vshlv16qi (__a, __b, 2) #define vrshlq_u16(__a, __b) \ - (uint16x8_t)__builtin_neon_vshlv8hi (__a, __b, 2); + (uint16x8_t)__builtin_neon_vshlv8hi (__a, __b, 2) #define vrshlq_u32(__a, __b) \ - (uint32x4_t)__builtin_neon_vshlv4si (__a, __b, 2); + (uint32x4_t)__builtin_neon_vshlv4si (__a, __b, 2) #define vrshlq_u64(__a, __b) \ - (uint64x2_t)__builtin_neon_vshlv2di (__a, __b, 2); + (uint64x2_t)__builtin_neon_vshlv2di (__a, __b, 2) #define vqshl_s8(__a, __b) \ - (int8x8_t)__builtin_neon_vqshlv8qi (__a, __b, 1); + (int8x8_t)__builtin_neon_vqshlv8qi (__a, __b, 1) #define vqshl_s16(__a, __b) \ - (int16x4_t)__builtin_neon_vqshlv4hi (__a, __b, 1); + (int16x4_t)__builtin_neon_vqshlv4hi (__a, __b, 1) #define vqshl_s32(__a, __b) \ - (int32x2_t)__builtin_neon_vqshlv2si (__a, __b, 1); + (int32x2_t)__builtin_neon_vqshlv2si (__a, __b, 1) #define vqshl_s64(__a, __b) \ - (int64x1_t)__builtin_neon_vqshldi (__a, __b, 1); + (int64x1_t)__builtin_neon_vqshldi (__a, __b, 1) #define vqshl_u8(__a, __b) \ - (uint8x8_t)__builtin_neon_vqshlv8qi (__a, __b, 0); + (uint8x8_t)__builtin_neon_vqshlv8qi (__a, __b, 0) #define vqshl_u16(__a, __b) \ - (uint16x4_t)__builtin_neon_vqshlv4hi (__a, __b, 0); + (uint16x4_t)__builtin_neon_vqshlv4hi (__a, __b, 0) #define vqshl_u32(__a, __b) \ - (uint32x2_t)__builtin_neon_vqshlv2si (__a, __b, 0); + (uint32x2_t)__builtin_neon_vqshlv2si (__a, __b, 0) #define vqshl_u64(__a, __b) \ - (uint64x1_t)__builtin_neon_vqshldi (__a, __b, 0); + (uint64x1_t)__builtin_neon_vqshldi (__a, __b, 0) #define vqshlq_s8(__a, __b) \ - (int8x16_t)__builtin_neon_vqshlv16qi (__a, __b, 1); + (int8x16_t)__builtin_neon_vqshlv16qi (__a, __b, 1) #define vqshlq_s16(__a, __b) \ - (int16x8_t)__builtin_neon_vqshlv8hi (__a, __b, 1); + (int16x8_t)__builtin_neon_vqshlv8hi (__a, __b, 1) #define vqshlq_s32(__a, __b) \ - (int32x4_t)__builtin_neon_vqshlv4si (__a, __b, 1); + (int32x4_t)__builtin_neon_vqshlv4si (__a, __b, 1) #define vqshlq_s64(__a, __b) \ - (int64x2_t)__builtin_neon_vqshlv2di (__a, __b, 1); + (int64x2_t)__builtin_neon_vqshlv2di (__a, __b, 1) #define vqshlq_u8(__a, __b) \ - (uint8x16_t)__builtin_neon_vqshlv16qi (__a, __b, 0); + (uint8x16_t)__builtin_neon_vqshlv16qi (__a, __b, 0) #define vqshlq_u16(__a, __b) \ - (uint16x8_t)__builtin_neon_vqshlv8hi (__a, __b, 0); + (uint16x8_t)__builtin_neon_vqshlv8hi (__a, __b, 0) #define vqshlq_u32(__a, __b) \ - (uint32x4_t)__builtin_neon_vqshlv4si (__a, __b, 0); + (uint32x4_t)__builtin_neon_vqshlv4si (__a, __b, 0) #define vqshlq_u64(__a, __b) \ - (uint64x2_t)__builtin_neon_vqshlv2di (__a, __b, 0); + (uint64x2_t)__builtin_neon_vqshlv2di (__a, __b, 0) #define vqrshl_s8(__a, __b) \ - (int8x8_t)__builtin_neon_vqshlv8qi (__a, __b, 3); + (int8x8_t)__builtin_neon_vqshlv8qi (__a, __b, 3) #define vqrshl_s16(__a, __b) \ - (int16x4_t)__builtin_neon_vqshlv4hi (__a, __b, 3); + (int16x4_t)__builtin_neon_vqshlv4hi (__a, __b, 3) #define vqrshl_s32(__a, __b) \ - (int32x2_t)__builtin_neon_vqshlv2si (__a, __b, 3); + (int32x2_t)__builtin_neon_vqshlv2si (__a, __b, 3) #define vqrshl_s64(__a, __b) \ - (int64x1_t)__builtin_neon_vqshldi (__a, __b, 3); + (int64x1_t)__builtin_neon_vqshldi (__a, __b, 3) #define vqrshl_u8(__a, __b) \ - (uint8x8_t)__builtin_neon_vqshlv8qi (__a, __b, 2); + (uint8x8_t)__builtin_neon_vqshlv8qi (__a, __b, 2) #define vqrshl_u16(__a, __b) \ - (uint16x4_t)__builtin_neon_vqshlv4hi (__a, __b, 2); + (uint16x4_t)__builtin_neon_vqshlv4hi (__a, __b, 2) #define vqrshl_u32(__a, __b) \ - (uint32x2_t)__builtin_neon_vqshlv2si (__a, __b, 2); + (uint32x2_t)__builtin_neon_vqshlv2si (__a, __b, 2) #define vqrshl_u64(__a, __b) \ - (uint64x1_t)__builtin_neon_vqshldi (__a, __b, 2); + (uint64x1_t)__builtin_neon_vqshldi (__a, __b, 2) #define vqrshlq_s8(__a, __b) \ - (int8x16_t)__builtin_neon_vqshlv16qi (__a, __b, 3); + (int8x16_t)__builtin_neon_vqshlv16qi (__a, __b, 3) #define vqrshlq_s16(__a, __b) \ - (int16x8_t)__builtin_neon_vqshlv8hi (__a, __b, 3); + (int16x8_t)__builtin_neon_vqshlv8hi (__a, __b, 3) #define vqrshlq_s32(__a, __b) \ - (int32x4_t)__builtin_neon_vqshlv4si (__a, __b, 3); + (int32x4_t)__builtin_neon_vqshlv4si (__a, __b, 3) #define vqrshlq_s64(__a, __b) \ - (int64x2_t)__builtin_neon_vqshlv2di (__a, __b, 3); + (int64x2_t)__builtin_neon_vqshlv2di (__a, __b, 3) #define vqrshlq_u8(__a, __b) \ - (uint8x16_t)__builtin_neon_vqshlv16qi (__a, __b, 2); + (uint8x16_t)__builtin_neon_vqshlv16qi (__a, __b, 2) #define vqrshlq_u16(__a, __b) \ - (uint16x8_t)__builtin_neon_vqshlv8hi (__a, __b, 2); + (uint16x8_t)__builtin_neon_vqshlv8hi (__a, __b, 2) #define vqrshlq_u32(__a, __b) \ - (uint32x4_t)__builtin_neon_vqshlv4si (__a, __b, 2); + (uint32x4_t)__builtin_neon_vqshlv4si (__a, __b, 2) #define vqrshlq_u64(__a, __b) \ - (uint64x2_t)__builtin_neon_vqshlv2di (__a, __b, 2); + (uint64x2_t)__builtin_neon_vqshlv2di (__a, __b, 2) #define vshr_n_s8(__a, __b) \ - (int8x8_t)__builtin_neon_vshr_nv8qi (__a, __b, 1); + (int8x8_t)__builtin_neon_vshr_nv8qi (__a, __b, 1) #define vshr_n_s16(__a, __b) \ - (int16x4_t)__builtin_neon_vshr_nv4hi (__a, __b, 1); + (int16x4_t)__builtin_neon_vshr_nv4hi (__a, __b, 1) #define vshr_n_s32(__a, __b) \ - (int32x2_t)__builtin_neon_vshr_nv2si (__a, __b, 1); + (int32x2_t)__builtin_neon_vshr_nv2si (__a, __b, 1) #define vshr_n_s64(__a, __b) \ - (int64x1_t)__builtin_neon_vshr_ndi (__a, __b, 1); + (int64x1_t)__builtin_neon_vshr_ndi (__a, __b, 1) #define vshr_n_u8(__a, __b) \ - (uint8x8_t)__builtin_neon_vshr_nv8qi (__a, __b, 0); + (uint8x8_t)__builtin_neon_vshr_nv8qi (__a, __b, 0) #define vshr_n_u16(__a, __b) \ - (uint16x4_t)__builtin_neon_vshr_nv4hi (__a, __b, 0); + (uint16x4_t)__builtin_neon_vshr_nv4hi (__a, __b, 0) #define vshr_n_u32(__a, __b) \ - (uint32x2_t)__builtin_neon_vshr_nv2si (__a, __b, 0); + (uint32x2_t)__builtin_neon_vshr_nv2si (__a, __b, 0) #define vshr_n_u64(__a, __b) \ - (uint64x1_t)__builtin_neon_vshr_ndi (__a, __b, 0); + (uint64x1_t)__builtin_neon_vshr_ndi (__a, __b, 0) #define vshrq_n_s8(__a, __b) \ - (int8x16_t)__builtin_neon_vshr_nv16qi (__a, __b, 1); + (int8x16_t)__builtin_neon_vshr_nv16qi (__a, __b, 1) #define vshrq_n_s16(__a, __b) \ - (int16x8_t)__builtin_neon_vshr_nv8hi (__a, __b, 1); + (int16x8_t)__builtin_neon_vshr_nv8hi (__a, __b, 1) #define vshrq_n_s32(__a, __b) \ - (int32x4_t)__builtin_neon_vshr_nv4si (__a, __b, 1); + (int32x4_t)__builtin_neon_vshr_nv4si (__a, __b, 1) #define vshrq_n_s64(__a, __b) \ - (int64x2_t)__builtin_neon_vshr_nv2di (__a, __b, 1); + (int64x2_t)__builtin_neon_vshr_nv2di (__a, __b, 1) #define vshrq_n_u8(__a, __b) \ - (uint8x16_t)__builtin_neon_vshr_nv16qi (__a, __b, 0); + (uint8x16_t)__builtin_neon_vshr_nv16qi (__a, __b, 0) #define vshrq_n_u16(__a, __b) \ - (uint16x8_t)__builtin_neon_vshr_nv8hi (__a, __b, 0); + (uint16x8_t)__builtin_neon_vshr_nv8hi (__a, __b, 0) #define vshrq_n_u32(__a, __b) \ - (uint32x4_t)__builtin_neon_vshr_nv4si (__a, __b, 0); + (uint32x4_t)__builtin_neon_vshr_nv4si (__a, __b, 0) #define vshrq_n_u64(__a, __b) \ - (uint64x2_t)__builtin_neon_vshr_nv2di (__a, __b, 0); + (uint64x2_t)__builtin_neon_vshr_nv2di (__a, __b, 0) #define vrshr_n_s8(__a, __b) \ - (int8x8_t)__builtin_neon_vshr_nv8qi (__a, __b, 3); + (int8x8_t)__builtin_neon_vshr_nv8qi (__a, __b, 3) #define vrshr_n_s16(__a, __b) \ - (int16x4_t)__builtin_neon_vshr_nv4hi (__a, __b, 3); + (int16x4_t)__builtin_neon_vshr_nv4hi (__a, __b, 3) #define vrshr_n_s32(__a, __b) \ - (int32x2_t)__builtin_neon_vshr_nv2si (__a, __b, 3); + (int32x2_t)__builtin_neon_vshr_nv2si (__a, __b, 3) #define vrshr_n_s64(__a, __b) \ - (int64x1_t)__builtin_neon_vshr_ndi (__a, __b, 3); + (int64x1_t)__builtin_neon_vshr_ndi (__a, __b, 3) #define vrshr_n_u8(__a, __b) \ - (uint8x8_t)__builtin_neon_vshr_nv8qi (__a, __b, 2); + (uint8x8_t)__builtin_neon_vshr_nv8qi (__a, __b, 2) #define vrshr_n_u16(__a, __b) \ - (uint16x4_t)__builtin_neon_vshr_nv4hi (__a, __b, 2); + (uint16x4_t)__builtin_neon_vshr_nv4hi (__a, __b, 2) #define vrshr_n_u32(__a, __b) \ - (uint32x2_t)__builtin_neon_vshr_nv2si (__a, __b, 2); + (uint32x2_t)__builtin_neon_vshr_nv2si (__a, __b, 2) #define vrshr_n_u64(__a, __b) \ - (uint64x1_t)__builtin_neon_vshr_ndi (__a, __b, 2); + (uint64x1_t)__builtin_neon_vshr_ndi (__a, __b, 2) #define vrshrq_n_s8(__a, __b) \ - (int8x16_t)__builtin_neon_vshr_nv16qi (__a, __b, 3); + (int8x16_t)__builtin_neon_vshr_nv16qi (__a, __b, 3) #define vrshrq_n_s16(__a, __b) \ - (int16x8_t)__builtin_neon_vshr_nv8hi (__a, __b, 3); + (int16x8_t)__builtin_neon_vshr_nv8hi (__a, __b, 3) #define vrshrq_n_s32(__a, __b) \ - (int32x4_t)__builtin_neon_vshr_nv4si (__a, __b, 3); + (int32x4_t)__builtin_neon_vshr_nv4si (__a, __b, 3) #define vrshrq_n_s64(__a, __b) \ - (int64x2_t)__builtin_neon_vshr_nv2di (__a, __b, 3); + (int64x2_t)__builtin_neon_vshr_nv2di (__a, __b, 3) #define vrshrq_n_u8(__a, __b) \ - (uint8x16_t)__builtin_neon_vshr_nv16qi (__a, __b, 2); + (uint8x16_t)__builtin_neon_vshr_nv16qi (__a, __b, 2) #define vrshrq_n_u16(__a, __b) \ - (uint16x8_t)__builtin_neon_vshr_nv8hi (__a, __b, 2); + (uint16x8_t)__builtin_neon_vshr_nv8hi (__a, __b, 2) #define vrshrq_n_u32(__a, __b) \ - (uint32x4_t)__builtin_neon_vshr_nv4si (__a, __b, 2); + (uint32x4_t)__builtin_neon_vshr_nv4si (__a, __b, 2) #define vrshrq_n_u64(__a, __b) \ - (uint64x2_t)__builtin_neon_vshr_nv2di (__a, __b, 2); + (uint64x2_t)__builtin_neon_vshr_nv2di (__a, __b, 2) #define vshrn_n_s16(__a, __b) \ - (int8x8_t)__builtin_neon_vshrn_nv8hi (__a, __b, 1); + (int8x8_t)__builtin_neon_vshrn_nv8hi (__a, __b, 1) #define vshrn_n_s32(__a, __b) \ - (int16x4_t)__builtin_neon_vshrn_nv4si (__a, __b, 1); + (int16x4_t)__builtin_neon_vshrn_nv4si (__a, __b, 1) #define vshrn_n_s64(__a, __b) \ - (int32x2_t)__builtin_neon_vshrn_nv2di (__a, __b, 1); + (int32x2_t)__builtin_neon_vshrn_nv2di (__a, __b, 1) #define vshrn_n_u16(__a, __b) \ - (uint8x8_t)__builtin_neon_vshrn_nv8hi (__a, __b, 0); + (uint8x8_t)__builtin_neon_vshrn_nv8hi (__a, __b, 0) #define vshrn_n_u32(__a, __b) \ - (uint16x4_t)__builtin_neon_vshrn_nv4si (__a, __b, 0); + (uint16x4_t)__builtin_neon_vshrn_nv4si (__a, __b, 0) #define vshrn_n_u64(__a, __b) \ - (uint32x2_t)__builtin_neon_vshrn_nv2di (__a, __b, 0); + (uint32x2_t)__builtin_neon_vshrn_nv2di (__a, __b, 0) #define vrshrn_n_s16(__a, __b) \ - (int8x8_t)__builtin_neon_vshrn_nv8hi (__a, __b, 3); + (int8x8_t)__builtin_neon_vshrn_nv8hi (__a, __b, 3) #define vrshrn_n_s32(__a, __b) \ - (int16x4_t)__builtin_neon_vshrn_nv4si (__a, __b, 3); + (int16x4_t)__builtin_neon_vshrn_nv4si (__a, __b, 3) #define vrshrn_n_s64(__a, __b) \ - (int32x2_t)__builtin_neon_vshrn_nv2di (__a, __b, 3); + (int32x2_t)__builtin_neon_vshrn_nv2di (__a, __b, 3) #define vrshrn_n_u16(__a, __b) \ - (uint8x8_t)__builtin_neon_vshrn_nv8hi (__a, __b, 2); + (uint8x8_t)__builtin_neon_vshrn_nv8hi (__a, __b, 2) #define vrshrn_n_u32(__a, __b) \ - (uint16x4_t)__builtin_neon_vshrn_nv4si (__a, __b, 2); + (uint16x4_t)__builtin_neon_vshrn_nv4si (__a, __b, 2) #define vrshrn_n_u64(__a, __b) \ - (uint32x2_t)__builtin_neon_vshrn_nv2di (__a, __b, 2); + (uint32x2_t)__builtin_neon_vshrn_nv2di (__a, __b, 2) #define vqshrn_n_s16(__a, __b) \ - (int8x8_t)__builtin_neon_vqshrn_nv8hi (__a, __b, 1); + (int8x8_t)__builtin_neon_vqshrn_nv8hi (__a, __b, 1) #define vqshrn_n_s32(__a, __b) \ - (int16x4_t)__builtin_neon_vqshrn_nv4si (__a, __b, 1); + (int16x4_t)__builtin_neon_vqshrn_nv4si (__a, __b, 1) #define vqshrn_n_s64(__a, __b) \ - (int32x2_t)__builtin_neon_vqshrn_nv2di (__a, __b, 1); + (int32x2_t)__builtin_neon_vqshrn_nv2di (__a, __b, 1) #define vqshrn_n_u16(__a, __b) \ - (uint8x8_t)__builtin_neon_vqshrn_nv8hi (__a, __b, 0); + (uint8x8_t)__builtin_neon_vqshrn_nv8hi (__a, __b, 0) #define vqshrn_n_u32(__a, __b) \ - (uint16x4_t)__builtin_neon_vqshrn_nv4si (__a, __b, 0); + (uint16x4_t)__builtin_neon_vqshrn_nv4si (__a, __b, 0) #define vqshrn_n_u64(__a, __b) \ - (uint32x2_t)__builtin_neon_vqshrn_nv2di (__a, __b, 0); + (uint32x2_t)__builtin_neon_vqshrn_nv2di (__a, __b, 0) #define vqrshrn_n_s16(__a, __b) \ - (int8x8_t)__builtin_neon_vqshrn_nv8hi (__a, __b, 3); + (int8x8_t)__builtin_neon_vqshrn_nv8hi (__a, __b, 3) #define vqrshrn_n_s32(__a, __b) \ - (int16x4_t)__builtin_neon_vqshrn_nv4si (__a, __b, 3); + (int16x4_t)__builtin_neon_vqshrn_nv4si (__a, __b, 3) #define vqrshrn_n_s64(__a, __b) \ - (int32x2_t)__builtin_neon_vqshrn_nv2di (__a, __b, 3); + (int32x2_t)__builtin_neon_vqshrn_nv2di (__a, __b, 3) #define vqrshrn_n_u16(__a, __b) \ - (uint8x8_t)__builtin_neon_vqshrn_nv8hi (__a, __b, 2); + (uint8x8_t)__builtin_neon_vqshrn_nv8hi (__a, __b, 2) #define vqrshrn_n_u32(__a, __b) \ - (uint16x4_t)__builtin_neon_vqshrn_nv4si (__a, __b, 2); + (uint16x4_t)__builtin_neon_vqshrn_nv4si (__a, __b, 2) #define vqrshrn_n_u64(__a, __b) \ - (uint32x2_t)__builtin_neon_vqshrn_nv2di (__a, __b, 2); + (uint32x2_t)__builtin_neon_vqshrn_nv2di (__a, __b, 2) #define vqshrun_n_s16(__a, __b) \ - (uint8x8_t)__builtin_neon_vqshrun_nv8hi (__a, __b, 1); + (uint8x8_t)__builtin_neon_vqshrun_nv8hi (__a, __b, 1) #define vqshrun_n_s32(__a, __b) \ - (uint16x4_t)__builtin_neon_vqshrun_nv4si (__a, __b, 1); + (uint16x4_t)__builtin_neon_vqshrun_nv4si (__a, __b, 1) #define vqshrun_n_s64(__a, __b) \ - (uint32x2_t)__builtin_neon_vqshrun_nv2di (__a, __b, 1); + (uint32x2_t)__builtin_neon_vqshrun_nv2di (__a, __b, 1) #define vqrshrun_n_s16(__a, __b) \ - (uint8x8_t)__builtin_neon_vqshrun_nv8hi (__a, __b, 3); + (uint8x8_t)__builtin_neon_vqshrun_nv8hi (__a, __b, 3) #define vqrshrun_n_s32(__a, __b) \ - (uint16x4_t)__builtin_neon_vqshrun_nv4si (__a, __b, 3); + (uint16x4_t)__builtin_neon_vqshrun_nv4si (__a, __b, 3) #define vqrshrun_n_s64(__a, __b) \ - (uint32x2_t)__builtin_neon_vqshrun_nv2di (__a, __b, 3); + (uint32x2_t)__builtin_neon_vqshrun_nv2di (__a, __b, 3) #define vshl_n_s8(__a, __b) \ - (int8x8_t)__builtin_neon_vshl_nv8qi (__a, __b, 1); + (int8x8_t)__builtin_neon_vshl_nv8qi (__a, __b, 1) #define vshl_n_s16(__a, __b) \ - (int16x4_t)__builtin_neon_vshl_nv4hi (__a, __b, 1); + (int16x4_t)__builtin_neon_vshl_nv4hi (__a, __b, 1) #define vshl_n_s32(__a, __b) \ - (int32x2_t)__builtin_neon_vshl_nv2si (__a, __b, 1); + (int32x2_t)__builtin_neon_vshl_nv2si (__a, __b, 1) #define vshl_n_s64(__a, __b) \ - (int64x1_t)__builtin_neon_vshl_ndi (__a, __b, 1); + (int64x1_t)__builtin_neon_vshl_ndi (__a, __b, 1) #define vshl_n_u8(__a, __b) \ - (uint8x8_t)__builtin_neon_vshl_nv8qi (__a, __b, 0); + (uint8x8_t)__builtin_neon_vshl_nv8qi (__a, __b, 0) #define vshl_n_u16(__a, __b) \ - (uint16x4_t)__builtin_neon_vshl_nv4hi (__a, __b, 0); + (uint16x4_t)__builtin_neon_vshl_nv4hi (__a, __b, 0) #define vshl_n_u32(__a, __b) \ - (uint32x2_t)__builtin_neon_vshl_nv2si (__a, __b, 0); + (uint32x2_t)__builtin_neon_vshl_nv2si (__a, __b, 0) #define vshl_n_u64(__a, __b) \ - (uint64x1_t)__builtin_neon_vshl_ndi (__a, __b, 0); + (uint64x1_t)__builtin_neon_vshl_ndi (__a, __b, 0) #define vshlq_n_s8(__a, __b) \ - (int8x16_t)__builtin_neon_vshl_nv16qi (__a, __b, 1); + (int8x16_t)__builtin_neon_vshl_nv16qi (__a, __b, 1) #define vshlq_n_s16(__a, __b) \ - (int16x8_t)__builtin_neon_vshl_nv8hi (__a, __b, 1); + (int16x8_t)__builtin_neon_vshl_nv8hi (__a, __b, 1) #define vshlq_n_s32(__a, __b) \ - (int32x4_t)__builtin_neon_vshl_nv4si (__a, __b, 1); + (int32x4_t)__builtin_neon_vshl_nv4si (__a, __b, 1) #define vshlq_n_s64(__a, __b) \ - (int64x2_t)__builtin_neon_vshl_nv2di (__a, __b, 1); + (int64x2_t)__builtin_neon_vshl_nv2di (__a, __b, 1) #define vshlq_n_u8(__a, __b) \ - (uint8x16_t)__builtin_neon_vshl_nv16qi (__a, __b, 0); + (uint8x16_t)__builtin_neon_vshl_nv16qi (__a, __b, 0) #define vshlq_n_u16(__a, __b) \ - (uint16x8_t)__builtin_neon_vshl_nv8hi (__a, __b, 0); + (uint16x8_t)__builtin_neon_vshl_nv8hi (__a, __b, 0) #define vshlq_n_u32(__a, __b) \ - (uint32x4_t)__builtin_neon_vshl_nv4si (__a, __b, 0); + (uint32x4_t)__builtin_neon_vshl_nv4si (__a, __b, 0) #define vshlq_n_u64(__a, __b) \ - (uint64x2_t)__builtin_neon_vshl_nv2di (__a, __b, 0); + (uint64x2_t)__builtin_neon_vshl_nv2di (__a, __b, 0) #define vqshl_n_s8(__a, __b) \ - (int8x8_t)__builtin_neon_vqshl_nv8qi (__a, __b, 1); + (int8x8_t)__builtin_neon_vqshl_nv8qi (__a, __b, 1) #define vqshl_n_s16(__a, __b) \ - (int16x4_t)__builtin_neon_vqshl_nv4hi (__a, __b, 1); + (int16x4_t)__builtin_neon_vqshl_nv4hi (__a, __b, 1) #define vqshl_n_s32(__a, __b) \ - (int32x2_t)__builtin_neon_vqshl_nv2si (__a, __b, 1); + (int32x2_t)__builtin_neon_vqshl_nv2si (__a, __b, 1) #define vqshl_n_s64(__a, __b) \ - (int64x1_t)__builtin_neon_vqshl_ndi (__a, __b, 1); + (int64x1_t)__builtin_neon_vqshl_ndi (__a, __b, 1) #define vqshl_n_u8(__a, __b) \ - (uint8x8_t)__builtin_neon_vqshl_nv8qi (__a, __b, 0); + (uint8x8_t)__builtin_neon_vqshl_nv8qi (__a, __b, 0) #define vqshl_n_u16(__a, __b) \ - (uint16x4_t)__builtin_neon_vqshl_nv4hi (__a, __b, 0); + (uint16x4_t)__builtin_neon_vqshl_nv4hi (__a, __b, 0) #define vqshl_n_u32(__a, __b) \ - (uint32x2_t)__builtin_neon_vqshl_nv2si (__a, __b, 0); + (uint32x2_t)__builtin_neon_vqshl_nv2si (__a, __b, 0) #define vqshl_n_u64(__a, __b) \ - (uint64x1_t)__builtin_neon_vqshl_ndi (__a, __b, 0); + (uint64x1_t)__builtin_neon_vqshl_ndi (__a, __b, 0) #define vqshlq_n_s8(__a, __b) \ - (int8x16_t)__builtin_neon_vqshl_nv16qi (__a, __b, 1); + (int8x16_t)__builtin_neon_vqshl_nv16qi (__a, __b, 1) #define vqshlq_n_s16(__a, __b) \ - (int16x8_t)__builtin_neon_vqshl_nv8hi (__a, __b, 1); + (int16x8_t)__builtin_neon_vqshl_nv8hi (__a, __b, 1) #define vqshlq_n_s32(__a, __b) \ - (int32x4_t)__builtin_neon_vqshl_nv4si (__a, __b, 1); + (int32x4_t)__builtin_neon_vqshl_nv4si (__a, __b, 1) #define vqshlq_n_s64(__a, __b) \ - (int64x2_t)__builtin_neon_vqshl_nv2di (__a, __b, 1); + (int64x2_t)__builtin_neon_vqshl_nv2di (__a, __b, 1) #define vqshlq_n_u8(__a, __b) \ - (uint8x16_t)__builtin_neon_vqshl_nv16qi (__a, __b, 0); + (uint8x16_t)__builtin_neon_vqshl_nv16qi (__a, __b, 0) #define vqshlq_n_u16(__a, __b) \ - (uint16x8_t)__builtin_neon_vqshl_nv8hi (__a, __b, 0); + (uint16x8_t)__builtin_neon_vqshl_nv8hi (__a, __b, 0) #define vqshlq_n_u32(__a, __b) \ - (uint32x4_t)__builtin_neon_vqshl_nv4si (__a, __b, 0); + (uint32x4_t)__builtin_neon_vqshl_nv4si (__a, __b, 0) #define vqshlq_n_u64(__a, __b) \ - (uint64x2_t)__builtin_neon_vqshl_nv2di (__a, __b, 0); + (uint64x2_t)__builtin_neon_vqshl_nv2di (__a, __b, 0) #define vqshlu_n_s8(__a, __b) \ - (uint8x8_t)__builtin_neon_vqshlu_nv8qi (__a, __b, 1); + (uint8x8_t)__builtin_neon_vqshlu_nv8qi (__a, __b, 1) #define vqshlu_n_s16(__a, __b) \ - (uint16x4_t)__builtin_neon_vqshlu_nv4hi (__a, __b, 1); + (uint16x4_t)__builtin_neon_vqshlu_nv4hi (__a, __b, 1) #define vqshlu_n_s32(__a, __b) \ - (uint32x2_t)__builtin_neon_vqshlu_nv2si (__a, __b, 1); + (uint32x2_t)__builtin_neon_vqshlu_nv2si (__a, __b, 1) #define vqshlu_n_s64(__a, __b) \ - (uint64x1_t)__builtin_neon_vqshlu_ndi (__a, __b, 1); + (uint64x1_t)__builtin_neon_vqshlu_ndi (__a, __b, 1) #define vqshluq_n_s8(__a, __b) \ - (uint8x16_t)__builtin_neon_vqshlu_nv16qi (__a, __b, 1); + (uint8x16_t)__builtin_neon_vqshlu_nv16qi (__a, __b, 1) #define vqshluq_n_s16(__a, __b) \ - (uint16x8_t)__builtin_neon_vqshlu_nv8hi (__a, __b, 1); + (uint16x8_t)__builtin_neon_vqshlu_nv8hi (__a, __b, 1) #define vqshluq_n_s32(__a, __b) \ - (uint32x4_t)__builtin_neon_vqshlu_nv4si (__a, __b, 1); + (uint32x4_t)__builtin_neon_vqshlu_nv4si (__a, __b, 1) #define vqshluq_n_s64(__a, __b) \ - (uint64x2_t)__builtin_neon_vqshlu_nv2di (__a, __b, 1); + (uint64x2_t)__builtin_neon_vqshlu_nv2di (__a, __b, 1) #define vshll_n_s8(__a, __b) \ - (int16x8_t)__builtin_neon_vshll_nv8qi (__a, __b, 1); + (int16x8_t)__builtin_neon_vshll_nv8qi (__a, __b, 1) #define vshll_n_s16(__a, __b) \ - (int32x4_t)__builtin_neon_vshll_nv4hi (__a, __b, 1); + (int32x4_t)__builtin_neon_vshll_nv4hi (__a, __b, 1) #define vshll_n_s32(__a, __b) \ - (int64x2_t)__builtin_neon_vshll_nv2si (__a, __b, 1); + (int64x2_t)__builtin_neon_vshll_nv2si (__a, __b, 1) #define vshll_n_u8(__a, __b) \ - (uint16x8_t)__builtin_neon_vshll_nv8qi (__a, __b, 0); + (uint16x8_t)__builtin_neon_vshll_nv8qi (__a, __b, 0) #define vshll_n_u16(__a, __b) \ - (uint32x4_t)__builtin_neon_vshll_nv4hi (__a, __b, 0); + (uint32x4_t)__builtin_neon_vshll_nv4hi (__a, __b, 0) #define vshll_n_u32(__a, __b) \ - (uint64x2_t)__builtin_neon_vshll_nv2si (__a, __b, 0); + (uint64x2_t)__builtin_neon_vshll_nv2si (__a, __b, 0) #define vsra_n_s8(__a, __b, __c) \ - (int8x8_t)__builtin_neon_vsra_nv8qi (__a, __b, __c, 1); + (int8x8_t)__builtin_neon_vsra_nv8qi (__a, __b, __c, 1) #define vsra_n_s16(__a, __b, __c) \ - (int16x4_t)__builtin_neon_vsra_nv4hi (__a, __b, __c, 1); + (int16x4_t)__builtin_neon_vsra_nv4hi (__a, __b, __c, 1) #define vsra_n_s32(__a, __b, __c) \ - (int32x2_t)__builtin_neon_vsra_nv2si (__a, __b, __c, 1); + (int32x2_t)__builtin_neon_vsra_nv2si (__a, __b, __c, 1) #define vsra_n_s64(__a, __b, __c) \ - (int64x1_t)__builtin_neon_vsra_ndi (__a, __b, __c, 1); + (int64x1_t)__builtin_neon_vsra_ndi (__a, __b, __c, 1) #define vsra_n_u8(__a, __b, __c) \ - (uint8x8_t)__builtin_neon_vsra_nv8qi (__a, __b, __c, 0); + (uint8x8_t)__builtin_neon_vsra_nv8qi (__a, __b, __c, 0) #define vsra_n_u16(__a, __b, __c) \ - (uint16x4_t)__builtin_neon_vsra_nv4hi (__a, __b, __c, 0); + (uint16x4_t)__builtin_neon_vsra_nv4hi (__a, __b, __c, 0) #define vsra_n_u32(__a, __b, __c) \ - (uint32x2_t)__builtin_neon_vsra_nv2si (__a, __b, __c, 0); + (uint32x2_t)__builtin_neon_vsra_nv2si (__a, __b, __c, 0) #define vsra_n_u64(__a, __b, __c) \ - (uint64x1_t)__builtin_neon_vsra_ndi (__a, __b, __c, 0); + (uint64x1_t)__builtin_neon_vsra_ndi (__a, __b, __c, 0) #define vsraq_n_s8(__a, __b, __c) \ - (int8x16_t)__builtin_neon_vsra_nv16qi (__a, __b, __c, 1); + (int8x16_t)__builtin_neon_vsra_nv16qi (__a, __b, __c, 1) #define vsraq_n_s16(__a, __b, __c) \ - (int16x8_t)__builtin_neon_vsra_nv8hi (__a, __b, __c, 1); + (int16x8_t)__builtin_neon_vsra_nv8hi (__a, __b, __c, 1) #define vsraq_n_s32(__a, __b, __c) \ - (int32x4_t)__builtin_neon_vsra_nv4si (__a, __b, __c, 1); + (int32x4_t)__builtin_neon_vsra_nv4si (__a, __b, __c, 1) #define vsraq_n_s64(__a, __b, __c) \ - (int64x2_t)__builtin_neon_vsra_nv2di (__a, __b, __c, 1); + (int64x2_t)__builtin_neon_vsra_nv2di (__a, __b, __c, 1) #define vsraq_n_u8(__a, __b, __c) \ - (uint8x16_t)__builtin_neon_vsra_nv16qi (__a, __b, __c, 0); + (uint8x16_t)__builtin_neon_vsra_nv16qi (__a, __b, __c, 0) #define vsraq_n_u16(__a, __b, __c) \ - (uint16x8_t)__builtin_neon_vsra_nv8hi (__a, __b, __c, 0); + (uint16x8_t)__builtin_neon_vsra_nv8hi (__a, __b, __c, 0) #define vsraq_n_u32(__a, __b, __c) \ - (uint32x4_t)__builtin_neon_vsra_nv4si (__a, __b, __c, 0); + (uint32x4_t)__builtin_neon_vsra_nv4si (__a, __b, __c, 0) #define vsraq_n_u64(__a, __b, __c) \ - (uint64x2_t)__builtin_neon_vsra_nv2di (__a, __b, __c, 0); + (uint64x2_t)__builtin_neon_vsra_nv2di (__a, __b, __c, 0) #define vrsra_n_s8(__a, __b, __c) \ - (int8x8_t)__builtin_neon_vsra_nv8qi (__a, __b, __c, 3); + (int8x8_t)__builtin_neon_vsra_nv8qi (__a, __b, __c, 3) #define vrsra_n_s16(__a, __b, __c) \ - (int16x4_t)__builtin_neon_vsra_nv4hi (__a, __b, __c, 3); + (int16x4_t)__builtin_neon_vsra_nv4hi (__a, __b, __c, 3) #define vrsra_n_s32(__a, __b, __c) \ - (int32x2_t)__builtin_neon_vsra_nv2si (__a, __b, __c, 3); + (int32x2_t)__builtin_neon_vsra_nv2si (__a, __b, __c, 3) #define vrsra_n_s64(__a, __b, __c) \ - (int64x1_t)__builtin_neon_vsra_ndi (__a, __b, __c, 3); + (int64x1_t)__builtin_neon_vsra_ndi (__a, __b, __c, 3) #define vrsra_n_u8(__a, __b, __c) \ - (uint8x8_t)__builtin_neon_vsra_nv8qi (__a, __b, __c, 2); + (uint8x8_t)__builtin_neon_vsra_nv8qi (__a, __b, __c, 2) #define vrsra_n_u16(__a, __b, __c) \ - (uint16x4_t)__builtin_neon_vsra_nv4hi (__a, __b, __c, 2); + (uint16x4_t)__builtin_neon_vsra_nv4hi (__a, __b, __c, 2) #define vrsra_n_u32(__a, __b, __c) \ - (uint32x2_t)__builtin_neon_vsra_nv2si (__a, __b, __c, 2); + (uint32x2_t)__builtin_neon_vsra_nv2si (__a, __b, __c, 2) #define vrsra_n_u64(__a, __b, __c) \ - (uint64x1_t)__builtin_neon_vsra_ndi (__a, __b, __c, 2); + (uint64x1_t)__builtin_neon_vsra_ndi (__a, __b, __c, 2) #define vrsraq_n_s8(__a, __b, __c) \ - (int8x16_t)__builtin_neon_vsra_nv16qi (__a, __b, __c, 3); + (int8x16_t)__builtin_neon_vsra_nv16qi (__a, __b, __c, 3) #define vrsraq_n_s16(__a, __b, __c) \ - (int16x8_t)__builtin_neon_vsra_nv8hi (__a, __b, __c, 3); + (int16x8_t)__builtin_neon_vsra_nv8hi (__a, __b, __c, 3) #define vrsraq_n_s32(__a, __b, __c) \ - (int32x4_t)__builtin_neon_vsra_nv4si (__a, __b, __c, 3); + (int32x4_t)__builtin_neon_vsra_nv4si (__a, __b, __c, 3) #define vrsraq_n_s64(__a, __b, __c) \ - (int64x2_t)__builtin_neon_vsra_nv2di (__a, __b, __c, 3); + (int64x2_t)__builtin_neon_vsra_nv2di (__a, __b, __c, 3) #define vrsraq_n_u8(__a, __b, __c) \ - (uint8x16_t)__builtin_neon_vsra_nv16qi (__a, __b, __c, 2); + (uint8x16_t)__builtin_neon_vsra_nv16qi (__a, __b, __c, 2) #define vrsraq_n_u16(__a, __b, __c) \ - (uint16x8_t)__builtin_neon_vsra_nv8hi (__a, __b, __c, 2); + (uint16x8_t)__builtin_neon_vsra_nv8hi (__a, __b, __c, 2) #define vrsraq_n_u32(__a, __b, __c) \ - (uint32x4_t)__builtin_neon_vsra_nv4si (__a, __b, __c, 2); + (uint32x4_t)__builtin_neon_vsra_nv4si (__a, __b, __c, 2) #define vrsraq_n_u64(__a, __b, __c) \ - (uint64x2_t)__builtin_neon_vsra_nv2di (__a, __b, __c, 2); + (uint64x2_t)__builtin_neon_vsra_nv2di (__a, __b, __c, 2) #define vsri_n_s8(__a, __b, __c) \ - (int8x8_t)__builtin_neon_vsri_nv8qi (__a, __b, __c); + (int8x8_t)__builtin_neon_vsri_nv8qi (__a, __b, __c) #define vsri_n_s16(__a, __b, __c) \ - (int16x4_t)__builtin_neon_vsri_nv4hi (__a, __b, __c); + (int16x4_t)__builtin_neon_vsri_nv4hi (__a, __b, __c) #define vsri_n_s32(__a, __b, __c) \ - (int32x2_t)__builtin_neon_vsri_nv2si (__a, __b, __c); + (int32x2_t)__builtin_neon_vsri_nv2si (__a, __b, __c) #define vsri_n_s64(__a, __b, __c) \ - (int64x1_t)__builtin_neon_vsri_ndi (__a, __b, __c); + (int64x1_t)__builtin_neon_vsri_ndi (__a, __b, __c) #define vsri_n_u8(__a, __b, __c) \ - (uint8x8_t)__builtin_neon_vsri_nv8qi (__a, __b, __c); + (uint8x8_t)__builtin_neon_vsri_nv8qi (__a, __b, __c) #define vsri_n_u16(__a, __b, __c) \ - (uint16x4_t)__builtin_neon_vsri_nv4hi (__a, __b, __c); + (uint16x4_t)__builtin_neon_vsri_nv4hi (__a, __b, __c) #define vsri_n_u32(__a, __b, __c) \ - (uint32x2_t)__builtin_neon_vsri_nv2si (__a, __b, __c); + (uint32x2_t)__builtin_neon_vsri_nv2si (__a, __b, __c) #define vsri_n_u64(__a, __b, __c) \ - (uint64x1_t)__builtin_neon_vsri_ndi (__a, __b, __c); + (uint64x1_t)__builtin_neon_vsri_ndi (__a, __b, __c) #define vsri_n_p8(__a, __b, __c) \ - (poly8x8_t)__builtin_neon_vsri_nv8qi (__a, __b, __c); + (poly8x8_t)__builtin_neon_vsri_nv8qi (__a, __b, __c) #define vsri_n_p16(__a, __b, __c) \ - (poly16x4_t)__builtin_neon_vsri_nv4hi (__a, __b, __c); + (poly16x4_t)__builtin_neon_vsri_nv4hi (__a, __b, __c) #define vsriq_n_s8(__a, __b, __c) \ - (int8x16_t)__builtin_neon_vsri_nv16qi (__a, __b, __c); + (int8x16_t)__builtin_neon_vsri_nv16qi (__a, __b, __c) #define vsriq_n_s16(__a, __b, __c) \ - (int16x8_t)__builtin_neon_vsri_nv8hi (__a, __b, __c); + (int16x8_t)__builtin_neon_vsri_nv8hi (__a, __b, __c) #define vsriq_n_s32(__a, __b, __c) \ - (int32x4_t)__builtin_neon_vsri_nv4si (__a, __b, __c); + (int32x4_t)__builtin_neon_vsri_nv4si (__a, __b, __c) #define vsriq_n_s64(__a, __b, __c) \ - (int64x2_t)__builtin_neon_vsri_nv2di (__a, __b, __c); + (int64x2_t)__builtin_neon_vsri_nv2di (__a, __b, __c) #define vsriq_n_u8(__a, __b, __c) \ - (uint8x16_t)__builtin_neon_vsri_nv16qi (__a, __b, __c); + (uint8x16_t)__builtin_neon_vsri_nv16qi (__a, __b, __c) #define vsriq_n_u16(__a, __b, __c) \ - (uint16x8_t)__builtin_neon_vsri_nv8hi (__a, __b, __c); + (uint16x8_t)__builtin_neon_vsri_nv8hi (__a, __b, __c) #define vsriq_n_u32(__a, __b, __c) \ - (uint32x4_t)__builtin_neon_vsri_nv4si (__a, __b, __c); + (uint32x4_t)__builtin_neon_vsri_nv4si (__a, __b, __c) #define vsriq_n_u64(__a, __b, __c) \ - (uint64x2_t)__builtin_neon_vsri_nv2di (__a, __b, __c); + (uint64x2_t)__builtin_neon_vsri_nv2di (__a, __b, __c) #define vsriq_n_p8(__a, __b, __c) \ - (poly8x16_t)__builtin_neon_vsri_nv16qi (__a, __b, __c); + (poly8x16_t)__builtin_neon_vsri_nv16qi (__a, __b, __c) #define vsriq_n_p16(__a, __b, __c) \ - (poly16x8_t)__builtin_neon_vsri_nv8hi (__a, __b, __c); + (poly16x8_t)__builtin_neon_vsri_nv8hi (__a, __b, __c) #define vsli_n_s8(__a, __b, __c) \ - (int8x8_t)__builtin_neon_vsli_nv8qi (__a, __b, __c); + (int8x8_t)__builtin_neon_vsli_nv8qi (__a, __b, __c) #define vsli_n_s16(__a, __b, __c) \ - (int16x4_t)__builtin_neon_vsli_nv4hi (__a, __b, __c); + (int16x4_t)__builtin_neon_vsli_nv4hi (__a, __b, __c) #define vsli_n_s32(__a, __b, __c) \ - (int32x2_t)__builtin_neon_vsli_nv2si (__a, __b, __c); + (int32x2_t)__builtin_neon_vsli_nv2si (__a, __b, __c) #define vsli_n_s64(__a, __b, __c) \ - (int64x1_t)__builtin_neon_vsli_ndi (__a, __b, __c); + (int64x1_t)__builtin_neon_vsli_ndi (__a, __b, __c) #define vsli_n_u8(__a, __b, __c) \ - (uint8x8_t)__builtin_neon_vsli_nv8qi (__a, __b, __c); + (uint8x8_t)__builtin_neon_vsli_nv8qi (__a, __b, __c) #define vsli_n_u16(__a, __b, __c) \ - (uint16x4_t)__builtin_neon_vsli_nv4hi (__a, __b, __c); + (uint16x4_t)__builtin_neon_vsli_nv4hi (__a, __b, __c) #define vsli_n_u32(__a, __b, __c) \ - (uint32x2_t)__builtin_neon_vsli_nv2si (__a, __b, __c); + (uint32x2_t)__builtin_neon_vsli_nv2si (__a, __b, __c) #define vsli_n_u64(__a, __b, __c) \ - (uint64x1_t)__builtin_neon_vsli_ndi (__a, __b, __c); + (uint64x1_t)__builtin_neon_vsli_ndi (__a, __b, __c) #define vsli_n_p8(__a, __b, __c) \ - (poly8x8_t)__builtin_neon_vsli_nv8qi (__a, __b, __c); + (poly8x8_t)__builtin_neon_vsli_nv8qi (__a, __b, __c) #define vsli_n_p16(__a, __b, __c) \ - (poly16x4_t)__builtin_neon_vsli_nv4hi (__a, __b, __c); + (poly16x4_t)__builtin_neon_vsli_nv4hi (__a, __b, __c) #define vsliq_n_s8(__a, __b, __c) \ - (int8x16_t)__builtin_neon_vsli_nv16qi (__a, __b, __c); + (int8x16_t)__builtin_neon_vsli_nv16qi (__a, __b, __c) #define vsliq_n_s16(__a, __b, __c) \ - (int16x8_t)__builtin_neon_vsli_nv8hi (__a, __b, __c); + (int16x8_t)__builtin_neon_vsli_nv8hi (__a, __b, __c) #define vsliq_n_s32(__a, __b, __c) \ - (int32x4_t)__builtin_neon_vsli_nv4si (__a, __b, __c); + (int32x4_t)__builtin_neon_vsli_nv4si (__a, __b, __c) #define vsliq_n_s64(__a, __b, __c) \ - (int64x2_t)__builtin_neon_vsli_nv2di (__a, __b, __c); + (int64x2_t)__builtin_neon_vsli_nv2di (__a, __b, __c) #define vsliq_n_u8(__a, __b, __c) \ - (uint8x16_t)__builtin_neon_vsli_nv16qi (__a, __b, __c); + (uint8x16_t)__builtin_neon_vsli_nv16qi (__a, __b, __c) #define vsliq_n_u16(__a, __b, __c) \ - (uint16x8_t)__builtin_neon_vsli_nv8hi (__a, __b, __c); + (uint16x8_t)__builtin_neon_vsli_nv8hi (__a, __b, __c) #define vsliq_n_u32(__a, __b, __c) \ - (uint32x4_t)__builtin_neon_vsli_nv4si (__a, __b, __c); + (uint32x4_t)__builtin_neon_vsli_nv4si (__a, __b, __c) #define vsliq_n_u64(__a, __b, __c) \ - (uint64x2_t)__builtin_neon_vsli_nv2di (__a, __b, __c); + (uint64x2_t)__builtin_neon_vsli_nv2di (__a, __b, __c) #define vsliq_n_p8(__a, __b, __c) \ - (poly8x16_t)__builtin_neon_vsli_nv16qi (__a, __b, __c); + (poly8x16_t)__builtin_neon_vsli_nv16qi (__a, __b, __c) #define vsliq_n_p16(__a, __b, __c) \ - (poly16x8_t)__builtin_neon_vsli_nv8hi (__a, __b, __c); + (poly16x8_t)__builtin_neon_vsli_nv8hi (__a, __b, __c) #define vabs_s8(__a) \ - (int8x8_t)__builtin_neon_vabsv8qi (__a, 1); + (int8x8_t)__builtin_neon_vabsv8qi (__a, 1) #define vabs_s16(__a) \ - (int16x4_t)__builtin_neon_vabsv4hi (__a, 1); + (int16x4_t)__builtin_neon_vabsv4hi (__a, 1) #define vabs_s32(__a) \ - (int32x2_t)__builtin_neon_vabsv2si (__a, 1); + (int32x2_t)__builtin_neon_vabsv2si (__a, 1) #define vabs_f32(__a) \ - (float32x2_t)__builtin_neon_vabsv2sf (__a, 5); + (float32x2_t)__builtin_neon_vabsv2sf (__a, 5) #define vabsq_s8(__a) \ - (int8x16_t)__builtin_neon_vabsv16qi (__a, 1); + (int8x16_t)__builtin_neon_vabsv16qi (__a, 1) #define vabsq_s16(__a) \ - (int16x8_t)__builtin_neon_vabsv8hi (__a, 1); + (int16x8_t)__builtin_neon_vabsv8hi (__a, 1) #define vabsq_s32(__a) \ - (int32x4_t)__builtin_neon_vabsv4si (__a, 1); + (int32x4_t)__builtin_neon_vabsv4si (__a, 1) #define vabsq_f32(__a) \ - (float32x4_t)__builtin_neon_vabsv4sf (__a, 5); + (float32x4_t)__builtin_neon_vabsv4sf (__a, 5) #define vqabs_s8(__a) \ - (int8x8_t)__builtin_neon_vqabsv8qi (__a, 1); + (int8x8_t)__builtin_neon_vqabsv8qi (__a, 1) #define vqabs_s16(__a) \ - (int16x4_t)__builtin_neon_vqabsv4hi (__a, 1); + (int16x4_t)__builtin_neon_vqabsv4hi (__a, 1) #define vqabs_s32(__a) \ - (int32x2_t)__builtin_neon_vqabsv2si (__a, 1); + (int32x2_t)__builtin_neon_vqabsv2si (__a, 1) #define vqabsq_s8(__a) \ - (int8x16_t)__builtin_neon_vqabsv16qi (__a, 1); + (int8x16_t)__builtin_neon_vqabsv16qi (__a, 1) #define vqabsq_s16(__a) \ - (int16x8_t)__builtin_neon_vqabsv8hi (__a, 1); + (int16x8_t)__builtin_neon_vqabsv8hi (__a, 1) #define vqabsq_s32(__a) \ - (int32x4_t)__builtin_neon_vqabsv4si (__a, 1); + (int32x4_t)__builtin_neon_vqabsv4si (__a, 1) #define vneg_s8(__a) \ - (int8x8_t)__builtin_neon_vnegv8qi (__a, 1); + (int8x8_t)__builtin_neon_vnegv8qi (__a, 1) #define vneg_s16(__a) \ - (int16x4_t)__builtin_neon_vnegv4hi (__a, 1); + (int16x4_t)__builtin_neon_vnegv4hi (__a, 1) #define vneg_s32(__a) \ - (int32x2_t)__builtin_neon_vnegv2si (__a, 1); + (int32x2_t)__builtin_neon_vnegv2si (__a, 1) #define vneg_f32(__a) \ - (float32x2_t)__builtin_neon_vnegv2sf (__a, 5); + (float32x2_t)__builtin_neon_vnegv2sf (__a, 5) #define vnegq_s8(__a) \ - (int8x16_t)__builtin_neon_vnegv16qi (__a, 1); + (int8x16_t)__builtin_neon_vnegv16qi (__a, 1) #define vnegq_s16(__a) \ - (int16x8_t)__builtin_neon_vnegv8hi (__a, 1); + (int16x8_t)__builtin_neon_vnegv8hi (__a, 1) #define vnegq_s32(__a) \ - (int32x4_t)__builtin_neon_vnegv4si (__a, 1); + (int32x4_t)__builtin_neon_vnegv4si (__a, 1) #define vnegq_f32(__a) \ - (float32x4_t)__builtin_neon_vnegv4sf (__a, 5); + (float32x4_t)__builtin_neon_vnegv4sf (__a, 5) #define vqneg_s8(__a) \ - (int8x8_t)__builtin_neon_vqnegv8qi (__a, 1); + (int8x8_t)__builtin_neon_vqnegv8qi (__a, 1) #define vqneg_s16(__a) \ - (int16x4_t)__builtin_neon_vqnegv4hi (__a, 1); + (int16x4_t)__builtin_neon_vqnegv4hi (__a, 1) #define vqneg_s32(__a) \ - (int32x2_t)__builtin_neon_vqnegv2si (__a, 1); + (int32x2_t)__builtin_neon_vqnegv2si (__a, 1) #define vqnegq_s8(__a) \ - (int8x16_t)__builtin_neon_vqnegv16qi (__a, 1); + (int8x16_t)__builtin_neon_vqnegv16qi (__a, 1) #define vqnegq_s16(__a) \ - (int16x8_t)__builtin_neon_vqnegv8hi (__a, 1); + (int16x8_t)__builtin_neon_vqnegv8hi (__a, 1) #define vqnegq_s32(__a) \ - (int32x4_t)__builtin_neon_vqnegv4si (__a, 1); + (int32x4_t)__builtin_neon_vqnegv4si (__a, 1) #define vmvn_s8(__a) \ - (int8x8_t)__builtin_neon_vmvnv8qi (__a, 1); + (int8x8_t)__builtin_neon_vmvnv8qi (__a, 1) #define vmvn_s16(__a) \ - (int16x4_t)__builtin_neon_vmvnv4hi (__a, 1); + (int16x4_t)__builtin_neon_vmvnv4hi (__a, 1) #define vmvn_s32(__a) \ - (int32x2_t)__builtin_neon_vmvnv2si (__a, 1); + (int32x2_t)__builtin_neon_vmvnv2si (__a, 1) #define vmvn_u8(__a) \ - (uint8x8_t)__builtin_neon_vmvnv8qi (__a, 0); + (uint8x8_t)__builtin_neon_vmvnv8qi (__a, 0) #define vmvn_u16(__a) \ - (uint16x4_t)__builtin_neon_vmvnv4hi (__a, 0); + (uint16x4_t)__builtin_neon_vmvnv4hi (__a, 0) #define vmvn_u32(__a) \ - (uint32x2_t)__builtin_neon_vmvnv2si (__a, 0); + (uint32x2_t)__builtin_neon_vmvnv2si (__a, 0) #define vmvn_p8(__a) \ - (poly8x8_t)__builtin_neon_vmvnv8qi (__a, 4); + (poly8x8_t)__builtin_neon_vmvnv8qi (__a, 4) #define vmvnq_s8(__a) \ - (int8x16_t)__builtin_neon_vmvnv16qi (__a, 1); + (int8x16_t)__builtin_neon_vmvnv16qi (__a, 1) #define vmvnq_s16(__a) \ - (int16x8_t)__builtin_neon_vmvnv8hi (__a, 1); + (int16x8_t)__builtin_neon_vmvnv8hi (__a, 1) #define vmvnq_s32(__a) \ - (int32x4_t)__builtin_neon_vmvnv4si (__a, 1); + (int32x4_t)__builtin_neon_vmvnv4si (__a, 1) #define vmvnq_u8(__a) \ - (uint8x16_t)__builtin_neon_vmvnv16qi (__a, 0); + (uint8x16_t)__builtin_neon_vmvnv16qi (__a, 0) #define vmvnq_u16(__a) \ - (uint16x8_t)__builtin_neon_vmvnv8hi (__a, 0); + (uint16x8_t)__builtin_neon_vmvnv8hi (__a, 0) #define vmvnq_u32(__a) \ - (uint32x4_t)__builtin_neon_vmvnv4si (__a, 0); + (uint32x4_t)__builtin_neon_vmvnv4si (__a, 0) #define vmvnq_p8(__a) \ - (poly8x16_t)__builtin_neon_vmvnv16qi (__a, 4); + (poly8x16_t)__builtin_neon_vmvnv16qi (__a, 4) #define vcls_s8(__a) \ - (int8x8_t)__builtin_neon_vclsv8qi (__a, 1); + (int8x8_t)__builtin_neon_vclsv8qi (__a, 1) #define vcls_s16(__a) \ - (int16x4_t)__builtin_neon_vclsv4hi (__a, 1); + (int16x4_t)__builtin_neon_vclsv4hi (__a, 1) #define vcls_s32(__a) \ - (int32x2_t)__builtin_neon_vclsv2si (__a, 1); + (int32x2_t)__builtin_neon_vclsv2si (__a, 1) #define vclsq_s8(__a) \ - (int8x16_t)__builtin_neon_vclsv16qi (__a, 1); + (int8x16_t)__builtin_neon_vclsv16qi (__a, 1) #define vclsq_s16(__a) \ - (int16x8_t)__builtin_neon_vclsv8hi (__a, 1); + (int16x8_t)__builtin_neon_vclsv8hi (__a, 1) #define vclsq_s32(__a) \ - (int32x4_t)__builtin_neon_vclsv4si (__a, 1); + (int32x4_t)__builtin_neon_vclsv4si (__a, 1) #define vclz_s8(__a) \ - (int8x8_t)__builtin_neon_vclzv8qi (__a, 1); + (int8x8_t)__builtin_neon_vclzv8qi (__a, 1) #define vclz_s16(__a) \ - (int16x4_t)__builtin_neon_vclzv4hi (__a, 1); + (int16x4_t)__builtin_neon_vclzv4hi (__a, 1) #define vclz_s32(__a) \ - (int32x2_t)__builtin_neon_vclzv2si (__a, 1); + (int32x2_t)__builtin_neon_vclzv2si (__a, 1) #define vclz_u8(__a) \ - (uint8x8_t)__builtin_neon_vclzv8qi (__a, 0); + (uint8x8_t)__builtin_neon_vclzv8qi (__a, 0) #define vclz_u16(__a) \ - (uint16x4_t)__builtin_neon_vclzv4hi (__a, 0); + (uint16x4_t)__builtin_neon_vclzv4hi (__a, 0) #define vclz_u32(__a) \ - (uint32x2_t)__builtin_neon_vclzv2si (__a, 0); + (uint32x2_t)__builtin_neon_vclzv2si (__a, 0) #define vclzq_s8(__a) \ - (int8x16_t)__builtin_neon_vclzv16qi (__a, 1); + (int8x16_t)__builtin_neon_vclzv16qi (__a, 1) #define vclzq_s16(__a) \ - (int16x8_t)__builtin_neon_vclzv8hi (__a, 1); + (int16x8_t)__builtin_neon_vclzv8hi (__a, 1) #define vclzq_s32(__a) \ - (int32x4_t)__builtin_neon_vclzv4si (__a, 1); + (int32x4_t)__builtin_neon_vclzv4si (__a, 1) #define vclzq_u8(__a) \ - (uint8x16_t)__builtin_neon_vclzv16qi (__a, 0); + (uint8x16_t)__builtin_neon_vclzv16qi (__a, 0) #define vclzq_u16(__a) \ - (uint16x8_t)__builtin_neon_vclzv8hi (__a, 0); + (uint16x8_t)__builtin_neon_vclzv8hi (__a, 0) #define vclzq_u32(__a) \ - (uint32x4_t)__builtin_neon_vclzv4si (__a, 0); + (uint32x4_t)__builtin_neon_vclzv4si (__a, 0) #define vcnt_s8(__a) \ - (int8x8_t)__builtin_neon_vcntv8qi (__a, 1); + (int8x8_t)__builtin_neon_vcntv8qi (__a, 1) #define vcnt_u8(__a) \ - (uint8x8_t)__builtin_neon_vcntv8qi (__a, 0); + (uint8x8_t)__builtin_neon_vcntv8qi (__a, 0) #define vcnt_p8(__a) \ - (poly8x8_t)__builtin_neon_vcntv8qi (__a, 4); + (poly8x8_t)__builtin_neon_vcntv8qi (__a, 4) #define vcntq_s8(__a) \ - (int8x16_t)__builtin_neon_vcntv16qi (__a, 1); + (int8x16_t)__builtin_neon_vcntv16qi (__a, 1) #define vcntq_u8(__a) \ - (uint8x16_t)__builtin_neon_vcntv16qi (__a, 0); + (uint8x16_t)__builtin_neon_vcntv16qi (__a, 0) #define vcntq_p8(__a) \ - (poly8x16_t)__builtin_neon_vcntv16qi (__a, 4); + (poly8x16_t)__builtin_neon_vcntv16qi (__a, 4) #define vrecpe_f32(__a) \ - (float32x2_t)__builtin_neon_vrecpev2sf (__a, 5); + (float32x2_t)__builtin_neon_vrecpev2sf (__a, 5) #define vrecpe_u32(__a) \ - (uint32x2_t)__builtin_neon_vrecpev2si (__a, 0); + (uint32x2_t)__builtin_neon_vrecpev2si (__a, 0) #define vrecpeq_f32(__a) \ - (float32x4_t)__builtin_neon_vrecpev4sf (__a, 5); + (float32x4_t)__builtin_neon_vrecpev4sf (__a, 5) #define vrecpeq_u32(__a) \ - (uint32x4_t)__builtin_neon_vrecpev4si (__a, 0); + (uint32x4_t)__builtin_neon_vrecpev4si (__a, 0) #define vrsqrte_f32(__a) \ - (float32x2_t)__builtin_neon_vrsqrtev2sf (__a, 5); + (float32x2_t)__builtin_neon_vrsqrtev2sf (__a, 5) #define vrsqrte_u32(__a) \ - (uint32x2_t)__builtin_neon_vrsqrtev2si (__a, 0); + (uint32x2_t)__builtin_neon_vrsqrtev2si (__a, 0) #define vrsqrteq_f32(__a) \ - (float32x4_t)__builtin_neon_vrsqrtev4sf (__a, 5); + (float32x4_t)__builtin_neon_vrsqrtev4sf (__a, 5) #define vrsqrteq_u32(__a) \ - (uint32x4_t)__builtin_neon_vrsqrtev4si (__a, 0); + (uint32x4_t)__builtin_neon_vrsqrtev4si (__a, 0) #define vget_lane_s8(__a, __b) \ - (int8_t)__builtin_neon_vget_lanev8qi (__a, __b, 1); + (int8_t)__builtin_neon_vget_lanev8qi (__a, __b, 1) #define vget_lane_s16(__a, __b) \ - (int16_t)__builtin_neon_vget_lanev4hi (__a, __b, 1); + (int16_t)__builtin_neon_vget_lanev4hi (__a, __b, 1) #define vget_lane_s32(__a, __b) \ - (int32_t)__builtin_neon_vget_lanev2si (__a, __b, 1); + (int32_t)__builtin_neon_vget_lanev2si (__a, __b, 1) #define vget_lane_f32(__a, __b) \ - (float32_t)__builtin_neon_vget_lanev2sf (__a, __b, 5); + (float32_t)__builtin_neon_vget_lanev2sf (__a, __b, 5) #define vget_lane_u8(__a, __b) \ - (uint8_t)__builtin_neon_vget_lanev8qi (__a, __b, 0); + (uint8_t)__builtin_neon_vget_lanev8qi (__a, __b, 0) #define vget_lane_u16(__a, __b) \ - (uint16_t)__builtin_neon_vget_lanev4hi (__a, __b, 0); + (uint16_t)__builtin_neon_vget_lanev4hi (__a, __b, 0) #define vget_lane_u32(__a, __b) \ - (uint32_t)__builtin_neon_vget_lanev2si (__a, __b, 0); + (uint32_t)__builtin_neon_vget_lanev2si (__a, __b, 0) #define vget_lane_p8(__a, __b) \ - (poly8_t)__builtin_neon_vget_lanev8qi (__a, __b, 4); + (poly8_t)__builtin_neon_vget_lanev8qi (__a, __b, 4) #define vget_lane_p16(__a, __b) \ - (poly16_t)__builtin_neon_vget_lanev4hi (__a, __b, 4); + (poly16_t)__builtin_neon_vget_lanev4hi (__a, __b, 4) #define vget_lane_s64(__a, __b) \ - (int64_t)__builtin_neon_vget_lanedi (__a, __b, 1); + (int64_t)__builtin_neon_vget_lanedi (__a, __b, 1) #define vget_lane_u64(__a, __b) \ - (uint64_t)__builtin_neon_vget_lanedi (__a, __b, 0); + (uint64_t)__builtin_neon_vget_lanedi (__a, __b, 0) #define vgetq_lane_s8(__a, __b) \ - (int8_t)__builtin_neon_vget_lanev16qi (__a, __b, 1); + (int8_t)__builtin_neon_vget_lanev16qi (__a, __b, 1) #define vgetq_lane_s16(__a, __b) \ - (int16_t)__builtin_neon_vget_lanev8hi (__a, __b, 1); + (int16_t)__builtin_neon_vget_lanev8hi (__a, __b, 1) #define vgetq_lane_s32(__a, __b) \ - (int32_t)__builtin_neon_vget_lanev4si (__a, __b, 1); + (int32_t)__builtin_neon_vget_lanev4si (__a, __b, 1) #define vgetq_lane_f32(__a, __b) \ - (float32_t)__builtin_neon_vget_lanev4sf (__a, __b, 5); + (float32_t)__builtin_neon_vget_lanev4sf (__a, __b, 5) #define vgetq_lane_u8(__a, __b) \ - (uint8_t)__builtin_neon_vget_lanev16qi (__a, __b, 0); + (uint8_t)__builtin_neon_vget_lanev16qi (__a, __b, 0) #define vgetq_lane_u16(__a, __b) \ - (uint16_t)__builtin_neon_vget_lanev8hi (__a, __b, 0); + (uint16_t)__builtin_neon_vget_lanev8hi (__a, __b, 0) #define vgetq_lane_u32(__a, __b) \ - (uint32_t)__builtin_neon_vget_lanev4si (__a, __b, 0); + (uint32_t)__builtin_neon_vget_lanev4si (__a, __b, 0) #define vgetq_lane_p8(__a, __b) \ - (poly8_t)__builtin_neon_vget_lanev16qi (__a, __b, 4); + (poly8_t)__builtin_neon_vget_lanev16qi (__a, __b, 4) #define vgetq_lane_p16(__a, __b) \ - (poly16_t)__builtin_neon_vget_lanev8hi (__a, __b, 4); + (poly16_t)__builtin_neon_vget_lanev8hi (__a, __b, 4) #define vgetq_lane_s64(__a, __b) \ - (int64_t)__builtin_neon_vget_lanev2di (__a, __b, 1); + (int64_t)__builtin_neon_vget_lanev2di (__a, __b, 1) #define vgetq_lane_u64(__a, __b) \ - (uint64_t)__builtin_neon_vget_lanev2di (__a, __b, 0); + (uint64_t)__builtin_neon_vget_lanev2di (__a, __b, 0) #define vset_lane_s8(__a, __b, __c) \ - (int8x8_t)__builtin_neon_vset_lanev8qi (__a, __b, __c); + (int8x8_t)__builtin_neon_vset_lanev8qi (__a, __b, __c) #define vset_lane_s16(__a, __b, __c) \ - (int16x4_t)__builtin_neon_vset_lanev4hi (__a, __b, __c); + (int16x4_t)__builtin_neon_vset_lanev4hi (__a, __b, __c) #define vset_lane_s32(__a, __b, __c) \ - (int32x2_t)__builtin_neon_vset_lanev2si (__a, __b, __c); + (int32x2_t)__builtin_neon_vset_lanev2si (__a, __b, __c) #define vset_lane_f32(__a, __b, __c) \ - (float32x2_t)__builtin_neon_vset_lanev2sf (__a, __b, __c); + (float32x2_t)__builtin_neon_vset_lanev2sf (__a, __b, __c) #define vset_lane_u8(__a, __b, __c) \ - (uint8x8_t)__builtin_neon_vset_lanev8qi (__a, __b, __c); + (uint8x8_t)__builtin_neon_vset_lanev8qi (__a, __b, __c) #define vset_lane_u16(__a, __b, __c) \ - (uint16x4_t)__builtin_neon_vset_lanev4hi (__a, __b, __c); + (uint16x4_t)__builtin_neon_vset_lanev4hi (__a, __b, __c) #define vset_lane_u32(__a, __b, __c) \ - (uint32x2_t)__builtin_neon_vset_lanev2si (__a, __b, __c); + (uint32x2_t)__builtin_neon_vset_lanev2si (__a, __b, __c) #define vset_lane_p8(__a, __b, __c) \ - (poly8x8_t)__builtin_neon_vset_lanev8qi (__a, __b, __c); + (poly8x8_t)__builtin_neon_vset_lanev8qi (__a, __b, __c) #define vset_lane_p16(__a, __b, __c) \ - (poly16x4_t)__builtin_neon_vset_lanev4hi (__a, __b, __c); + (poly16x4_t)__builtin_neon_vset_lanev4hi (__a, __b, __c) #define vset_lane_s64(__a, __b, __c) \ - (int64x1_t)__builtin_neon_vset_lanedi (__a, __b, __c); + (int64x1_t)__builtin_neon_vset_lanedi (__a, __b, __c) #define vset_lane_u64(__a, __b, __c) \ - (uint64x1_t)__builtin_neon_vset_lanedi (__a, __b, __c); + (uint64x1_t)__builtin_neon_vset_lanedi (__a, __b, __c) #define vsetq_lane_s8(__a, __b, __c) \ - (int8x16_t)__builtin_neon_vset_lanev16qi (__a, __b, __c); + (int8x16_t)__builtin_neon_vset_lanev16qi (__a, __b, __c) #define vsetq_lane_s16(__a, __b, __c) \ - (int16x8_t)__builtin_neon_vset_lanev8hi (__a, __b, __c); + (int16x8_t)__builtin_neon_vset_lanev8hi (__a, __b, __c) #define vsetq_lane_s32(__a, __b, __c) \ - (int32x4_t)__builtin_neon_vset_lanev4si (__a, __b, __c); + (int32x4_t)__builtin_neon_vset_lanev4si (__a, __b, __c) #define vsetq_lane_f32(__a, __b, __c) \ - (float32x4_t)__builtin_neon_vset_lanev4sf (__a, __b, __c); + (float32x4_t)__builtin_neon_vset_lanev4sf (__a, __b, __c) #define vsetq_lane_u8(__a, __b, __c) \ - (uint8x16_t)__builtin_neon_vset_lanev16qi (__a, __b, __c); + (uint8x16_t)__builtin_neon_vset_lanev16qi (__a, __b, __c) #define vsetq_lane_u16(__a, __b, __c) \ - (uint16x8_t)__builtin_neon_vset_lanev8hi (__a, __b, __c); + (uint16x8_t)__builtin_neon_vset_lanev8hi (__a, __b, __c) #define vsetq_lane_u32(__a, __b, __c) \ - (uint32x4_t)__builtin_neon_vset_lanev4si (__a, __b, __c); + (uint32x4_t)__builtin_neon_vset_lanev4si (__a, __b, __c) #define vsetq_lane_p8(__a, __b, __c) \ - (poly8x16_t)__builtin_neon_vset_lanev16qi (__a, __b, __c); + (poly8x16_t)__builtin_neon_vset_lanev16qi (__a, __b, __c) #define vsetq_lane_p16(__a, __b, __c) \ - (poly16x8_t)__builtin_neon_vset_lanev8hi (__a, __b, __c); + (poly16x8_t)__builtin_neon_vset_lanev8hi (__a, __b, __c) #define vsetq_lane_s64(__a, __b, __c) \ - (int64x2_t)__builtin_neon_vset_lanev2di (__a, __b, __c); + (int64x2_t)__builtin_neon_vset_lanev2di (__a, __b, __c) #define vsetq_lane_u64(__a, __b, __c) \ - (uint64x2_t)__builtin_neon_vset_lanev2di (__a, __b, __c); + (uint64x2_t)__builtin_neon_vset_lanev2di (__a, __b, __c) #define vcreate_s8(__a) \ - (int8x8_t)__builtin_neon_vcreatev8qi (__a); + (int8x8_t)__builtin_neon_vcreatev8qi (__a) #define vcreate_s16(__a) \ - (int16x4_t)__builtin_neon_vcreatev4hi (__a); + (int16x4_t)__builtin_neon_vcreatev4hi (__a) #define vcreate_s32(__a) \ - (int32x2_t)__builtin_neon_vcreatev2si (__a); + (int32x2_t)__builtin_neon_vcreatev2si (__a) #define vcreate_s64(__a) \ - (int64x1_t)__builtin_neon_vcreatedi (__a); + (int64x1_t)__builtin_neon_vcreatedi (__a) #define vcreate_f32(__a) \ - (float32x2_t)__builtin_neon_vcreatev2sf (__a); + (float32x2_t)__builtin_neon_vcreatev2sf (__a) #define vcreate_u8(__a) \ - (uint8x8_t)__builtin_neon_vcreatev8qi (__a); + (uint8x8_t)__builtin_neon_vcreatev8qi (__a) #define vcreate_u16(__a) \ - (uint16x4_t)__builtin_neon_vcreatev4hi (__a); + (uint16x4_t)__builtin_neon_vcreatev4hi (__a) #define vcreate_u32(__a) \ - (uint32x2_t)__builtin_neon_vcreatev2si (__a); + (uint32x2_t)__builtin_neon_vcreatev2si (__a) #define vcreate_u64(__a) \ - (uint64x1_t)__builtin_neon_vcreatedi (__a); + (uint64x1_t)__builtin_neon_vcreatedi (__a) #define vcreate_p8(__a) \ - (poly8x8_t)__builtin_neon_vcreatev8qi (__a); + (poly8x8_t)__builtin_neon_vcreatev8qi (__a) #define vcreate_p16(__a) \ - (poly16x4_t)__builtin_neon_vcreatev4hi (__a); + (poly16x4_t)__builtin_neon_vcreatev4hi (__a) #define vdup_n_s8(__a) \ - (int8x8_t)__builtin_neon_vdup_nv8qi (__a); + (int8x8_t)__builtin_neon_vdup_nv8qi (__a) #define vdup_n_s16(__a) \ - (int16x4_t)__builtin_neon_vdup_nv4hi (__a); + (int16x4_t)__builtin_neon_vdup_nv4hi (__a) #define vdup_n_s32(__a) \ - (int32x2_t)__builtin_neon_vdup_nv2si (__a); + (int32x2_t)__builtin_neon_vdup_nv2si (__a) #define vdup_n_f32(__a) \ - (float32x2_t)__builtin_neon_vdup_nv2sf (__a); + (float32x2_t)__builtin_neon_vdup_nv2sf (__a) #define vdup_n_u8(__a) \ - (uint8x8_t)__builtin_neon_vdup_nv8qi (__a); + (uint8x8_t)__builtin_neon_vdup_nv8qi (__a) #define vdup_n_u16(__a) \ - (uint16x4_t)__builtin_neon_vdup_nv4hi (__a); + (uint16x4_t)__builtin_neon_vdup_nv4hi (__a) #define vdup_n_u32(__a) \ - (uint32x2_t)__builtin_neon_vdup_nv2si (__a); + (uint32x2_t)__builtin_neon_vdup_nv2si (__a) #define vdup_n_p8(__a) \ - (poly8x8_t)__builtin_neon_vdup_nv8qi (__a); + (poly8x8_t)__builtin_neon_vdup_nv8qi (__a) #define vdup_n_p16(__a) \ - (poly16x4_t)__builtin_neon_vdup_nv4hi (__a); + (poly16x4_t)__builtin_neon_vdup_nv4hi (__a) #define vdup_n_s64(__a) \ - (int64x1_t)__builtin_neon_vdup_ndi (__a); + (int64x1_t)__builtin_neon_vdup_ndi (__a) #define vdup_n_u64(__a) \ - (uint64x1_t)__builtin_neon_vdup_ndi (__a); + (uint64x1_t)__builtin_neon_vdup_ndi (__a) #define vdupq_n_s8(__a) \ - (int8x16_t)__builtin_neon_vdup_nv16qi (__a); + (int8x16_t)__builtin_neon_vdup_nv16qi (__a) #define vdupq_n_s16(__a) \ - (int16x8_t)__builtin_neon_vdup_nv8hi (__a); + (int16x8_t)__builtin_neon_vdup_nv8hi (__a) #define vdupq_n_s32(__a) \ - (int32x4_t)__builtin_neon_vdup_nv4si (__a); + (int32x4_t)__builtin_neon_vdup_nv4si (__a) #define vdupq_n_f32(__a) \ - (float32x4_t)__builtin_neon_vdup_nv4sf (__a); + (float32x4_t)__builtin_neon_vdup_nv4sf (__a) #define vdupq_n_u8(__a) \ - (uint8x16_t)__builtin_neon_vdup_nv16qi (__a); + (uint8x16_t)__builtin_neon_vdup_nv16qi (__a) #define vdupq_n_u16(__a) \ - (uint16x8_t)__builtin_neon_vdup_nv8hi (__a); + (uint16x8_t)__builtin_neon_vdup_nv8hi (__a) #define vdupq_n_u32(__a) \ - (uint32x4_t)__builtin_neon_vdup_nv4si (__a); + (uint32x4_t)__builtin_neon_vdup_nv4si (__a) #define vdupq_n_p8(__a) \ - (poly8x16_t)__builtin_neon_vdup_nv16qi (__a); + (poly8x16_t)__builtin_neon_vdup_nv16qi (__a) #define vdupq_n_p16(__a) \ - (poly16x8_t)__builtin_neon_vdup_nv8hi (__a); + (poly16x8_t)__builtin_neon_vdup_nv8hi (__a) #define vdupq_n_s64(__a) \ - (int64x2_t)__builtin_neon_vdup_nv2di (__a); + (int64x2_t)__builtin_neon_vdup_nv2di (__a) #define vdupq_n_u64(__a) \ - (uint64x2_t)__builtin_neon_vdup_nv2di (__a); + (uint64x2_t)__builtin_neon_vdup_nv2di (__a) #define vmov_n_s8(__a) \ - (int8x8_t)__builtin_neon_vdup_nv8qi (__a); + (int8x8_t)__builtin_neon_vdup_nv8qi (__a) #define vmov_n_s16(__a) \ - (int16x4_t)__builtin_neon_vdup_nv4hi (__a); + (int16x4_t)__builtin_neon_vdup_nv4hi (__a) #define vmov_n_s32(__a) \ - (int32x2_t)__builtin_neon_vdup_nv2si (__a); + (int32x2_t)__builtin_neon_vdup_nv2si (__a) #define vmov_n_f32(__a) \ - (float32x2_t)__builtin_neon_vdup_nv2sf (__a); + (float32x2_t)__builtin_neon_vdup_nv2sf (__a) #define vmov_n_u8(__a) \ - (uint8x8_t)__builtin_neon_vdup_nv8qi (__a); + (uint8x8_t)__builtin_neon_vdup_nv8qi (__a) #define vmov_n_u16(__a) \ - (uint16x4_t)__builtin_neon_vdup_nv4hi (__a); + (uint16x4_t)__builtin_neon_vdup_nv4hi (__a) #define vmov_n_u32(__a) \ - (uint32x2_t)__builtin_neon_vdup_nv2si (__a); + (uint32x2_t)__builtin_neon_vdup_nv2si (__a) #define vmov_n_p8(__a) \ - (poly8x8_t)__builtin_neon_vdup_nv8qi (__a); + (poly8x8_t)__builtin_neon_vdup_nv8qi (__a) #define vmov_n_p16(__a) \ - (poly16x4_t)__builtin_neon_vdup_nv4hi (__a); + (poly16x4_t)__builtin_neon_vdup_nv4hi (__a) #define vmov_n_s64(__a) \ - (int64x1_t)__builtin_neon_vdup_ndi (__a); + (int64x1_t)__builtin_neon_vdup_ndi (__a) #define vmov_n_u64(__a) \ - (uint64x1_t)__builtin_neon_vdup_ndi (__a); + (uint64x1_t)__builtin_neon_vdup_ndi (__a) #define vmovq_n_s8(__a) \ - (int8x16_t)__builtin_neon_vdup_nv16qi (__a); + (int8x16_t)__builtin_neon_vdup_nv16qi (__a) #define vmovq_n_s16(__a) \ - (int16x8_t)__builtin_neon_vdup_nv8hi (__a); + (int16x8_t)__builtin_neon_vdup_nv8hi (__a) #define vmovq_n_s32(__a) \ - (int32x4_t)__builtin_neon_vdup_nv4si (__a); + (int32x4_t)__builtin_neon_vdup_nv4si (__a) #define vmovq_n_f32(__a) \ - (float32x4_t)__builtin_neon_vdup_nv4sf (__a); + (float32x4_t)__builtin_neon_vdup_nv4sf (__a) #define vmovq_n_u8(__a) \ - (uint8x16_t)__builtin_neon_vdup_nv16qi (__a); + (uint8x16_t)__builtin_neon_vdup_nv16qi (__a) #define vmovq_n_u16(__a) \ - (uint16x8_t)__builtin_neon_vdup_nv8hi (__a); + (uint16x8_t)__builtin_neon_vdup_nv8hi (__a) #define vmovq_n_u32(__a) \ - (uint32x4_t)__builtin_neon_vdup_nv4si (__a); + (uint32x4_t)__builtin_neon_vdup_nv4si (__a) #define vmovq_n_p8(__a) \ - (poly8x16_t)__builtin_neon_vdup_nv16qi (__a); + (poly8x16_t)__builtin_neon_vdup_nv16qi (__a) #define vmovq_n_p16(__a) \ - (poly16x8_t)__builtin_neon_vdup_nv8hi (__a); + (poly16x8_t)__builtin_neon_vdup_nv8hi (__a) #define vmovq_n_s64(__a) \ - (int64x2_t)__builtin_neon_vdup_nv2di (__a); + (int64x2_t)__builtin_neon_vdup_nv2di (__a) #define vmovq_n_u64(__a) \ - (uint64x2_t)__builtin_neon_vdup_nv2di (__a); + (uint64x2_t)__builtin_neon_vdup_nv2di (__a) #define vdup_lane_s8(__a, __b) \ - (int8x8_t)__builtin_neon_vdup_lanev8qi (__a, __b); + (int8x8_t)__builtin_neon_vdup_lanev8qi (__a, __b) #define vdup_lane_s16(__a, __b) \ - (int16x4_t)__builtin_neon_vdup_lanev4hi (__a, __b); + (int16x4_t)__builtin_neon_vdup_lanev4hi (__a, __b) #define vdup_lane_s32(__a, __b) \ - (int32x2_t)__builtin_neon_vdup_lanev2si (__a, __b); + (int32x2_t)__builtin_neon_vdup_lanev2si (__a, __b) #define vdup_lane_f32(__a, __b) \ - (float32x2_t)__builtin_neon_vdup_lanev2sf (__a, __b); + (float32x2_t)__builtin_neon_vdup_lanev2sf (__a, __b) #define vdup_lane_u8(__a, __b) \ - (uint8x8_t)__builtin_neon_vdup_lanev8qi (__a, __b); + (uint8x8_t)__builtin_neon_vdup_lanev8qi (__a, __b) #define vdup_lane_u16(__a, __b) \ - (uint16x4_t)__builtin_neon_vdup_lanev4hi (__a, __b); + (uint16x4_t)__builtin_neon_vdup_lanev4hi (__a, __b) #define vdup_lane_u32(__a, __b) \ - (uint32x2_t)__builtin_neon_vdup_lanev2si (__a, __b); + (uint32x2_t)__builtin_neon_vdup_lanev2si (__a, __b) #define vdup_lane_p8(__a, __b) \ - (poly8x8_t)__builtin_neon_vdup_lanev8qi (__a, __b); + (poly8x8_t)__builtin_neon_vdup_lanev8qi (__a, __b) #define vdup_lane_p16(__a, __b) \ - (poly16x4_t)__builtin_neon_vdup_lanev4hi (__a, __b); + (poly16x4_t)__builtin_neon_vdup_lanev4hi (__a, __b) #define vdup_lane_s64(__a, __b) \ - (int64x1_t)__builtin_neon_vdup_lanedi (__a, __b); + (int64x1_t)__builtin_neon_vdup_lanedi (__a, __b) #define vdup_lane_u64(__a, __b) \ - (uint64x1_t)__builtin_neon_vdup_lanedi (__a, __b); + (uint64x1_t)__builtin_neon_vdup_lanedi (__a, __b) #define vdupq_lane_s8(__a, __b) \ - (int8x16_t)__builtin_neon_vdup_lanev16qi (__a, __b); + (int8x16_t)__builtin_neon_vdup_lanev16qi (__a, __b) #define vdupq_lane_s16(__a, __b) \ - (int16x8_t)__builtin_neon_vdup_lanev8hi (__a, __b); + (int16x8_t)__builtin_neon_vdup_lanev8hi (__a, __b) #define vdupq_lane_s32(__a, __b) \ - (int32x4_t)__builtin_neon_vdup_lanev4si (__a, __b); + (int32x4_t)__builtin_neon_vdup_lanev4si (__a, __b) #define vdupq_lane_f32(__a, __b) \ - (float32x4_t)__builtin_neon_vdup_lanev4sf (__a, __b); + (float32x4_t)__builtin_neon_vdup_lanev4sf (__a, __b) #define vdupq_lane_u8(__a, __b) \ - (uint8x16_t)__builtin_neon_vdup_lanev16qi (__a, __b); + (uint8x16_t)__builtin_neon_vdup_lanev16qi (__a, __b) #define vdupq_lane_u16(__a, __b) \ - (uint16x8_t)__builtin_neon_vdup_lanev8hi (__a, __b); + (uint16x8_t)__builtin_neon_vdup_lanev8hi (__a, __b) #define vdupq_lane_u32(__a, __b) \ - (uint32x4_t)__builtin_neon_vdup_lanev4si (__a, __b); + (uint32x4_t)__builtin_neon_vdup_lanev4si (__a, __b) #define vdupq_lane_p8(__a, __b) \ - (poly8x16_t)__builtin_neon_vdup_lanev16qi (__a, __b); + (poly8x16_t)__builtin_neon_vdup_lanev16qi (__a, __b) #define vdupq_lane_p16(__a, __b) \ - (poly16x8_t)__builtin_neon_vdup_lanev8hi (__a, __b); + (poly16x8_t)__builtin_neon_vdup_lanev8hi (__a, __b) #define vdupq_lane_s64(__a, __b) \ - (int64x2_t)__builtin_neon_vdup_lanev2di (__a, __b); + (int64x2_t)__builtin_neon_vdup_lanev2di (__a, __b) #define vdupq_lane_u64(__a, __b) \ - (uint64x2_t)__builtin_neon_vdup_lanev2di (__a, __b); + (uint64x2_t)__builtin_neon_vdup_lanev2di (__a, __b) #define vcombine_s8(__a, __b) \ - (int8x16_t)__builtin_neon_vcombinev8qi (__a, __b); + (int8x16_t)__builtin_neon_vcombinev8qi (__a, __b) #define vcombine_s16(__a, __b) \ - (int16x8_t)__builtin_neon_vcombinev4hi (__a, __b); + (int16x8_t)__builtin_neon_vcombinev4hi (__a, __b) #define vcombine_s32(__a, __b) \ - (int32x4_t)__builtin_neon_vcombinev2si (__a, __b); + (int32x4_t)__builtin_neon_vcombinev2si (__a, __b) #define vcombine_s64(__a, __b) \ - (int64x2_t)__builtin_neon_vcombinedi (__a, __b); + (int64x2_t)__builtin_neon_vcombinedi (__a, __b) #define vcombine_f32(__a, __b) \ - (float32x4_t)__builtin_neon_vcombinev2sf (__a, __b); + (float32x4_t)__builtin_neon_vcombinev2sf (__a, __b) #define vcombine_u8(__a, __b) \ - (uint8x16_t)__builtin_neon_vcombinev8qi (__a, __b); + (uint8x16_t)__builtin_neon_vcombinev8qi (__a, __b) #define vcombine_u16(__a, __b) \ - (uint16x8_t)__builtin_neon_vcombinev4hi (__a, __b); + (uint16x8_t)__builtin_neon_vcombinev4hi (__a, __b) #define vcombine_u32(__a, __b) \ - (uint32x4_t)__builtin_neon_vcombinev2si (__a, __b); + (uint32x4_t)__builtin_neon_vcombinev2si (__a, __b) #define vcombine_u64(__a, __b) \ - (uint64x2_t)__builtin_neon_vcombinedi (__a, __b); + (uint64x2_t)__builtin_neon_vcombinedi (__a, __b) #define vcombine_p8(__a, __b) \ - (poly8x16_t)__builtin_neon_vcombinev8qi (__a, __b); + (poly8x16_t)__builtin_neon_vcombinev8qi (__a, __b) #define vcombine_p16(__a, __b) \ - (poly16x8_t)__builtin_neon_vcombinev4hi (__a, __b); + (poly16x8_t)__builtin_neon_vcombinev4hi (__a, __b) #define vget_high_s8(__a) \ - (int8x8_t)__builtin_neon_vget_highv16qi (__a); + (int8x8_t)__builtin_neon_vget_highv16qi (__a) #define vget_high_s16(__a) \ - (int16x4_t)__builtin_neon_vget_highv8hi (__a); + (int16x4_t)__builtin_neon_vget_highv8hi (__a) #define vget_high_s32(__a) \ - (int32x2_t)__builtin_neon_vget_highv4si (__a); + (int32x2_t)__builtin_neon_vget_highv4si (__a) #define vget_high_s64(__a) \ - (int64x1_t)__builtin_neon_vget_highv2di (__a); + (int64x1_t)__builtin_neon_vget_highv2di (__a) #define vget_high_f32(__a) \ - (float32x2_t)__builtin_neon_vget_highv4sf (__a); + (float32x2_t)__builtin_neon_vget_highv4sf (__a) #define vget_high_u8(__a) \ - (uint8x8_t)__builtin_neon_vget_highv16qi (__a); + (uint8x8_t)__builtin_neon_vget_highv16qi (__a) #define vget_high_u16(__a) \ - (uint16x4_t)__builtin_neon_vget_highv8hi (__a); + (uint16x4_t)__builtin_neon_vget_highv8hi (__a) #define vget_high_u32(__a) \ - (uint32x2_t)__builtin_neon_vget_highv4si (__a); + (uint32x2_t)__builtin_neon_vget_highv4si (__a) #define vget_high_u64(__a) \ - (uint64x1_t)__builtin_neon_vget_highv2di (__a); + (uint64x1_t)__builtin_neon_vget_highv2di (__a) #define vget_high_p8(__a) \ - (poly8x8_t)__builtin_neon_vget_highv16qi (__a); + (poly8x8_t)__builtin_neon_vget_highv16qi (__a) #define vget_high_p16(__a) \ - (poly16x4_t)__builtin_neon_vget_highv8hi (__a); + (poly16x4_t)__builtin_neon_vget_highv8hi (__a) #define vget_low_s8(__a) \ - (int8x8_t)__builtin_neon_vget_lowv16qi (__a); + (int8x8_t)__builtin_neon_vget_lowv16qi (__a) #define vget_low_s16(__a) \ - (int16x4_t)__builtin_neon_vget_lowv8hi (__a); + (int16x4_t)__builtin_neon_vget_lowv8hi (__a) #define vget_low_s32(__a) \ - (int32x2_t)__builtin_neon_vget_lowv4si (__a); + (int32x2_t)__builtin_neon_vget_lowv4si (__a) #define vget_low_s64(__a) \ - (int64x1_t)__builtin_neon_vget_lowv2di (__a); + (int64x1_t)__builtin_neon_vget_lowv2di (__a) #define vget_low_f32(__a) \ - (float32x2_t)__builtin_neon_vget_lowv4sf (__a); + (float32x2_t)__builtin_neon_vget_lowv4sf (__a) #define vget_low_u8(__a) \ - (uint8x8_t)__builtin_neon_vget_lowv16qi (__a); + (uint8x8_t)__builtin_neon_vget_lowv16qi (__a) #define vget_low_u16(__a) \ - (uint16x4_t)__builtin_neon_vget_lowv8hi (__a); + (uint16x4_t)__builtin_neon_vget_lowv8hi (__a) #define vget_low_u32(__a) \ - (uint32x2_t)__builtin_neon_vget_lowv4si (__a); + (uint32x2_t)__builtin_neon_vget_lowv4si (__a) #define vget_low_u64(__a) \ - (uint64x1_t)__builtin_neon_vget_lowv2di (__a); + (uint64x1_t)__builtin_neon_vget_lowv2di (__a) #define vget_low_p8(__a) \ - (poly8x8_t)__builtin_neon_vget_lowv16qi (__a); + (poly8x8_t)__builtin_neon_vget_lowv16qi (__a) #define vget_low_p16(__a) \ - (poly16x4_t)__builtin_neon_vget_lowv8hi (__a); + (poly16x4_t)__builtin_neon_vget_lowv8hi (__a) #define vcvt_s32_f32(__a) \ - (int32x2_t)__builtin_neon_vcvtv2sf (__a, 1); + (int32x2_t)__builtin_neon_vcvtv2sf (__a, 1) #define vcvt_f32_s32(__a) \ - (float32x2_t)__builtin_neon_vcvtv2si (__a, 1); + (float32x2_t)__builtin_neon_vcvtv2si (__a, 1) #define vcvt_f32_u32(__a) \ - (float32x2_t)__builtin_neon_vcvtv2si (__a, 0); + (float32x2_t)__builtin_neon_vcvtv2si (__a, 0) #define vcvt_u32_f32(__a) \ - (uint32x2_t)__builtin_neon_vcvtv2sf (__a, 0); + (uint32x2_t)__builtin_neon_vcvtv2sf (__a, 0) #define vcvtq_s32_f32(__a) \ - (int32x4_t)__builtin_neon_vcvtv4sf (__a, 1); + (int32x4_t)__builtin_neon_vcvtv4sf (__a, 1) #define vcvtq_f32_s32(__a) \ - (float32x4_t)__builtin_neon_vcvtv4si (__a, 1); + (float32x4_t)__builtin_neon_vcvtv4si (__a, 1) #define vcvtq_f32_u32(__a) \ - (float32x4_t)__builtin_neon_vcvtv4si (__a, 0); + (float32x4_t)__builtin_neon_vcvtv4si (__a, 0) #define vcvtq_u32_f32(__a) \ - (uint32x4_t)__builtin_neon_vcvtv4sf (__a, 0); + (uint32x4_t)__builtin_neon_vcvtv4sf (__a, 0) #define vcvt_n_s32_f32(__a, __b) \ - (int32x2_t)__builtin_neon_vcvt_nv2sf (__a, __b, 1); + (int32x2_t)__builtin_neon_vcvt_nv2sf (__a, __b, 1) #define vcvt_n_f32_s32(__a, __b) \ - (float32x2_t)__builtin_neon_vcvt_nv2si (__a, __b, 1); + (float32x2_t)__builtin_neon_vcvt_nv2si (__a, __b, 1) #define vcvt_n_f32_u32(__a, __b) \ - (float32x2_t)__builtin_neon_vcvt_nv2si (__a, __b, 0); + (float32x2_t)__builtin_neon_vcvt_nv2si (__a, __b, 0) #define vcvt_n_u32_f32(__a, __b) \ - (uint32x2_t)__builtin_neon_vcvt_nv2sf (__a, __b, 0); + (uint32x2_t)__builtin_neon_vcvt_nv2sf (__a, __b, 0) #define vcvtq_n_s32_f32(__a, __b) \ - (int32x4_t)__builtin_neon_vcvt_nv4sf (__a, __b, 1); + (int32x4_t)__builtin_neon_vcvt_nv4sf (__a, __b, 1) #define vcvtq_n_f32_s32(__a, __b) \ - (float32x4_t)__builtin_neon_vcvt_nv4si (__a, __b, 1); + (float32x4_t)__builtin_neon_vcvt_nv4si (__a, __b, 1) #define vcvtq_n_f32_u32(__a, __b) \ - (float32x4_t)__builtin_neon_vcvt_nv4si (__a, __b, 0); + (float32x4_t)__builtin_neon_vcvt_nv4si (__a, __b, 0) #define vcvtq_n_u32_f32(__a, __b) \ - (uint32x4_t)__builtin_neon_vcvt_nv4sf (__a, __b, 0); + (uint32x4_t)__builtin_neon_vcvt_nv4sf (__a, __b, 0) #define vmovn_s16(__a) \ - (int8x8_t)__builtin_neon_vmovnv8hi (__a, 1); + (int8x8_t)__builtin_neon_vmovnv8hi (__a, 1) #define vmovn_s32(__a) \ - (int16x4_t)__builtin_neon_vmovnv4si (__a, 1); + (int16x4_t)__builtin_neon_vmovnv4si (__a, 1) #define vmovn_s64(__a) \ - (int32x2_t)__builtin_neon_vmovnv2di (__a, 1); + (int32x2_t)__builtin_neon_vmovnv2di (__a, 1) #define vmovn_u16(__a) \ - (uint8x8_t)__builtin_neon_vmovnv8hi (__a, 0); + (uint8x8_t)__builtin_neon_vmovnv8hi (__a, 0) #define vmovn_u32(__a) \ - (uint16x4_t)__builtin_neon_vmovnv4si (__a, 0); + (uint16x4_t)__builtin_neon_vmovnv4si (__a, 0) #define vmovn_u64(__a) \ - (uint32x2_t)__builtin_neon_vmovnv2di (__a, 0); + (uint32x2_t)__builtin_neon_vmovnv2di (__a, 0) #define vqmovn_s16(__a) \ - (int8x8_t)__builtin_neon_vqmovnv8hi (__a, 1); + (int8x8_t)__builtin_neon_vqmovnv8hi (__a, 1) #define vqmovn_s32(__a) \ - (int16x4_t)__builtin_neon_vqmovnv4si (__a, 1); + (int16x4_t)__builtin_neon_vqmovnv4si (__a, 1) #define vqmovn_s64(__a) \ - (int32x2_t)__builtin_neon_vqmovnv2di (__a, 1); + (int32x2_t)__builtin_neon_vqmovnv2di (__a, 1) #define vqmovn_u16(__a) \ - (uint8x8_t)__builtin_neon_vqmovnv8hi (__a, 0); + (uint8x8_t)__builtin_neon_vqmovnv8hi (__a, 0) #define vqmovn_u32(__a) \ - (uint16x4_t)__builtin_neon_vqmovnv4si (__a, 0); + (uint16x4_t)__builtin_neon_vqmovnv4si (__a, 0) #define vqmovn_u64(__a) \ - (uint32x2_t)__builtin_neon_vqmovnv2di (__a, 0); + (uint32x2_t)__builtin_neon_vqmovnv2di (__a, 0) #define vqmovun_s16(__a) \ - (uint8x8_t)__builtin_neon_vqmovunv8hi (__a, 1); + (uint8x8_t)__builtin_neon_vqmovunv8hi (__a, 1) #define vqmovun_s32(__a) \ - (uint16x4_t)__builtin_neon_vqmovunv4si (__a, 1); + (uint16x4_t)__builtin_neon_vqmovunv4si (__a, 1) #define vqmovun_s64(__a) \ - (uint32x2_t)__builtin_neon_vqmovunv2di (__a, 1); + (uint32x2_t)__builtin_neon_vqmovunv2di (__a, 1) #define vmovl_s8(__a) \ - (int16x8_t)__builtin_neon_vmovlv8qi (__a, 1); + (int16x8_t)__builtin_neon_vmovlv8qi (__a, 1) #define vmovl_s16(__a) \ - (int32x4_t)__builtin_neon_vmovlv4hi (__a, 1); + (int32x4_t)__builtin_neon_vmovlv4hi (__a, 1) #define vmovl_s32(__a) \ - (int64x2_t)__builtin_neon_vmovlv2si (__a, 1); + (int64x2_t)__builtin_neon_vmovlv2si (__a, 1) #define vmovl_u8(__a) \ - (uint16x8_t)__builtin_neon_vmovlv8qi (__a, 0); + (uint16x8_t)__builtin_neon_vmovlv8qi (__a, 0) #define vmovl_u16(__a) \ - (uint32x4_t)__builtin_neon_vmovlv4hi (__a, 0); + (uint32x4_t)__builtin_neon_vmovlv4hi (__a, 0) #define vmovl_u32(__a) \ - (uint64x2_t)__builtin_neon_vmovlv2si (__a, 0); + (uint64x2_t)__builtin_neon_vmovlv2si (__a, 0) #define vtbl1_s8(__a, __b) \ - (int8x8_t)__builtin_neon_vtbl1v8qi (__a, __b); + (int8x8_t)__builtin_neon_vtbl1v8qi (__a, __b) #define vtbl1_u8(__a, __b) \ - (uint8x8_t)__builtin_neon_vtbl1v8qi (__a, __b); + (uint8x8_t)__builtin_neon_vtbl1v8qi (__a, __b) #define vtbl1_p8(__a, __b) \ - (poly8x8_t)__builtin_neon_vtbl1v8qi (__a, __b); + (poly8x8_t)__builtin_neon_vtbl1v8qi (__a, __b) #define vtbl2_s8(__a, __b) \ ({ \ @@ -3306,13 +3306,13 @@ }) #define vtbx1_s8(__a, __b, __c) \ - (int8x8_t)__builtin_neon_vtbx1v8qi (__a, __b, __c); + (int8x8_t)__builtin_neon_vtbx1v8qi (__a, __b, __c) #define vtbx1_u8(__a, __b, __c) \ - (uint8x8_t)__builtin_neon_vtbx1v8qi (__a, __b, __c); + (uint8x8_t)__builtin_neon_vtbx1v8qi (__a, __b, __c) #define vtbx1_p8(__a, __b, __c) \ - (poly8x8_t)__builtin_neon_vtbx1v8qi (__a, __b, __c); + (poly8x8_t)__builtin_neon_vtbx1v8qi (__a, __b, __c) #define vtbx2_s8(__a, __b, __c) \ ({ \ @@ -3369,580 +3369,580 @@ }) #define vmul_lane_s16(__a, __b, __c) \ - (int16x4_t)__builtin_neon_vmul_lanev4hi (__a, __b, __c, 1); + (int16x4_t)__builtin_neon_vmul_lanev4hi (__a, __b, __c, 1) #define vmul_lane_s32(__a, __b, __c) \ - (int32x2_t)__builtin_neon_vmul_lanev2si (__a, __b, __c, 1); + (int32x2_t)__builtin_neon_vmul_lanev2si (__a, __b, __c, 1) #define vmul_lane_f32(__a, __b, __c) \ - (float32x2_t)__builtin_neon_vmul_lanev2sf (__a, __b, __c, 5); + (float32x2_t)__builtin_neon_vmul_lanev2sf (__a, __b, __c, 5) #define vmul_lane_u16(__a, __b, __c) \ - (uint16x4_t)__builtin_neon_vmul_lanev4hi (__a, __b, __c, 0); + (uint16x4_t)__builtin_neon_vmul_lanev4hi (__a, __b, __c, 0) #define vmul_lane_u32(__a, __b, __c) \ - (uint32x2_t)__builtin_neon_vmul_lanev2si (__a, __b, __c, 0); + (uint32x2_t)__builtin_neon_vmul_lanev2si (__a, __b, __c, 0) #define vmulq_lane_s16(__a, __b, __c) \ - (int16x8_t)__builtin_neon_vmul_lanev8hi (__a, __b, __c, 1); + (int16x8_t)__builtin_neon_vmul_lanev8hi (__a, __b, __c, 1) #define vmulq_lane_s32(__a, __b, __c) \ - (int32x4_t)__builtin_neon_vmul_lanev4si (__a, __b, __c, 1); + (int32x4_t)__builtin_neon_vmul_lanev4si (__a, __b, __c, 1) #define vmulq_lane_f32(__a, __b, __c) \ - (float32x4_t)__builtin_neon_vmul_lanev4sf (__a, __b, __c, 5); + (float32x4_t)__builtin_neon_vmul_lanev4sf (__a, __b, __c, 5) #define vmulq_lane_u16(__a, __b, __c) \ - (uint16x8_t)__builtin_neon_vmul_lanev8hi (__a, __b, __c, 0); + (uint16x8_t)__builtin_neon_vmul_lanev8hi (__a, __b, __c, 0) #define vmulq_lane_u32(__a, __b, __c) \ - (uint32x4_t)__builtin_neon_vmul_lanev4si (__a, __b, __c, 0); + (uint32x4_t)__builtin_neon_vmul_lanev4si (__a, __b, __c, 0) #define vmla_lane_s16(__a, __b, __c, __d) \ - (int16x4_t)__builtin_neon_vmla_lanev4hi (__a, __b, __c, __d, 1); + (int16x4_t)__builtin_neon_vmla_lanev4hi (__a, __b, __c, __d, 1) #define vmla_lane_s32(__a, __b, __c, __d) \ - (int32x2_t)__builtin_neon_vmla_lanev2si (__a, __b, __c, __d, 1); + (int32x2_t)__builtin_neon_vmla_lanev2si (__a, __b, __c, __d, 1) #define vmla_lane_f32(__a, __b, __c, __d) \ - (float32x2_t)__builtin_neon_vmla_lanev2sf (__a, __b, __c, __d, 5); + (float32x2_t)__builtin_neon_vmla_lanev2sf (__a, __b, __c, __d, 5) #define vmla_lane_u16(__a, __b, __c, __d) \ - (uint16x4_t)__builtin_neon_vmla_lanev4hi (__a, __b, __c, __d, 0); + (uint16x4_t)__builtin_neon_vmla_lanev4hi (__a, __b, __c, __d, 0) #define vmla_lane_u32(__a, __b, __c, __d) \ - (uint32x2_t)__builtin_neon_vmla_lanev2si (__a, __b, __c, __d, 0); + (uint32x2_t)__builtin_neon_vmla_lanev2si (__a, __b, __c, __d, 0) #define vmlaq_lane_s16(__a, __b, __c, __d) \ - (int16x8_t)__builtin_neon_vmla_lanev8hi (__a, __b, __c, __d, 1); + (int16x8_t)__builtin_neon_vmla_lanev8hi (__a, __b, __c, __d, 1) #define vmlaq_lane_s32(__a, __b, __c, __d) \ - (int32x4_t)__builtin_neon_vmla_lanev4si (__a, __b, __c, __d, 1); + (int32x4_t)__builtin_neon_vmla_lanev4si (__a, __b, __c, __d, 1) #define vmlaq_lane_f32(__a, __b, __c, __d) \ - (float32x4_t)__builtin_neon_vmla_lanev4sf (__a, __b, __c, __d, 5); + (float32x4_t)__builtin_neon_vmla_lanev4sf (__a, __b, __c, __d, 5) #define vmlaq_lane_u16(__a, __b, __c, __d) \ - (uint16x8_t)__builtin_neon_vmla_lanev8hi (__a, __b, __c, __d, 0); + (uint16x8_t)__builtin_neon_vmla_lanev8hi (__a, __b, __c, __d, 0) #define vmlaq_lane_u32(__a, __b, __c, __d) \ - (uint32x4_t)__builtin_neon_vmla_lanev4si (__a, __b, __c, __d, 0); + (uint32x4_t)__builtin_neon_vmla_lanev4si (__a, __b, __c, __d, 0) #define vmlal_lane_s16(__a, __b, __c, __d) \ - (int32x4_t)__builtin_neon_vmlal_lanev4hi (__a, __b, __c, __d, 1); + (int32x4_t)__builtin_neon_vmlal_lanev4hi (__a, __b, __c, __d, 1) #define vmlal_lane_s32(__a, __b, __c, __d) \ - (int64x2_t)__builtin_neon_vmlal_lanev2si (__a, __b, __c, __d, 1); + (int64x2_t)__builtin_neon_vmlal_lanev2si (__a, __b, __c, __d, 1) #define vmlal_lane_u16(__a, __b, __c, __d) \ - (uint32x4_t)__builtin_neon_vmlal_lanev4hi (__a, __b, __c, __d, 0); + (uint32x4_t)__builtin_neon_vmlal_lanev4hi (__a, __b, __c, __d, 0) #define vmlal_lane_u32(__a, __b, __c, __d) \ - (uint64x2_t)__builtin_neon_vmlal_lanev2si (__a, __b, __c, __d, 0); + (uint64x2_t)__builtin_neon_vmlal_lanev2si (__a, __b, __c, __d, 0) #define vqdmlal_lane_s16(__a, __b, __c, __d) \ - (int32x4_t)__builtin_neon_vqdmlal_lanev4hi (__a, __b, __c, __d, 1); + (int32x4_t)__builtin_neon_vqdmlal_lanev4hi (__a, __b, __c, __d, 1) #define vqdmlal_lane_s32(__a, __b, __c, __d) \ - (int64x2_t)__builtin_neon_vqdmlal_lanev2si (__a, __b, __c, __d, 1); + (int64x2_t)__builtin_neon_vqdmlal_lanev2si (__a, __b, __c, __d, 1) #define vmls_lane_s16(__a, __b, __c, __d) \ - (int16x4_t)__builtin_neon_vmls_lanev4hi (__a, __b, __c, __d, 1); + (int16x4_t)__builtin_neon_vmls_lanev4hi (__a, __b, __c, __d, 1) #define vmls_lane_s32(__a, __b, __c, __d) \ - (int32x2_t)__builtin_neon_vmls_lanev2si (__a, __b, __c, __d, 1); + (int32x2_t)__builtin_neon_vmls_lanev2si (__a, __b, __c, __d, 1) #define vmls_lane_f32(__a, __b, __c, __d) \ - (float32x2_t)__builtin_neon_vmls_lanev2sf (__a, __b, __c, __d, 5); + (float32x2_t)__builtin_neon_vmls_lanev2sf (__a, __b, __c, __d, 5) #define vmls_lane_u16(__a, __b, __c, __d) \ - (uint16x4_t)__builtin_neon_vmls_lanev4hi (__a, __b, __c, __d, 0); + (uint16x4_t)__builtin_neon_vmls_lanev4hi (__a, __b, __c, __d, 0) #define vmls_lane_u32(__a, __b, __c, __d) \ - (uint32x2_t)__builtin_neon_vmls_lanev2si (__a, __b, __c, __d, 0); + (uint32x2_t)__builtin_neon_vmls_lanev2si (__a, __b, __c, __d, 0) #define vmlsq_lane_s16(__a, __b, __c, __d) \ - (int16x8_t)__builtin_neon_vmls_lanev8hi (__a, __b, __c, __d, 1); + (int16x8_t)__builtin_neon_vmls_lanev8hi (__a, __b, __c, __d, 1) #define vmlsq_lane_s32(__a, __b, __c, __d) \ - (int32x4_t)__builtin_neon_vmls_lanev4si (__a, __b, __c, __d, 1); + (int32x4_t)__builtin_neon_vmls_lanev4si (__a, __b, __c, __d, 1) #define vmlsq_lane_f32(__a, __b, __c, __d) \ - (float32x4_t)__builtin_neon_vmls_lanev4sf (__a, __b, __c, __d, 5); + (float32x4_t)__builtin_neon_vmls_lanev4sf (__a, __b, __c, __d, 5) #define vmlsq_lane_u16(__a, __b, __c, __d) \ - (uint16x8_t)__builtin_neon_vmls_lanev8hi (__a, __b, __c, __d, 0); + (uint16x8_t)__builtin_neon_vmls_lanev8hi (__a, __b, __c, __d, 0) #define vmlsq_lane_u32(__a, __b, __c, __d) \ - (uint32x4_t)__builtin_neon_vmls_lanev4si (__a, __b, __c, __d, 0); + (uint32x4_t)__builtin_neon_vmls_lanev4si (__a, __b, __c, __d, 0) #define vmlsl_lane_s16(__a, __b, __c, __d) \ - (int32x4_t)__builtin_neon_vmlsl_lanev4hi (__a, __b, __c, __d, 1); + (int32x4_t)__builtin_neon_vmlsl_lanev4hi (__a, __b, __c, __d, 1) #define vmlsl_lane_s32(__a, __b, __c, __d) \ - (int64x2_t)__builtin_neon_vmlsl_lanev2si (__a, __b, __c, __d, 1); + (int64x2_t)__builtin_neon_vmlsl_lanev2si (__a, __b, __c, __d, 1) #define vmlsl_lane_u16(__a, __b, __c, __d) \ - (uint32x4_t)__builtin_neon_vmlsl_lanev4hi (__a, __b, __c, __d, 0); + (uint32x4_t)__builtin_neon_vmlsl_lanev4hi (__a, __b, __c, __d, 0) #define vmlsl_lane_u32(__a, __b, __c, __d) \ - (uint64x2_t)__builtin_neon_vmlsl_lanev2si (__a, __b, __c, __d, 0); + (uint64x2_t)__builtin_neon_vmlsl_lanev2si (__a, __b, __c, __d, 0) #define vqdmlsl_lane_s16(__a, __b, __c, __d) \ - (int32x4_t)__builtin_neon_vqdmlsl_lanev4hi (__a, __b, __c, __d, 1); + (int32x4_t)__builtin_neon_vqdmlsl_lanev4hi (__a, __b, __c, __d, 1) #define vqdmlsl_lane_s32(__a, __b, __c, __d) \ - (int64x2_t)__builtin_neon_vqdmlsl_lanev2si (__a, __b, __c, __d, 1); + (int64x2_t)__builtin_neon_vqdmlsl_lanev2si (__a, __b, __c, __d, 1) #define vmull_lane_s16(__a, __b, __c) \ - (int32x4_t)__builtin_neon_vmull_lanev4hi (__a, __b, __c, 1); + (int32x4_t)__builtin_neon_vmull_lanev4hi (__a, __b, __c, 1) #define vmull_lane_s32(__a, __b, __c) \ - (int64x2_t)__builtin_neon_vmull_lanev2si (__a, __b, __c, 1); + (int64x2_t)__builtin_neon_vmull_lanev2si (__a, __b, __c, 1) #define vmull_lane_u16(__a, __b, __c) \ - (uint32x4_t)__builtin_neon_vmull_lanev4hi (__a, __b, __c, 0); + (uint32x4_t)__builtin_neon_vmull_lanev4hi (__a, __b, __c, 0) #define vmull_lane_u32(__a, __b, __c) \ - (uint64x2_t)__builtin_neon_vmull_lanev2si (__a, __b, __c, 0); + (uint64x2_t)__builtin_neon_vmull_lanev2si (__a, __b, __c, 0) #define vqdmull_lane_s16(__a, __b, __c) \ - (int32x4_t)__builtin_neon_vqdmull_lanev4hi (__a, __b, __c, 1); + (int32x4_t)__builtin_neon_vqdmull_lanev4hi (__a, __b, __c, 1) #define vqdmull_lane_s32(__a, __b, __c) \ - (int64x2_t)__builtin_neon_vqdmull_lanev2si (__a, __b, __c, 1); + (int64x2_t)__builtin_neon_vqdmull_lanev2si (__a, __b, __c, 1) #define vqdmulhq_lane_s16(__a, __b, __c) \ - (int16x8_t)__builtin_neon_vqdmulh_lanev8hi (__a, __b, __c, 1); + (int16x8_t)__builtin_neon_vqdmulh_lanev8hi (__a, __b, __c, 1) #define vqdmulhq_lane_s32(__a, __b, __c) \ - (int32x4_t)__builtin_neon_vqdmulh_lanev4si (__a, __b, __c, 1); + (int32x4_t)__builtin_neon_vqdmulh_lanev4si (__a, __b, __c, 1) #define vqdmulh_lane_s16(__a, __b, __c) \ - (int16x4_t)__builtin_neon_vqdmulh_lanev4hi (__a, __b, __c, 1); + (int16x4_t)__builtin_neon_vqdmulh_lanev4hi (__a, __b, __c, 1) #define vqdmulh_lane_s32(__a, __b, __c) \ - (int32x2_t)__builtin_neon_vqdmulh_lanev2si (__a, __b, __c, 1); + (int32x2_t)__builtin_neon_vqdmulh_lanev2si (__a, __b, __c, 1) #define vqrdmulhq_lane_s16(__a, __b, __c) \ - (int16x8_t)__builtin_neon_vqdmulh_lanev8hi (__a, __b, __c, 3); + (int16x8_t)__builtin_neon_vqdmulh_lanev8hi (__a, __b, __c, 3) #define vqrdmulhq_lane_s32(__a, __b, __c) \ - (int32x4_t)__builtin_neon_vqdmulh_lanev4si (__a, __b, __c, 3); + (int32x4_t)__builtin_neon_vqdmulh_lanev4si (__a, __b, __c, 3) #define vqrdmulh_lane_s16(__a, __b, __c) \ - (int16x4_t)__builtin_neon_vqdmulh_lanev4hi (__a, __b, __c, 3); + (int16x4_t)__builtin_neon_vqdmulh_lanev4hi (__a, __b, __c, 3) #define vqrdmulh_lane_s32(__a, __b, __c) \ - (int32x2_t)__builtin_neon_vqdmulh_lanev2si (__a, __b, __c, 3); + (int32x2_t)__builtin_neon_vqdmulh_lanev2si (__a, __b, __c, 3) #define vmul_n_s16(__a, __b) \ - (int16x4_t)__builtin_neon_vmul_nv4hi (__a, __b, 1); + (int16x4_t)__builtin_neon_vmul_nv4hi (__a, __b, 1) #define vmul_n_s32(__a, __b) \ - (int32x2_t)__builtin_neon_vmul_nv2si (__a, __b, 1); + (int32x2_t)__builtin_neon_vmul_nv2si (__a, __b, 1) #define vmul_n_f32(__a, __b) \ - (float32x2_t)__builtin_neon_vmul_nv2sf (__a, __b, 5); + (float32x2_t)__builtin_neon_vmul_nv2sf (__a, __b, 5) #define vmul_n_u16(__a, __b) \ - (uint16x4_t)__builtin_neon_vmul_nv4hi (__a, __b, 0); + (uint16x4_t)__builtin_neon_vmul_nv4hi (__a, __b, 0) #define vmul_n_u32(__a, __b) \ - (uint32x2_t)__builtin_neon_vmul_nv2si (__a, __b, 0); + (uint32x2_t)__builtin_neon_vmul_nv2si (__a, __b, 0) #define vmulq_n_s16(__a, __b) \ - (int16x8_t)__builtin_neon_vmul_nv8hi (__a, __b, 1); + (int16x8_t)__builtin_neon_vmul_nv8hi (__a, __b, 1) #define vmulq_n_s32(__a, __b) \ - (int32x4_t)__builtin_neon_vmul_nv4si (__a, __b, 1); + (int32x4_t)__builtin_neon_vmul_nv4si (__a, __b, 1) #define vmulq_n_f32(__a, __b) \ - (float32x4_t)__builtin_neon_vmul_nv4sf (__a, __b, 5); + (float32x4_t)__builtin_neon_vmul_nv4sf (__a, __b, 5) #define vmulq_n_u16(__a, __b) \ - (uint16x8_t)__builtin_neon_vmul_nv8hi (__a, __b, 0); + (uint16x8_t)__builtin_neon_vmul_nv8hi (__a, __b, 0) #define vmulq_n_u32(__a, __b) \ - (uint32x4_t)__builtin_neon_vmul_nv4si (__a, __b, 0); + (uint32x4_t)__builtin_neon_vmul_nv4si (__a, __b, 0) #define vmull_n_s16(__a, __b) \ - (int32x4_t)__builtin_neon_vmull_nv4hi (__a, __b, 1); + (int32x4_t)__builtin_neon_vmull_nv4hi (__a, __b, 1) #define vmull_n_s32(__a, __b) \ - (int64x2_t)__builtin_neon_vmull_nv2si (__a, __b, 1); + (int64x2_t)__builtin_neon_vmull_nv2si (__a, __b, 1) #define vmull_n_u16(__a, __b) \ - (uint32x4_t)__builtin_neon_vmull_nv4hi (__a, __b, 0); + (uint32x4_t)__builtin_neon_vmull_nv4hi (__a, __b, 0) #define vmull_n_u32(__a, __b) \ - (uint64x2_t)__builtin_neon_vmull_nv2si (__a, __b, 0); + (uint64x2_t)__builtin_neon_vmull_nv2si (__a, __b, 0) #define vqdmull_n_s16(__a, __b) \ - (int32x4_t)__builtin_neon_vqdmull_nv4hi (__a, __b, 1); + (int32x4_t)__builtin_neon_vqdmull_nv4hi (__a, __b, 1) #define vqdmull_n_s32(__a, __b) \ - (int64x2_t)__builtin_neon_vqdmull_nv2si (__a, __b, 1); + (int64x2_t)__builtin_neon_vqdmull_nv2si (__a, __b, 1) #define vqdmulhq_n_s16(__a, __b) \ - (int16x8_t)__builtin_neon_vqdmulh_nv8hi (__a, __b, 1); + (int16x8_t)__builtin_neon_vqdmulh_nv8hi (__a, __b, 1) #define vqdmulhq_n_s32(__a, __b) \ - (int32x4_t)__builtin_neon_vqdmulh_nv4si (__a, __b, 1); + (int32x4_t)__builtin_neon_vqdmulh_nv4si (__a, __b, 1) #define vqdmulh_n_s16(__a, __b) \ - (int16x4_t)__builtin_neon_vqdmulh_nv4hi (__a, __b, 1); + (int16x4_t)__builtin_neon_vqdmulh_nv4hi (__a, __b, 1) #define vqdmulh_n_s32(__a, __b) \ - (int32x2_t)__builtin_neon_vqdmulh_nv2si (__a, __b, 1); + (int32x2_t)__builtin_neon_vqdmulh_nv2si (__a, __b, 1) #define vqrdmulhq_n_s16(__a, __b) \ - (int16x8_t)__builtin_neon_vqdmulh_nv8hi (__a, __b, 3); + (int16x8_t)__builtin_neon_vqdmulh_nv8hi (__a, __b, 3) #define vqrdmulhq_n_s32(__a, __b) \ - (int32x4_t)__builtin_neon_vqdmulh_nv4si (__a, __b, 3); + (int32x4_t)__builtin_neon_vqdmulh_nv4si (__a, __b, 3) #define vqrdmulh_n_s16(__a, __b) \ - (int16x4_t)__builtin_neon_vqdmulh_nv4hi (__a, __b, 3); + (int16x4_t)__builtin_neon_vqdmulh_nv4hi (__a, __b, 3) #define vqrdmulh_n_s32(__a, __b) \ - (int32x2_t)__builtin_neon_vqdmulh_nv2si (__a, __b, 3); + (int32x2_t)__builtin_neon_vqdmulh_nv2si (__a, __b, 3) #define vmla_n_s16(__a, __b, __c) \ - (int16x4_t)__builtin_neon_vmla_nv4hi (__a, __b, __c, 1); + (int16x4_t)__builtin_neon_vmla_nv4hi (__a, __b, __c, 1) #define vmla_n_s32(__a, __b, __c) \ - (int32x2_t)__builtin_neon_vmla_nv2si (__a, __b, __c, 1); + (int32x2_t)__builtin_neon_vmla_nv2si (__a, __b, __c, 1) #define vmla_n_f32(__a, __b, __c) \ - (float32x2_t)__builtin_neon_vmla_nv2sf (__a, __b, __c, 5); + (float32x2_t)__builtin_neon_vmla_nv2sf (__a, __b, __c, 5) #define vmla_n_u16(__a, __b, __c) \ - (uint16x4_t)__builtin_neon_vmla_nv4hi (__a, __b, __c, 0); + (uint16x4_t)__builtin_neon_vmla_nv4hi (__a, __b, __c, 0) #define vmla_n_u32(__a, __b, __c) \ - (uint32x2_t)__builtin_neon_vmla_nv2si (__a, __b, __c, 0); + (uint32x2_t)__builtin_neon_vmla_nv2si (__a, __b, __c, 0) #define vmlaq_n_s16(__a, __b, __c) \ - (int16x8_t)__builtin_neon_vmla_nv8hi (__a, __b, __c, 1); + (int16x8_t)__builtin_neon_vmla_nv8hi (__a, __b, __c, 1) #define vmlaq_n_s32(__a, __b, __c) \ - (int32x4_t)__builtin_neon_vmla_nv4si (__a, __b, __c, 1); + (int32x4_t)__builtin_neon_vmla_nv4si (__a, __b, __c, 1) #define vmlaq_n_f32(__a, __b, __c) \ - (float32x4_t)__builtin_neon_vmla_nv4sf (__a, __b, __c, 5); + (float32x4_t)__builtin_neon_vmla_nv4sf (__a, __b, __c, 5) #define vmlaq_n_u16(__a, __b, __c) \ - (uint16x8_t)__builtin_neon_vmla_nv8hi (__a, __b, __c, 0); + (uint16x8_t)__builtin_neon_vmla_nv8hi (__a, __b, __c, 0) #define vmlaq_n_u32(__a, __b, __c) \ - (uint32x4_t)__builtin_neon_vmla_nv4si (__a, __b, __c, 0); + (uint32x4_t)__builtin_neon_vmla_nv4si (__a, __b, __c, 0) #define vmlal_n_s16(__a, __b, __c) \ - (int32x4_t)__builtin_neon_vmlal_nv4hi (__a, __b, __c, 1); + (int32x4_t)__builtin_neon_vmlal_nv4hi (__a, __b, __c, 1) #define vmlal_n_s32(__a, __b, __c) \ - (int64x2_t)__builtin_neon_vmlal_nv2si (__a, __b, __c, 1); + (int64x2_t)__builtin_neon_vmlal_nv2si (__a, __b, __c, 1) #define vmlal_n_u16(__a, __b, __c) \ - (uint32x4_t)__builtin_neon_vmlal_nv4hi (__a, __b, __c, 0); + (uint32x4_t)__builtin_neon_vmlal_nv4hi (__a, __b, __c, 0) #define vmlal_n_u32(__a, __b, __c) \ - (uint64x2_t)__builtin_neon_vmlal_nv2si (__a, __b, __c, 0); + (uint64x2_t)__builtin_neon_vmlal_nv2si (__a, __b, __c, 0) #define vqdmlal_n_s16(__a, __b, __c) \ - (int32x4_t)__builtin_neon_vqdmlal_nv4hi (__a, __b, __c, 1); + (int32x4_t)__builtin_neon_vqdmlal_nv4hi (__a, __b, __c, 1) #define vqdmlal_n_s32(__a, __b, __c) \ - (int64x2_t)__builtin_neon_vqdmlal_nv2si (__a, __b, __c, 1); + (int64x2_t)__builtin_neon_vqdmlal_nv2si (__a, __b, __c, 1) #define vmls_n_s16(__a, __b, __c) \ - (int16x4_t)__builtin_neon_vmls_nv4hi (__a, __b, __c, 1); + (int16x4_t)__builtin_neon_vmls_nv4hi (__a, __b, __c, 1) #define vmls_n_s32(__a, __b, __c) \ - (int32x2_t)__builtin_neon_vmls_nv2si (__a, __b, __c, 1); + (int32x2_t)__builtin_neon_vmls_nv2si (__a, __b, __c, 1) #define vmls_n_f32(__a, __b, __c) \ - (float32x2_t)__builtin_neon_vmls_nv2sf (__a, __b, __c, 5); + (float32x2_t)__builtin_neon_vmls_nv2sf (__a, __b, __c, 5) #define vmls_n_u16(__a, __b, __c) \ - (uint16x4_t)__builtin_neon_vmls_nv4hi (__a, __b, __c, 0); + (uint16x4_t)__builtin_neon_vmls_nv4hi (__a, __b, __c, 0) #define vmls_n_u32(__a, __b, __c) \ - (uint32x2_t)__builtin_neon_vmls_nv2si (__a, __b, __c, 0); + (uint32x2_t)__builtin_neon_vmls_nv2si (__a, __b, __c, 0) #define vmlsq_n_s16(__a, __b, __c) \ - (int16x8_t)__builtin_neon_vmls_nv8hi (__a, __b, __c, 1); + (int16x8_t)__builtin_neon_vmls_nv8hi (__a, __b, __c, 1) #define vmlsq_n_s32(__a, __b, __c) \ - (int32x4_t)__builtin_neon_vmls_nv4si (__a, __b, __c, 1); + (int32x4_t)__builtin_neon_vmls_nv4si (__a, __b, __c, 1) #define vmlsq_n_f32(__a, __b, __c) \ - (float32x4_t)__builtin_neon_vmls_nv4sf (__a, __b, __c, 5); + (float32x4_t)__builtin_neon_vmls_nv4sf (__a, __b, __c, 5) #define vmlsq_n_u16(__a, __b, __c) \ - (uint16x8_t)__builtin_neon_vmls_nv8hi (__a, __b, __c, 0); + (uint16x8_t)__builtin_neon_vmls_nv8hi (__a, __b, __c, 0) #define vmlsq_n_u32(__a, __b, __c) \ - (uint32x4_t)__builtin_neon_vmls_nv4si (__a, __b, __c, 0); + (uint32x4_t)__builtin_neon_vmls_nv4si (__a, __b, __c, 0) #define vmlsl_n_s16(__a, __b, __c) \ - (int32x4_t)__builtin_neon_vmlsl_nv4hi (__a, __b, __c, 1); + (int32x4_t)__builtin_neon_vmlsl_nv4hi (__a, __b, __c, 1) #define vmlsl_n_s32(__a, __b, __c) \ - (int64x2_t)__builtin_neon_vmlsl_nv2si (__a, __b, __c, 1); + (int64x2_t)__builtin_neon_vmlsl_nv2si (__a, __b, __c, 1) #define vmlsl_n_u16(__a, __b, __c) \ - (uint32x4_t)__builtin_neon_vmlsl_nv4hi (__a, __b, __c, 0); + (uint32x4_t)__builtin_neon_vmlsl_nv4hi (__a, __b, __c, 0) #define vmlsl_n_u32(__a, __b, __c) \ - (uint64x2_t)__builtin_neon_vmlsl_nv2si (__a, __b, __c, 0); + (uint64x2_t)__builtin_neon_vmlsl_nv2si (__a, __b, __c, 0) #define vqdmlsl_n_s16(__a, __b, __c) \ - (int32x4_t)__builtin_neon_vqdmlsl_nv4hi (__a, __b, __c, 1); + (int32x4_t)__builtin_neon_vqdmlsl_nv4hi (__a, __b, __c, 1) #define vqdmlsl_n_s32(__a, __b, __c) \ - (int64x2_t)__builtin_neon_vqdmlsl_nv2si (__a, __b, __c, 1); + (int64x2_t)__builtin_neon_vqdmlsl_nv2si (__a, __b, __c, 1) #define vext_s8(__a, __b, __c) \ - (int8x8_t)__builtin_neon_vextv8qi (__a, __b, __c); + (int8x8_t)__builtin_neon_vextv8qi (__a, __b, __c) #define vext_s16(__a, __b, __c) \ - (int16x4_t)__builtin_neon_vextv4hi (__a, __b, __c); + (int16x4_t)__builtin_neon_vextv4hi (__a, __b, __c) #define vext_s32(__a, __b, __c) \ - (int32x2_t)__builtin_neon_vextv2si (__a, __b, __c); + (int32x2_t)__builtin_neon_vextv2si (__a, __b, __c) #define vext_s64(__a, __b, __c) \ - (int64x1_t)__builtin_neon_vextdi (__a, __b, __c); + (int64x1_t)__builtin_neon_vextdi (__a, __b, __c) #define vext_f32(__a, __b, __c) \ - (float32x2_t)__builtin_neon_vextv2sf (__a, __b, __c); + (float32x2_t)__builtin_neon_vextv2sf (__a, __b, __c) #define vext_u8(__a, __b, __c) \ - (uint8x8_t)__builtin_neon_vextv8qi (__a, __b, __c); + (uint8x8_t)__builtin_neon_vextv8qi (__a, __b, __c) #define vext_u16(__a, __b, __c) \ - (uint16x4_t)__builtin_neon_vextv4hi (__a, __b, __c); + (uint16x4_t)__builtin_neon_vextv4hi (__a, __b, __c) #define vext_u32(__a, __b, __c) \ - (uint32x2_t)__builtin_neon_vextv2si (__a, __b, __c); + (uint32x2_t)__builtin_neon_vextv2si (__a, __b, __c) #define vext_u64(__a, __b, __c) \ - (uint64x1_t)__builtin_neon_vextdi (__a, __b, __c); + (uint64x1_t)__builtin_neon_vextdi (__a, __b, __c) #define vext_p8(__a, __b, __c) \ - (poly8x8_t)__builtin_neon_vextv8qi (__a, __b, __c); + (poly8x8_t)__builtin_neon_vextv8qi (__a, __b, __c) #define vext_p16(__a, __b, __c) \ - (poly16x4_t)__builtin_neon_vextv4hi (__a, __b, __c); + (poly16x4_t)__builtin_neon_vextv4hi (__a, __b, __c) #define vextq_s8(__a, __b, __c) \ - (int8x16_t)__builtin_neon_vextv16qi (__a, __b, __c); + (int8x16_t)__builtin_neon_vextv16qi (__a, __b, __c) #define vextq_s16(__a, __b, __c) \ - (int16x8_t)__builtin_neon_vextv8hi (__a, __b, __c); + (int16x8_t)__builtin_neon_vextv8hi (__a, __b, __c) #define vextq_s32(__a, __b, __c) \ - (int32x4_t)__builtin_neon_vextv4si (__a, __b, __c); + (int32x4_t)__builtin_neon_vextv4si (__a, __b, __c) #define vextq_s64(__a, __b, __c) \ - (int64x2_t)__builtin_neon_vextv2di (__a, __b, __c); + (int64x2_t)__builtin_neon_vextv2di (__a, __b, __c) #define vextq_f32(__a, __b, __c) \ - (float32x4_t)__builtin_neon_vextv4sf (__a, __b, __c); + (float32x4_t)__builtin_neon_vextv4sf (__a, __b, __c) #define vextq_u8(__a, __b, __c) \ - (uint8x16_t)__builtin_neon_vextv16qi (__a, __b, __c); + (uint8x16_t)__builtin_neon_vextv16qi (__a, __b, __c) #define vextq_u16(__a, __b, __c) \ - (uint16x8_t)__builtin_neon_vextv8hi (__a, __b, __c); + (uint16x8_t)__builtin_neon_vextv8hi (__a, __b, __c) #define vextq_u32(__a, __b, __c) \ - (uint32x4_t)__builtin_neon_vextv4si (__a, __b, __c); + (uint32x4_t)__builtin_neon_vextv4si (__a, __b, __c) #define vextq_u64(__a, __b, __c) \ - (uint64x2_t)__builtin_neon_vextv2di (__a, __b, __c); + (uint64x2_t)__builtin_neon_vextv2di (__a, __b, __c) #define vextq_p8(__a, __b, __c) \ - (poly8x16_t)__builtin_neon_vextv16qi (__a, __b, __c); + (poly8x16_t)__builtin_neon_vextv16qi (__a, __b, __c) #define vextq_p16(__a, __b, __c) \ - (poly16x8_t)__builtin_neon_vextv8hi (__a, __b, __c); + (poly16x8_t)__builtin_neon_vextv8hi (__a, __b, __c) #define vrev64_s8(__a) \ - (int8x8_t)__builtin_neon_vrev64v8qi (__a, 1); + (int8x8_t)__builtin_neon_vrev64v8qi (__a, 1) #define vrev64_s16(__a) \ - (int16x4_t)__builtin_neon_vrev64v4hi (__a, 1); + (int16x4_t)__builtin_neon_vrev64v4hi (__a, 1) #define vrev64_s32(__a) \ - (int32x2_t)__builtin_neon_vrev64v2si (__a, 1); + (int32x2_t)__builtin_neon_vrev64v2si (__a, 1) #define vrev64_f32(__a) \ - (float32x2_t)__builtin_neon_vrev64v2sf (__a, 5); + (float32x2_t)__builtin_neon_vrev64v2sf (__a, 5) #define vrev64_u8(__a) \ - (uint8x8_t)__builtin_neon_vrev64v8qi (__a, 0); + (uint8x8_t)__builtin_neon_vrev64v8qi (__a, 0) #define vrev64_u16(__a) \ - (uint16x4_t)__builtin_neon_vrev64v4hi (__a, 0); + (uint16x4_t)__builtin_neon_vrev64v4hi (__a, 0) #define vrev64_u32(__a) \ - (uint32x2_t)__builtin_neon_vrev64v2si (__a, 0); + (uint32x2_t)__builtin_neon_vrev64v2si (__a, 0) #define vrev64_p8(__a) \ - (poly8x8_t)__builtin_neon_vrev64v8qi (__a, 4); + (poly8x8_t)__builtin_neon_vrev64v8qi (__a, 4) #define vrev64_p16(__a) \ - (poly16x4_t)__builtin_neon_vrev64v4hi (__a, 4); + (poly16x4_t)__builtin_neon_vrev64v4hi (__a, 4) #define vrev64q_s8(__a) \ - (int8x16_t)__builtin_neon_vrev64v16qi (__a, 1); + (int8x16_t)__builtin_neon_vrev64v16qi (__a, 1) #define vrev64q_s16(__a) \ - (int16x8_t)__builtin_neon_vrev64v8hi (__a, 1); + (int16x8_t)__builtin_neon_vrev64v8hi (__a, 1) #define vrev64q_s32(__a) \ - (int32x4_t)__builtin_neon_vrev64v4si (__a, 1); + (int32x4_t)__builtin_neon_vrev64v4si (__a, 1) #define vrev64q_f32(__a) \ - (float32x4_t)__builtin_neon_vrev64v4sf (__a, 5); + (float32x4_t)__builtin_neon_vrev64v4sf (__a, 5) #define vrev64q_u8(__a) \ - (uint8x16_t)__builtin_neon_vrev64v16qi (__a, 0); + (uint8x16_t)__builtin_neon_vrev64v16qi (__a, 0) #define vrev64q_u16(__a) \ - (uint16x8_t)__builtin_neon_vrev64v8hi (__a, 0); + (uint16x8_t)__builtin_neon_vrev64v8hi (__a, 0) #define vrev64q_u32(__a) \ - (uint32x4_t)__builtin_neon_vrev64v4si (__a, 0); + (uint32x4_t)__builtin_neon_vrev64v4si (__a, 0) #define vrev64q_p8(__a) \ - (poly8x16_t)__builtin_neon_vrev64v16qi (__a, 4); + (poly8x16_t)__builtin_neon_vrev64v16qi (__a, 4) #define vrev64q_p16(__a) \ - (poly16x8_t)__builtin_neon_vrev64v8hi (__a, 4); + (poly16x8_t)__builtin_neon_vrev64v8hi (__a, 4) #define vrev32_s8(__a) \ - (int8x8_t)__builtin_neon_vrev32v8qi (__a, 1); + (int8x8_t)__builtin_neon_vrev32v8qi (__a, 1) #define vrev32_s16(__a) \ - (int16x4_t)__builtin_neon_vrev32v4hi (__a, 1); + (int16x4_t)__builtin_neon_vrev32v4hi (__a, 1) #define vrev32_u8(__a) \ - (uint8x8_t)__builtin_neon_vrev32v8qi (__a, 0); + (uint8x8_t)__builtin_neon_vrev32v8qi (__a, 0) #define vrev32_u16(__a) \ - (uint16x4_t)__builtin_neon_vrev32v4hi (__a, 0); + (uint16x4_t)__builtin_neon_vrev32v4hi (__a, 0) #define vrev32_p8(__a) \ - (poly8x8_t)__builtin_neon_vrev32v8qi (__a, 4); + (poly8x8_t)__builtin_neon_vrev32v8qi (__a, 4) #define vrev32_p16(__a) \ - (poly16x4_t)__builtin_neon_vrev32v4hi (__a, 4); + (poly16x4_t)__builtin_neon_vrev32v4hi (__a, 4) #define vrev32q_s8(__a) \ - (int8x16_t)__builtin_neon_vrev32v16qi (__a, 1); + (int8x16_t)__builtin_neon_vrev32v16qi (__a, 1) #define vrev32q_s16(__a) \ - (int16x8_t)__builtin_neon_vrev32v8hi (__a, 1); + (int16x8_t)__builtin_neon_vrev32v8hi (__a, 1) #define vrev32q_u8(__a) \ - (uint8x16_t)__builtin_neon_vrev32v16qi (__a, 0); + (uint8x16_t)__builtin_neon_vrev32v16qi (__a, 0) #define vrev32q_u16(__a) \ - (uint16x8_t)__builtin_neon_vrev32v8hi (__a, 0); + (uint16x8_t)__builtin_neon_vrev32v8hi (__a, 0) #define vrev32q_p8(__a) \ - (poly8x16_t)__builtin_neon_vrev32v16qi (__a, 4); + (poly8x16_t)__builtin_neon_vrev32v16qi (__a, 4) #define vrev32q_p16(__a) \ - (poly16x8_t)__builtin_neon_vrev32v8hi (__a, 4); + (poly16x8_t)__builtin_neon_vrev32v8hi (__a, 4) #define vrev16_s8(__a) \ - (int8x8_t)__builtin_neon_vrev16v8qi (__a, 1); + (int8x8_t)__builtin_neon_vrev16v8qi (__a, 1) #define vrev16_u8(__a) \ - (uint8x8_t)__builtin_neon_vrev16v8qi (__a, 0); + (uint8x8_t)__builtin_neon_vrev16v8qi (__a, 0) #define vrev16_p8(__a) \ - (poly8x8_t)__builtin_neon_vrev16v8qi (__a, 4); + (poly8x8_t)__builtin_neon_vrev16v8qi (__a, 4) #define vrev16q_s8(__a) \ - (int8x16_t)__builtin_neon_vrev16v16qi (__a, 1); + (int8x16_t)__builtin_neon_vrev16v16qi (__a, 1) #define vrev16q_u8(__a) \ - (uint8x16_t)__builtin_neon_vrev16v16qi (__a, 0); + (uint8x16_t)__builtin_neon_vrev16v16qi (__a, 0) #define vrev16q_p8(__a) \ - (poly8x16_t)__builtin_neon_vrev16v16qi (__a, 4); + (poly8x16_t)__builtin_neon_vrev16v16qi (__a, 4) #define vbsl_s8(__a, __b, __c) \ - (int8x8_t)__builtin_neon_vbslv8qi (__a, __b, __c); + (int8x8_t)__builtin_neon_vbslv8qi (__a, __b, __c) #define vbsl_s16(__a, __b, __c) \ - (int16x4_t)__builtin_neon_vbslv4hi (__a, __b, __c); + (int16x4_t)__builtin_neon_vbslv4hi (__a, __b, __c) #define vbsl_s32(__a, __b, __c) \ - (int32x2_t)__builtin_neon_vbslv2si (__a, __b, __c); + (int32x2_t)__builtin_neon_vbslv2si (__a, __b, __c) #define vbsl_s64(__a, __b, __c) \ - (int64x1_t)__builtin_neon_vbsldi (__a, __b, __c); + (int64x1_t)__builtin_neon_vbsldi (__a, __b, __c) #define vbsl_f32(__a, __b, __c) \ - (float32x2_t)__builtin_neon_vbslv2sf (__a, __b, __c); + (float32x2_t)__builtin_neon_vbslv2sf (__a, __b, __c) #define vbsl_u8(__a, __b, __c) \ - (uint8x8_t)__builtin_neon_vbslv8qi (__a, __b, __c); + (uint8x8_t)__builtin_neon_vbslv8qi (__a, __b, __c) #define vbsl_u16(__a, __b, __c) \ - (uint16x4_t)__builtin_neon_vbslv4hi (__a, __b, __c); + (uint16x4_t)__builtin_neon_vbslv4hi (__a, __b, __c) #define vbsl_u32(__a, __b, __c) \ - (uint32x2_t)__builtin_neon_vbslv2si (__a, __b, __c); + (uint32x2_t)__builtin_neon_vbslv2si (__a, __b, __c) #define vbsl_u64(__a, __b, __c) \ - (uint64x1_t)__builtin_neon_vbsldi (__a, __b, __c); + (uint64x1_t)__builtin_neon_vbsldi (__a, __b, __c) #define vbsl_p8(__a, __b, __c) \ - (poly8x8_t)__builtin_neon_vbslv8qi (__a, __b, __c); + (poly8x8_t)__builtin_neon_vbslv8qi (__a, __b, __c) #define vbsl_p16(__a, __b, __c) \ - (poly16x4_t)__builtin_neon_vbslv4hi (__a, __b, __c); + (poly16x4_t)__builtin_neon_vbslv4hi (__a, __b, __c) #define vbslq_s8(__a, __b, __c) \ - (int8x16_t)__builtin_neon_vbslv16qi (__a, __b, __c); + (int8x16_t)__builtin_neon_vbslv16qi (__a, __b, __c) #define vbslq_s16(__a, __b, __c) \ - (int16x8_t)__builtin_neon_vbslv8hi (__a, __b, __c); + (int16x8_t)__builtin_neon_vbslv8hi (__a, __b, __c) #define vbslq_s32(__a, __b, __c) \ - (int32x4_t)__builtin_neon_vbslv4si (__a, __b, __c); + (int32x4_t)__builtin_neon_vbslv4si (__a, __b, __c) #define vbslq_s64(__a, __b, __c) \ - (int64x2_t)__builtin_neon_vbslv2di (__a, __b, __c); + (int64x2_t)__builtin_neon_vbslv2di (__a, __b, __c) #define vbslq_f32(__a, __b, __c) \ - (float32x4_t)__builtin_neon_vbslv4sf (__a, __b, __c); + (float32x4_t)__builtin_neon_vbslv4sf (__a, __b, __c) #define vbslq_u8(__a, __b, __c) \ - (uint8x16_t)__builtin_neon_vbslv16qi (__a, __b, __c); + (uint8x16_t)__builtin_neon_vbslv16qi (__a, __b, __c) #define vbslq_u16(__a, __b, __c) \ - (uint16x8_t)__builtin_neon_vbslv8hi (__a, __b, __c); + (uint16x8_t)__builtin_neon_vbslv8hi (__a, __b, __c) #define vbslq_u32(__a, __b, __c) \ - (uint32x4_t)__builtin_neon_vbslv4si (__a, __b, __c); + (uint32x4_t)__builtin_neon_vbslv4si (__a, __b, __c) #define vbslq_u64(__a, __b, __c) \ - (uint64x2_t)__builtin_neon_vbslv2di (__a, __b, __c); + (uint64x2_t)__builtin_neon_vbslv2di (__a, __b, __c) #define vbslq_p8(__a, __b, __c) \ - (poly8x16_t)__builtin_neon_vbslv16qi (__a, __b, __c); + (poly8x16_t)__builtin_neon_vbslv16qi (__a, __b, __c) #define vbslq_p16(__a, __b, __c) \ - (poly16x8_t)__builtin_neon_vbslv8hi (__a, __b, __c); + (poly16x8_t)__builtin_neon_vbslv8hi (__a, __b, __c) #define vtrn_s8(__a, __b) \ ({ \ @@ -4323,334 +4323,334 @@ }) #define vld1_s8(__a) \ - (int8x8_t)__builtin_neon_vld1v8qi (__a); + (int8x8_t)__builtin_neon_vld1v8qi (__a) #define vld1_s16(__a) \ - (int16x4_t)__builtin_neon_vld1v4hi (__a); + (int16x4_t)__builtin_neon_vld1v4hi (__a) #define vld1_s32(__a) \ - (int32x2_t)__builtin_neon_vld1v2si (__a); + (int32x2_t)__builtin_neon_vld1v2si (__a) #define vld1_s64(__a) \ - (int64x1_t)__builtin_neon_vld1di (__a); + (int64x1_t)__builtin_neon_vld1di (__a) #define vld1_f32(__a) \ - (float32x2_t)__builtin_neon_vld1v2sf (__a); + (float32x2_t)__builtin_neon_vld1v2sf (__a) #define vld1_u8(__a) \ - (uint8x8_t)__builtin_neon_vld1v8qi (__a); + (uint8x8_t)__builtin_neon_vld1v8qi (__a) #define vld1_u16(__a) \ - (uint16x4_t)__builtin_neon_vld1v4hi (__a); + (uint16x4_t)__builtin_neon_vld1v4hi (__a) #define vld1_u32(__a) \ - (uint32x2_t)__builtin_neon_vld1v2si (__a); + (uint32x2_t)__builtin_neon_vld1v2si (__a) #define vld1_u64(__a) \ - (uint64x1_t)__builtin_neon_vld1di (__a); + (uint64x1_t)__builtin_neon_vld1di (__a) #define vld1_p8(__a) \ - (poly8x8_t)__builtin_neon_vld1v8qi (__a); + (poly8x8_t)__builtin_neon_vld1v8qi (__a) #define vld1_p16(__a) \ - (poly16x4_t)__builtin_neon_vld1v4hi (__a); + (poly16x4_t)__builtin_neon_vld1v4hi (__a) #define vld1q_s8(__a) \ - (int8x16_t)__builtin_neon_vld1v16qi (__a); + (int8x16_t)__builtin_neon_vld1v16qi (__a) #define vld1q_s16(__a) \ - (int16x8_t)__builtin_neon_vld1v8hi (__a); + (int16x8_t)__builtin_neon_vld1v8hi (__a) #define vld1q_s32(__a) \ - (int32x4_t)__builtin_neon_vld1v4si (__a); + (int32x4_t)__builtin_neon_vld1v4si (__a) #define vld1q_s64(__a) \ - (int64x2_t)__builtin_neon_vld1v2di (__a); + (int64x2_t)__builtin_neon_vld1v2di (__a) #define vld1q_f32(__a) \ - (float32x4_t)__builtin_neon_vld1v4sf (__a); + (float32x4_t)__builtin_neon_vld1v4sf (__a) #define vld1q_u8(__a) \ - (uint8x16_t)__builtin_neon_vld1v16qi (__a); + (uint8x16_t)__builtin_neon_vld1v16qi (__a) #define vld1q_u16(__a) \ - (uint16x8_t)__builtin_neon_vld1v8hi (__a); + (uint16x8_t)__builtin_neon_vld1v8hi (__a) #define vld1q_u32(__a) \ - (uint32x4_t)__builtin_neon_vld1v4si (__a); + (uint32x4_t)__builtin_neon_vld1v4si (__a) #define vld1q_u64(__a) \ - (uint64x2_t)__builtin_neon_vld1v2di (__a); + (uint64x2_t)__builtin_neon_vld1v2di (__a) #define vld1q_p8(__a) \ - (poly8x16_t)__builtin_neon_vld1v16qi (__a); + (poly8x16_t)__builtin_neon_vld1v16qi (__a) #define vld1q_p16(__a) \ - (poly16x8_t)__builtin_neon_vld1v8hi (__a); + (poly16x8_t)__builtin_neon_vld1v8hi (__a) #define vld1_lane_s8(__a, __b, __c) \ - (int8x8_t)__builtin_neon_vld1_lanev8qi (__a, __b, __c); + (int8x8_t)__builtin_neon_vld1_lanev8qi (__a, __b, __c) #define vld1_lane_s16(__a, __b, __c) \ - (int16x4_t)__builtin_neon_vld1_lanev4hi (__a, __b, __c); + (int16x4_t)__builtin_neon_vld1_lanev4hi (__a, __b, __c) #define vld1_lane_s32(__a, __b, __c) \ - (int32x2_t)__builtin_neon_vld1_lanev2si (__a, __b, __c); + (int32x2_t)__builtin_neon_vld1_lanev2si (__a, __b, __c) #define vld1_lane_f32(__a, __b, __c) \ - (float32x2_t)__builtin_neon_vld1_lanev2sf (__a, __b, __c); + (float32x2_t)__builtin_neon_vld1_lanev2sf (__a, __b, __c) #define vld1_lane_u8(__a, __b, __c) \ - (uint8x8_t)__builtin_neon_vld1_lanev8qi (__a, __b, __c); + (uint8x8_t)__builtin_neon_vld1_lanev8qi (__a, __b, __c) #define vld1_lane_u16(__a, __b, __c) \ - (uint16x4_t)__builtin_neon_vld1_lanev4hi (__a, __b, __c); + (uint16x4_t)__builtin_neon_vld1_lanev4hi (__a, __b, __c) #define vld1_lane_u32(__a, __b, __c) \ - (uint32x2_t)__builtin_neon_vld1_lanev2si (__a, __b, __c); + (uint32x2_t)__builtin_neon_vld1_lanev2si (__a, __b, __c) #define vld1_lane_p8(__a, __b, __c) \ - (poly8x8_t)__builtin_neon_vld1_lanev8qi (__a, __b, __c); + (poly8x8_t)__builtin_neon_vld1_lanev8qi (__a, __b, __c) #define vld1_lane_p16(__a, __b, __c) \ - (poly16x4_t)__builtin_neon_vld1_lanev4hi (__a, __b, __c); + (poly16x4_t)__builtin_neon_vld1_lanev4hi (__a, __b, __c) #define vld1_lane_s64(__a, __b, __c) \ - (int64x1_t)__builtin_neon_vld1_lanedi (__a, __b, __c); + (int64x1_t)__builtin_neon_vld1_lanedi (__a, __b, __c) #define vld1_lane_u64(__a, __b, __c) \ - (uint64x1_t)__builtin_neon_vld1_lanedi (__a, __b, __c); + (uint64x1_t)__builtin_neon_vld1_lanedi (__a, __b, __c) #define vld1q_lane_s8(__a, __b, __c) \ - (int8x16_t)__builtin_neon_vld1_lanev16qi (__a, __b, __c); + (int8x16_t)__builtin_neon_vld1_lanev16qi (__a, __b, __c) #define vld1q_lane_s16(__a, __b, __c) \ - (int16x8_t)__builtin_neon_vld1_lanev8hi (__a, __b, __c); + (int16x8_t)__builtin_neon_vld1_lanev8hi (__a, __b, __c) #define vld1q_lane_s32(__a, __b, __c) \ - (int32x4_t)__builtin_neon_vld1_lanev4si (__a, __b, __c); + (int32x4_t)__builtin_neon_vld1_lanev4si (__a, __b, __c) #define vld1q_lane_f32(__a, __b, __c) \ - (float32x4_t)__builtin_neon_vld1_lanev4sf (__a, __b, __c); + (float32x4_t)__builtin_neon_vld1_lanev4sf (__a, __b, __c) #define vld1q_lane_u8(__a, __b, __c) \ - (uint8x16_t)__builtin_neon_vld1_lanev16qi (__a, __b, __c); + (uint8x16_t)__builtin_neon_vld1_lanev16qi (__a, __b, __c) #define vld1q_lane_u16(__a, __b, __c) \ - (uint16x8_t)__builtin_neon_vld1_lanev8hi (__a, __b, __c); + (uint16x8_t)__builtin_neon_vld1_lanev8hi (__a, __b, __c) #define vld1q_lane_u32(__a, __b, __c) \ - (uint32x4_t)__builtin_neon_vld1_lanev4si (__a, __b, __c); + (uint32x4_t)__builtin_neon_vld1_lanev4si (__a, __b, __c) #define vld1q_lane_p8(__a, __b, __c) \ - (poly8x16_t)__builtin_neon_vld1_lanev16qi (__a, __b, __c); + (poly8x16_t)__builtin_neon_vld1_lanev16qi (__a, __b, __c) #define vld1q_lane_p16(__a, __b, __c) \ - (poly16x8_t)__builtin_neon_vld1_lanev8hi (__a, __b, __c); + (poly16x8_t)__builtin_neon_vld1_lanev8hi (__a, __b, __c) #define vld1q_lane_s64(__a, __b, __c) \ - (int64x2_t)__builtin_neon_vld1_lanev2di (__a, __b, __c); + (int64x2_t)__builtin_neon_vld1_lanev2di (__a, __b, __c) #define vld1q_lane_u64(__a, __b, __c) \ - (uint64x2_t)__builtin_neon_vld1_lanev2di (__a, __b, __c); + (uint64x2_t)__builtin_neon_vld1_lanev2di (__a, __b, __c) #define vld1_dup_s8(__a) \ - (int8x8_t)__builtin_neon_vld1_dupv8qi (__a); + (int8x8_t)__builtin_neon_vld1_dupv8qi (__a) #define vld1_dup_s16(__a) \ - (int16x4_t)__builtin_neon_vld1_dupv4hi (__a); + (int16x4_t)__builtin_neon_vld1_dupv4hi (__a) #define vld1_dup_s32(__a) \ - (int32x2_t)__builtin_neon_vld1_dupv2si (__a); + (int32x2_t)__builtin_neon_vld1_dupv2si (__a) #define vld1_dup_f32(__a) \ - (float32x2_t)__builtin_neon_vld1_dupv2sf (__a); + (float32x2_t)__builtin_neon_vld1_dupv2sf (__a) #define vld1_dup_u8(__a) \ - (uint8x8_t)__builtin_neon_vld1_dupv8qi (__a); + (uint8x8_t)__builtin_neon_vld1_dupv8qi (__a) #define vld1_dup_u16(__a) \ - (uint16x4_t)__builtin_neon_vld1_dupv4hi (__a); + (uint16x4_t)__builtin_neon_vld1_dupv4hi (__a) #define vld1_dup_u32(__a) \ - (uint32x2_t)__builtin_neon_vld1_dupv2si (__a); + (uint32x2_t)__builtin_neon_vld1_dupv2si (__a) #define vld1_dup_p8(__a) \ - (poly8x8_t)__builtin_neon_vld1_dupv8qi (__a); + (poly8x8_t)__builtin_neon_vld1_dupv8qi (__a) #define vld1_dup_p16(__a) \ - (poly16x4_t)__builtin_neon_vld1_dupv4hi (__a); + (poly16x4_t)__builtin_neon_vld1_dupv4hi (__a) #define vld1_dup_s64(__a) \ - (int64x1_t)__builtin_neon_vld1_dupdi (__a); + (int64x1_t)__builtin_neon_vld1_dupdi (__a) #define vld1_dup_u64(__a) \ - (uint64x1_t)__builtin_neon_vld1_dupdi (__a); + (uint64x1_t)__builtin_neon_vld1_dupdi (__a) #define vld1q_dup_s8(__a) \ - (int8x16_t)__builtin_neon_vld1_dupv16qi (__a); + (int8x16_t)__builtin_neon_vld1_dupv16qi (__a) #define vld1q_dup_s16(__a) \ - (int16x8_t)__builtin_neon_vld1_dupv8hi (__a); + (int16x8_t)__builtin_neon_vld1_dupv8hi (__a) #define vld1q_dup_s32(__a) \ - (int32x4_t)__builtin_neon_vld1_dupv4si (__a); + (int32x4_t)__builtin_neon_vld1_dupv4si (__a) #define vld1q_dup_f32(__a) \ - (float32x4_t)__builtin_neon_vld1_dupv4sf (__a); + (float32x4_t)__builtin_neon_vld1_dupv4sf (__a) #define vld1q_dup_u8(__a) \ - (uint8x16_t)__builtin_neon_vld1_dupv16qi (__a); + (uint8x16_t)__builtin_neon_vld1_dupv16qi (__a) #define vld1q_dup_u16(__a) \ - (uint16x8_t)__builtin_neon_vld1_dupv8hi (__a); + (uint16x8_t)__builtin_neon_vld1_dupv8hi (__a) #define vld1q_dup_u32(__a) \ - (uint32x4_t)__builtin_neon_vld1_dupv4si (__a); + (uint32x4_t)__builtin_neon_vld1_dupv4si (__a) #define vld1q_dup_p8(__a) \ - (poly8x16_t)__builtin_neon_vld1_dupv16qi (__a); + (poly8x16_t)__builtin_neon_vld1_dupv16qi (__a) #define vld1q_dup_p16(__a) \ - (poly16x8_t)__builtin_neon_vld1_dupv8hi (__a); + (poly16x8_t)__builtin_neon_vld1_dupv8hi (__a) #define vld1q_dup_s64(__a) \ - (int64x2_t)__builtin_neon_vld1_dupv2di (__a); + (int64x2_t)__builtin_neon_vld1_dupv2di (__a) #define vld1q_dup_u64(__a) \ - (uint64x2_t)__builtin_neon_vld1_dupv2di (__a); + (uint64x2_t)__builtin_neon_vld1_dupv2di (__a) #define vst1_s8(__a, __b) \ - __builtin_neon_vst1v8qi (__a, __b); + __builtin_neon_vst1v8qi (__a, __b) #define vst1_s16(__a, __b) \ - __builtin_neon_vst1v4hi (__a, __b); + __builtin_neon_vst1v4hi (__a, __b) #define vst1_s32(__a, __b) \ - __builtin_neon_vst1v2si (__a, __b); + __builtin_neon_vst1v2si (__a, __b) #define vst1_s64(__a, __b) \ - __builtin_neon_vst1di (__a, __b); + __builtin_neon_vst1di (__a, __b) #define vst1_f32(__a, __b) \ - __builtin_neon_vst1v2sf (__a, __b); + __builtin_neon_vst1v2sf (__a, __b) #define vst1_u8(__a, __b) \ - __builtin_neon_vst1v8qi (__a, __b); + __builtin_neon_vst1v8qi (__a, __b) #define vst1_u16(__a, __b) \ - __builtin_neon_vst1v4hi (__a, __b); + __builtin_neon_vst1v4hi (__a, __b) #define vst1_u32(__a, __b) \ - __builtin_neon_vst1v2si (__a, __b); + __builtin_neon_vst1v2si (__a, __b) #define vst1_u64(__a, __b) \ - __builtin_neon_vst1di (__a, __b); + __builtin_neon_vst1di (__a, __b) #define vst1_p8(__a, __b) \ - __builtin_neon_vst1v8qi (__a, __b); + __builtin_neon_vst1v8qi (__a, __b) #define vst1_p16(__a, __b) \ - __builtin_neon_vst1v4hi (__a, __b); + __builtin_neon_vst1v4hi (__a, __b) #define vst1q_s8(__a, __b) \ - __builtin_neon_vst1v16qi (__a, __b); + __builtin_neon_vst1v16qi (__a, __b) #define vst1q_s16(__a, __b) \ - __builtin_neon_vst1v8hi (__a, __b); + __builtin_neon_vst1v8hi (__a, __b) #define vst1q_s32(__a, __b) \ - __builtin_neon_vst1v4si (__a, __b); + __builtin_neon_vst1v4si (__a, __b) #define vst1q_s64(__a, __b) \ - __builtin_neon_vst1v2di (__a, __b); + __builtin_neon_vst1v2di (__a, __b) #define vst1q_f32(__a, __b) \ - __builtin_neon_vst1v4sf (__a, __b); + __builtin_neon_vst1v4sf (__a, __b) #define vst1q_u8(__a, __b) \ - __builtin_neon_vst1v16qi (__a, __b); + __builtin_neon_vst1v16qi (__a, __b) #define vst1q_u16(__a, __b) \ - __builtin_neon_vst1v8hi (__a, __b); + __builtin_neon_vst1v8hi (__a, __b) #define vst1q_u32(__a, __b) \ - __builtin_neon_vst1v4si (__a, __b); + __builtin_neon_vst1v4si (__a, __b) #define vst1q_u64(__a, __b) \ - __builtin_neon_vst1v2di (__a, __b); + __builtin_neon_vst1v2di (__a, __b) #define vst1q_p8(__a, __b) \ - __builtin_neon_vst1v16qi (__a, __b); + __builtin_neon_vst1v16qi (__a, __b) #define vst1q_p16(__a, __b) \ - __builtin_neon_vst1v8hi (__a, __b); + __builtin_neon_vst1v8hi (__a, __b) #define vst1_lane_s8(__a, __b, __c) \ - __builtin_neon_vst1_lanev8qi (__a, __b, __c); + __builtin_neon_vst1_lanev8qi (__a, __b, __c) #define vst1_lane_s16(__a, __b, __c) \ - __builtin_neon_vst1_lanev4hi (__a, __b, __c); + __builtin_neon_vst1_lanev4hi (__a, __b, __c) #define vst1_lane_s32(__a, __b, __c) \ - __builtin_neon_vst1_lanev2si (__a, __b, __c); + __builtin_neon_vst1_lanev2si (__a, __b, __c) #define vst1_lane_f32(__a, __b, __c) \ - __builtin_neon_vst1_lanev2sf (__a, __b, __c); + __builtin_neon_vst1_lanev2sf (__a, __b, __c) #define vst1_lane_u8(__a, __b, __c) \ - __builtin_neon_vst1_lanev8qi (__a, __b, __c); + __builtin_neon_vst1_lanev8qi (__a, __b, __c) #define vst1_lane_u16(__a, __b, __c) \ - __builtin_neon_vst1_lanev4hi (__a, __b, __c); + __builtin_neon_vst1_lanev4hi (__a, __b, __c) #define vst1_lane_u32(__a, __b, __c) \ - __builtin_neon_vst1_lanev2si (__a, __b, __c); + __builtin_neon_vst1_lanev2si (__a, __b, __c) #define vst1_lane_p8(__a, __b, __c) \ - __builtin_neon_vst1_lanev8qi (__a, __b, __c); + __builtin_neon_vst1_lanev8qi (__a, __b, __c) #define vst1_lane_p16(__a, __b, __c) \ - __builtin_neon_vst1_lanev4hi (__a, __b, __c); + __builtin_neon_vst1_lanev4hi (__a, __b, __c) #define vst1_lane_s64(__a, __b, __c) \ - __builtin_neon_vst1_lanedi (__a, __b, __c); + __builtin_neon_vst1_lanedi (__a, __b, __c) #define vst1_lane_u64(__a, __b, __c) \ - __builtin_neon_vst1_lanedi (__a, __b, __c); + __builtin_neon_vst1_lanedi (__a, __b, __c) #define vst1q_lane_s8(__a, __b, __c) \ - __builtin_neon_vst1_lanev16qi (__a, __b, __c); + __builtin_neon_vst1_lanev16qi (__a, __b, __c) #define vst1q_lane_s16(__a, __b, __c) \ - __builtin_neon_vst1_lanev8hi (__a, __b, __c); + __builtin_neon_vst1_lanev8hi (__a, __b, __c) #define vst1q_lane_s32(__a, __b, __c) \ - __builtin_neon_vst1_lanev4si (__a, __b, __c); + __builtin_neon_vst1_lanev4si (__a, __b, __c) #define vst1q_lane_f32(__a, __b, __c) \ - __builtin_neon_vst1_lanev4sf (__a, __b, __c); + __builtin_neon_vst1_lanev4sf (__a, __b, __c) #define vst1q_lane_u8(__a, __b, __c) \ - __builtin_neon_vst1_lanev16qi (__a, __b, __c); + __builtin_neon_vst1_lanev16qi (__a, __b, __c) #define vst1q_lane_u16(__a, __b, __c) \ - __builtin_neon_vst1_lanev8hi (__a, __b, __c); + __builtin_neon_vst1_lanev8hi (__a, __b, __c) #define vst1q_lane_u32(__a, __b, __c) \ - __builtin_neon_vst1_lanev4si (__a, __b, __c); + __builtin_neon_vst1_lanev4si (__a, __b, __c) #define vst1q_lane_p8(__a, __b, __c) \ - __builtin_neon_vst1_lanev16qi (__a, __b, __c); + __builtin_neon_vst1_lanev16qi (__a, __b, __c) #define vst1q_lane_p16(__a, __b, __c) \ - __builtin_neon_vst1_lanev8hi (__a, __b, __c); + __builtin_neon_vst1_lanev8hi (__a, __b, __c) #define vst1q_lane_s64(__a, __b, __c) \ - __builtin_neon_vst1_lanev2di (__a, __b, __c); + __builtin_neon_vst1_lanev2di (__a, __b, __c) #define vst1q_lane_u64(__a, __b, __c) \ - __builtin_neon_vst1_lanev2di (__a, __b, __c); + __builtin_neon_vst1_lanev2di (__a, __b, __c) #define vld2_s8(__a) \ ({ \ @@ -6294,905 +6294,905 @@ }) #define vand_s8(__a, __b) \ - (int8x8_t)__builtin_neon_vandv8qi (__a, __b, 1); + (int8x8_t)__builtin_neon_vandv8qi (__a, __b, 1) #define vand_s16(__a, __b) \ - (int16x4_t)__builtin_neon_vandv4hi (__a, __b, 1); + (int16x4_t)__builtin_neon_vandv4hi (__a, __b, 1) #define vand_s32(__a, __b) \ - (int32x2_t)__builtin_neon_vandv2si (__a, __b, 1); + (int32x2_t)__builtin_neon_vandv2si (__a, __b, 1) #define vand_s64(__a, __b) \ - (int64x1_t)__builtin_neon_vanddi (__a, __b, 1); + (int64x1_t)__builtin_neon_vanddi (__a, __b, 1) #define vand_u8(__a, __b) \ - (uint8x8_t)__builtin_neon_vandv8qi (__a, __b, 0); + (uint8x8_t)__builtin_neon_vandv8qi (__a, __b, 0) #define vand_u16(__a, __b) \ - (uint16x4_t)__builtin_neon_vandv4hi (__a, __b, 0); + (uint16x4_t)__builtin_neon_vandv4hi (__a, __b, 0) #define vand_u32(__a, __b) \ - (uint32x2_t)__builtin_neon_vandv2si (__a, __b, 0); + (uint32x2_t)__builtin_neon_vandv2si (__a, __b, 0) #define vand_u64(__a, __b) \ - (uint64x1_t)__builtin_neon_vanddi (__a, __b, 0); + (uint64x1_t)__builtin_neon_vanddi (__a, __b, 0) #define vandq_s8(__a, __b) \ - (int8x16_t)__builtin_neon_vandv16qi (__a, __b, 1); + (int8x16_t)__builtin_neon_vandv16qi (__a, __b, 1) #define vandq_s16(__a, __b) \ - (int16x8_t)__builtin_neon_vandv8hi (__a, __b, 1); + (int16x8_t)__builtin_neon_vandv8hi (__a, __b, 1) #define vandq_s32(__a, __b) \ - (int32x4_t)__builtin_neon_vandv4si (__a, __b, 1); + (int32x4_t)__builtin_neon_vandv4si (__a, __b, 1) #define vandq_s64(__a, __b) \ - (int64x2_t)__builtin_neon_vandv2di (__a, __b, 1); + (int64x2_t)__builtin_neon_vandv2di (__a, __b, 1) #define vandq_u8(__a, __b) \ - (uint8x16_t)__builtin_neon_vandv16qi (__a, __b, 0); + (uint8x16_t)__builtin_neon_vandv16qi (__a, __b, 0) #define vandq_u16(__a, __b) \ - (uint16x8_t)__builtin_neon_vandv8hi (__a, __b, 0); + (uint16x8_t)__builtin_neon_vandv8hi (__a, __b, 0) #define vandq_u32(__a, __b) \ - (uint32x4_t)__builtin_neon_vandv4si (__a, __b, 0); + (uint32x4_t)__builtin_neon_vandv4si (__a, __b, 0) #define vandq_u64(__a, __b) \ - (uint64x2_t)__builtin_neon_vandv2di (__a, __b, 0); + (uint64x2_t)__builtin_neon_vandv2di (__a, __b, 0) #define vorr_s8(__a, __b) \ - (int8x8_t)__builtin_neon_vorrv8qi (__a, __b, 1); + (int8x8_t)__builtin_neon_vorrv8qi (__a, __b, 1) #define vorr_s16(__a, __b) \ - (int16x4_t)__builtin_neon_vorrv4hi (__a, __b, 1); + (int16x4_t)__builtin_neon_vorrv4hi (__a, __b, 1) #define vorr_s32(__a, __b) \ - (int32x2_t)__builtin_neon_vorrv2si (__a, __b, 1); + (int32x2_t)__builtin_neon_vorrv2si (__a, __b, 1) #define vorr_s64(__a, __b) \ - (int64x1_t)__builtin_neon_vorrdi (__a, __b, 1); + (int64x1_t)__builtin_neon_vorrdi (__a, __b, 1) #define vorr_u8(__a, __b) \ - (uint8x8_t)__builtin_neon_vorrv8qi (__a, __b, 0); + (uint8x8_t)__builtin_neon_vorrv8qi (__a, __b, 0) #define vorr_u16(__a, __b) \ - (uint16x4_t)__builtin_neon_vorrv4hi (__a, __b, 0); + (uint16x4_t)__builtin_neon_vorrv4hi (__a, __b, 0) #define vorr_u32(__a, __b) \ - (uint32x2_t)__builtin_neon_vorrv2si (__a, __b, 0); + (uint32x2_t)__builtin_neon_vorrv2si (__a, __b, 0) #define vorr_u64(__a, __b) \ - (uint64x1_t)__builtin_neon_vorrdi (__a, __b, 0); + (uint64x1_t)__builtin_neon_vorrdi (__a, __b, 0) #define vorrq_s8(__a, __b) \ - (int8x16_t)__builtin_neon_vorrv16qi (__a, __b, 1); + (int8x16_t)__builtin_neon_vorrv16qi (__a, __b, 1) #define vorrq_s16(__a, __b) \ - (int16x8_t)__builtin_neon_vorrv8hi (__a, __b, 1); + (int16x8_t)__builtin_neon_vorrv8hi (__a, __b, 1) #define vorrq_s32(__a, __b) \ - (int32x4_t)__builtin_neon_vorrv4si (__a, __b, 1); + (int32x4_t)__builtin_neon_vorrv4si (__a, __b, 1) #define vorrq_s64(__a, __b) \ - (int64x2_t)__builtin_neon_vorrv2di (__a, __b, 1); + (int64x2_t)__builtin_neon_vorrv2di (__a, __b, 1) #define vorrq_u8(__a, __b) \ - (uint8x16_t)__builtin_neon_vorrv16qi (__a, __b, 0); + (uint8x16_t)__builtin_neon_vorrv16qi (__a, __b, 0) #define vorrq_u16(__a, __b) \ - (uint16x8_t)__builtin_neon_vorrv8hi (__a, __b, 0); + (uint16x8_t)__builtin_neon_vorrv8hi (__a, __b, 0) #define vorrq_u32(__a, __b) \ - (uint32x4_t)__builtin_neon_vorrv4si (__a, __b, 0); + (uint32x4_t)__builtin_neon_vorrv4si (__a, __b, 0) #define vorrq_u64(__a, __b) \ - (uint64x2_t)__builtin_neon_vorrv2di (__a, __b, 0); + (uint64x2_t)__builtin_neon_vorrv2di (__a, __b, 0) #define veor_s8(__a, __b) \ - (int8x8_t)__builtin_neon_veorv8qi (__a, __b, 1); + (int8x8_t)__builtin_neon_veorv8qi (__a, __b, 1) #define veor_s16(__a, __b) \ - (int16x4_t)__builtin_neon_veorv4hi (__a, __b, 1); + (int16x4_t)__builtin_neon_veorv4hi (__a, __b, 1) #define veor_s32(__a, __b) \ - (int32x2_t)__builtin_neon_veorv2si (__a, __b, 1); + (int32x2_t)__builtin_neon_veorv2si (__a, __b, 1) #define veor_s64(__a, __b) \ - (int64x1_t)__builtin_neon_veordi (__a, __b, 1); + (int64x1_t)__builtin_neon_veordi (__a, __b, 1) #define veor_u8(__a, __b) \ - (uint8x8_t)__builtin_neon_veorv8qi (__a, __b, 0); + (uint8x8_t)__builtin_neon_veorv8qi (__a, __b, 0) #define veor_u16(__a, __b) \ - (uint16x4_t)__builtin_neon_veorv4hi (__a, __b, 0); + (uint16x4_t)__builtin_neon_veorv4hi (__a, __b, 0) #define veor_u32(__a, __b) \ - (uint32x2_t)__builtin_neon_veorv2si (__a, __b, 0); + (uint32x2_t)__builtin_neon_veorv2si (__a, __b, 0) #define veor_u64(__a, __b) \ - (uint64x1_t)__builtin_neon_veordi (__a, __b, 0); + (uint64x1_t)__builtin_neon_veordi (__a, __b, 0) #define veorq_s8(__a, __b) \ - (int8x16_t)__builtin_neon_veorv16qi (__a, __b, 1); + (int8x16_t)__builtin_neon_veorv16qi (__a, __b, 1) #define veorq_s16(__a, __b) \ - (int16x8_t)__builtin_neon_veorv8hi (__a, __b, 1); + (int16x8_t)__builtin_neon_veorv8hi (__a, __b, 1) #define veorq_s32(__a, __b) \ - (int32x4_t)__builtin_neon_veorv4si (__a, __b, 1); + (int32x4_t)__builtin_neon_veorv4si (__a, __b, 1) #define veorq_s64(__a, __b) \ - (int64x2_t)__builtin_neon_veorv2di (__a, __b, 1); + (int64x2_t)__builtin_neon_veorv2di (__a, __b, 1) #define veorq_u8(__a, __b) \ - (uint8x16_t)__builtin_neon_veorv16qi (__a, __b, 0); + (uint8x16_t)__builtin_neon_veorv16qi (__a, __b, 0) #define veorq_u16(__a, __b) \ - (uint16x8_t)__builtin_neon_veorv8hi (__a, __b, 0); + (uint16x8_t)__builtin_neon_veorv8hi (__a, __b, 0) #define veorq_u32(__a, __b) \ - (uint32x4_t)__builtin_neon_veorv4si (__a, __b, 0); + (uint32x4_t)__builtin_neon_veorv4si (__a, __b, 0) #define veorq_u64(__a, __b) \ - (uint64x2_t)__builtin_neon_veorv2di (__a, __b, 0); + (uint64x2_t)__builtin_neon_veorv2di (__a, __b, 0) #define vbic_s8(__a, __b) \ - (int8x8_t)__builtin_neon_vbicv8qi (__a, __b, 1); + (int8x8_t)__builtin_neon_vbicv8qi (__a, __b, 1) #define vbic_s16(__a, __b) \ - (int16x4_t)__builtin_neon_vbicv4hi (__a, __b, 1); + (int16x4_t)__builtin_neon_vbicv4hi (__a, __b, 1) #define vbic_s32(__a, __b) \ - (int32x2_t)__builtin_neon_vbicv2si (__a, __b, 1); + (int32x2_t)__builtin_neon_vbicv2si (__a, __b, 1) #define vbic_s64(__a, __b) \ - (int64x1_t)__builtin_neon_vbicdi (__a, __b, 1); + (int64x1_t)__builtin_neon_vbicdi (__a, __b, 1) #define vbic_u8(__a, __b) \ - (uint8x8_t)__builtin_neon_vbicv8qi (__a, __b, 0); + (uint8x8_t)__builtin_neon_vbicv8qi (__a, __b, 0) #define vbic_u16(__a, __b) \ - (uint16x4_t)__builtin_neon_vbicv4hi (__a, __b, 0); + (uint16x4_t)__builtin_neon_vbicv4hi (__a, __b, 0) #define vbic_u32(__a, __b) \ - (uint32x2_t)__builtin_neon_vbicv2si (__a, __b, 0); + (uint32x2_t)__builtin_neon_vbicv2si (__a, __b, 0) #define vbic_u64(__a, __b) \ - (uint64x1_t)__builtin_neon_vbicdi (__a, __b, 0); + (uint64x1_t)__builtin_neon_vbicdi (__a, __b, 0) #define vbicq_s8(__a, __b) \ - (int8x16_t)__builtin_neon_vbicv16qi (__a, __b, 1); + (int8x16_t)__builtin_neon_vbicv16qi (__a, __b, 1) #define vbicq_s16(__a, __b) \ - (int16x8_t)__builtin_neon_vbicv8hi (__a, __b, 1); + (int16x8_t)__builtin_neon_vbicv8hi (__a, __b, 1) #define vbicq_s32(__a, __b) \ - (int32x4_t)__builtin_neon_vbicv4si (__a, __b, 1); + (int32x4_t)__builtin_neon_vbicv4si (__a, __b, 1) #define vbicq_s64(__a, __b) \ - (int64x2_t)__builtin_neon_vbicv2di (__a, __b, 1); + (int64x2_t)__builtin_neon_vbicv2di (__a, __b, 1) #define vbicq_u8(__a, __b) \ - (uint8x16_t)__builtin_neon_vbicv16qi (__a, __b, 0); + (uint8x16_t)__builtin_neon_vbicv16qi (__a, __b, 0) #define vbicq_u16(__a, __b) \ - (uint16x8_t)__builtin_neon_vbicv8hi (__a, __b, 0); + (uint16x8_t)__builtin_neon_vbicv8hi (__a, __b, 0) #define vbicq_u32(__a, __b) \ - (uint32x4_t)__builtin_neon_vbicv4si (__a, __b, 0); + (uint32x4_t)__builtin_neon_vbicv4si (__a, __b, 0) #define vbicq_u64(__a, __b) \ - (uint64x2_t)__builtin_neon_vbicv2di (__a, __b, 0); + (uint64x2_t)__builtin_neon_vbicv2di (__a, __b, 0) #define vorn_s8(__a, __b) \ - (int8x8_t)__builtin_neon_vornv8qi (__a, __b, 1); + (int8x8_t)__builtin_neon_vornv8qi (__a, __b, 1) #define vorn_s16(__a, __b) \ - (int16x4_t)__builtin_neon_vornv4hi (__a, __b, 1); + (int16x4_t)__builtin_neon_vornv4hi (__a, __b, 1) #define vorn_s32(__a, __b) \ - (int32x2_t)__builtin_neon_vornv2si (__a, __b, 1); + (int32x2_t)__builtin_neon_vornv2si (__a, __b, 1) #define vorn_s64(__a, __b) \ - (int64x1_t)__builtin_neon_vorndi (__a, __b, 1); + (int64x1_t)__builtin_neon_vorndi (__a, __b, 1) #define vorn_u8(__a, __b) \ - (uint8x8_t)__builtin_neon_vornv8qi (__a, __b, 0); + (uint8x8_t)__builtin_neon_vornv8qi (__a, __b, 0) #define vorn_u16(__a, __b) \ - (uint16x4_t)__builtin_neon_vornv4hi (__a, __b, 0); + (uint16x4_t)__builtin_neon_vornv4hi (__a, __b, 0) #define vorn_u32(__a, __b) \ - (uint32x2_t)__builtin_neon_vornv2si (__a, __b, 0); + (uint32x2_t)__builtin_neon_vornv2si (__a, __b, 0) #define vorn_u64(__a, __b) \ - (uint64x1_t)__builtin_neon_vorndi (__a, __b, 0); + (uint64x1_t)__builtin_neon_vorndi (__a, __b, 0) #define vornq_s8(__a, __b) \ - (int8x16_t)__builtin_neon_vornv16qi (__a, __b, 1); + (int8x16_t)__builtin_neon_vornv16qi (__a, __b, 1) #define vornq_s16(__a, __b) \ - (int16x8_t)__builtin_neon_vornv8hi (__a, __b, 1); + (int16x8_t)__builtin_neon_vornv8hi (__a, __b, 1) #define vornq_s32(__a, __b) \ - (int32x4_t)__builtin_neon_vornv4si (__a, __b, 1); + (int32x4_t)__builtin_neon_vornv4si (__a, __b, 1) #define vornq_s64(__a, __b) \ - (int64x2_t)__builtin_neon_vornv2di (__a, __b, 1); + (int64x2_t)__builtin_neon_vornv2di (__a, __b, 1) #define vornq_u8(__a, __b) \ - (uint8x16_t)__builtin_neon_vornv16qi (__a, __b, 0); + (uint8x16_t)__builtin_neon_vornv16qi (__a, __b, 0) #define vornq_u16(__a, __b) \ - (uint16x8_t)__builtin_neon_vornv8hi (__a, __b, 0); + (uint16x8_t)__builtin_neon_vornv8hi (__a, __b, 0) #define vornq_u32(__a, __b) \ - (uint32x4_t)__builtin_neon_vornv4si (__a, __b, 0); + (uint32x4_t)__builtin_neon_vornv4si (__a, __b, 0) #define vornq_u64(__a, __b) \ - (uint64x2_t)__builtin_neon_vornv2di (__a, __b, 0); + (uint64x2_t)__builtin_neon_vornv2di (__a, __b, 0) #define vreinterpret_p8_s8(__a) \ - (poly8x8_t)__builtin_neon_vreinterpretv8qiv8qi (__a); + (poly8x8_t)__builtin_neon_vreinterpretv8qiv8qi (__a) #define vreinterpret_p8_s16(__a) \ - (poly8x8_t)__builtin_neon_vreinterpretv8qiv4hi (__a); + (poly8x8_t)__builtin_neon_vreinterpretv8qiv4hi (__a) #define vreinterpret_p8_s32(__a) \ - (poly8x8_t)__builtin_neon_vreinterpretv8qiv2si (__a); + (poly8x8_t)__builtin_neon_vreinterpretv8qiv2si (__a) #define vreinterpret_p8_s64(__a) \ - (poly8x8_t)__builtin_neon_vreinterpretv8qidi (__a); + (poly8x8_t)__builtin_neon_vreinterpretv8qidi (__a) #define vreinterpret_p8_f32(__a) \ - (poly8x8_t)__builtin_neon_vreinterpretv8qiv2sf (__a); + (poly8x8_t)__builtin_neon_vreinterpretv8qiv2sf (__a) #define vreinterpret_p8_u8(__a) \ - (poly8x8_t)__builtin_neon_vreinterpretv8qiv8qi (__a); + (poly8x8_t)__builtin_neon_vreinterpretv8qiv8qi (__a) #define vreinterpret_p8_u16(__a) \ - (poly8x8_t)__builtin_neon_vreinterpretv8qiv4hi (__a); + (poly8x8_t)__builtin_neon_vreinterpretv8qiv4hi (__a) #define vreinterpret_p8_u32(__a) \ - (poly8x8_t)__builtin_neon_vreinterpretv8qiv2si (__a); + (poly8x8_t)__builtin_neon_vreinterpretv8qiv2si (__a) #define vreinterpret_p8_u64(__a) \ - (poly8x8_t)__builtin_neon_vreinterpretv8qidi (__a); + (poly8x8_t)__builtin_neon_vreinterpretv8qidi (__a) #define vreinterpret_p8_p16(__a) \ - (poly8x8_t)__builtin_neon_vreinterpretv8qiv4hi (__a); + (poly8x8_t)__builtin_neon_vreinterpretv8qiv4hi (__a) #define vreinterpretq_p8_s8(__a) \ - (poly8x16_t)__builtin_neon_vreinterpretv16qiv16qi (__a); + (poly8x16_t)__builtin_neon_vreinterpretv16qiv16qi (__a) #define vreinterpretq_p8_s16(__a) \ - (poly8x16_t)__builtin_neon_vreinterpretv16qiv8hi (__a); + (poly8x16_t)__builtin_neon_vreinterpretv16qiv8hi (__a) #define vreinterpretq_p8_s32(__a) \ - (poly8x16_t)__builtin_neon_vreinterpretv16qiv4si (__a); + (poly8x16_t)__builtin_neon_vreinterpretv16qiv4si (__a) #define vreinterpretq_p8_s64(__a) \ - (poly8x16_t)__builtin_neon_vreinterpretv16qiv2di (__a); + (poly8x16_t)__builtin_neon_vreinterpretv16qiv2di (__a) #define vreinterpretq_p8_f32(__a) \ - (poly8x16_t)__builtin_neon_vreinterpretv16qiv4sf (__a); + (poly8x16_t)__builtin_neon_vreinterpretv16qiv4sf (__a) #define vreinterpretq_p8_u8(__a) \ - (poly8x16_t)__builtin_neon_vreinterpretv16qiv16qi (__a); + (poly8x16_t)__builtin_neon_vreinterpretv16qiv16qi (__a) #define vreinterpretq_p8_u16(__a) \ - (poly8x16_t)__builtin_neon_vreinterpretv16qiv8hi (__a); + (poly8x16_t)__builtin_neon_vreinterpretv16qiv8hi (__a) #define vreinterpretq_p8_u32(__a) \ - (poly8x16_t)__builtin_neon_vreinterpretv16qiv4si (__a); + (poly8x16_t)__builtin_neon_vreinterpretv16qiv4si (__a) #define vreinterpretq_p8_u64(__a) \ - (poly8x16_t)__builtin_neon_vreinterpretv16qiv2di (__a); + (poly8x16_t)__builtin_neon_vreinterpretv16qiv2di (__a) #define vreinterpretq_p8_p16(__a) \ - (poly8x16_t)__builtin_neon_vreinterpretv16qiv8hi (__a); + (poly8x16_t)__builtin_neon_vreinterpretv16qiv8hi (__a) #define vreinterpret_p16_s8(__a) \ - (poly16x4_t)__builtin_neon_vreinterpretv4hiv8qi (__a); + (poly16x4_t)__builtin_neon_vreinterpretv4hiv8qi (__a) #define vreinterpret_p16_s16(__a) \ - (poly16x4_t)__builtin_neon_vreinterpretv4hiv4hi (__a); + (poly16x4_t)__builtin_neon_vreinterpretv4hiv4hi (__a) #define vreinterpret_p16_s32(__a) \ - (poly16x4_t)__builtin_neon_vreinterpretv4hiv2si (__a); + (poly16x4_t)__builtin_neon_vreinterpretv4hiv2si (__a) #define vreinterpret_p16_s64(__a) \ - (poly16x4_t)__builtin_neon_vreinterpretv4hidi (__a); + (poly16x4_t)__builtin_neon_vreinterpretv4hidi (__a) #define vreinterpret_p16_f32(__a) \ - (poly16x4_t)__builtin_neon_vreinterpretv4hiv2sf (__a); + (poly16x4_t)__builtin_neon_vreinterpretv4hiv2sf (__a) #define vreinterpret_p16_u8(__a) \ - (poly16x4_t)__builtin_neon_vreinterpretv4hiv8qi (__a); + (poly16x4_t)__builtin_neon_vreinterpretv4hiv8qi (__a) #define vreinterpret_p16_u16(__a) \ - (poly16x4_t)__builtin_neon_vreinterpretv4hiv4hi (__a); + (poly16x4_t)__builtin_neon_vreinterpretv4hiv4hi (__a) #define vreinterpret_p16_u32(__a) \ - (poly16x4_t)__builtin_neon_vreinterpretv4hiv2si (__a); + (poly16x4_t)__builtin_neon_vreinterpretv4hiv2si (__a) #define vreinterpret_p16_u64(__a) \ - (poly16x4_t)__builtin_neon_vreinterpretv4hidi (__a); + (poly16x4_t)__builtin_neon_vreinterpretv4hidi (__a) #define vreinterpret_p16_p8(__a) \ - (poly16x4_t)__builtin_neon_vreinterpretv4hiv8qi (__a); + (poly16x4_t)__builtin_neon_vreinterpretv4hiv8qi (__a) #define vreinterpretq_p16_s8(__a) \ - (poly16x8_t)__builtin_neon_vreinterpretv8hiv16qi (__a); + (poly16x8_t)__builtin_neon_vreinterpretv8hiv16qi (__a) #define vreinterpretq_p16_s16(__a) \ - (poly16x8_t)__builtin_neon_vreinterpretv8hiv8hi (__a); + (poly16x8_t)__builtin_neon_vreinterpretv8hiv8hi (__a) #define vreinterpretq_p16_s32(__a) \ - (poly16x8_t)__builtin_neon_vreinterpretv8hiv4si (__a); + (poly16x8_t)__builtin_neon_vreinterpretv8hiv4si (__a) #define vreinterpretq_p16_s64(__a) \ - (poly16x8_t)__builtin_neon_vreinterpretv8hiv2di (__a); + (poly16x8_t)__builtin_neon_vreinterpretv8hiv2di (__a) #define vreinterpretq_p16_f32(__a) \ - (poly16x8_t)__builtin_neon_vreinterpretv8hiv4sf (__a); + (poly16x8_t)__builtin_neon_vreinterpretv8hiv4sf (__a) #define vreinterpretq_p16_u8(__a) \ - (poly16x8_t)__builtin_neon_vreinterpretv8hiv16qi (__a); + (poly16x8_t)__builtin_neon_vreinterpretv8hiv16qi (__a) #define vreinterpretq_p16_u16(__a) \ - (poly16x8_t)__builtin_neon_vreinterpretv8hiv8hi (__a); + (poly16x8_t)__builtin_neon_vreinterpretv8hiv8hi (__a) #define vreinterpretq_p16_u32(__a) \ - (poly16x8_t)__builtin_neon_vreinterpretv8hiv4si (__a); + (poly16x8_t)__builtin_neon_vreinterpretv8hiv4si (__a) #define vreinterpretq_p16_u64(__a) \ - (poly16x8_t)__builtin_neon_vreinterpretv8hiv2di (__a); + (poly16x8_t)__builtin_neon_vreinterpretv8hiv2di (__a) #define vreinterpretq_p16_p8(__a) \ - (poly16x8_t)__builtin_neon_vreinterpretv8hiv16qi (__a); + (poly16x8_t)__builtin_neon_vreinterpretv8hiv16qi (__a) #define vreinterpret_f32_s8(__a) \ - (float32x2_t)__builtin_neon_vreinterpretv2sfv8qi (__a); + (float32x2_t)__builtin_neon_vreinterpretv2sfv8qi (__a) #define vreinterpret_f32_s16(__a) \ - (float32x2_t)__builtin_neon_vreinterpretv2sfv4hi (__a); + (float32x2_t)__builtin_neon_vreinterpretv2sfv4hi (__a) #define vreinterpret_f32_s32(__a) \ - (float32x2_t)__builtin_neon_vreinterpretv2sfv2si (__a); + (float32x2_t)__builtin_neon_vreinterpretv2sfv2si (__a) #define vreinterpret_f32_s64(__a) \ - (float32x2_t)__builtin_neon_vreinterpretv2sfdi (__a); + (float32x2_t)__builtin_neon_vreinterpretv2sfdi (__a) #define vreinterpret_f32_u8(__a) \ - (float32x2_t)__builtin_neon_vreinterpretv2sfv8qi (__a); + (float32x2_t)__builtin_neon_vreinterpretv2sfv8qi (__a) #define vreinterpret_f32_u16(__a) \ - (float32x2_t)__builtin_neon_vreinterpretv2sfv4hi (__a); + (float32x2_t)__builtin_neon_vreinterpretv2sfv4hi (__a) #define vreinterpret_f32_u32(__a) \ - (float32x2_t)__builtin_neon_vreinterpretv2sfv2si (__a); + (float32x2_t)__builtin_neon_vreinterpretv2sfv2si (__a) #define vreinterpret_f32_u64(__a) \ - (float32x2_t)__builtin_neon_vreinterpretv2sfdi (__a); + (float32x2_t)__builtin_neon_vreinterpretv2sfdi (__a) #define vreinterpret_f32_p8(__a) \ - (float32x2_t)__builtin_neon_vreinterpretv2sfv8qi (__a); + (float32x2_t)__builtin_neon_vreinterpretv2sfv8qi (__a) #define vreinterpret_f32_p16(__a) \ - (float32x2_t)__builtin_neon_vreinterpretv2sfv4hi (__a); + (float32x2_t)__builtin_neon_vreinterpretv2sfv4hi (__a) #define vreinterpretq_f32_s8(__a) \ - (float32x4_t)__builtin_neon_vreinterpretv4sfv16qi (__a); + (float32x4_t)__builtin_neon_vreinterpretv4sfv16qi (__a) #define vreinterpretq_f32_s16(__a) \ - (float32x4_t)__builtin_neon_vreinterpretv4sfv8hi (__a); + (float32x4_t)__builtin_neon_vreinterpretv4sfv8hi (__a) #define vreinterpretq_f32_s32(__a) \ - (float32x4_t)__builtin_neon_vreinterpretv4sfv4si (__a); + (float32x4_t)__builtin_neon_vreinterpretv4sfv4si (__a) #define vreinterpretq_f32_s64(__a) \ - (float32x4_t)__builtin_neon_vreinterpretv4sfv2di (__a); + (float32x4_t)__builtin_neon_vreinterpretv4sfv2di (__a) #define vreinterpretq_f32_u8(__a) \ - (float32x4_t)__builtin_neon_vreinterpretv4sfv16qi (__a); + (float32x4_t)__builtin_neon_vreinterpretv4sfv16qi (__a) #define vreinterpretq_f32_u16(__a) \ - (float32x4_t)__builtin_neon_vreinterpretv4sfv8hi (__a); + (float32x4_t)__builtin_neon_vreinterpretv4sfv8hi (__a) #define vreinterpretq_f32_u32(__a) \ - (float32x4_t)__builtin_neon_vreinterpretv4sfv4si (__a); + (float32x4_t)__builtin_neon_vreinterpretv4sfv4si (__a) #define vreinterpretq_f32_u64(__a) \ - (float32x4_t)__builtin_neon_vreinterpretv4sfv2di (__a); + (float32x4_t)__builtin_neon_vreinterpretv4sfv2di (__a) #define vreinterpretq_f32_p8(__a) \ - (float32x4_t)__builtin_neon_vreinterpretv4sfv16qi (__a); + (float32x4_t)__builtin_neon_vreinterpretv4sfv16qi (__a) #define vreinterpretq_f32_p16(__a) \ - (float32x4_t)__builtin_neon_vreinterpretv4sfv8hi (__a); + (float32x4_t)__builtin_neon_vreinterpretv4sfv8hi (__a) #define vreinterpret_s64_s8(__a) \ - (int64x1_t)__builtin_neon_vreinterpretdiv8qi (__a); + (int64x1_t)__builtin_neon_vreinterpretdiv8qi (__a) #define vreinterpret_s64_s16(__a) \ - (int64x1_t)__builtin_neon_vreinterpretdiv4hi (__a); + (int64x1_t)__builtin_neon_vreinterpretdiv4hi (__a) #define vreinterpret_s64_s32(__a) \ - (int64x1_t)__builtin_neon_vreinterpretdiv2si (__a); + (int64x1_t)__builtin_neon_vreinterpretdiv2si (__a) #define vreinterpret_s64_f32(__a) \ - (int64x1_t)__builtin_neon_vreinterpretdiv2sf (__a); + (int64x1_t)__builtin_neon_vreinterpretdiv2sf (__a) #define vreinterpret_s64_u8(__a) \ - (int64x1_t)__builtin_neon_vreinterpretdiv8qi (__a); + (int64x1_t)__builtin_neon_vreinterpretdiv8qi (__a) #define vreinterpret_s64_u16(__a) \ - (int64x1_t)__builtin_neon_vreinterpretdiv4hi (__a); + (int64x1_t)__builtin_neon_vreinterpretdiv4hi (__a) #define vreinterpret_s64_u32(__a) \ - (int64x1_t)__builtin_neon_vreinterpretdiv2si (__a); + (int64x1_t)__builtin_neon_vreinterpretdiv2si (__a) #define vreinterpret_s64_u64(__a) \ - (int64x1_t)__builtin_neon_vreinterpretdidi (__a); + (int64x1_t)__builtin_neon_vreinterpretdidi (__a) #define vreinterpret_s64_p8(__a) \ - (int64x1_t)__builtin_neon_vreinterpretdiv8qi (__a); + (int64x1_t)__builtin_neon_vreinterpretdiv8qi (__a) #define vreinterpret_s64_p16(__a) \ - (int64x1_t)__builtin_neon_vreinterpretdiv4hi (__a); + (int64x1_t)__builtin_neon_vreinterpretdiv4hi (__a) #define vreinterpretq_s64_s8(__a) \ - (int64x2_t)__builtin_neon_vreinterpretv2div16qi (__a); + (int64x2_t)__builtin_neon_vreinterpretv2div16qi (__a) #define vreinterpretq_s64_s16(__a) \ - (int64x2_t)__builtin_neon_vreinterpretv2div8hi (__a); + (int64x2_t)__builtin_neon_vreinterpretv2div8hi (__a) #define vreinterpretq_s64_s32(__a) \ - (int64x2_t)__builtin_neon_vreinterpretv2div4si (__a); + (int64x2_t)__builtin_neon_vreinterpretv2div4si (__a) #define vreinterpretq_s64_f32(__a) \ - (int64x2_t)__builtin_neon_vreinterpretv2div4sf (__a); + (int64x2_t)__builtin_neon_vreinterpretv2div4sf (__a) #define vreinterpretq_s64_u8(__a) \ - (int64x2_t)__builtin_neon_vreinterpretv2div16qi (__a); + (int64x2_t)__builtin_neon_vreinterpretv2div16qi (__a) #define vreinterpretq_s64_u16(__a) \ - (int64x2_t)__builtin_neon_vreinterpretv2div8hi (__a); + (int64x2_t)__builtin_neon_vreinterpretv2div8hi (__a) #define vreinterpretq_s64_u32(__a) \ - (int64x2_t)__builtin_neon_vreinterpretv2div4si (__a); + (int64x2_t)__builtin_neon_vreinterpretv2div4si (__a) #define vreinterpretq_s64_u64(__a) \ - (int64x2_t)__builtin_neon_vreinterpretv2div2di (__a); + (int64x2_t)__builtin_neon_vreinterpretv2div2di (__a) #define vreinterpretq_s64_p8(__a) \ - (int64x2_t)__builtin_neon_vreinterpretv2div16qi (__a); + (int64x2_t)__builtin_neon_vreinterpretv2div16qi (__a) #define vreinterpretq_s64_p16(__a) \ - (int64x2_t)__builtin_neon_vreinterpretv2div8hi (__a); + (int64x2_t)__builtin_neon_vreinterpretv2div8hi (__a) #define vreinterpret_u64_s8(__a) \ - (uint64x1_t)__builtin_neon_vreinterpretdiv8qi (__a); + (uint64x1_t)__builtin_neon_vreinterpretdiv8qi (__a) #define vreinterpret_u64_s16(__a) \ - (uint64x1_t)__builtin_neon_vreinterpretdiv4hi (__a); + (uint64x1_t)__builtin_neon_vreinterpretdiv4hi (__a) #define vreinterpret_u64_s32(__a) \ - (uint64x1_t)__builtin_neon_vreinterpretdiv2si (__a); + (uint64x1_t)__builtin_neon_vreinterpretdiv2si (__a) #define vreinterpret_u64_s64(__a) \ - (uint64x1_t)__builtin_neon_vreinterpretdidi (__a); + (uint64x1_t)__builtin_neon_vreinterpretdidi (__a) #define vreinterpret_u64_f32(__a) \ - (uint64x1_t)__builtin_neon_vreinterpretdiv2sf (__a); + (uint64x1_t)__builtin_neon_vreinterpretdiv2sf (__a) #define vreinterpret_u64_u8(__a) \ - (uint64x1_t)__builtin_neon_vreinterpretdiv8qi (__a); + (uint64x1_t)__builtin_neon_vreinterpretdiv8qi (__a) #define vreinterpret_u64_u16(__a) \ - (uint64x1_t)__builtin_neon_vreinterpretdiv4hi (__a); + (uint64x1_t)__builtin_neon_vreinterpretdiv4hi (__a) #define vreinterpret_u64_u32(__a) \ - (uint64x1_t)__builtin_neon_vreinterpretdiv2si (__a); + (uint64x1_t)__builtin_neon_vreinterpretdiv2si (__a) #define vreinterpret_u64_p8(__a) \ - (uint64x1_t)__builtin_neon_vreinterpretdiv8qi (__a); + (uint64x1_t)__builtin_neon_vreinterpretdiv8qi (__a) #define vreinterpret_u64_p16(__a) \ - (uint64x1_t)__builtin_neon_vreinterpretdiv4hi (__a); + (uint64x1_t)__builtin_neon_vreinterpretdiv4hi (__a) #define vreinterpretq_u64_s8(__a) \ - (uint64x2_t)__builtin_neon_vreinterpretv2div16qi (__a); + (uint64x2_t)__builtin_neon_vreinterpretv2div16qi (__a) #define vreinterpretq_u64_s16(__a) \ - (uint64x2_t)__builtin_neon_vreinterpretv2div8hi (__a); + (uint64x2_t)__builtin_neon_vreinterpretv2div8hi (__a) #define vreinterpretq_u64_s32(__a) \ - (uint64x2_t)__builtin_neon_vreinterpretv2div4si (__a); + (uint64x2_t)__builtin_neon_vreinterpretv2div4si (__a) #define vreinterpretq_u64_s64(__a) \ - (uint64x2_t)__builtin_neon_vreinterpretv2div2di (__a); + (uint64x2_t)__builtin_neon_vreinterpretv2div2di (__a) #define vreinterpretq_u64_f32(__a) \ - (uint64x2_t)__builtin_neon_vreinterpretv2div4sf (__a); + (uint64x2_t)__builtin_neon_vreinterpretv2div4sf (__a) #define vreinterpretq_u64_u8(__a) \ - (uint64x2_t)__builtin_neon_vreinterpretv2div16qi (__a); + (uint64x2_t)__builtin_neon_vreinterpretv2div16qi (__a) #define vreinterpretq_u64_u16(__a) \ - (uint64x2_t)__builtin_neon_vreinterpretv2div8hi (__a); + (uint64x2_t)__builtin_neon_vreinterpretv2div8hi (__a) #define vreinterpretq_u64_u32(__a) \ - (uint64x2_t)__builtin_neon_vreinterpretv2div4si (__a); + (uint64x2_t)__builtin_neon_vreinterpretv2div4si (__a) #define vreinterpretq_u64_p8(__a) \ - (uint64x2_t)__builtin_neon_vreinterpretv2div16qi (__a); + (uint64x2_t)__builtin_neon_vreinterpretv2div16qi (__a) #define vreinterpretq_u64_p16(__a) \ - (uint64x2_t)__builtin_neon_vreinterpretv2div8hi (__a); + (uint64x2_t)__builtin_neon_vreinterpretv2div8hi (__a) #define vreinterpret_s8_s16(__a) \ - (int8x8_t)__builtin_neon_vreinterpretv8qiv4hi (__a); + (int8x8_t)__builtin_neon_vreinterpretv8qiv4hi (__a) #define vreinterpret_s8_s32(__a) \ - (int8x8_t)__builtin_neon_vreinterpretv8qiv2si (__a); + (int8x8_t)__builtin_neon_vreinterpretv8qiv2si (__a) #define vreinterpret_s8_s64(__a) \ - (int8x8_t)__builtin_neon_vreinterpretv8qidi (__a); + (int8x8_t)__builtin_neon_vreinterpretv8qidi (__a) #define vreinterpret_s8_f32(__a) \ - (int8x8_t)__builtin_neon_vreinterpretv8qiv2sf (__a); + (int8x8_t)__builtin_neon_vreinterpretv8qiv2sf (__a) #define vreinterpret_s8_u8(__a) \ - (int8x8_t)__builtin_neon_vreinterpretv8qiv8qi (__a); + (int8x8_t)__builtin_neon_vreinterpretv8qiv8qi (__a) #define vreinterpret_s8_u16(__a) \ - (int8x8_t)__builtin_neon_vreinterpretv8qiv4hi (__a); + (int8x8_t)__builtin_neon_vreinterpretv8qiv4hi (__a) #define vreinterpret_s8_u32(__a) \ - (int8x8_t)__builtin_neon_vreinterpretv8qiv2si (__a); + (int8x8_t)__builtin_neon_vreinterpretv8qiv2si (__a) #define vreinterpret_s8_u64(__a) \ - (int8x8_t)__builtin_neon_vreinterpretv8qidi (__a); + (int8x8_t)__builtin_neon_vreinterpretv8qidi (__a) #define vreinterpret_s8_p8(__a) \ - (int8x8_t)__builtin_neon_vreinterpretv8qiv8qi (__a); + (int8x8_t)__builtin_neon_vreinterpretv8qiv8qi (__a) #define vreinterpret_s8_p16(__a) \ - (int8x8_t)__builtin_neon_vreinterpretv8qiv4hi (__a); + (int8x8_t)__builtin_neon_vreinterpretv8qiv4hi (__a) #define vreinterpretq_s8_s16(__a) \ - (int8x16_t)__builtin_neon_vreinterpretv16qiv8hi (__a); + (int8x16_t)__builtin_neon_vreinterpretv16qiv8hi (__a) #define vreinterpretq_s8_s32(__a) \ - (int8x16_t)__builtin_neon_vreinterpretv16qiv4si (__a); + (int8x16_t)__builtin_neon_vreinterpretv16qiv4si (__a) #define vreinterpretq_s8_s64(__a) \ - (int8x16_t)__builtin_neon_vreinterpretv16qiv2di (__a); + (int8x16_t)__builtin_neon_vreinterpretv16qiv2di (__a) #define vreinterpretq_s8_f32(__a) \ - (int8x16_t)__builtin_neon_vreinterpretv16qiv4sf (__a); + (int8x16_t)__builtin_neon_vreinterpretv16qiv4sf (__a) #define vreinterpretq_s8_u8(__a) \ - (int8x16_t)__builtin_neon_vreinterpretv16qiv16qi (__a); + (int8x16_t)__builtin_neon_vreinterpretv16qiv16qi (__a) #define vreinterpretq_s8_u16(__a) \ - (int8x16_t)__builtin_neon_vreinterpretv16qiv8hi (__a); + (int8x16_t)__builtin_neon_vreinterpretv16qiv8hi (__a) #define vreinterpretq_s8_u32(__a) \ - (int8x16_t)__builtin_neon_vreinterpretv16qiv4si (__a); + (int8x16_t)__builtin_neon_vreinterpretv16qiv4si (__a) #define vreinterpretq_s8_u64(__a) \ - (int8x16_t)__builtin_neon_vreinterpretv16qiv2di (__a); + (int8x16_t)__builtin_neon_vreinterpretv16qiv2di (__a) #define vreinterpretq_s8_p8(__a) \ - (int8x16_t)__builtin_neon_vreinterpretv16qiv16qi (__a); + (int8x16_t)__builtin_neon_vreinterpretv16qiv16qi (__a) #define vreinterpretq_s8_p16(__a) \ - (int8x16_t)__builtin_neon_vreinterpretv16qiv8hi (__a); + (int8x16_t)__builtin_neon_vreinterpretv16qiv8hi (__a) #define vreinterpret_s16_s8(__a) \ - (int16x4_t)__builtin_neon_vreinterpretv4hiv8qi (__a); + (int16x4_t)__builtin_neon_vreinterpretv4hiv8qi (__a) #define vreinterpret_s16_s32(__a) \ - (int16x4_t)__builtin_neon_vreinterpretv4hiv2si (__a); + (int16x4_t)__builtin_neon_vreinterpretv4hiv2si (__a) #define vreinterpret_s16_s64(__a) \ - (int16x4_t)__builtin_neon_vreinterpretv4hidi (__a); + (int16x4_t)__builtin_neon_vreinterpretv4hidi (__a) #define vreinterpret_s16_f32(__a) \ - (int16x4_t)__builtin_neon_vreinterpretv4hiv2sf (__a); + (int16x4_t)__builtin_neon_vreinterpretv4hiv2sf (__a) #define vreinterpret_s16_u8(__a) \ - (int16x4_t)__builtin_neon_vreinterpretv4hiv8qi (__a); + (int16x4_t)__builtin_neon_vreinterpretv4hiv8qi (__a) #define vreinterpret_s16_u16(__a) \ - (int16x4_t)__builtin_neon_vreinterpretv4hiv4hi (__a); + (int16x4_t)__builtin_neon_vreinterpretv4hiv4hi (__a) #define vreinterpret_s16_u32(__a) \ - (int16x4_t)__builtin_neon_vreinterpretv4hiv2si (__a); + (int16x4_t)__builtin_neon_vreinterpretv4hiv2si (__a) #define vreinterpret_s16_u64(__a) \ - (int16x4_t)__builtin_neon_vreinterpretv4hidi (__a); + (int16x4_t)__builtin_neon_vreinterpretv4hidi (__a) #define vreinterpret_s16_p8(__a) \ - (int16x4_t)__builtin_neon_vreinterpretv4hiv8qi (__a); + (int16x4_t)__builtin_neon_vreinterpretv4hiv8qi (__a) #define vreinterpret_s16_p16(__a) \ - (int16x4_t)__builtin_neon_vreinterpretv4hiv4hi (__a); + (int16x4_t)__builtin_neon_vreinterpretv4hiv4hi (__a) #define vreinterpretq_s16_s8(__a) \ - (int16x8_t)__builtin_neon_vreinterpretv8hiv16qi (__a); + (int16x8_t)__builtin_neon_vreinterpretv8hiv16qi (__a) #define vreinterpretq_s16_s32(__a) \ - (int16x8_t)__builtin_neon_vreinterpretv8hiv4si (__a); + (int16x8_t)__builtin_neon_vreinterpretv8hiv4si (__a) #define vreinterpretq_s16_s64(__a) \ - (int16x8_t)__builtin_neon_vreinterpretv8hiv2di (__a); + (int16x8_t)__builtin_neon_vreinterpretv8hiv2di (__a) #define vreinterpretq_s16_f32(__a) \ - (int16x8_t)__builtin_neon_vreinterpretv8hiv4sf (__a); + (int16x8_t)__builtin_neon_vreinterpretv8hiv4sf (__a) #define vreinterpretq_s16_u8(__a) \ - (int16x8_t)__builtin_neon_vreinterpretv8hiv16qi (__a); + (int16x8_t)__builtin_neon_vreinterpretv8hiv16qi (__a) #define vreinterpretq_s16_u16(__a) \ - (int16x8_t)__builtin_neon_vreinterpretv8hiv8hi (__a); + (int16x8_t)__builtin_neon_vreinterpretv8hiv8hi (__a) #define vreinterpretq_s16_u32(__a) \ - (int16x8_t)__builtin_neon_vreinterpretv8hiv4si (__a); + (int16x8_t)__builtin_neon_vreinterpretv8hiv4si (__a) #define vreinterpretq_s16_u64(__a) \ - (int16x8_t)__builtin_neon_vreinterpretv8hiv2di (__a); + (int16x8_t)__builtin_neon_vreinterpretv8hiv2di (__a) #define vreinterpretq_s16_p8(__a) \ - (int16x8_t)__builtin_neon_vreinterpretv8hiv16qi (__a); + (int16x8_t)__builtin_neon_vreinterpretv8hiv16qi (__a) #define vreinterpretq_s16_p16(__a) \ - (int16x8_t)__builtin_neon_vreinterpretv8hiv8hi (__a); + (int16x8_t)__builtin_neon_vreinterpretv8hiv8hi (__a) #define vreinterpret_s32_s8(__a) \ - (int32x2_t)__builtin_neon_vreinterpretv2siv8qi (__a); + (int32x2_t)__builtin_neon_vreinterpretv2siv8qi (__a) #define vreinterpret_s32_s16(__a) \ - (int32x2_t)__builtin_neon_vreinterpretv2siv4hi (__a); + (int32x2_t)__builtin_neon_vreinterpretv2siv4hi (__a) #define vreinterpret_s32_s64(__a) \ - (int32x2_t)__builtin_neon_vreinterpretv2sidi (__a); + (int32x2_t)__builtin_neon_vreinterpretv2sidi (__a) #define vreinterpret_s32_f32(__a) \ - (int32x2_t)__builtin_neon_vreinterpretv2siv2sf (__a); + (int32x2_t)__builtin_neon_vreinterpretv2siv2sf (__a) #define vreinterpret_s32_u8(__a) \ - (int32x2_t)__builtin_neon_vreinterpretv2siv8qi (__a); + (int32x2_t)__builtin_neon_vreinterpretv2siv8qi (__a) #define vreinterpret_s32_u16(__a) \ - (int32x2_t)__builtin_neon_vreinterpretv2siv4hi (__a); + (int32x2_t)__builtin_neon_vreinterpretv2siv4hi (__a) #define vreinterpret_s32_u32(__a) \ - (int32x2_t)__builtin_neon_vreinterpretv2siv2si (__a); + (int32x2_t)__builtin_neon_vreinterpretv2siv2si (__a) #define vreinterpret_s32_u64(__a) \ - (int32x2_t)__builtin_neon_vreinterpretv2sidi (__a); + (int32x2_t)__builtin_neon_vreinterpretv2sidi (__a) #define vreinterpret_s32_p8(__a) \ - (int32x2_t)__builtin_neon_vreinterpretv2siv8qi (__a); + (int32x2_t)__builtin_neon_vreinterpretv2siv8qi (__a) #define vreinterpret_s32_p16(__a) \ - (int32x2_t)__builtin_neon_vreinterpretv2siv4hi (__a); + (int32x2_t)__builtin_neon_vreinterpretv2siv4hi (__a) #define vreinterpretq_s32_s8(__a) \ - (int32x4_t)__builtin_neon_vreinterpretv4siv16qi (__a); + (int32x4_t)__builtin_neon_vreinterpretv4siv16qi (__a) #define vreinterpretq_s32_s16(__a) \ - (int32x4_t)__builtin_neon_vreinterpretv4siv8hi (__a); + (int32x4_t)__builtin_neon_vreinterpretv4siv8hi (__a) #define vreinterpretq_s32_s64(__a) \ - (int32x4_t)__builtin_neon_vreinterpretv4siv2di (__a); + (int32x4_t)__builtin_neon_vreinterpretv4siv2di (__a) #define vreinterpretq_s32_f32(__a) \ - (int32x4_t)__builtin_neon_vreinterpretv4siv4sf (__a); + (int32x4_t)__builtin_neon_vreinterpretv4siv4sf (__a) #define vreinterpretq_s32_u8(__a) \ - (int32x4_t)__builtin_neon_vreinterpretv4siv16qi (__a); + (int32x4_t)__builtin_neon_vreinterpretv4siv16qi (__a) #define vreinterpretq_s32_u16(__a) \ - (int32x4_t)__builtin_neon_vreinterpretv4siv8hi (__a); + (int32x4_t)__builtin_neon_vreinterpretv4siv8hi (__a) #define vreinterpretq_s32_u32(__a) \ - (int32x4_t)__builtin_neon_vreinterpretv4siv4si (__a); + (int32x4_t)__builtin_neon_vreinterpretv4siv4si (__a) #define vreinterpretq_s32_u64(__a) \ - (int32x4_t)__builtin_neon_vreinterpretv4siv2di (__a); + (int32x4_t)__builtin_neon_vreinterpretv4siv2di (__a) #define vreinterpretq_s32_p8(__a) \ - (int32x4_t)__builtin_neon_vreinterpretv4siv16qi (__a); + (int32x4_t)__builtin_neon_vreinterpretv4siv16qi (__a) #define vreinterpretq_s32_p16(__a) \ - (int32x4_t)__builtin_neon_vreinterpretv4siv8hi (__a); + (int32x4_t)__builtin_neon_vreinterpretv4siv8hi (__a) #define vreinterpret_u8_s8(__a) \ - (uint8x8_t)__builtin_neon_vreinterpretv8qiv8qi (__a); + (uint8x8_t)__builtin_neon_vreinterpretv8qiv8qi (__a) #define vreinterpret_u8_s16(__a) \ - (uint8x8_t)__builtin_neon_vreinterpretv8qiv4hi (__a); + (uint8x8_t)__builtin_neon_vreinterpretv8qiv4hi (__a) #define vreinterpret_u8_s32(__a) \ - (uint8x8_t)__builtin_neon_vreinterpretv8qiv2si (__a); + (uint8x8_t)__builtin_neon_vreinterpretv8qiv2si (__a) #define vreinterpret_u8_s64(__a) \ - (uint8x8_t)__builtin_neon_vreinterpretv8qidi (__a); + (uint8x8_t)__builtin_neon_vreinterpretv8qidi (__a) #define vreinterpret_u8_f32(__a) \ - (uint8x8_t)__builtin_neon_vreinterpretv8qiv2sf (__a); + (uint8x8_t)__builtin_neon_vreinterpretv8qiv2sf (__a) #define vreinterpret_u8_u16(__a) \ - (uint8x8_t)__builtin_neon_vreinterpretv8qiv4hi (__a); + (uint8x8_t)__builtin_neon_vreinterpretv8qiv4hi (__a) #define vreinterpret_u8_u32(__a) \ - (uint8x8_t)__builtin_neon_vreinterpretv8qiv2si (__a); + (uint8x8_t)__builtin_neon_vreinterpretv8qiv2si (__a) #define vreinterpret_u8_u64(__a) \ - (uint8x8_t)__builtin_neon_vreinterpretv8qidi (__a); + (uint8x8_t)__builtin_neon_vreinterpretv8qidi (__a) #define vreinterpret_u8_p8(__a) \ - (uint8x8_t)__builtin_neon_vreinterpretv8qiv8qi (__a); + (uint8x8_t)__builtin_neon_vreinterpretv8qiv8qi (__a) #define vreinterpret_u8_p16(__a) \ - (uint8x8_t)__builtin_neon_vreinterpretv8qiv4hi (__a); + (uint8x8_t)__builtin_neon_vreinterpretv8qiv4hi (__a) #define vreinterpretq_u8_s8(__a) \ - (uint8x16_t)__builtin_neon_vreinterpretv16qiv16qi (__a); + (uint8x16_t)__builtin_neon_vreinterpretv16qiv16qi (__a) #define vreinterpretq_u8_s16(__a) \ - (uint8x16_t)__builtin_neon_vreinterpretv16qiv8hi (__a); + (uint8x16_t)__builtin_neon_vreinterpretv16qiv8hi (__a) #define vreinterpretq_u8_s32(__a) \ - (uint8x16_t)__builtin_neon_vreinterpretv16qiv4si (__a); + (uint8x16_t)__builtin_neon_vreinterpretv16qiv4si (__a) #define vreinterpretq_u8_s64(__a) \ - (uint8x16_t)__builtin_neon_vreinterpretv16qiv2di (__a); + (uint8x16_t)__builtin_neon_vreinterpretv16qiv2di (__a) #define vreinterpretq_u8_f32(__a) \ - (uint8x16_t)__builtin_neon_vreinterpretv16qiv4sf (__a); + (uint8x16_t)__builtin_neon_vreinterpretv16qiv4sf (__a) #define vreinterpretq_u8_u16(__a) \ - (uint8x16_t)__builtin_neon_vreinterpretv16qiv8hi (__a); + (uint8x16_t)__builtin_neon_vreinterpretv16qiv8hi (__a) #define vreinterpretq_u8_u32(__a) \ - (uint8x16_t)__builtin_neon_vreinterpretv16qiv4si (__a); + (uint8x16_t)__builtin_neon_vreinterpretv16qiv4si (__a) #define vreinterpretq_u8_u64(__a) \ - (uint8x16_t)__builtin_neon_vreinterpretv16qiv2di (__a); + (uint8x16_t)__builtin_neon_vreinterpretv16qiv2di (__a) #define vreinterpretq_u8_p8(__a) \ - (uint8x16_t)__builtin_neon_vreinterpretv16qiv16qi (__a); + (uint8x16_t)__builtin_neon_vreinterpretv16qiv16qi (__a) #define vreinterpretq_u8_p16(__a) \ - (uint8x16_t)__builtin_neon_vreinterpretv16qiv8hi (__a); + (uint8x16_t)__builtin_neon_vreinterpretv16qiv8hi (__a) #define vreinterpret_u16_s8(__a) \ - (uint16x4_t)__builtin_neon_vreinterpretv4hiv8qi (__a); + (uint16x4_t)__builtin_neon_vreinterpretv4hiv8qi (__a) #define vreinterpret_u16_s16(__a) \ - (uint16x4_t)__builtin_neon_vreinterpretv4hiv4hi (__a); + (uint16x4_t)__builtin_neon_vreinterpretv4hiv4hi (__a) #define vreinterpret_u16_s32(__a) \ - (uint16x4_t)__builtin_neon_vreinterpretv4hiv2si (__a); + (uint16x4_t)__builtin_neon_vreinterpretv4hiv2si (__a) #define vreinterpret_u16_s64(__a) \ - (uint16x4_t)__builtin_neon_vreinterpretv4hidi (__a); + (uint16x4_t)__builtin_neon_vreinterpretv4hidi (__a) #define vreinterpret_u16_f32(__a) \ - (uint16x4_t)__builtin_neon_vreinterpretv4hiv2sf (__a); + (uint16x4_t)__builtin_neon_vreinterpretv4hiv2sf (__a) #define vreinterpret_u16_u8(__a) \ - (uint16x4_t)__builtin_neon_vreinterpretv4hiv8qi (__a); + (uint16x4_t)__builtin_neon_vreinterpretv4hiv8qi (__a) #define vreinterpret_u16_u32(__a) \ - (uint16x4_t)__builtin_neon_vreinterpretv4hiv2si (__a); + (uint16x4_t)__builtin_neon_vreinterpretv4hiv2si (__a) #define vreinterpret_u16_u64(__a) \ - (uint16x4_t)__builtin_neon_vreinterpretv4hidi (__a); + (uint16x4_t)__builtin_neon_vreinterpretv4hidi (__a) #define vreinterpret_u16_p8(__a) \ - (uint16x4_t)__builtin_neon_vreinterpretv4hiv8qi (__a); + (uint16x4_t)__builtin_neon_vreinterpretv4hiv8qi (__a) #define vreinterpret_u16_p16(__a) \ - (uint16x4_t)__builtin_neon_vreinterpretv4hiv4hi (__a); + (uint16x4_t)__builtin_neon_vreinterpretv4hiv4hi (__a) #define vreinterpretq_u16_s8(__a) \ - (uint16x8_t)__builtin_neon_vreinterpretv8hiv16qi (__a); + (uint16x8_t)__builtin_neon_vreinterpretv8hiv16qi (__a) #define vreinterpretq_u16_s16(__a) \ - (uint16x8_t)__builtin_neon_vreinterpretv8hiv8hi (__a); + (uint16x8_t)__builtin_neon_vreinterpretv8hiv8hi (__a) #define vreinterpretq_u16_s32(__a) \ - (uint16x8_t)__builtin_neon_vreinterpretv8hiv4si (__a); + (uint16x8_t)__builtin_neon_vreinterpretv8hiv4si (__a) #define vreinterpretq_u16_s64(__a) \ - (uint16x8_t)__builtin_neon_vreinterpretv8hiv2di (__a); + (uint16x8_t)__builtin_neon_vreinterpretv8hiv2di (__a) #define vreinterpretq_u16_f32(__a) \ - (uint16x8_t)__builtin_neon_vreinterpretv8hiv4sf (__a); + (uint16x8_t)__builtin_neon_vreinterpretv8hiv4sf (__a) #define vreinterpretq_u16_u8(__a) \ - (uint16x8_t)__builtin_neon_vreinterpretv8hiv16qi (__a); + (uint16x8_t)__builtin_neon_vreinterpretv8hiv16qi (__a) #define vreinterpretq_u16_u32(__a) \ - (uint16x8_t)__builtin_neon_vreinterpretv8hiv4si (__a); + (uint16x8_t)__builtin_neon_vreinterpretv8hiv4si (__a) #define vreinterpretq_u16_u64(__a) \ - (uint16x8_t)__builtin_neon_vreinterpretv8hiv2di (__a); + (uint16x8_t)__builtin_neon_vreinterpretv8hiv2di (__a) #define vreinterpretq_u16_p8(__a) \ - (uint16x8_t)__builtin_neon_vreinterpretv8hiv16qi (__a); + (uint16x8_t)__builtin_neon_vreinterpretv8hiv16qi (__a) #define vreinterpretq_u16_p16(__a) \ - (uint16x8_t)__builtin_neon_vreinterpretv8hiv8hi (__a); + (uint16x8_t)__builtin_neon_vreinterpretv8hiv8hi (__a) #define vreinterpret_u32_s8(__a) \ - (uint32x2_t)__builtin_neon_vreinterpretv2siv8qi (__a); + (uint32x2_t)__builtin_neon_vreinterpretv2siv8qi (__a) #define vreinterpret_u32_s16(__a) \ - (uint32x2_t)__builtin_neon_vreinterpretv2siv4hi (__a); + (uint32x2_t)__builtin_neon_vreinterpretv2siv4hi (__a) #define vreinterpret_u32_s32(__a) \ - (uint32x2_t)__builtin_neon_vreinterpretv2siv2si (__a); + (uint32x2_t)__builtin_neon_vreinterpretv2siv2si (__a) #define vreinterpret_u32_s64(__a) \ - (uint32x2_t)__builtin_neon_vreinterpretv2sidi (__a); + (uint32x2_t)__builtin_neon_vreinterpretv2sidi (__a) #define vreinterpret_u32_f32(__a) \ - (uint32x2_t)__builtin_neon_vreinterpretv2siv2sf (__a); + (uint32x2_t)__builtin_neon_vreinterpretv2siv2sf (__a) #define vreinterpret_u32_u8(__a) \ - (uint32x2_t)__builtin_neon_vreinterpretv2siv8qi (__a); + (uint32x2_t)__builtin_neon_vreinterpretv2siv8qi (__a) #define vreinterpret_u32_u16(__a) \ - (uint32x2_t)__builtin_neon_vreinterpretv2siv4hi (__a); + (uint32x2_t)__builtin_neon_vreinterpretv2siv4hi (__a) #define vreinterpret_u32_u64(__a) \ - (uint32x2_t)__builtin_neon_vreinterpretv2sidi (__a); + (uint32x2_t)__builtin_neon_vreinterpretv2sidi (__a) #define vreinterpret_u32_p8(__a) \ - (uint32x2_t)__builtin_neon_vreinterpretv2siv8qi (__a); + (uint32x2_t)__builtin_neon_vreinterpretv2siv8qi (__a) #define vreinterpret_u32_p16(__a) \ - (uint32x2_t)__builtin_neon_vreinterpretv2siv4hi (__a); + (uint32x2_t)__builtin_neon_vreinterpretv2siv4hi (__a) #define vreinterpretq_u32_s8(__a) \ - (uint32x4_t)__builtin_neon_vreinterpretv4siv16qi (__a); + (uint32x4_t)__builtin_neon_vreinterpretv4siv16qi (__a) #define vreinterpretq_u32_s16(__a) \ - (uint32x4_t)__builtin_neon_vreinterpretv4siv8hi (__a); + (uint32x4_t)__builtin_neon_vreinterpretv4siv8hi (__a) #define vreinterpretq_u32_s32(__a) \ - (uint32x4_t)__builtin_neon_vreinterpretv4siv4si (__a); + (uint32x4_t)__builtin_neon_vreinterpretv4siv4si (__a) #define vreinterpretq_u32_s64(__a) \ - (uint32x4_t)__builtin_neon_vreinterpretv4siv2di (__a); + (uint32x4_t)__builtin_neon_vreinterpretv4siv2di (__a) #define vreinterpretq_u32_f32(__a) \ - (uint32x4_t)__builtin_neon_vreinterpretv4siv4sf (__a); + (uint32x4_t)__builtin_neon_vreinterpretv4siv4sf (__a) #define vreinterpretq_u32_u8(__a) \ - (uint32x4_t)__builtin_neon_vreinterpretv4siv16qi (__a); + (uint32x4_t)__builtin_neon_vreinterpretv4siv16qi (__a) #define vreinterpretq_u32_u16(__a) \ - (uint32x4_t)__builtin_neon_vreinterpretv4siv8hi (__a); + (uint32x4_t)__builtin_neon_vreinterpretv4siv8hi (__a) #define vreinterpretq_u32_u64(__a) \ - (uint32x4_t)__builtin_neon_vreinterpretv4siv2di (__a); + (uint32x4_t)__builtin_neon_vreinterpretv4siv2di (__a) #define vreinterpretq_u32_p8(__a) \ - (uint32x4_t)__builtin_neon_vreinterpretv4siv16qi (__a); + (uint32x4_t)__builtin_neon_vreinterpretv4siv16qi (__a) #define vreinterpretq_u32_p16(__a) \ - (uint32x4_t)__builtin_neon_vreinterpretv4siv8hi (__a); + (uint32x4_t)__builtin_neon_vreinterpretv4siv8hi (__a) #ifdef __cplusplus } From resistor at mac.com Tue Jul 28 13:32:18 2009 From: resistor at mac.com (Owen Anderson) Date: Tue, 28 Jul 2009 18:32:18 -0000 Subject: [llvm-commits] [llvm] r77347 - in /llvm/trunk: examples/BrainF/ include/llvm/ include/llvm/Support/ lib/Analysis/ lib/AsmParser/ lib/Bitcode/Reader/ lib/CodeGen/ lib/CodeGen/SelectionDAG/ lib/Linker/ lib/Target/XCore/ lib/Transforms/IPO/ lib/Transforms/Scalar/ lib/Transforms/Utils/ lib/VMCore/ tools/bugpoint/ Message-ID: <200907281832.n6SIWK4Z008270@zion.cs.uiuc.edu> Author: resistor Date: Tue Jul 28 13:32:17 2009 New Revision: 77347 URL: http://llvm.org/viewvc/llvm-project?rev=77347&view=rev Log: Change ConstantArray to 2.5 API. Modified: llvm/trunk/examples/BrainF/BrainF.cpp llvm/trunk/include/llvm/Constants.h llvm/trunk/include/llvm/LLVMContext.h llvm/trunk/include/llvm/Support/IRBuilder.h llvm/trunk/lib/Analysis/DebugInfo.cpp llvm/trunk/lib/AsmParser/LLParser.cpp llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp llvm/trunk/lib/CodeGen/ShadowStackGC.cpp llvm/trunk/lib/Linker/LinkModules.cpp llvm/trunk/lib/Target/XCore/XCoreTargetObjectFile.cpp llvm/trunk/lib/Transforms/IPO/ExtractGV.cpp llvm/trunk/lib/Transforms/IPO/GlobalOpt.cpp llvm/trunk/lib/Transforms/Scalar/SimplifyLibCalls.cpp llvm/trunk/lib/Transforms/Utils/LowerInvoke.cpp llvm/trunk/lib/Transforms/Utils/ValueMapper.cpp llvm/trunk/lib/VMCore/ConstantFold.cpp llvm/trunk/lib/VMCore/Constants.cpp llvm/trunk/lib/VMCore/Core.cpp llvm/trunk/lib/VMCore/LLVMContext.cpp llvm/trunk/lib/VMCore/LLVMContextImpl.cpp llvm/trunk/lib/VMCore/LLVMContextImpl.h llvm/trunk/tools/bugpoint/ExtractFunction.cpp llvm/trunk/tools/bugpoint/Miscompilation.cpp Modified: llvm/trunk/examples/BrainF/BrainF.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/examples/BrainF/BrainF.cpp?rev=77347&r1=77346&r2=77347&view=diff ============================================================================== --- llvm/trunk/examples/BrainF/BrainF.cpp (original) +++ llvm/trunk/examples/BrainF/BrainF.cpp Tue Jul 28 13:32:17 2009 @@ -125,7 +125,7 @@ { //@aberrormsg = internal constant [%d x i8] c"\00" Constant *msg_0 = - C.getConstantArray("Error: The head has left the tape.", true); + ConstantArray::get("Error: The head has left the tape.", true); GlobalVariable *aberrormsg = new GlobalVariable( *module, Modified: llvm/trunk/include/llvm/Constants.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Constants.h?rev=77347&r1=77346&r2=77347&view=diff ============================================================================== --- llvm/trunk/include/llvm/Constants.h (original) +++ llvm/trunk/include/llvm/Constants.h Tue Jul 28 13:32:17 2009 @@ -327,10 +327,22 @@ friend struct ConstantCreator >; ConstantArray(const ConstantArray &); // DO NOT IMPLEMENT - friend class LLVMContextImpl; protected: ConstantArray(const ArrayType *T, const std::vector &Val); public: + // ConstantArray accessors + static Constant* get(const ArrayType* T, const std::vector& V); + static Constant* get(const ArrayType* T, Constant* const* Vals, + unsigned NumVals); + + /// This method constructs a ConstantArray and initializes it with a text + /// string. The default behavior (AddNull==true) causes a null terminator to + /// be placed at the end of the array. This effectively increases the length + /// of the array by one (you've been warned). However, in some situations + /// this is not desired so if AddNull==false then the string is copied without + /// null termination. + static Constant* get(const StringRef &Initializer, bool AddNull = true); + /// Transparently provide more efficient getOperand methods. DECLARE_TRANSPARENT_OPERAND_ACCESSORS(Constant); Modified: llvm/trunk/include/llvm/LLVMContext.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/LLVMContext.h?rev=77347&r1=77346&r2=77347&view=diff ============================================================================== --- llvm/trunk/include/llvm/LLVMContext.h (original) +++ llvm/trunk/include/llvm/LLVMContext.h Tue Jul 28 13:32:17 2009 @@ -58,6 +58,7 @@ friend class ConstantInt; friend class ConstantFP; friend class ConstantStruct; + friend class ConstantArray; public: LLVMContext(); ~LLVMContext(); @@ -82,21 +83,6 @@ // ConstantAggregateZero accessors ConstantAggregateZero* getConstantAggregateZero(const Type* Ty); - - // ConstantArray accessors - Constant* getConstantArray(const ArrayType* T, - const std::vector& V); - Constant* getConstantArray(const ArrayType* T, Constant* const* Vals, - unsigned NumVals); - - /// This method constructs a ConstantArray and initializes it with a text - /// string. The default behavior (AddNull==true) causes a null terminator to - /// be placed at the end of the array. This effectively increases the length - /// of the array by one (you've been warned). However, in some situations - /// this is not desired so if AddNull==false then the string is copied without - /// null termination. - Constant* getConstantArray(const StringRef &Initializer, - bool AddNull = true); // ConstantExpr accessors Constant* getConstantExpr(unsigned Opcode, Constant* C1, Constant* C2); @@ -225,12 +211,7 @@ void erase(MDString *M); void erase(MDNode *M); void erase(ConstantAggregateZero *Z); - void erase(ConstantArray *Z); void erase(ConstantVector *V); - - // RAUW helpers - Constant *replaceUsesOfWithOnConstant(ConstantArray *CA, - Value *From, Value *To, Use *U); }; /// FOR BACKWARDS COMPATIBILITY - Returns a global context. Modified: llvm/trunk/include/llvm/Support/IRBuilder.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/IRBuilder.h?rev=77347&r1=77346&r2=77347&view=diff ============================================================================== --- llvm/trunk/include/llvm/Support/IRBuilder.h (original) +++ llvm/trunk/include/llvm/Support/IRBuilder.h Tue Jul 28 13:32:17 2009 @@ -413,7 +413,7 @@ return CreateConstGEP2_32(Ptr, 0, Idx, Name); } Value *CreateGlobalString(const char *Str = "", const char *Name = "") { - Constant *StrConstant = Context.getConstantArray(Str, true); + Constant *StrConstant = ConstantArray::get(Str, true); Module &M = *BB->getParent()->getParent(); GlobalVariable *gv = new GlobalVariable(M, StrConstant->getType(), Modified: llvm/trunk/lib/Analysis/DebugInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/DebugInfo.cpp?rev=77347&r1=77346&r2=77347&view=diff ============================================================================== --- llvm/trunk/lib/Analysis/DebugInfo.cpp (original) +++ llvm/trunk/lib/Analysis/DebugInfo.cpp Tue Jul 28 13:32:17 2009 @@ -499,7 +499,7 @@ return Slot = VMContext.getConstantPointerNull(DestTy); // Construct string as an llvm constant. - Constant *ConstStr = VMContext.getConstantArray(String); + Constant *ConstStr = ConstantArray::get(String); // Otherwise create and return a new string global. GlobalVariable *StrGV = new GlobalVariable(M, ConstStr->getType(), true, @@ -521,7 +521,7 @@ for (unsigned i = 0; i != NumTys; ++i) Elts.push_back(getCastToEmpty(Tys[i])); - Constant *Init = VMContext.getConstantArray(VMContext.getArrayType(EmptyStructPtr, + Constant *Init = ConstantArray::get(VMContext.getArrayType(EmptyStructPtr, Elts.size()), Elts.data(), Elts.size()); // If we already have this array, just return the uniqued version. Modified: llvm/trunk/lib/AsmParser/LLParser.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/AsmParser/LLParser.cpp?rev=77347&r1=77346&r2=77347&view=diff ============================================================================== --- llvm/trunk/lib/AsmParser/LLParser.cpp (original) +++ llvm/trunk/lib/AsmParser/LLParser.cpp Tue Jul 28 13:32:17 2009 @@ -1811,13 +1811,13 @@ " is not of type '" +Elts[0]->getType()->getDescription()); } - ID.ConstantVal = Context.getConstantArray(ATy, Elts.data(), Elts.size()); + ID.ConstantVal = ConstantArray::get(ATy, Elts.data(), Elts.size()); ID.Kind = ValID::t_Constant; return false; } case lltok::kw_c: // c "foo" Lex.Lex(); - ID.ConstantVal = Context.getConstantArray(Lex.getStrVal(), false); + ID.ConstantVal = ConstantArray::get(Lex.getStrVal(), false); if (ParseToken(lltok::StringConstant, "expected string")) return true; ID.Kind = ValID::t_Constant; return false; Modified: llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp?rev=77347&r1=77346&r2=77347&view=diff ============================================================================== --- llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp (original) +++ llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp Tue Jul 28 13:32:17 2009 @@ -288,7 +288,7 @@ // Make the new constant. Constant *NewC; if (ConstantArray *UserCA = dyn_cast(UserC)) { - NewC = Context.getConstantArray(UserCA->getType(), &NewOps[0], + NewC = ConstantArray::get(UserCA->getType(), &NewOps[0], NewOps.size()); } else if (ConstantStruct *UserCS = dyn_cast(UserC)) { NewC = ConstantStruct::get(&NewOps[0], NewOps.size(), @@ -930,7 +930,7 @@ const Type *EltTy = ATy->getElementType(); for (unsigned i = 0; i != Size; ++i) Elts.push_back(ValueList.getConstantFwdRef(Record[i], EltTy)); - V = Context.getConstantArray(ATy, Elts); + V = ConstantArray::get(ATy, Elts); } else if (const VectorType *VTy = dyn_cast(CurTy)) { const Type *EltTy = VTy->getElementType(); for (unsigned i = 0; i != Size; ++i) @@ -952,7 +952,7 @@ std::vector Elts; for (unsigned i = 0; i != Size; ++i) Elts.push_back(ConstantInt::get(EltTy, Record[i])); - V = Context.getConstantArray(ATy, Elts); + V = ConstantArray::get(ATy, Elts); break; } case bitc::CST_CODE_CSTRING: { // CSTRING: [values] @@ -967,7 +967,7 @@ for (unsigned i = 0; i != Size; ++i) Elts.push_back(ConstantInt::get(EltTy, Record[i])); Elts.push_back(Context.getNullValue(EltTy)); - V = Context.getConstantArray(ATy, Elts); + V = ConstantArray::get(ATy, Elts); break; } case bitc::CST_CODE_CE_BINOP: { // CE_BINOP: [opcode, opval, opval] Modified: llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp?rev=77347&r1=77346&r2=77347&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Tue Jul 28 13:32:17 2009 @@ -5812,7 +5812,7 @@ const TargetData &TD = *TLI.getTargetData(); // Create a ConstantArray of the two constants. - Constant *CA = DAG.getContext()->getConstantArray( + Constant *CA = ConstantArray::get( DAG.getContext()->getArrayType(FPTy, 2), Elts, 2); SDValue CPIdx = DAG.getConstantPool(CA, TLI.getPointerTy(), TD.getPrefTypeAlignment(FPTy)); Modified: llvm/trunk/lib/CodeGen/ShadowStackGC.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/ShadowStackGC.cpp?rev=77347&r1=77346&r2=77347&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/ShadowStackGC.cpp (original) +++ llvm/trunk/lib/CodeGen/ShadowStackGC.cpp Tue Jul 28 13:32:17 2009 @@ -209,7 +209,7 @@ Constant *DescriptorElts[] = { ConstantStruct::get(BaseElts, 2), - Context.getConstantArray(Context.getArrayType(VoidPtr, NumMeta), + ConstantArray::get(Context.getArrayType(VoidPtr, NumMeta), Metadata.begin(), NumMeta) }; Modified: llvm/trunk/lib/Linker/LinkModules.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Linker/LinkModules.cpp?rev=77347&r1=77346&r2=77347&view=diff ============================================================================== --- llvm/trunk/lib/Linker/LinkModules.cpp (original) +++ llvm/trunk/lib/Linker/LinkModules.cpp Tue Jul 28 13:32:17 2009 @@ -369,7 +369,7 @@ Operands[i] =cast(RemapOperand(CPA->getOperand(i), ValueMap, Context)); Result = - Context.getConstantArray(cast(CPA->getType()), Operands); + ConstantArray::get(cast(CPA->getType()), Operands); } else if (const ConstantStruct *CPS = dyn_cast(CPV)) { std::vector Operands(CPS->getNumOperands()); for (unsigned i = 0, e = CPS->getNumOperands(); i != e; ++i) @@ -1186,7 +1186,7 @@ for (unsigned i = 0, e = T2->getNumElements(); i != e; ++i) Inits.push_back(CV); } - NG->setInitializer(Context.getConstantArray(NewType, Inits)); + NG->setInitializer(ConstantArray::get(NewType, Inits)); Inits.clear(); // Replace any uses of the two global variables with uses of the new Modified: llvm/trunk/lib/Target/XCore/XCoreTargetObjectFile.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/XCore/XCoreTargetObjectFile.cpp?rev=77347&r1=77346&r2=77347&view=diff ============================================================================== --- llvm/trunk/lib/Target/XCore/XCoreTargetObjectFile.cpp (original) +++ llvm/trunk/lib/Target/XCore/XCoreTargetObjectFile.cpp Tue Jul 28 13:32:17 2009 @@ -29,4 +29,4 @@ else ReadOnlySection = getOrCreateSection("\t.cp.rodata", false, SectionKind::ReadOnly); -} \ No newline at end of file +} Modified: llvm/trunk/lib/Transforms/IPO/ExtractGV.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/ExtractGV.cpp?rev=77347&r1=77346&r2=77347&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/IPO/ExtractGV.cpp (original) +++ llvm/trunk/lib/Transforms/IPO/ExtractGV.cpp Tue Jul 28 13:32:17 2009 @@ -110,7 +110,7 @@ AUGs.push_back(Context.getConstantExprBitCast(*GI, SBP)); } ArrayType *AT = Context.getArrayType(SBP, AUGs.size()); - Constant *Init = Context.getConstantArray(AT, AUGs); + Constant *Init = ConstantArray::get(AT, AUGs); GlobalValue *gv = new GlobalVariable(M, AT, false, GlobalValue::AppendingLinkage, Init, "llvm.used"); Modified: llvm/trunk/lib/Transforms/IPO/GlobalOpt.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/GlobalOpt.cpp?rev=77347&r1=77346&r2=77347&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/IPO/GlobalOpt.cpp (original) +++ llvm/trunk/lib/Transforms/IPO/GlobalOpt.cpp Tue Jul 28 13:32:17 2009 @@ -1968,7 +1968,7 @@ // Create the array initializer. const Type *StructTy = cast(GCL->getType()->getElementType())->getElementType(); - Constant *CA = Context.getConstantArray(ArrayType::get(StructTy, + Constant *CA = ConstantArray::get(ArrayType::get(StructTy, CAList.size()), CAList); // If we didn't change the number of elements, don't create a new GV. @@ -2094,7 +2094,7 @@ assert(CI->getZExtValue() < ATy->getNumElements()); Elts[CI->getZExtValue()] = EvaluateStoreInto(Elts[CI->getZExtValue()], Val, Addr, OpNo+1, Context); - return Context.getConstantArray(ATy, Elts); + return ConstantArray::get(ATy, Elts); } } Modified: llvm/trunk/lib/Transforms/Scalar/SimplifyLibCalls.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/SimplifyLibCalls.cpp?rev=77347&r1=77346&r2=77347&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/SimplifyLibCalls.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/SimplifyLibCalls.cpp Tue Jul 28 13:32:17 2009 @@ -1290,7 +1290,7 @@ // Create a string literal with no \n on it. We expect the constant merge // pass to be run after this pass, to merge duplicate strings. FormatStr.erase(FormatStr.end()-1); - Constant *C = Context->getConstantArray(FormatStr, true); + Constant *C = ConstantArray::get(FormatStr, true); C = new GlobalVariable(*Callee->getParent(), C->getType(), true, GlobalVariable::InternalLinkage, C, "str"); EmitPutS(C, B); Modified: llvm/trunk/lib/Transforms/Utils/LowerInvoke.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/LowerInvoke.cpp?rev=77347&r1=77346&r2=77347&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Utils/LowerInvoke.cpp (original) +++ llvm/trunk/lib/Transforms/Utils/LowerInvoke.cpp Tue Jul 28 13:32:17 2009 @@ -183,7 +183,7 @@ // The abort message for expensive EH support tells the user that the // program 'unwound' without an 'invoke' instruction. Constant *Msg = - Context.getConstantArray("ERROR: Exception thrown, but not caught!\n"); + ConstantArray::get("ERROR: Exception thrown, but not caught!\n"); AbortMessageLength = Msg->getNumOperands()-1; // don't include \0 GlobalVariable *MsgGV = new GlobalVariable(*M, Msg->getType(), true, @@ -195,7 +195,7 @@ // The abort message for cheap EH support tells the user that EH is not // enabled. Constant *Msg = - Context.getConstantArray("Exception handler needed, but not enabled." + ConstantArray::get("Exception handler needed, but not enabled." "Recompile program with -enable-correct-eh-support.\n"); AbortMessageLength = Msg->getNumOperands()-1; // don't include \0 Modified: llvm/trunk/lib/Transforms/Utils/ValueMapper.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/ValueMapper.cpp?rev=77347&r1=77346&r2=77347&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Utils/ValueMapper.cpp (original) +++ llvm/trunk/lib/Transforms/Utils/ValueMapper.cpp Tue Jul 28 13:32:17 2009 @@ -56,7 +56,7 @@ Values.push_back(cast(MV)); for (++i; i != e; ++i) Values.push_back(cast(MapValue(*i, VM, Context))); - return VM[V] = Context.getConstantArray(CA->getType(), Values); + return VM[V] = ConstantArray::get(CA->getType(), Values); } } return VM[V] = C; Modified: llvm/trunk/lib/VMCore/ConstantFold.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/ConstantFold.cpp?rev=77347&r1=77346&r2=77347&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/ConstantFold.cpp (original) +++ llvm/trunk/lib/VMCore/ConstantFold.cpp Tue Jul 28 13:32:17 2009 @@ -521,7 +521,7 @@ if (isa(AggTy)) return ConstantStruct::get(Ops); else - return Context.getConstantArray(cast(AggTy), Ops); + return ConstantArray::get(cast(AggTy), Ops); } if (isa(Agg)) { // Insertion of constant into aggregate zero @@ -550,7 +550,7 @@ if (isa(AggTy)) return ConstantStruct::get(Ops); else - return Context.getConstantArray(cast(AggTy), Ops); + return ConstantArray::get(cast(AggTy), Ops); } if (isa(Agg) || isa(Agg)) { // Insertion of constant into aggregate constant @@ -567,7 +567,7 @@ if (isa(Agg->getType())) C = ConstantStruct::get(Ops); else - C = Context.getConstantArray(cast(Agg->getType()), Ops); + C = ConstantArray::get(cast(Agg->getType()), Ops); return C; } Modified: llvm/trunk/lib/VMCore/Constants.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Constants.cpp?rev=77347&r1=77346&r2=77347&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/Constants.cpp (original) +++ llvm/trunk/lib/VMCore/Constants.cpp Tue Jul 28 13:32:17 2009 @@ -375,6 +375,54 @@ } } +Constant *ConstantArray::get(const ArrayType *Ty, + const std::vector &V) { + LLVMContextImpl *pImpl = Ty->getContext().pImpl; + // If this is an all-zero array, return a ConstantAggregateZero object + if (!V.empty()) { + Constant *C = V[0]; + if (!C->isNullValue()) { + // Implicitly locked. + return pImpl->ArrayConstants.getOrCreate(Ty, V); + } + for (unsigned i = 1, e = V.size(); i != e; ++i) + if (V[i] != C) { + // Implicitly locked. + return pImpl->ArrayConstants.getOrCreate(Ty, V); + } + } + + return Ty->getContext().getConstantAggregateZero(Ty); +} + + +Constant* ConstantArray::get(const ArrayType* T, Constant* const* Vals, + unsigned NumVals) { + // FIXME: make this the primary ctor method. + return get(T, std::vector(Vals, Vals+NumVals)); +} + +/// ConstantArray::get(const string&) - Return an array that is initialized to +/// contain the specified string. If length is zero then a null terminator is +/// added to the specified string so that it may be used in a natural way. +/// Otherwise, the length parameter specifies how much of the string to use +/// and it won't be null terminated. +/// +Constant* ConstantArray::get(const StringRef &Str, bool AddNull) { + std::vector ElementVals; + for (unsigned i = 0; i < Str.size(); ++i) + ElementVals.push_back(ConstantInt::get(Type::Int8Ty, Str[i])); + + // Add a null terminator to the string... + if (AddNull) { + ElementVals.push_back(ConstantInt::get(Type::Int8Ty, 0)); + } + + ArrayType *ATy = ArrayType::get(Type::Int8Ty, ElementVals.size()); + return get(ATy, ElementVals); +} + + ConstantStruct::ConstantStruct(const StructType *T, const std::vector &V) @@ -943,7 +991,7 @@ /// void ConstantArray::destroyConstant() { // Implicitly locked. - getType()->getContext().erase(this); + getType()->getContext().pImpl->ArrayConstants.remove(this); destroyConstantImpl(); } @@ -1907,12 +1955,91 @@ /// single invocation handles all 1000 uses. Handling them one at a time would /// work, but would be really slow because it would have to unique each updated /// array instance. + +static std::vector getValType(ConstantArray *CA) { + std::vector Elements; + Elements.reserve(CA->getNumOperands()); + for (unsigned i = 0, e = CA->getNumOperands(); i != e; ++i) + Elements.push_back(cast(CA->getOperand(i))); + return Elements; +} + + void ConstantArray::replaceUsesOfWithOnConstant(Value *From, Value *To, Use *U) { - Constant *Replacement = - getType()->getContext().replaceUsesOfWithOnConstant(this, From, To, U); - - if (!Replacement) return; + assert(isa(To) && "Cannot make Constant refer to non-constant!"); + Constant *ToC = cast(To); + + LLVMContext &Context = getType()->getContext(); + LLVMContextImpl *pImpl = Context.pImpl; + + std::pair Lookup; + Lookup.first.first = getType(); + Lookup.second = this; + + std::vector &Values = Lookup.first.second; + Values.reserve(getNumOperands()); // Build replacement array. + + // Fill values with the modified operands of the constant array. Also, + // compute whether this turns into an all-zeros array. + bool isAllZeros = false; + unsigned NumUpdated = 0; + if (!ToC->isNullValue()) { + for (Use *O = OperandList, *E = OperandList+getNumOperands(); O != E; ++O) { + Constant *Val = cast(O->get()); + if (Val == From) { + Val = ToC; + ++NumUpdated; + } + Values.push_back(Val); + } + } else { + isAllZeros = true; + for (Use *O = OperandList, *E = OperandList+getNumOperands();O != E; ++O) { + Constant *Val = cast(O->get()); + if (Val == From) { + Val = ToC; + ++NumUpdated; + } + Values.push_back(Val); + if (isAllZeros) isAllZeros = Val->isNullValue(); + } + } + + Constant *Replacement = 0; + if (isAllZeros) { + Replacement = Context.getConstantAggregateZero(getType()); + } else { + // Check to see if we have this array type already. + sys::SmartScopedWriter Writer(pImpl->ConstantsLock); + bool Exists; + LLVMContextImpl::ArrayConstantsTy::MapTy::iterator I = + pImpl->ArrayConstants.InsertOrGetItem(Lookup, Exists); + + if (Exists) { + Replacement = I->second; + } else { + // Okay, the new shape doesn't exist in the system yet. Instead of + // creating a new constant array, inserting it, replaceallusesof'ing the + // old with the new, then deleting the old... just update the current one + // in place! + pImpl->ArrayConstants.MoveConstantToNewSlot(this, I); + + // Update to the new value. Optimize for the case when we have a single + // operand that we're changing, but handle bulk updates efficiently. + if (NumUpdated == 1) { + unsigned OperandToUpdate = U - OperandList; + assert(getOperand(OperandToUpdate) == From && + "ReplaceAllUsesWith broken!"); + setOperand(OperandToUpdate, ToC); + } else { + for (unsigned i = 0, e = getNumOperands(); i != e; ++i) + if (getOperand(i) == From) + setOperand(i, ToC); + } + return; + } + } // Otherwise, I do need to replace this with an existing value. assert(Replacement != this && "I didn't contain From!"); Modified: llvm/trunk/lib/VMCore/Core.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Core.cpp?rev=77347&r1=77346&r2=77347&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/Core.cpp (original) +++ llvm/trunk/lib/VMCore/Core.cpp Tue Jul 28 13:32:17 2009 @@ -402,13 +402,13 @@ int DontNullTerminate) { /* Inverted the sense of AddNull because ', 0)' is a better mnemonic for null termination than ', 1)'. */ - return wrap(getGlobalContext().getConstantArray(std::string(Str, Length), + return wrap(ConstantArray::get(std::string(Str, Length), DontNullTerminate == 0)); } LLVMValueRef LLVMConstArray(LLVMTypeRef ElementTy, LLVMValueRef *ConstantVals, unsigned Length) { - return wrap(getGlobalContext().getConstantArray( + return wrap(ConstantArray::get( getGlobalContext().getArrayType(unwrap(ElementTy), Length), unwrap(ConstantVals, Length), Length)); Modified: llvm/trunk/lib/VMCore/LLVMContext.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/LLVMContext.cpp?rev=77347&r1=77346&r2=77347&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/LLVMContext.cpp (original) +++ llvm/trunk/lib/VMCore/LLVMContext.cpp Tue Jul 28 13:32:17 2009 @@ -103,42 +103,6 @@ return pImpl->getConstantAggregateZero(Ty); } - -// ConstantArray accessors. -Constant* LLVMContext::getConstantArray(const ArrayType* T, - const std::vector& V) { - return pImpl->getConstantArray(T, V); -} - -Constant* LLVMContext::getConstantArray(const ArrayType* T, - Constant* const* Vals, - unsigned NumVals) { - // FIXME: make this the primary ctor method. - return getConstantArray(T, std::vector(Vals, Vals+NumVals)); -} - -/// ConstantArray::get(const string&) - Return an array that is initialized to -/// contain the specified string. If length is zero then a null terminator is -/// added to the specified string so that it may be used in a natural way. -/// Otherwise, the length parameter specifies how much of the string to use -/// and it won't be null terminated. -/// -Constant* LLVMContext::getConstantArray(const StringRef &Str, - bool AddNull) { - std::vector ElementVals; - for (unsigned i = 0; i < Str.size(); ++i) - ElementVals.push_back(ConstantInt::get(Type::Int8Ty, Str[i])); - - // Add a null terminator to the string... - if (AddNull) { - ElementVals.push_back(ConstantInt::get(Type::Int8Ty, 0)); - } - - ArrayType *ATy = getArrayType(Type::Int8Ty, ElementVals.size()); - return getConstantArray(ATy, ElementVals); -} - - // ConstantExpr accessors. Constant* LLVMContext::getConstantExpr(unsigned Opcode, Constant* C1, Constant* C2) { @@ -525,15 +489,6 @@ pImpl->erase(Z); } -void LLVMContext::erase(ConstantArray *C) { - pImpl->erase(C); -} - void LLVMContext::erase(ConstantVector *V) { pImpl->erase(V); } - -Constant *LLVMContext::replaceUsesOfWithOnConstant(ConstantArray *CA, - Value *From, Value *To, Use *U) { - return pImpl->replaceUsesOfWithOnConstant(CA, From, To, U); -} Modified: llvm/trunk/lib/VMCore/LLVMContextImpl.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/LLVMContextImpl.cpp?rev=77347&r1=77346&r2=77347&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/LLVMContextImpl.cpp (original) +++ llvm/trunk/lib/VMCore/LLVMContextImpl.cpp Tue Jul 28 13:32:17 2009 @@ -21,14 +21,6 @@ static char getValType(ConstantAggregateZero *CPZ) { return 0; } -static std::vector getValType(ConstantArray *CA) { - std::vector Elements; - Elements.reserve(CA->getNumOperands()); - for (unsigned i = 0, e = CA->getNumOperands(); i != e; ++i) - Elements.push_back(cast(CA->getOperand(i))); - return Elements; -} - static std::vector getValType(ConstantVector *CP) { std::vector Elements; Elements.reserve(CP->getNumOperands()); @@ -85,25 +77,6 @@ return AggZeroConstants.getOrCreate(Ty, 0); } -Constant *LLVMContextImpl::getConstantArray(const ArrayType *Ty, - const std::vector &V) { - // If this is an all-zero array, return a ConstantAggregateZero object - if (!V.empty()) { - Constant *C = V[0]; - if (!C->isNullValue()) { - // Implicitly locked. - return ArrayConstants.getOrCreate(Ty, V); - } - for (unsigned i = 1, e = V.size(); i != e; ++i) - if (V[i] != C) { - // Implicitly locked. - return ArrayConstants.getOrCreate(Ty, V); - } - } - - return Context.getConstantAggregateZero(Ty); -} - Constant *LLVMContextImpl::getConstantVector(const VectorType *Ty, const std::vector &V) { assert(!V.empty() && "Vectors can't be empty"); @@ -146,90 +119,6 @@ AggZeroConstants.remove(Z); } -void LLVMContextImpl::erase(ConstantArray *C) { - ArrayConstants.remove(C); -} - void LLVMContextImpl::erase(ConstantVector *V) { VectorConstants.remove(V); } - -// *** RAUW helpers *** - -Constant *LLVMContextImpl::replaceUsesOfWithOnConstant(ConstantArray *CA, - Value *From, Value *To, Use *U) { - assert(isa(To) && "Cannot make Constant refer to non-constant!"); - Constant *ToC = cast(To); - - std::pair Lookup; - Lookup.first.first = CA->getType(); - Lookup.second = CA; - - std::vector &Values = Lookup.first.second; - Values.reserve(CA->getNumOperands()); // Build replacement array. - - // Fill values with the modified operands of the constant array. Also, - // compute whether this turns into an all-zeros array. - bool isAllZeros = false; - unsigned NumUpdated = 0; - if (!ToC->isNullValue()) { - for (Use *O = CA->OperandList, *E = CA->OperandList + CA->getNumOperands(); - O != E; ++O) { - Constant *Val = cast(O->get()); - if (Val == From) { - Val = ToC; - ++NumUpdated; - } - Values.push_back(Val); - } - } else { - isAllZeros = true; - for (Use *O = CA->OperandList, *E = CA->OperandList + CA->getNumOperands(); - O != E; ++O) { - Constant *Val = cast(O->get()); - if (Val == From) { - Val = ToC; - ++NumUpdated; - } - Values.push_back(Val); - if (isAllZeros) isAllZeros = Val->isNullValue(); - } - } - - Constant *Replacement = 0; - if (isAllZeros) { - Replacement = Context.getConstantAggregateZero(CA->getType()); - } else { - // Check to see if we have this array type already. - sys::SmartScopedWriter Writer(ConstantsLock); - bool Exists; - ArrayConstantsTy::MapTy::iterator I = - ArrayConstants.InsertOrGetItem(Lookup, Exists); - - if (Exists) { - Replacement = I->second; - } else { - // Okay, the new shape doesn't exist in the system yet. Instead of - // creating a new constant array, inserting it, replaceallusesof'ing the - // old with the new, then deleting the old... just update the current one - // in place! - ArrayConstants.MoveConstantToNewSlot(CA, I); - - // Update to the new value. Optimize for the case when we have a single - // operand that we're changing, but handle bulk updates efficiently. - if (NumUpdated == 1) { - unsigned OperandToUpdate = U - CA->OperandList; - assert(CA->getOperand(OperandToUpdate) == From && - "ReplaceAllUsesWith broken!"); - CA->setOperand(OperandToUpdate, ToC); - } else { - for (unsigned i = 0, e = CA->getNumOperands(); i != e; ++i) - if (CA->getOperand(i) == From) - CA->setOperand(i, ToC); - } - return 0; - } - } - - return Replacement; -} \ No newline at end of file Modified: llvm/trunk/lib/VMCore/LLVMContextImpl.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/LLVMContextImpl.h?rev=77347&r1=77346&r2=77347&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/LLVMContextImpl.h (original) +++ llvm/trunk/lib/VMCore/LLVMContextImpl.h Tue Jul 28 13:32:17 2009 @@ -88,7 +88,7 @@ std::vector C; for (unsigned i = 0, e = OldC->getNumOperands(); i != e; ++i) C.push_back(cast(OldC->getOperand(i))); - Constant *New = NewTy->getContext().getConstantArray(NewTy, C); + Constant *New = ConstantArray::get(NewTy, C); assert(New != OldC && "Didn't replace constant??"); OldC->uncheckedReplaceAllUsesWith(New); OldC->destroyConstant(); // This constant is now dead, destroy it. @@ -459,6 +459,7 @@ friend class ConstantInt; friend class ConstantFP; friend class ConstantStruct; + friend class ConstantArray; public: LLVMContextImpl(LLVMContext &C); @@ -468,9 +469,6 @@ ConstantAggregateZero *getConstantAggregateZero(const Type *Ty); - Constant *getConstantArray(const ArrayType *Ty, - const std::vector &V); - Constant *getConstantVector(const VectorType *Ty, const std::vector &V); @@ -491,13 +489,7 @@ void erase(MDString *M); void erase(MDNode *M); void erase(ConstantAggregateZero *Z); - void erase(ConstantArray *C); void erase(ConstantVector *V); - - // RAUW helpers - - Constant *replaceUsesOfWithOnConstant(ConstantArray *CA, Value *From, - Value *To, Use *U); }; } Modified: llvm/trunk/tools/bugpoint/ExtractFunction.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/bugpoint/ExtractFunction.cpp?rev=77347&r1=77346&r2=77347&view=diff ============================================================================== --- llvm/trunk/tools/bugpoint/ExtractFunction.cpp (original) +++ llvm/trunk/tools/bugpoint/ExtractFunction.cpp Tue Jul 28 13:32:17 2009 @@ -189,7 +189,7 @@ Elts.push_back(TorList[i].first); ArrayElts.push_back(ConstantStruct::get(Elts)); } - return Context.getConstantArray(Context.getArrayType(ArrayElts[0]->getType(), + return ConstantArray::get(Context.getArrayType(ArrayElts[0]->getType(), ArrayElts.size()), ArrayElts); } Modified: llvm/trunk/tools/bugpoint/Miscompilation.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/bugpoint/Miscompilation.cpp?rev=77347&r1=77346&r2=77347&view=diff ============================================================================== --- llvm/trunk/tools/bugpoint/Miscompilation.cpp (original) +++ llvm/trunk/tools/bugpoint/Miscompilation.cpp Tue Jul 28 13:32:17 2009 @@ -709,7 +709,7 @@ // Don't forward functions which are external in the test module too. if (TestFn && !TestFn->isDeclaration()) { // 1. Add a string constant with its name to the global file - Constant *InitArray = Context.getConstantArray(F->getName()); + Constant *InitArray = ConstantArray::get(F->getName()); GlobalVariable *funcName = new GlobalVariable(*Safe, InitArray->getType(), true /*isConstant*/, GlobalValue::InternalLinkage, InitArray, From resistor at mac.com Tue Jul 28 13:32:26 2009 From: resistor at mac.com (Owen Anderson) Date: Tue, 28 Jul 2009 18:32:26 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r77348 - in /llvm-gcc-4.2/trunk/gcc: llvm-backend.cpp llvm-convert.cpp llvm-types.cpp Message-ID: <200907281832.n6SIWQ4d008285@zion.cs.uiuc.edu> Author: resistor Date: Tue Jul 28 13:32:26 2009 New Revision: 77348 URL: http://llvm.org/viewvc/llvm-project?rev=77348&view=rev Log: Update for LLVM API change. Modified: llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp llvm-gcc-4.2/trunk/gcc/llvm-types.cpp Modified: llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp?rev=77348&r1=77347&r2=77348&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp (original) +++ llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp Tue Jul 28 13:32:26 2009 @@ -813,7 +813,7 @@ StructInit[1] = TheFolder->CreateBitCast(Tors[i].first, FPTy); InitList.push_back(ConstantStruct::get(StructInit, false)); } - Constant *Array = Context.getConstantArray( + Constant *Array = ConstantArray::get( Context.getArrayType(InitList[0]->getType(), InitList.size()), InitList); new GlobalVariable(*TheModule, Array->getType(), false, GlobalValue::AppendingLinkage, @@ -850,7 +850,7 @@ } ArrayType *AT = Context.getArrayType(SBP, AUGs.size()); - Constant *Init = Context.getConstantArray(AT, AUGs); + Constant *Init = ConstantArray::get(AT, AUGs); GlobalValue *gv = new GlobalVariable(*TheModule, AT, false, GlobalValue::AppendingLinkage, Init, "llvm.used"); @@ -860,7 +860,7 @@ // Add llvm.global.annotations if (!AttributeAnnotateGlobals.empty()) { - Constant *Array = Context.getConstantArray( + Constant *Array = ConstantArray::get( Context.getArrayType(AttributeAnnotateGlobals[0]->getType(), AttributeAnnotateGlobals.size()), AttributeAnnotateGlobals); @@ -1093,7 +1093,7 @@ /// global if possible. Constant* ConvertMetadataStringToGV(const char *str) { - Constant *Init = getGlobalContext().getConstantArray(std::string(str)); + Constant *Init = ConstantArray::get(std::string(str)); // Use cached string if it exists. static std::map StringCSTCache; Modified: llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp?rev=77348&r1=77347&r2=77348&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp (original) +++ llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp Tue Jul 28 13:32:26 2009 @@ -7117,7 +7117,7 @@ Elts.push_back(C); } } - return Context.getConstantArray(StrTy, Elts); + return ConstantArray::get(StrTy, Elts); } Constant *TreeConstantToLLVM::ConvertCOMPLEX_CST(tree exp) { @@ -7281,7 +7281,7 @@ // Zero length array. if (ResultElts.empty()) - return Context.getConstantArray( + return ConstantArray::get( cast(ConvertType(TREE_TYPE(exp))), ResultElts); assert(SomeVal && "If we had some initializer, we should have some value!"); @@ -7308,7 +7308,7 @@ } if (AllEltsSameType) - return Context.getConstantArray( + return ConstantArray::get( Context.getArrayType(ElTy, ResultElts.size()), ResultElts); return ConstantStruct::get(ResultElts, false); } Modified: llvm-gcc-4.2/trunk/gcc/llvm-types.cpp URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-types.cpp?rev=77348&r1=77347&r2=77348&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/llvm-types.cpp (original) +++ llvm-gcc-4.2/trunk/gcc/llvm-types.cpp Tue Jul 28 13:32:26 2009 @@ -188,7 +188,7 @@ } const std::string &TypeName = TypeNameMap[*I]; - LTypesNames.push_back(Context.getConstantArray(TypeName, false)); + LTypesNames.push_back(ConstantArray::get(TypeName, false)); } // Create string table. From clattner at apple.com Tue Jul 28 13:44:58 2009 From: clattner at apple.com (Chris Lattner) Date: Tue, 28 Jul 2009 11:44:58 -0700 Subject: [llvm-commits] [llvm] r76910 - in /llvm/trunk: include/llvm/Support/FormattedStream.h lib/Support/FormattedStream.cpp In-Reply-To: <200907281153.00746.greened@obbligato.org> References: <200907232321.n6NNLlYR010481@zion.cs.uiuc.edu> <8FE84457-ED22-4423-BE95-8552A0CD225B@apple.com> <200907281153.00746.greened@obbligato.org> Message-ID: <81526033-6055-4731-AFBF-D18A8CB714ED@apple.com> On Jul 28, 2009, at 9:52 AM, David A. Greene wrote: >>> + // Keep a buffer of spaces handy to speed up processing. >>> + static char Spaces[MAX_COLUMN_PAD]; >>> + static bool Initialized = false; >>> + if (!Initialized) { >> >> This won't work because it isn't thread safe. Why not just use: > > Why isn't it thread safe? Multiple threads might enter the then- > clause You're assuming a lot about the implementation of std::fill_n and the memory ordering properties of various CPUs. Please just don't go there. -Chris From nlewycky at google.com Tue Jul 28 13:46:28 2009 From: nlewycky at google.com (Nick Lewycky) Date: Tue, 28 Jul 2009 11:46:28 -0700 Subject: [llvm-commits] make llvm-poolalloc build with current llvm svn Message-ID: Hi, This patch updates llvm-poolalloc to make it build with current LLVM svn. Please commit! Nick -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20090728/1dc8a3e5/attachment.html -------------- next part -------------- A non-text attachment was scrubbed... Name: poolalloc.patch Type: text/x-diff Size: 31574 bytes Desc: not available Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20090728/1dc8a3e5/attachment.bin From sabre at nondot.org Tue Jul 28 13:48:43 2009 From: sabre at nondot.org (Chris Lattner) Date: Tue, 28 Jul 2009 18:48:43 -0000 Subject: [llvm-commits] [llvm] r77350 - /llvm/trunk/lib/Target/ARM/ARMBaseRegisterInfo.cpp Message-ID: <200907281848.n6SImh94008770@zion.cs.uiuc.edu> Author: lattner Date: Tue Jul 28 13:48:43 2009 New Revision: 77350 URL: http://llvm.org/viewvc/llvm-project?rev=77350&view=rev Log: more simplifications and cleanup. :) Modified: llvm/trunk/lib/Target/ARM/ARMBaseRegisterInfo.cpp Modified: llvm/trunk/lib/Target/ARM/ARMBaseRegisterInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMBaseRegisterInfo.cpp?rev=77350&r1=77349&r2=77350&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMBaseRegisterInfo.cpp (original) +++ llvm/trunk/lib/Target/ARM/ARMBaseRegisterInfo.cpp Tue Jul 28 13:48:43 2009 @@ -464,24 +464,23 @@ static unsigned estimateRSStackSizeLimit(MachineFunction &MF, const ARMBaseInstrInfo &TII) { unsigned Limit = (1 << 12) - 1; - for (MachineFunction::iterator BB = MF.begin(),E = MF.end();BB != E; ++BB) { - for (MachineBasicBlock::iterator I= BB->begin(); I != BB->end(); ++I) { - for (unsigned i = 0, e = I->getNumOperands(); i != e; ++i) - if (I->getOperand(i).isFI()) { - unsigned Opcode = I->getOpcode(); - const TargetInstrDesc &Desc = TII.get(Opcode); - unsigned AddrMode = (Desc.TSFlags & ARMII::AddrModeMask); - if (AddrMode == ARMII::AddrMode3 || - AddrMode == ARMII::AddrModeT2_i8) { - return (1 << 8) - 1; - } else if (AddrMode == ARMII::AddrMode5 || - AddrMode == ARMII::AddrModeT2_i8s4) { - unsigned ThisLimit = ((1 << 8) - 1) * 4; - if (ThisLimit < Limit) - Limit = ThisLimit; - } - break; // At most one FI per instruction - } + for (MachineFunction::iterator BB = MF.begin(),E = MF.end(); BB != E; ++BB) { + for (MachineBasicBlock::iterator I = BB->begin(), E = BB->end(); + I != E; ++I) { + for (unsigned i = 0, e = I->getNumOperands(); i != e; ++i) { + if (!I->getOperand(i).isFI()) continue; + + const TargetInstrDesc &Desc = TII.get(I->getOpcode()); + unsigned AddrMode = (Desc.TSFlags & ARMII::AddrModeMask); + if (AddrMode == ARMII::AddrMode3 || + AddrMode == ARMII::AddrModeT2_i8) + return (1 << 8) - 1; + + if (AddrMode == ARMII::AddrMode5 || + AddrMode == ARMII::AddrModeT2_i8s4) + Limit = std::min(Limit, ((1U << 8) - 1) * 4); + break; // At most one FI per instruction + } } } From clattner at apple.com Tue Jul 28 13:49:41 2009 From: clattner at apple.com (Chris Lattner) Date: Tue, 28 Jul 2009 11:49:41 -0700 Subject: [llvm-commits] make llvm-poolalloc build with current llvm svn In-Reply-To: References: Message-ID: On Jul 28, 2009, at 11:46 AM, Nick Lewycky wrote: > Hi, > > This patch updates llvm-poolalloc to make it build with current LLVM > svn. Please commit! Looks fine, go for it. -Chris From nlewycky at google.com Tue Jul 28 13:59:31 2009 From: nlewycky at google.com (Nick Lewycky) Date: Tue, 28 Jul 2009 11:59:31 -0700 Subject: [llvm-commits] make llvm-poolalloc build with current llvm svn In-Reply-To: References: Message-ID: 2009/7/28 Chris Lattner > > On Jul 28, 2009, at 11:46 AM, Nick Lewycky wrote: > > > Hi, > > > > This patch updates llvm-poolalloc to make it build with current LLVM > > svn. Please commit! > > Looks fine, go for it. This patch was made out-of-date by r77347. I'll try again later :) Nick -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20090728/a122d183/attachment.html From bruno.cardoso at gmail.com Tue Jul 28 14:25:33 2009 From: bruno.cardoso at gmail.com (Bruno Cardoso Lopes) Date: Tue, 28 Jul 2009 19:25:33 -0000 Subject: [llvm-commits] [llvm] r77354 - in /llvm/trunk/lib/CodeGen: ELFCodeEmitter.cpp ELFWriter.cpp Message-ID: <200907281925.n6SJPXbg009955@zion.cs.uiuc.edu> Author: bruno Date: Tue Jul 28 14:25:33 2009 New Revision: 77354 URL: http://llvm.org/viewvc/llvm-project?rev=77354&view=rev Log: Handle null and file symbol on doInitialization Modified: llvm/trunk/lib/CodeGen/ELFCodeEmitter.cpp llvm/trunk/lib/CodeGen/ELFWriter.cpp Modified: llvm/trunk/lib/CodeGen/ELFCodeEmitter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/ELFCodeEmitter.cpp?rev=77354&r1=77353&r2=77354&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/ELFCodeEmitter.cpp (original) +++ llvm/trunk/lib/CodeGen/ELFCodeEmitter.cpp Tue Jul 28 14:25:33 2009 @@ -36,7 +36,7 @@ /// startFunction - This callback is invoked when a new machine function is /// about to be emitted. void ELFCodeEmitter::startFunction(MachineFunction &MF) { - DEBUG(errs() << "processing function: " + DEBUG(errs() << "processing function: " << MF.getFunction()->getName() << "\n"); // Get the ELF Section that this function belongs in. Modified: llvm/trunk/lib/CodeGen/ELFWriter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/ELFWriter.cpp?rev=77354&r1=77353&r2=77354&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/ELFWriter.cpp (original) +++ llvm/trunk/lib/CodeGen/ELFWriter.cpp Tue Jul 28 14:25:33 2009 @@ -143,6 +143,11 @@ // Add the null section, which is required to be first in the file. getNullSection(); + // The first entry in the symtab is the null symbol and the second + // is a local symbol containing the module/file name + SymbolList.push_back(new ELFSym()); + SymbolList.push_back(ELFSym::getFileSym()); + return false; } @@ -189,7 +194,7 @@ const TargetLoweringObjectFile &TLOF = TM.getTargetLowering()->getObjFileLowering(); - + return getSection(TLOF.getSectionForMergeableConstant(Kind)->getName(), ELFSection::SHT_PROGBITS, ELFSection::SHF_MERGE | ELFSection::SHF_ALLOC, @@ -320,7 +325,7 @@ const TargetLoweringObjectFile &TLOF = TM.getTargetLowering()->getObjFileLowering(); - // Get ELF section from TAI + // Get the ELF section where this global belongs from TLOF const Section *S = TLOF.SectionForGlobal(GV, TM); unsigned SectionFlags = getElfSectionFlags(S->getKind()); @@ -522,9 +527,6 @@ if (TAI->getNonexecutableStackDirective()) getNonExecStackSection(); - // Emit module name - SymbolList.push_back(ELFSym::getFileSym()); - // Emit a symbol for each section created until now, skip null section for (unsigned i = 1, e = SectionList.size(); i < e; ++i) { ELFSection &ES = *SectionList[i]; @@ -798,9 +800,6 @@ // Size of each symtab entry. SymTab.EntSize = TEW->getSymTabEntrySize(); - // The first entry in the symtab is the null symbol - SymbolList.insert(SymbolList.begin(), new ELFSym()); - // Reorder the symbol table with local symbols first! unsigned FirstNonLocalSymbol = SortSymbols(); From a at bolka.at Tue Jul 28 14:49:26 2009 From: a at bolka.at (Andreas Bolka) Date: Tue, 28 Jul 2009 19:49:26 -0000 Subject: [llvm-commits] [llvm] r77357 - /llvm/trunk/lib/Analysis/LoopDependenceAnalysis.cpp Message-ID: <200907281949.n6SJnQWg011021@zion.cs.uiuc.edu> Author: abolka Date: Tue Jul 28 14:49:25 2009 New Revision: 77357 URL: http://llvm.org/viewvc/llvm-project?rev=77357&view=rev Log: Minor factoring, naming and formatting cleanups. Modified: llvm/trunk/lib/Analysis/LoopDependenceAnalysis.cpp Modified: llvm/trunk/lib/Analysis/LoopDependenceAnalysis.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/LoopDependenceAnalysis.cpp?rev=77357&r1=77356&r2=77357&view=diff ============================================================================== --- llvm/trunk/lib/Analysis/LoopDependenceAnalysis.cpp (original) +++ llvm/trunk/lib/Analysis/LoopDependenceAnalysis.cpp Tue Jul 28 14:49:25 2009 @@ -50,9 +50,9 @@ static void GetMemRefInstrs(const Loop *L, SmallVectorImpl &Memrefs) { for (Loop::block_iterator b = L->block_begin(), be = L->block_end(); - b != be; ++b) + b != be; ++b) for (BasicBlock::iterator i = (*b)->begin(), ie = (*b)->end(); - i != ie; ++i) + i != ie; ++i) if (IsMemRefInstr(i)) Memrefs.push_back(i); } @@ -71,6 +71,15 @@ return 0; } +static AliasAnalysis::AliasResult UnderlyingObjectsAlias(AliasAnalysis *AA, + const Value *A, + const Value *B) { + const Value *aObj = A->getUnderlyingObject(); + const Value *bObj = B->getUnderlyingObject(); + return AA->alias(aObj, AA->getTypeStoreSize(aObj->getType()), + bObj, AA->getTypeStoreSize(bObj->getType())); +} + //===----------------------------------------------------------------------===// // Dependence Testing //===----------------------------------------------------------------------===// @@ -83,19 +92,19 @@ cast(B)->mayWriteToMemory()); } -bool LoopDependenceAnalysis::findOrInsertDependencePair(Value *X, - Value *Y, +bool LoopDependenceAnalysis::findOrInsertDependencePair(Value *A, + Value *B, DependencePair *&P) { void *insertPos = 0; FoldingSetNodeID id; - id.AddPointer(X); - id.AddPointer(Y); + id.AddPointer(A); + id.AddPointer(B); P = Pairs.FindNodeOrInsertPos(id, insertPos); if (P) return true; P = PairAllocator.Allocate(); - new (P) DependencePair(id, X, Y); + new (P) DependencePair(id, A, B); Pairs.InsertNode(P, insertPos); return false; } @@ -114,28 +123,24 @@ return; } - Value *aptr = GetPointerOperand(P->A); - Value *bptr = GetPointerOperand(P->B); - const Value *aobj = aptr->getUnderlyingObject(); - const Value *bobj = bptr->getUnderlyingObject(); - AliasAnalysis::AliasResult alias = AA->alias( - aobj, AA->getTypeStoreSize(aobj->getType()), - bobj, AA->getTypeStoreSize(bobj->getType())); + Value *aPtr = GetPointerOperand(P->A); + Value *bPtr = GetPointerOperand(P->B); - // We can not analyse objects if we do not know about their aliasing. - if (alias == AliasAnalysis::MayAlias) { + switch (UnderlyingObjectsAlias(AA, aPtr, bPtr)) { + case AliasAnalysis::MayAlias: + // We can not analyse objects if we do not know about their aliasing. DEBUG(errs() << "---> [?] may alias\n"); return; - } - // If the objects noalias, they are distinct, accesses are independent. - if (alias == AliasAnalysis::NoAlias) { + case AliasAnalysis::NoAlias: + // If the objects noalias, they are distinct, accesses are independent. DEBUG(errs() << "---> [I] no alias\n"); P->Result = Independent; return; - } - // TODO: the underlying objects MustAlias, test for dependence + case AliasAnalysis::MustAlias: + break; // The underlying objects alias, test accesses for dependence. + } DEBUG(errs() << "---> [?] cannot analyse\n"); return; @@ -187,14 +192,14 @@ OS << " Load/store instructions: " << memrefs.size() << "\n"; for (SmallVector::const_iterator x = memrefs.begin(), - end = memrefs.end(); x != end; ++x) + end = memrefs.end(); x != end; ++x) OS << "\t" << (x - memrefs.begin()) << ": " << **x << "\n"; OS << " Pairwise dependence results:\n"; for (SmallVector::const_iterator x = memrefs.begin(), - end = memrefs.end(); x != end; ++x) + end = memrefs.end(); x != end; ++x) for (SmallVector::const_iterator y = x + 1; - y != end; ++y) + y != end; ++y) if (LDA->isDependencePair(*x, *y)) OS << "\t" << (x - memrefs.begin()) << "," << (y - memrefs.begin()) << ": " << (LDA->depends(*x, *y) ? "dependent" : "independent") From a at bolka.at Tue Jul 28 14:49:49 2009 From: a at bolka.at (Andreas Bolka) Date: Tue, 28 Jul 2009 19:49:49 -0000 Subject: [llvm-commits] [llvm] r77358 - /llvm/trunk/lib/Analysis/LoopDependenceAnalysis.cpp Message-ID: <200907281949.n6SJnncA011046@zion.cs.uiuc.edu> Author: abolka Date: Tue Jul 28 14:49:49 2009 New Revision: 77358 URL: http://llvm.org/viewvc/llvm-project?rev=77358&view=rev Log: Add LDA statistics. Modified: llvm/trunk/lib/Analysis/LoopDependenceAnalysis.cpp Modified: llvm/trunk/lib/Analysis/LoopDependenceAnalysis.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/LoopDependenceAnalysis.cpp?rev=77358&r1=77357&r2=77358&view=diff ============================================================================== --- llvm/trunk/lib/Analysis/LoopDependenceAnalysis.cpp (original) +++ llvm/trunk/lib/Analysis/LoopDependenceAnalysis.cpp Tue Jul 28 14:49:49 2009 @@ -18,6 +18,7 @@ //===----------------------------------------------------------------------===// #define DEBUG_TYPE "lda" +#include "llvm/ADT/Statistic.h" #include "llvm/Analysis/AliasAnalysis.h" #include "llvm/Analysis/LoopDependenceAnalysis.h" #include "llvm/Analysis/LoopPass.h" @@ -30,6 +31,12 @@ #include "llvm/Target/TargetData.h" using namespace llvm; +STATISTIC(NumAnswered, "Number of dependence queries answered"); +STATISTIC(NumAnalysed, "Number of distinct dependence pairs analysed"); +STATISTIC(NumDependent, "Number of pairs with dependent accesses"); +STATISTIC(NumIndependent, "Number of pairs with independent accesses"); +STATISTIC(NumUnknown, "Number of pairs with unknown accesses"); + LoopPass *llvm::createLoopDependenceAnalysisPass() { return new LoopDependenceAnalysis(); } @@ -148,11 +155,18 @@ bool LoopDependenceAnalysis::depends(Value *A, Value *B) { assert(isDependencePair(A, B) && "Values form no dependence pair!"); + ++NumAnswered; DependencePair *p; if (!findOrInsertDependencePair(A, B, p)) { // The pair is not cached, so analyse it. + ++NumAnalysed; analysePair(p); + switch (p->Result) { + case Dependent: ++NumDependent; break; + case Independent: ++NumIndependent; break; + case Unknown: ++NumUnknown; break; + } } return p->Result != Independent; } From a at bolka.at Tue Jul 28 14:50:13 2009 From: a at bolka.at (Andreas Bolka) Date: Tue, 28 Jul 2009 19:50:13 -0000 Subject: [llvm-commits] [llvm] r77359 - in /llvm/trunk: include/llvm/Analysis/LoopDependenceAnalysis.h lib/Analysis/LoopDependenceAnalysis.cpp Message-ID: <200907281950.n6SJoDDS011070@zion.cs.uiuc.edu> Author: abolka Date: Tue Jul 28 14:50:13 2009 New Revision: 77359 URL: http://llvm.org/viewvc/llvm-project?rev=77359&view=rev Log: Simplify LDA-internal interface. Modified: llvm/trunk/include/llvm/Analysis/LoopDependenceAnalysis.h llvm/trunk/lib/Analysis/LoopDependenceAnalysis.cpp Modified: llvm/trunk/include/llvm/Analysis/LoopDependenceAnalysis.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/LoopDependenceAnalysis.h?rev=77359&r1=77358&r2=77359&view=diff ============================================================================== --- llvm/trunk/include/llvm/Analysis/LoopDependenceAnalysis.h (original) +++ llvm/trunk/include/llvm/Analysis/LoopDependenceAnalysis.h Tue Jul 28 14:50:13 2009 @@ -62,7 +62,7 @@ bool findOrInsertDependencePair(Value*, Value*, DependencePair*&); /// TODO: doc - void analysePair(DependencePair *P) const; + DependenceResult analysePair(DependencePair *P) const; public: static char ID; // Class identification, replacement for typeinfo Modified: llvm/trunk/lib/Analysis/LoopDependenceAnalysis.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/LoopDependenceAnalysis.cpp?rev=77359&r1=77358&r2=77359&view=diff ============================================================================== --- llvm/trunk/lib/Analysis/LoopDependenceAnalysis.cpp (original) +++ llvm/trunk/lib/Analysis/LoopDependenceAnalysis.cpp Tue Jul 28 14:50:13 2009 @@ -116,18 +116,15 @@ return false; } -void LoopDependenceAnalysis::analysePair(DependencePair *P) const { +LoopDependenceAnalysis::DependenceResult +LoopDependenceAnalysis::analysePair(DependencePair *P) const { DEBUG(errs() << "Analysing:\n" << *P->A << "\n" << *P->B << "\n"); - // Our default answer: we don't know anything, i.e. we failed to analyse this - // pair to get a more specific answer (dependent, independent). - P->Result = Unknown; - // We only analyse loads and stores but no possible memory accesses by e.g. // free, call, or invoke instructions. if (!IsLoadOrStoreInst(P->A) || !IsLoadOrStoreInst(P->B)) { DEBUG(errs() << "--> [?] no load/store\n"); - return; + return Unknown; } Value *aPtr = GetPointerOperand(P->A); @@ -137,20 +134,20 @@ case AliasAnalysis::MayAlias: // We can not analyse objects if we do not know about their aliasing. DEBUG(errs() << "---> [?] may alias\n"); - return; + return Unknown; case AliasAnalysis::NoAlias: // If the objects noalias, they are distinct, accesses are independent. DEBUG(errs() << "---> [I] no alias\n"); - P->Result = Independent; - return; + return Independent; case AliasAnalysis::MustAlias: break; // The underlying objects alias, test accesses for dependence. } + // We failed to analyse this pair to get a more specific answer. DEBUG(errs() << "---> [?] cannot analyse\n"); - return; + return Unknown; } bool LoopDependenceAnalysis::depends(Value *A, Value *B) { @@ -161,8 +158,7 @@ if (!findOrInsertDependencePair(A, B, p)) { // The pair is not cached, so analyse it. ++NumAnalysed; - analysePair(p); - switch (p->Result) { + switch (p->Result = analysePair(p)) { case Dependent: ++NumDependent; break; case Independent: ++NumIndependent; break; case Unknown: ++NumUnknown; break; From dpatel at apple.com Tue Jul 28 14:55:13 2009 From: dpatel at apple.com (Devang Patel) Date: Tue, 28 Jul 2009 19:55:13 -0000 Subject: [llvm-commits] [llvm] r77360 - in /llvm/trunk: include/llvm/Analysis/DebugInfo.h lib/Analysis/DebugInfo.cpp Message-ID: <200907281955.n6SJtD6V011242@zion.cs.uiuc.edu> Author: dpatel Date: Tue Jul 28 14:55:13 2009 New Revision: 77360 URL: http://llvm.org/viewvc/llvm-project?rev=77360&view=rev Log: Add DebugInfoEnumerator to collect debug info. Modified: llvm/trunk/include/llvm/Analysis/DebugInfo.h llvm/trunk/lib/Analysis/DebugInfo.cpp Modified: llvm/trunk/include/llvm/Analysis/DebugInfo.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/DebugInfo.h?rev=77360&r1=77359&r2=77360&view=diff ============================================================================== --- llvm/trunk/include/llvm/Analysis/DebugInfo.h (original) +++ llvm/trunk/include/llvm/Analysis/DebugInfo.h Tue Jul 28 14:55:13 2009 @@ -21,6 +21,7 @@ #include "llvm/ADT/StringMap.h" #include "llvm/ADT/DenseMap.h" #include "llvm/ADT/SmallVector.h" +#include "llvm/ADT/SmallPtrSet.h" #include "llvm/Support/Dwarf.h" namespace llvm { @@ -609,6 +610,58 @@ /// isInlinedFnEnd - Return true if REI is ending an inlined function. bool isInlinedFnEnd(DbgRegionEndInst &REI, const Function *CurrentFn); + /// DebugInfoEnumrator - This object collects DebugInfo from + /// the module. + class DebugInfoEnumerator { + + public: + /// EnumerateModule - Enumerate entire module and collect debug info + /// anchors. + void enumerateModule(Module &M); + + private: + /// enumerateType - Enumerate DIType. + /// for a type. + void enumerateType(DIType DT); + + /// enumerateSubprogram - Enumberate DISubprogram. + void enumerateSubprogram(DISubprogram SP); + + /// enumerateStopPoint - Enumerate DbgStopPointInst. + void enumerateStopPoint(DbgStopPointInst *SPI); + + /// enumerateFuncStart - Enumberate DbgFuncStartInst. + void enumerateFuncStart(DbgFuncStartInst *FSI); + + /// addCompileUnit - Add compile unit into CUs. + bool addCompileUnit(DICompileUnit CU); + + /// addGlobalVariable - Add global variable into GVs. + bool addGlobalVariable(DIGlobalVariable DIG); + + // addSubprogram - Add subprgoram into SPs. + bool addSubprogram(DISubprogram SP); + + public: + typedef SmallVector::iterator iterator; + iterator compile_unit_begin() { return CUs.begin(); } + iterator compile_unit_end() { return CUs.end(); } + iterator subprogram_begin() { return SPs.begin(); } + iterator subprogram_end() { return SPs.end(); } + iterator global_variable_begin() { return GVs.begin(); } + iterator global_variable_end() { return GVs.end(); } + + unsigned compile_unit_count() { return CUs.size(); } + unsigned global_variable_count() { return GVs.size(); } + unsigned subprogram_count() { return SPs.size(); } + + private: + SmallVector CUs; // Compile Units + SmallVector SPs; // Subprograms + SmallVector GVs; // Global Variables; + SmallPtrSet NodesSeen; + + }; } // end namespace llvm #endif Modified: llvm/trunk/lib/Analysis/DebugInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/DebugInfo.cpp?rev=77360&r1=77359&r2=77360&view=diff ============================================================================== --- llvm/trunk/lib/Analysis/DebugInfo.cpp (original) +++ llvm/trunk/lib/Analysis/DebugInfo.cpp Tue Jul 28 14:55:13 2009 @@ -105,6 +105,7 @@ uint64_t DIDescriptor::getUInt64Field(unsigned Elt) const { if (DbgGV == 0) return 0; + if (!DbgGV->hasInitializer()) return 0; Constant *C = DbgGV->getInitializer(); if (C == 0 || Elt >= C->getNumOperands()) @@ -904,6 +905,122 @@ CallInst::Create(DeclareFn, Args, Args+2, "", BB); } +//===----------------------------------------------------------------------===// +// DebugInfoEnumerator implementations. +//===----------------------------------------------------------------------===// + +/// enumerateModule - Enumerate entire module and collect debug info. +void DebugInfoEnumerator::enumerateModule(Module &M) { + + for (Module::iterator I = M.begin(), E = M.end(); I != E; ++I) + for (Function::iterator FI = (*I).begin(), FE = (*I).end(); FI != FE; ++FI) + for (BasicBlock::iterator BI = (*FI).begin(), BE = (*FI).end(); BI != BE; + ++BI) { + if (DbgStopPointInst *SPI = dyn_cast(BI)) + enumerateStopPoint(SPI); + else if (DbgFuncStartInst *FSI = dyn_cast(BI)) + enumerateFuncStart(FSI); + } + + for (Module::global_iterator GVI = M.global_begin(), GVE = M.global_end(); + GVI != GVE; ++GVI) { + GlobalVariable *GV = GVI; + if (!GV->hasName() || !GV->isConstant() + || strcmp(GV->getName().data(), "llvm.dbg.global_variable") + || !GV->hasInitializer()) + continue; + DIGlobalVariable DIG(GV); + if (addGlobalVariable(DIG)) { + addCompileUnit(DIG.getCompileUnit()); + enumerateType(DIG.getType()); + } + } +} + +/// enumerateType - Enumerate DIType. +void DebugInfoEnumerator::enumerateType(DIType DT) { + if (DT.isNull()) + return; + if (!NodesSeen.insert(DT.getGV())) + return; + + addCompileUnit(DT.getCompileUnit()); + if (DT.isCompositeType(DT.getTag())) { + DICompositeType DCT(DT.getGV()); + enumerateType(DCT.getTypeDerivedFrom()); + DIArray DA = DCT.getTypeArray(); + if (!DA.isNull()) + for (unsigned i = 0, e = DA.getNumElements(); i != e; ++i) { + DIDescriptor D = DA.getElement(i); + DIType TypeE = DIType(D.getGV()); + if (!TypeE.isNull()) + enumerateType(TypeE); + else + enumerateSubprogram(DISubprogram(D.getGV())); + } + } else if (DT.isDerivedType(DT.getTag())) { + DIDerivedType DDT(DT.getGV()); + if (!DDT.isNull()) + enumerateType(DDT.getTypeDerivedFrom()); + } +} + +/// enumerateSubprogram - Enumberate DISubprogram. +void DebugInfoEnumerator::enumerateSubprogram(DISubprogram SP) { + if (!addSubprogram(SP)) + return; + addCompileUnit(SP.getCompileUnit()); + enumerateType(SP.getType()); +} + +/// enumerateStopPoint - Enumerate DbgStopPointInst. +void DebugInfoEnumerator::enumerateStopPoint(DbgStopPointInst *SPI) { + GlobalVariable *Context = dyn_cast(SPI->getContext()); + addCompileUnit(DICompileUnit(Context)); +} + +/// enumerateFuncStart - Enumberate DbgFuncStartInst. +void DebugInfoEnumerator::enumerateFuncStart(DbgFuncStartInst *FSI) { + GlobalVariable *SP = dyn_cast(FSI->getSubprogram()); + enumerateSubprogram(DISubprogram(SP)); +} + +/// addCompileUnit - Add compile unit into CUs. +bool DebugInfoEnumerator::addCompileUnit(DICompileUnit CU) { + if (CU.isNull()) + return false; + + if (!NodesSeen.insert(CU.getGV())) + return false; + + CUs.push_back(CU.getGV()); + return true; +} + +/// addGlobalVariable - Add global variable into GVs. +bool DebugInfoEnumerator::addGlobalVariable(DIGlobalVariable DIG) { + if (DIG.isNull()) + return false; + + if (!NodesSeen.insert(DIG.getGV())) + return false; + + GVs.push_back(DIG.getGV()); + return true; +} + +// addSubprogram - Add subprgoram into SPs. +bool DebugInfoEnumerator::addSubprogram(DISubprogram SP) { + if (SP.isNull()) + return false; + + if (!NodesSeen.insert(SP.getGV())) + return false; + + SPs.push_back(SP.getGV()); + return true; +} + namespace llvm { /// findStopPoint - Find the stoppoint coressponding to this instruction, that /// is the stoppoint that dominates this instruction. From deeppatel1987 at gmail.com Tue Jul 28 15:22:44 2009 From: deeppatel1987 at gmail.com (Sandeep Patel) Date: Tue, 28 Jul 2009 20:22:44 +0000 Subject: [llvm-commits] [llvm] r77340 - in /llvm/trunk: lib/Target/ARM/ARMInstrThumb2.td test/CodeGen/Thumb2/thumb2-lsr3.ll In-Reply-To: <200907281815.n6SIFctv007606@zion.cs.uiuc.edu> References: <200907281815.n6SIFctv007606@zion.cs.uiuc.edu> Message-ID: <305d6f60907281322r644d145ob3a9096c26e6a199@mail.gmail.com> For those without internal Radar access, could you elaborate? deep On Tue, Jul 28, 2009 at 6:15 PM, David Goodwin wrote: > Author: david_goodwin > Date: Tue Jul 28 13:15:38 2009 > New Revision: 77340 > > URL: http://llvm.org/viewvc/llvm-project?rev=77340&view=rev > Log: > Add workaround for . > > Modified: > ? ?llvm/trunk/lib/Target/ARM/ARMInstrThumb2.td > ? ?llvm/trunk/test/CodeGen/Thumb2/thumb2-lsr3.ll > > Modified: llvm/trunk/lib/Target/ARM/ARMInstrThumb2.td > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMInstrThumb2.td?rev=77340&r1=77339&r2=77340&view=diff > > ============================================================================== > --- llvm/trunk/lib/Target/ARM/ARMInstrThumb2.td (original) > +++ llvm/trunk/lib/Target/ARM/ARMInstrThumb2.td Tue Jul 28 13:15:38 2009 > @@ -714,8 +714,9 @@ > ?defm t2ASR ?: T2I_sh_ir<"asr", BinOpFrag<(sra ?node:$LHS, node:$RHS)>>; > ?defm t2ROR ?: T2I_sh_ir<"ror", BinOpFrag<(rotr node:$LHS, node:$RHS)>>; > > +// FIXME should be "rrx $dst,$src" once is fixed > ?def t2MOVrx : T2sI<(outs GPR:$dst), (ins GPR:$src), > - ? ? ? ? ? ? ? ? ? "rrx", " $dst, $src", > + ? ? ? ? ? ? ? ? ? "mov", ".w $dst, $src, rrx", > ? ? ? ? ? ? ? ? ? ?[(set GPR:$dst, (ARMrrx GPR:$src))]>; > > ?let Defs = [CPSR] in { > > Modified: llvm/trunk/test/CodeGen/Thumb2/thumb2-lsr3.ll > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Thumb2/thumb2-lsr3.ll?rev=77340&r1=77339&r2=77340&view=diff > > ============================================================================== > --- llvm/trunk/test/CodeGen/Thumb2/thumb2-lsr3.ll (original) > +++ llvm/trunk/test/CodeGen/Thumb2/thumb2-lsr3.ll Tue Jul 28 13:15:38 2009 > @@ -2,7 +2,7 @@ > > ?define i1 @test1(i64 %poscnt, i32 %work) { > ?entry: > -; CHECK: rrx r0, r0 > +; CHECK: mov.w r0, r0, rrx > ?; CHECK: lsrs.w r1, r1, #1 > ? ? ? ?%0 = lshr i64 %poscnt, 1 > ? ? ? ?%1 = icmp eq i64 %0, 0 > @@ -11,7 +11,7 @@ > > ?define i1 @test2(i64 %poscnt, i32 %work) { > ?entry: > -; CHECK: rrx r0, r0 > +; CHECK: mov.w r0, r0, rrx > ?; CHECK: asrs.w r1, r1, #1 > ? ? ? ?%0 = ashr i64 %poscnt, 1 > ? ? ? ?%1 = icmp eq i64 %0, 0 > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits > From bob.wilson at apple.com Tue Jul 28 15:28:49 2009 From: bob.wilson at apple.com (Bob Wilson) Date: Tue, 28 Jul 2009 13:28:49 -0700 Subject: [llvm-commits] [llvm] r77340 - in /llvm/trunk: lib/Target/ARM/ARMInstrThumb2.td test/CodeGen/Thumb2/thumb2-lsr3.ll In-Reply-To: <305d6f60907281322r644d145ob3a9096c26e6a199@mail.gmail.com> References: <200907281815.n6SIFctv007606@zion.cs.uiuc.edu> <305d6f60907281322r644d145ob3a9096c26e6a199@mail.gmail.com> Message-ID: <50A85D5F-3459-4763-B8A0-9C15D96E9BBD@apple.com> Apple's assembler doesn't recognize Thumb2 RRX instructions, e.g., "rrx r0,r0". On Jul 28, 2009, at 1:22 PM, Sandeep Patel wrote: > For those without internal Radar access, could you elaborate? > > deep > > On Tue, Jul 28, 2009 at 6:15 PM, David > Goodwin wrote: >> Author: david_goodwin >> Date: Tue Jul 28 13:15:38 2009 >> New Revision: 77340 >> >> URL: http://llvm.org/viewvc/llvm-project?rev=77340&view=rev >> Log: >> Add workaround for . >> >> Modified: >> llvm/trunk/lib/Target/ARM/ARMInstrThumb2.td >> llvm/trunk/test/CodeGen/Thumb2/thumb2-lsr3.ll >> >> Modified: llvm/trunk/lib/Target/ARM/ARMInstrThumb2.td >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMInstrThumb2.td?rev=77340&r1=77339&r2=77340&view=diff >> >> = >> = >> = >> = >> = >> = >> = >> = >> = >> ===================================================================== >> --- llvm/trunk/lib/Target/ARM/ARMInstrThumb2.td (original) >> +++ llvm/trunk/lib/Target/ARM/ARMInstrThumb2.td Tue Jul 28 13:15:38 >> 2009 >> @@ -714,8 +714,9 @@ >> defm t2ASR : T2I_sh_ir<"asr", BinOpFrag<(sra node:$LHS, node: >> $RHS)>>; >> defm t2ROR : T2I_sh_ir<"ror", BinOpFrag<(rotr node:$LHS, node: >> $RHS)>>; >> >> +// FIXME should be "rrx $dst,$src" once >> is fixed >> def t2MOVrx : T2sI<(outs GPR:$dst), (ins GPR:$src), >> - "rrx", " $dst, $src", >> + "mov", ".w $dst, $src, rrx", >> [(set GPR:$dst, (ARMrrx GPR:$src))]>; >> >> let Defs = [CPSR] in { >> >> Modified: llvm/trunk/test/CodeGen/Thumb2/thumb2-lsr3.ll >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Thumb2/thumb2-lsr3.ll?rev=77340&r1=77339&r2=77340&view=diff >> >> = >> = >> = >> = >> = >> = >> = >> = >> = >> ===================================================================== >> --- llvm/trunk/test/CodeGen/Thumb2/thumb2-lsr3.ll (original) >> +++ llvm/trunk/test/CodeGen/Thumb2/thumb2-lsr3.ll Tue Jul 28 >> 13:15:38 2009 >> @@ -2,7 +2,7 @@ >> >> define i1 @test1(i64 %poscnt, i32 %work) { >> entry: >> -; CHECK: rrx r0, r0 >> +; CHECK: mov.w r0, r0, rrx >> ; CHECK: lsrs.w r1, r1, #1 >> %0 = lshr i64 %poscnt, 1 >> %1 = icmp eq i64 %0, 0 >> @@ -11,7 +11,7 @@ >> >> define i1 @test2(i64 %poscnt, i32 %work) { >> entry: >> -; CHECK: rrx r0, r0 >> +; CHECK: mov.w r0, r0, rrx >> ; CHECK: asrs.w r1, r1, #1 >> %0 = ashr i64 %poscnt, 1 >> %1 = icmp eq i64 %0, 0 >> >> >> _______________________________________________ >> llvm-commits mailing list >> llvm-commits at cs.uiuc.edu >> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits >> > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From deeppatel1987 at gmail.com Tue Jul 28 15:45:35 2009 From: deeppatel1987 at gmail.com (Sandeep Patel) Date: Tue, 28 Jul 2009 20:45:35 +0000 Subject: [llvm-commits] [llvm] r77340 - in /llvm/trunk: lib/Target/ARM/ARMInstrThumb2.td test/CodeGen/Thumb2/thumb2-lsr3.ll In-Reply-To: <50A85D5F-3459-4763-B8A0-9C15D96E9BBD@apple.com> References: <200907281815.n6SIFctv007606@zion.cs.uiuc.edu> <305d6f60907281322r644d145ob3a9096c26e6a199@mail.gmail.com> <50A85D5F-3459-4763-B8A0-9C15D96E9BBD@apple.com> Message-ID: <305d6f60907281345q6f41e809w8166f84ee3c6afad@mail.gmail.com> Could this be conditionalized for Darwin? gas seems to work for these cases. deep On Tue, Jul 28, 2009 at 8:28 PM, Bob Wilson wrote: > Apple's assembler doesn't recognize Thumb2 RRX instructions, e.g., > "rrx r0,r0". > > On Jul 28, 2009, at 1:22 PM, Sandeep Patel wrote: > >> For those without internal Radar access, could you elaborate? >> >> deep >> >> On Tue, Jul 28, 2009 at 6:15 PM, David >> Goodwin wrote: >>> Author: david_goodwin >>> Date: Tue Jul 28 13:15:38 2009 >>> New Revision: 77340 >>> >>> URL: http://llvm.org/viewvc/llvm-project?rev=77340&view=rev >>> Log: >>> Add workaround for . >>> >>> Modified: >>> ? ?llvm/trunk/lib/Target/ARM/ARMInstrThumb2.td >>> ? ?llvm/trunk/test/CodeGen/Thumb2/thumb2-lsr3.ll >>> >>> Modified: llvm/trunk/lib/Target/ARM/ARMInstrThumb2.td >>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMInstrThumb2.td?rev=77340&r1=77339&r2=77340&view=diff >>> >>> = >>> = >>> = >>> = >>> = >>> = >>> = >>> = >>> = >>> ===================================================================== >>> --- llvm/trunk/lib/Target/ARM/ARMInstrThumb2.td (original) >>> +++ llvm/trunk/lib/Target/ARM/ARMInstrThumb2.td Tue Jul 28 13:15:38 >>> 2009 >>> @@ -714,8 +714,9 @@ >>> ?defm t2ASR ?: T2I_sh_ir<"asr", BinOpFrag<(sra ?node:$LHS, node: >>> $RHS)>>; >>> ?defm t2ROR ?: T2I_sh_ir<"ror", BinOpFrag<(rotr node:$LHS, node: >>> $RHS)>>; >>> >>> +// FIXME should be "rrx $dst,$src" once >>> is fixed >>> ?def t2MOVrx : T2sI<(outs GPR:$dst), (ins GPR:$src), >>> - ? ? ? ? ? ? ? ? ? "rrx", " $dst, $src", >>> + ? ? ? ? ? ? ? ? ? "mov", ".w $dst, $src, rrx", >>> ? ? ? ? ? ? ? ? ? ?[(set GPR:$dst, (ARMrrx GPR:$src))]>; >>> >>> ?let Defs = [CPSR] in { >>> >>> Modified: llvm/trunk/test/CodeGen/Thumb2/thumb2-lsr3.ll >>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Thumb2/thumb2-lsr3.ll?rev=77340&r1=77339&r2=77340&view=diff >>> >>> = >>> = >>> = >>> = >>> = >>> = >>> = >>> = >>> = >>> ===================================================================== >>> --- llvm/trunk/test/CodeGen/Thumb2/thumb2-lsr3.ll (original) >>> +++ llvm/trunk/test/CodeGen/Thumb2/thumb2-lsr3.ll Tue Jul 28 >>> 13:15:38 2009 >>> @@ -2,7 +2,7 @@ >>> >>> ?define i1 @test1(i64 %poscnt, i32 %work) { >>> ?entry: >>> -; CHECK: rrx r0, r0 >>> +; CHECK: mov.w r0, r0, rrx >>> ?; CHECK: lsrs.w r1, r1, #1 >>> ? ? ? ?%0 = lshr i64 %poscnt, 1 >>> ? ? ? ?%1 = icmp eq i64 %0, 0 >>> @@ -11,7 +11,7 @@ >>> >>> ?define i1 @test2(i64 %poscnt, i32 %work) { >>> ?entry: >>> -; CHECK: rrx r0, r0 >>> +; CHECK: mov.w r0, r0, rrx >>> ?; CHECK: asrs.w r1, r1, #1 >>> ? ? ? ?%0 = ashr i64 %poscnt, 1 >>> ? ? ? ?%1 = icmp eq i64 %0, 0 >>> >>> >>> _______________________________________________ >>> llvm-commits mailing list >>> llvm-commits at cs.uiuc.edu >>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits >>> >> >> _______________________________________________ >> llvm-commits mailing list >> llvm-commits at cs.uiuc.edu >> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits > From daniel at zuster.org Tue Jul 28 15:47:52 2009 From: daniel at zuster.org (Daniel Dunbar) Date: Tue, 28 Jul 2009 20:47:52 -0000 Subject: [llvm-commits] [llvm] r77362 - in /llvm/trunk: include/llvm/Target/TargetRegistry.h lib/Target/X86/AsmParser/X86AsmParser.cpp tools/llvm-mc/AsmParser.h tools/llvm-mc/llvm-mc.cpp Message-ID: <200907282047.n6SKlq9l013059@zion.cs.uiuc.edu> Author: ddunbar Date: Tue Jul 28 15:47:52 2009 New Revision: 77362 URL: http://llvm.org/viewvc/llvm-project?rev=77362&view=rev Log: Provide generic MCAsmParser when constructing target specific parsers. Modified: llvm/trunk/include/llvm/Target/TargetRegistry.h llvm/trunk/lib/Target/X86/AsmParser/X86AsmParser.cpp llvm/trunk/tools/llvm-mc/AsmParser.h llvm/trunk/tools/llvm-mc/llvm-mc.cpp Modified: llvm/trunk/include/llvm/Target/TargetRegistry.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetRegistry.h?rev=77362&r1=77361&r2=77362&view=diff ============================================================================== --- llvm/trunk/include/llvm/Target/TargetRegistry.h (original) +++ llvm/trunk/include/llvm/Target/TargetRegistry.h Tue Jul 28 15:47:52 2009 @@ -28,6 +28,7 @@ namespace llvm { class FunctionPass; + class MCAsmParser; class Module; class TargetAsmParser; class TargetMachine; @@ -51,7 +52,8 @@ typedef FunctionPass *(*AsmPrinterCtorTy)(formatted_raw_ostream &, TargetMachine &, bool); - typedef TargetAsmParser *(*AsmParserCtorTy)(const Target &); + typedef TargetAsmParser *(*AsmParserCtorTy)(const Target &, + MCAsmParser &); friend struct TargetRegistry; @@ -123,10 +125,13 @@ } /// createAsmParser - Create a target specific assembly parser. - TargetAsmParser *createAsmParser() const { + /// + /// \arg Parser - The target independent parser implementation to use for + /// parsing and lexing. + TargetAsmParser *createAsmParser(MCAsmParser &Parser) const { if (!AsmParserCtorFn) return 0; - return AsmParserCtorFn(*this); + return AsmParserCtorFn(*this, Parser); } }; @@ -344,12 +349,13 @@ } }; - /// RegisterAsmParser - Helper template for registering a target specific asm - /// parser, for use in the target machine initialization function. Usage: + /// RegisterAsmParser - Helper template for registering a target specific + /// assembly parser, for use in the target machine initialization + /// function. Usage: /// - /// extern "C" void LLVMInitializeFooAsmPrinter() { + /// extern "C" void LLVMInitializeFooAsmParser() { /// extern Target TheFooTarget; - /// RegisterAsmPrinter X(TheFooTarget); + /// RegisterAsmParser X(TheFooTarget); /// } template struct RegisterAsmParser { @@ -358,8 +364,8 @@ } private: - static TargetAsmParser *Allocator(const Target &T) { - return new AsmParserImpl(T); + static TargetAsmParser *Allocator(const Target &T, MCAsmParser &P) { + return new AsmParserImpl(T, P); } }; 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=77362&r1=77361&r2=77362&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/AsmParser/X86AsmParser.cpp (original) +++ llvm/trunk/lib/Target/X86/AsmParser/X86AsmParser.cpp Tue Jul 28 15:47:52 2009 @@ -9,6 +9,7 @@ #include "X86.h" #include "llvm/ADT/SmallVector.h" +#include "llvm/MC/MCAsmLexer.h" #include "llvm/MC/MCAsmParser.h" #include "llvm/Target/TargetRegistry.h" #include "llvm/Target/TargetAsmParser.h" @@ -19,25 +20,26 @@ }; class X86ATTAsmParser : public TargetAsmParser { + MCAsmParser &Parser; + + private: bool ParseOperand(X86Operand &Op); bool MatchInstruction(const StringRef &Name, llvm::SmallVector &Operands, MCInst &Inst); + MCAsmLexer &getLexer() const { return Parser.getLexer(); } + public: - explicit X86ATTAsmParser(const Target &); + X86ATTAsmParser(const Target &T, MCAsmParser &_Parser) + : TargetAsmParser(T), Parser(_Parser) {} virtual bool ParseInstruction(MCAsmParser &AP, const StringRef &Name, MCInst &Inst); }; } -X86ATTAsmParser::X86ATTAsmParser(const Target &T) - : TargetAsmParser(T) -{ -} - bool X86ATTAsmParser::ParseOperand(X86Operand &Op) { return true; } Modified: llvm/trunk/tools/llvm-mc/AsmParser.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-mc/AsmParser.h?rev=77362&r1=77361&r2=77362&view=diff ============================================================================== --- llvm/trunk/tools/llvm-mc/AsmParser.h (original) +++ llvm/trunk/tools/llvm-mc/AsmParser.h Tue Jul 28 15:47:52 2009 @@ -27,7 +27,7 @@ class TargetAsmParser; class Twine; -class AsmParser : MCAsmParser { +class AsmParser : public MCAsmParser { public: struct X86Operand; @@ -35,18 +35,18 @@ AsmLexer Lexer; MCContext &Ctx; MCStreamer &Out; - TargetAsmParser &TargetParser; + TargetAsmParser *TargetParser; public: - AsmParser(SourceMgr &_SM, MCContext &_Ctx, MCStreamer &_Out, - TargetAsmParser &_TargetParser) - : Lexer(_SM), Ctx(_Ctx), Out(_Out), TargetParser(_TargetParser) {} + AsmParser(SourceMgr &_SM, MCContext &_Ctx, MCStreamer &_Out) + : Lexer(_SM), Ctx(_Ctx), Out(_Out), TargetParser(0) {} ~AsmParser() {} - + bool Run(); public: - TargetAsmParser &getTargetParser() const { return TargetParser; } + TargetAsmParser &getTargetParser() const { return *TargetParser; } + void setTargetParser(TargetAsmParser &P) { TargetParser = &P; } virtual MCAsmLexer &getLexer() { return Lexer; } Modified: llvm/trunk/tools/llvm-mc/llvm-mc.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-mc/llvm-mc.cpp?rev=77362&r1=77361&r2=77362&view=diff ============================================================================== --- llvm/trunk/tools/llvm-mc/llvm-mc.cpp (original) +++ llvm/trunk/tools/llvm-mc/llvm-mc.cpp Tue Jul 28 15:47:52 2009 @@ -22,6 +22,7 @@ #include "llvm/Support/SourceMgr.h" #include "llvm/Support/raw_ostream.h" #include "llvm/System/Signals.h" +#include "llvm/Target/TargetAsmParser.h" #include "llvm/Target/TargetRegistry.h" #include "llvm/Target/TargetSelect.h" #include "AsmParser.h" @@ -140,7 +141,8 @@ return Error; } -static int AssembleInput(const char *ProgName) { +static TargetAsmParser *GetTargetAsmParser(const char *ProgName, + MCAsmParser &Parser) { // Get the target specific parser. std::string Error; const Target *TheTarget = @@ -151,23 +153,24 @@ if (TheTarget == 0) { errs() << ProgName << ": error: unable to get target for '" << TripleName << "', see --version and --triple.\n"; - return 1; + return 0; } - TargetAsmParser *TAP = TheTarget->createAsmParser(); - if (!TAP) { - errs() << ProgName - << ": error: this target does not support assembly parsing.\n"; - return 1; - } + if (TargetAsmParser *TAP = TheTarget->createAsmParser(Parser)) + return TAP; + + errs() << ProgName + << ": error: this target does not support assembly parsing.\n"; + return 0; +} - std::string ErrorMessage; - MemoryBuffer *Buffer = MemoryBuffer::getFileOrSTDIN(InputFilename, - &ErrorMessage); +static int AssembleInput(const char *ProgName) { + std::string Error; + MemoryBuffer *Buffer = MemoryBuffer::getFileOrSTDIN(InputFilename, &Error); if (Buffer == 0) { errs() << ProgName << ": "; - if (ErrorMessage.size()) - errs() << ErrorMessage << "\n"; + if (Error.size()) + errs() << Error << "\n"; else errs() << "input file didn't read correctly.\n"; return 1; @@ -189,7 +192,10 @@ Str.get()->SwitchSection(Ctx.GetSection("__TEXT,__text," "regular,pure_instructions")); - AsmParser Parser(SrcMgr, Ctx, *Str.get(), *TAP); + AsmParser Parser(SrcMgr, Ctx, *Str.get()); + OwningPtr TAP(GetTargetAsmParser(ProgName, Parser)); + if (!TAP) + return 1; return Parser.Run(); } From david_goodwin at apple.com Tue Jul 28 15:51:25 2009 From: david_goodwin at apple.com (David Goodwin) Date: Tue, 28 Jul 2009 20:51:25 -0000 Subject: [llvm-commits] [llvm] r77363 - in /llvm/trunk: lib/Target/ARM/ARMInstrThumb2.td test/CodeGen/Thumb2/thumb2-orn.ll test/CodeGen/Thumb2/thumb2-orn2.ll Message-ID: <200907282051.n6SKpQJP013197@zion.cs.uiuc.edu> Author: david_goodwin Date: Tue Jul 28 15:51:25 2009 New Revision: 77363 URL: http://llvm.org/viewvc/llvm-project?rev=77363&view=rev Log: Remove support for ORN to workaround . Modified: llvm/trunk/lib/Target/ARM/ARMInstrThumb2.td llvm/trunk/test/CodeGen/Thumb2/thumb2-orn.ll llvm/trunk/test/CodeGen/Thumb2/thumb2-orn2.ll Modified: llvm/trunk/lib/Target/ARM/ARMInstrThumb2.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMInstrThumb2.td?rev=77363&r1=77362&r2=77363&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMInstrThumb2.td (original) +++ llvm/trunk/lib/Target/ARM/ARMInstrThumb2.td Tue Jul 28 15:51:25 2009 @@ -745,7 +745,8 @@ // FIXME: A8.6.18 BFI - Bitfield insert (Encoding T1) -defm t2ORN : T2I_bin_irs<"orn", BinOpFrag<(or node:$LHS, (not node:$RHS))>>; +// FIXME workaround for +//defm t2ORN : T2I_bin_irs<"orn", BinOpFrag<(or node:$LHS, (not node:$RHS))>>; // Prefer over of t2EORri ra, rb, -1 because mvn has 16-bit version let AddedComplexity = 1 in @@ -755,8 +756,9 @@ def : T2Pat<(and GPR:$src, t2_so_imm_not:$imm), (t2BICri GPR:$src, t2_so_imm_not:$imm)>; -def : T2Pat<(or GPR:$src, t2_so_imm_not:$imm), - (t2ORNri GPR:$src, t2_so_imm_not:$imm)>; +// FIXME workaround for +//def : T2Pat<(or GPR:$src, t2_so_imm_not:$imm), +// (t2ORNri GPR:$src, t2_so_imm_not:$imm)>; def : T2Pat<(t2_so_imm_not:$src), (t2MVNi t2_so_imm_not:$src)>; Modified: llvm/trunk/test/CodeGen/Thumb2/thumb2-orn.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Thumb2/thumb2-orn.ll?rev=77363&r1=77362&r2=77363&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/Thumb2/thumb2-orn.ll (original) +++ llvm/trunk/test/CodeGen/Thumb2/thumb2-orn.ll Tue Jul 28 15:51:25 2009 @@ -1,3 +1,4 @@ +; XFAIL: * ; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {orn\\W*r\[0-9\]*,\\W*r\[0-9\]*,\\W*r\[0-9\]*$} | count 4 ; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {orn\\W*r\[0-9\],\\W*r\[0-9\],\\W*r\[0-9\],\\W*lsl\\W*#5$} | count 1 ; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {orn\\W*r\[0-9\],\\W*r\[0-9\],\\W*r\[0-9\],\\W*lsr\\W*#6$} | count 1 Modified: llvm/trunk/test/CodeGen/Thumb2/thumb2-orn2.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Thumb2/thumb2-orn2.ll?rev=77363&r1=77362&r2=77363&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/Thumb2/thumb2-orn2.ll (original) +++ llvm/trunk/test/CodeGen/Thumb2/thumb2-orn2.ll Tue Jul 28 15:51:25 2009 @@ -1,3 +1,4 @@ +; XFAIL: * ; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {orn\\W*r\[0-9\]*,\\W*r\[0-9\]*,\\W*#\[0-9\]*} | grep {#187\\|#11141290\\|#3422604288\\|#1114112} | count 4 ; 0x000000bb = 187 From evan.cheng at apple.com Tue Jul 28 15:53:24 2009 From: evan.cheng at apple.com (Evan Cheng) Date: Tue, 28 Jul 2009 20:53:24 -0000 Subject: [llvm-commits] [llvm] r77364 - in /llvm/trunk: lib/Target/ARM/ARMISelLowering.cpp lib/Target/ARM/ARMISelLowering.h lib/Target/ARM/ARMInstrInfo.td lib/Target/ARM/ARMInstrThumb.td lib/Target/ARM/ARMInstrThumb2.td test/CodeGen/Thumb2/thumb2-jtbl.ll Message-ID: <200907282053.n6SKrOPq013279@zion.cs.uiuc.edu> Author: evancheng Date: Tue Jul 28 15:53:24 2009 New Revision: 77364 URL: http://llvm.org/viewvc/llvm-project?rev=77364&view=rev Log: In thumb2 mode, add pc is unpredictable. Use add + mov pc instead (that is until more optimization goes in). Modified: llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp llvm/trunk/lib/Target/ARM/ARMISelLowering.h llvm/trunk/lib/Target/ARM/ARMInstrInfo.td llvm/trunk/lib/Target/ARM/ARMInstrThumb.td llvm/trunk/lib/Target/ARM/ARMInstrThumb2.td llvm/trunk/test/CodeGen/Thumb2/thumb2-jtbl.ll Modified: llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp?rev=77364&r1=77363&r2=77364&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp (original) +++ llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp Tue Jul 28 15:53:24 2009 @@ -409,7 +409,6 @@ case ARMISD::tCALL: return "ARMISD::tCALL"; case ARMISD::BRCOND: return "ARMISD::BRCOND"; case ARMISD::BR_JT: return "ARMISD::BR_JT"; - case ARMISD::BR2_JT: return "ARMISD::BR2_JT"; case ARMISD::RET_FLAG: return "ARMISD::RET_FLAG"; case ARMISD::PIC_ADD: return "ARMISD::PIC_ADD"; case ARMISD::CMP: return "ARMISD::CMP"; @@ -1712,17 +1711,15 @@ SDValue UId = DAG.getConstant(AFI->createJumpTableUId(), PTy); SDValue JTI = DAG.getTargetJumpTable(JT->getIndex(), PTy); Table = DAG.getNode(ARMISD::WrapperJT, dl, MVT::i32, JTI, UId); + Index = DAG.getNode(ISD::MUL, dl, PTy, Index, DAG.getConstant(4, PTy)); + SDValue Addr = DAG.getNode(ISD::ADD, dl, PTy, Index, Table); if (Subtarget->isThumb2()) { // Thumb2 uses a two-level jump. That is, it jumps into the jump table // which does another jump to the destination. This also makes it easier // to translate it to TBB / TBH later. // FIXME: This might not work if the function is extremely large. - return DAG.getNode(ARMISD::BR2_JT, dl, MVT::Other, Chain, Table, Index, - JTI, UId); + return DAG.getNode(ARMISD::BR_JT, dl, MVT::Other, Chain, Addr, JTI, UId); } - - Index = DAG.getNode(ISD::MUL, dl, PTy, Index, DAG.getConstant(4, PTy)); - SDValue Addr = DAG.getNode(ISD::ADD, dl, PTy, Index, Table); if (getTargetMachine().getRelocationModel() == Reloc::PIC_) { Addr = DAG.getLoad((MVT)MVT::i32, dl, Chain, Addr, NULL, 0); Chain = Addr.getValue(1); Modified: llvm/trunk/lib/Target/ARM/ARMISelLowering.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMISelLowering.h?rev=77364&r1=77363&r2=77364&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMISelLowering.h (original) +++ llvm/trunk/lib/Target/ARM/ARMISelLowering.h Tue Jul 28 15:53:24 2009 @@ -40,7 +40,6 @@ tCALL, // Thumb function call. BRCOND, // Conditional branch. BR_JT, // Jumptable branch. - BR2_JT, // Jumptable branch (2 level - jumptable entry is a jump). RET_FLAG, // Return with a flag operand. PIC_ADD, // Add with a PC operand and a PIC label. Modified: llvm/trunk/lib/Target/ARM/ARMInstrInfo.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMInstrInfo.td?rev=77364&r1=77363&r2=77364&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMInstrInfo.td (original) +++ llvm/trunk/lib/Target/ARM/ARMInstrInfo.td Tue Jul 28 15:53:24 2009 @@ -33,9 +33,6 @@ def SDT_ARMBrJT : SDTypeProfile<0, 3, [SDTCisPtrTy<0>, SDTCisVT<1, i32>, SDTCisVT<2, i32>]>; -def SDT_ARMBr2JT : SDTypeProfile<0, 4, - [SDTCisPtrTy<0>, SDTCisVT<1, i32>, - SDTCisVT<2, i32>, SDTCisVT<3, i32>]>; def SDT_ARMCmp : SDTypeProfile<0, 2, [SDTCisSameAs<0, 1>]>; @@ -75,9 +72,6 @@ def ARMbrjt : SDNode<"ARMISD::BR_JT", SDT_ARMBrJT, [SDNPHasChain]>; -def ARMbr2jt : SDNode<"ARMISD::BR2_JT", SDT_ARMBr2JT, - [SDNPHasChain]>; - def ARMcmp : SDNode<"ARMISD::CMP", SDT_ARMCmp, [SDNPOutFlag]>; Modified: llvm/trunk/lib/Target/ARM/ARMInstrThumb.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMInstrThumb.td?rev=77364&r1=77363&r2=77364&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMInstrThumb.td (original) +++ llvm/trunk/lib/Target/ARM/ARMInstrThumb.td Tue Jul 28 15:53:24 2009 @@ -198,7 +198,7 @@ def tBR_JTr : T1JTI<(outs), (ins tGPR:$target, jtblock_operand:$jt, i32imm:$id), - "mov pc, $target \n\t.align\t2\n$jt", + "mov pc, $target\n\t.align\t2\n$jt", [(ARMbrjt tGPR:$target, tjumptable:$jt, imm:$id)]>; } } Modified: llvm/trunk/lib/Target/ARM/ARMInstrThumb2.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMInstrThumb2.td?rev=77364&r1=77363&r2=77364&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMInstrThumb2.td (original) +++ llvm/trunk/lib/Target/ARM/ARMInstrThumb2.td Tue Jul 28 15:53:24 2009 @@ -1050,10 +1050,9 @@ let isNotDuplicable = 1, isIndirectBranch = 1 in def t2BR_JT : - T2JTI<(outs), - (ins GPR:$base, GPR:$idx, jt2block_operand:$jt, i32imm:$id), - "add.w pc, $base, $idx, lsl #2\n$jt", - [(ARMbr2jt GPR:$base, GPR:$idx, tjumptable:$jt, imm:$id)]>; + T2JTI<(outs), (ins GPR:$target, jt2block_operand:$jt, i32imm:$id), + "mov pc, $target\n$jt", + [(ARMbrjt GPR:$target, tjumptable:$jt, imm:$id)]>; } // isBranch, isTerminator, isBarrier // FIXME: should be able to write a pattern for ARMBrcond, but can't use Modified: llvm/trunk/test/CodeGen/Thumb2/thumb2-jtbl.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Thumb2/thumb2-jtbl.ll?rev=77364&r1=77363&r2=77364&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/Thumb2/thumb2-jtbl.ll (original) +++ llvm/trunk/test/CodeGen/Thumb2/thumb2-jtbl.ll Tue Jul 28 15:53:24 2009 @@ -4,7 +4,7 @@ define void @bar(i32 %n.u) { entry: ; CHECK: bar: -; CHECK: add.w pc +; CHECK: mov pc ; CHECK: b.w LBB1_2 switch i32 %n.u, label %bb12 [i32 1, label %bb i32 2, label %bb6 i32 4, label %bb7 i32 5, label %bb8 i32 6, label %bb10 i32 7, label %bb1 i32 8, label %bb3 i32 9, label %bb4 i32 10, label %bb9 i32 11, label %bb2 i32 12, label %bb5 i32 13, label %bb11 ] From david_goodwin at apple.com Tue Jul 28 15:57:08 2009 From: david_goodwin at apple.com (David Goodwin) Date: Tue, 28 Jul 2009 13:57:08 -0700 Subject: [llvm-commits] [llvm] r77340 - in /llvm/trunk: lib/Target/ARM/ARMInstrThumb2.td test/CodeGen/Thumb2/thumb2-lsr3.ll In-Reply-To: <305d6f60907281345q6f41e809w8166f84ee3c6afad@mail.gmail.com> References: <200907281815.n6SIFctv007606@zion.cs.uiuc.edu> <305d6f60907281322r644d145ob3a9096c26e6a199@mail.gmail.com> <50A85D5F-3459-4763-B8A0-9C15D96E9BBD@apple.com> <305d6f60907281345q6f41e809w8166f84ee3c6afad@mail.gmail.com> Message-ID: <05D6B1F4-A623-4AA9-9021-97B8ED7A95D8@apple.com> We (Apple) should have the assembler fixed soon and then I'll revert the workaround. gas should accept the current form as well so it shouldn't be a problem. David On Jul 28, 2009, at 1:45 PM, Sandeep Patel wrote: > Could this be conditionalized for Darwin? gas seems to work for > these cases. > > deep > > On Tue, Jul 28, 2009 at 8:28 PM, Bob Wilson > wrote: >> Apple's assembler doesn't recognize Thumb2 RRX instructions, e.g., >> "rrx r0,r0". >> >> On Jul 28, 2009, at 1:22 PM, Sandeep Patel wrote: >> >>> For those without internal Radar access, could you elaborate? >>> >>> deep >>> >>> On Tue, Jul 28, 2009 at 6:15 PM, David >>> Goodwin wrote: >>>> Author: david_goodwin >>>> Date: Tue Jul 28 13:15:38 2009 >>>> New Revision: 77340 >>>> >>>> URL: http://llvm.org/viewvc/llvm-project?rev=77340&view=rev >>>> Log: >>>> Add workaround for . >>>> >>>> Modified: >>>> llvm/trunk/lib/Target/ARM/ARMInstrThumb2.td >>>> llvm/trunk/test/CodeGen/Thumb2/thumb2-lsr3.ll >>>> >>>> Modified: llvm/trunk/lib/Target/ARM/ARMInstrThumb2.td >>>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMInstrThumb2.td?rev=77340&r1=77339&r2=77340&view=diff >>>> >>>> = >>>> = >>>> = >>>> = >>>> = >>>> = >>>> = >>>> = >>>> = >>>> = >>>> = >>>> =================================================================== >>>> --- llvm/trunk/lib/Target/ARM/ARMInstrThumb2.td (original) >>>> +++ llvm/trunk/lib/Target/ARM/ARMInstrThumb2.td Tue Jul 28 13:15:38 >>>> 2009 >>>> @@ -714,8 +714,9 @@ >>>> defm t2ASR : T2I_sh_ir<"asr", BinOpFrag<(sra node:$LHS, node: >>>> $RHS)>>; >>>> defm t2ROR : T2I_sh_ir<"ror", BinOpFrag<(rotr node:$LHS, node: >>>> $RHS)>>; >>>> >>>> +// FIXME should be "rrx $dst,$src" once >>>> is fixed >>>> def t2MOVrx : T2sI<(outs GPR:$dst), (ins GPR:$src), >>>> - "rrx", " $dst, $src", >>>> + "mov", ".w $dst, $src, rrx", >>>> [(set GPR:$dst, (ARMrrx GPR:$src))]>; >>>> >>>> let Defs = [CPSR] in { >>>> >>>> Modified: llvm/trunk/test/CodeGen/Thumb2/thumb2-lsr3.ll >>>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Thumb2/thumb2-lsr3.ll?rev=77340&r1=77339&r2=77340&view=diff >>>> >>>> = >>>> = >>>> = >>>> = >>>> = >>>> = >>>> = >>>> = >>>> = >>>> = >>>> = >>>> =================================================================== >>>> --- llvm/trunk/test/CodeGen/Thumb2/thumb2-lsr3.ll (original) >>>> +++ llvm/trunk/test/CodeGen/Thumb2/thumb2-lsr3.ll Tue Jul 28 >>>> 13:15:38 2009 >>>> @@ -2,7 +2,7 @@ >>>> >>>> define i1 @test1(i64 %poscnt, i32 %work) { >>>> entry: >>>> -; CHECK: rrx r0, r0 >>>> +; CHECK: mov.w r0, r0, rrx >>>> ; CHECK: lsrs.w r1, r1, #1 >>>> %0 = lshr i64 %poscnt, 1 >>>> %1 = icmp eq i64 %0, 0 >>>> @@ -11,7 +11,7 @@ >>>> >>>> define i1 @test2(i64 %poscnt, i32 %work) { >>>> entry: >>>> -; CHECK: rrx r0, r0 >>>> +; CHECK: mov.w r0, r0, rrx >>>> ; CHECK: asrs.w r1, r1, #1 >>>> %0 = ashr i64 %poscnt, 1 >>>> %1 = icmp eq i64 %0, 0 >>>> >>>> >>>> _______________________________________________ >>>> llvm-commits mailing list >>>> llvm-commits at cs.uiuc.edu >>>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits >>>> >>> >>> _______________________________________________ >>> llvm-commits mailing list >>> llvm-commits at cs.uiuc.edu >>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits >> >> _______________________________________________ >> llvm-commits mailing list >> llvm-commits at cs.uiuc.edu >> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits >> > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From david_goodwin at apple.com Tue Jul 28 15:58:33 2009 From: david_goodwin at apple.com (David Goodwin) Date: Tue, 28 Jul 2009 13:58:33 -0700 Subject: [llvm-commits] [llvm] r77363 - in /llvm/trunk: lib/Target/ARM/ARMInstrThumb2.td test/CodeGen/Thumb2/thumb2-orn.ll test/CodeGen/Thumb2/thumb2-orn2.ll In-Reply-To: <200907282051.n6SKpQJP013197@zion.cs.uiuc.edu> References: <200907282051.n6SKpQJP013197@zion.cs.uiuc.edu> Message-ID: <8E7FD6A6-DB6A-442D-8AA4-C0FEDD3F23C5@apple.com> Another rdar in an llvm commit! Who is that loser? Anyway this is another case of an instruction not being recognized by Apple's assembler. I'll revert as soon as we get that fixed (should be soon). David On Jul 28, 2009, at 1:51 PM, David Goodwin wrote: > Author: david_goodwin > Date: Tue Jul 28 15:51:25 2009 > New Revision: 77363 > > URL: http://llvm.org/viewvc/llvm-project?rev=77363&view=rev > Log: > Remove support for ORN to workaround . > > Modified: > llvm/trunk/lib/Target/ARM/ARMInstrThumb2.td > llvm/trunk/test/CodeGen/Thumb2/thumb2-orn.ll > llvm/trunk/test/CodeGen/Thumb2/thumb2-orn2.ll > > Modified: llvm/trunk/lib/Target/ARM/ARMInstrThumb2.td > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMInstrThumb2.td?rev=77363&r1=77362&r2=77363&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/lib/Target/ARM/ARMInstrThumb2.td (original) > +++ llvm/trunk/lib/Target/ARM/ARMInstrThumb2.td Tue Jul 28 15:51:25 > 2009 > @@ -745,7 +745,8 @@ > > // FIXME: A8.6.18 BFI - Bitfield insert (Encoding T1) > > -defm t2ORN : T2I_bin_irs<"orn", BinOpFrag<(or node:$LHS, (not > node:$RHS))>>; > +// FIXME workaround for > +//defm t2ORN : T2I_bin_irs<"orn", BinOpFrag<(or node:$LHS, (not > node:$RHS))>>; > > // Prefer over of t2EORri ra, rb, -1 because mvn has 16-bit version > let AddedComplexity = 1 in > @@ -755,8 +756,9 @@ > def : T2Pat<(and GPR:$src, t2_so_imm_not:$imm), > (t2BICri GPR:$src, t2_so_imm_not:$imm)>; > > -def : T2Pat<(or GPR:$src, t2_so_imm_not:$imm), > - (t2ORNri GPR:$src, t2_so_imm_not:$imm)>; > +// FIXME workaround for > +//def : T2Pat<(or GPR:$src, t2_so_imm_not:$imm), > +// (t2ORNri GPR:$src, t2_so_imm_not:$imm)>; > > def : T2Pat<(t2_so_imm_not:$src), > (t2MVNi t2_so_imm_not:$src)>; > > Modified: llvm/trunk/test/CodeGen/Thumb2/thumb2-orn.ll > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Thumb2/thumb2-orn.ll?rev=77363&r1=77362&r2=77363&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/test/CodeGen/Thumb2/thumb2-orn.ll (original) > +++ llvm/trunk/test/CodeGen/Thumb2/thumb2-orn.ll Tue Jul 28 15:51:25 > 2009 > @@ -1,3 +1,4 @@ > +; XFAIL: * > ; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {orn\ > \W*r\[0-9\]*,\\W*r\[0-9\]*,\\W*r\[0-9\]*$} | count 4 > ; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {orn\ > \W*r\[0-9\],\\W*r\[0-9\],\\W*r\[0-9\],\\W*lsl\\W*#5$} | count 1 > ; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {orn\ > \W*r\[0-9\],\\W*r\[0-9\],\\W*r\[0-9\],\\W*lsr\\W*#6$} | count 1 > > Modified: llvm/trunk/test/CodeGen/Thumb2/thumb2-orn2.ll > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Thumb2/thumb2-orn2.ll?rev=77363&r1=77362&r2=77363&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/test/CodeGen/Thumb2/thumb2-orn2.ll (original) > +++ llvm/trunk/test/CodeGen/Thumb2/thumb2-orn2.ll Tue Jul 28 > 15:51:25 2009 > @@ -1,3 +1,4 @@ > +; XFAIL: * > ; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {orn\ > \W*r\[0-9\]*,\\W*r\[0-9\]*,\\W*#\[0-9\]*} | grep {#187\\|#11141290\\| > #3422604288\\|#1114112} | count 4 > > ; 0x000000bb = 187 > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From echristo at apple.com Tue Jul 28 15:59:28 2009 From: echristo at apple.com (Eric Christopher) Date: Tue, 28 Jul 2009 13:59:28 -0700 Subject: [llvm-commits] [llvm] r77363 - in /llvm/trunk: lib/Target/ARM/ARMInstrThumb2.td test/CodeGen/Thumb2/thumb2-orn.ll test/CodeGen/Thumb2/thumb2-orn2.ll In-Reply-To: <8E7FD6A6-DB6A-442D-8AA4-C0FEDD3F23C5@apple.com> References: <200907282051.n6SKpQJP013197@zion.cs.uiuc.edu> <8E7FD6A6-DB6A-442D-8AA4-C0FEDD3F23C5@apple.com> Message-ID: <491BE10B-5718-47EA-9F72-462FEE70FE9A@apple.com> On Jul 28, 2009, at 1:58 PM, David Goodwin wrote: > Another rdar in an llvm commit! Who is that loser? Anyway this is > another case of an instruction not being recognized by Apple's > assembler. I'll revert as soon as we get that fixed (should be soon). Could you maybe just put that in next time? :) Even I can't look at that radar ;) -eric From david_goodwin at apple.com Tue Jul 28 16:01:52 2009 From: david_goodwin at apple.com (David Goodwin) Date: Tue, 28 Jul 2009 14:01:52 -0700 Subject: [llvm-commits] [llvm] r77363 - in /llvm/trunk: lib/Target/ARM/ARMInstrThumb2.td test/CodeGen/Thumb2/thumb2-orn.ll test/CodeGen/Thumb2/thumb2-orn2.ll In-Reply-To: <491BE10B-5718-47EA-9F72-462FEE70FE9A@apple.com> References: <200907282051.n6SKpQJP013197@zion.cs.uiuc.edu> <8E7FD6A6-DB6A-442D-8AA4-C0FEDD3F23C5@apple.com> <491BE10B-5718-47EA-9F72-462FEE70FE9A@apple.com> Message-ID: <18401D0E-0E90-41B7-843E-9A9F088B1023@apple.com> I'll be good from now on... On Jul 28, 2009, at 1:59 PM, Eric Christopher wrote: > > On Jul 28, 2009, at 1:58 PM, David Goodwin wrote: > >> Another rdar in an llvm commit! Who is that loser? Anyway this is >> another case of an instruction not being recognized by Apple's >> assembler. I'll revert as soon as we get that fixed (should be soon). > > Could you maybe just put that in next time? :) > > Even I can't look at that radar ;) > > -eric > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From resistor at mac.com Tue Jul 28 16:19:27 2009 From: resistor at mac.com (Owen Anderson) Date: Tue, 28 Jul 2009 21:19:27 -0000 Subject: [llvm-commits] [llvm] r77366 - in /llvm/trunk: include/llvm/ lib/Analysis/ lib/AsmParser/ lib/Bitcode/Reader/ lib/CodeGen/SelectionDAG/ lib/Linker/ lib/Target/CellSPU/ lib/Target/X86/ lib/Transforms/Scalar/ lib/Transforms/Utils/ lib/VMCore/ Message-ID: <200907282119.n6SLJSEE014150@zion.cs.uiuc.edu> Author: resistor Date: Tue Jul 28 16:19:26 2009 New Revision: 77366 URL: http://llvm.org/viewvc/llvm-project?rev=77366&view=rev Log: Return ConstantVector to 2.5 API. Modified: llvm/trunk/include/llvm/Constants.h llvm/trunk/include/llvm/LLVMContext.h llvm/trunk/lib/Analysis/ConstantFolding.cpp llvm/trunk/lib/AsmParser/LLParser.cpp llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp llvm/trunk/lib/Linker/LinkModules.cpp llvm/trunk/lib/Target/CellSPU/SPUISelDAGToDAG.cpp llvm/trunk/lib/Target/X86/X86ISelLowering.cpp llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp llvm/trunk/lib/Transforms/Scalar/ScalarReplAggregates.cpp llvm/trunk/lib/Transforms/Utils/ValueMapper.cpp llvm/trunk/lib/VMCore/AutoUpgrade.cpp llvm/trunk/lib/VMCore/ConstantFold.cpp llvm/trunk/lib/VMCore/Constants.cpp llvm/trunk/lib/VMCore/Core.cpp llvm/trunk/lib/VMCore/Instructions.cpp llvm/trunk/lib/VMCore/LLVMContext.cpp llvm/trunk/lib/VMCore/LLVMContextImpl.cpp llvm/trunk/lib/VMCore/LLVMContextImpl.h Modified: llvm/trunk/include/llvm/Constants.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Constants.h?rev=77366&r1=77365&r2=77366&view=diff ============================================================================== --- llvm/trunk/include/llvm/Constants.h (original) +++ llvm/trunk/include/llvm/Constants.h Tue Jul 28 16:19:26 2009 @@ -448,6 +448,11 @@ protected: ConstantVector(const VectorType *T, const std::vector &Val); public: + // ConstantVector accessors + static Constant* get(const VectorType* T, const std::vector& V); + static Constant* get(const std::vector& V); + static Constant* get(Constant* const* Vals, unsigned NumVals); + /// Transparently provide more efficient getOperand methods. DECLARE_TRANSPARENT_OPERAND_ACCESSORS(Constant); Modified: llvm/trunk/include/llvm/LLVMContext.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/LLVMContext.h?rev=77366&r1=77365&r2=77366&view=diff ============================================================================== --- llvm/trunk/include/llvm/LLVMContext.h (original) +++ llvm/trunk/include/llvm/LLVMContext.h Tue Jul 28 16:19:26 2009 @@ -59,6 +59,7 @@ friend class ConstantFP; friend class ConstantStruct; friend class ConstantArray; + friend class ConstantVector; public: LLVMContext(); ~LLVMContext(); @@ -160,12 +161,6 @@ /// Constant* getConstantExprSizeOf(const Type* Ty); - // ConstantVector accessors - Constant* getConstantVector(const VectorType* T, - const std::vector& V); - Constant* getConstantVector(const std::vector& V); - Constant* getConstantVector(Constant* const* Vals, unsigned NumVals); - // MDNode accessors MDNode* getMDNode(Value* const* Vals, unsigned NumVals); @@ -211,7 +206,6 @@ void erase(MDString *M); void erase(MDNode *M); void erase(ConstantAggregateZero *Z); - void erase(ConstantVector *V); }; /// FOR BACKWARDS COMPATIBILITY - Returns a global context. Modified: llvm/trunk/lib/Analysis/ConstantFolding.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/ConstantFolding.cpp?rev=77366&r1=77365&r2=77366&view=diff ============================================================================== --- llvm/trunk/lib/Analysis/ConstantFolding.cpp (original) +++ llvm/trunk/lib/Analysis/ConstantFolding.cpp Tue Jul 28 16:19:26 2009 @@ -264,7 +264,7 @@ } } - return Context.getConstantVector(Result.data(), Result.size()); + return ConstantVector::get(Result.data(), Result.size()); } } Modified: llvm/trunk/lib/AsmParser/LLParser.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/AsmParser/LLParser.cpp?rev=77366&r1=77365&r2=77366&view=diff ============================================================================== --- llvm/trunk/lib/AsmParser/LLParser.cpp (original) +++ llvm/trunk/lib/AsmParser/LLParser.cpp Tue Jul 28 16:19:26 2009 @@ -1777,7 +1777,7 @@ "vector element #" + utostr(i) + " is not of type '" + Elts[0]->getType()->getDescription()); - ID.ConstantVal = Context.getConstantVector(Elts.data(), Elts.size()); + ID.ConstantVal = ConstantVector::get(Elts.data(), Elts.size()); ID.Kind = ValID::t_Constant; return false; } Modified: llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp?rev=77366&r1=77365&r2=77366&view=diff ============================================================================== --- llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp (original) +++ llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp Tue Jul 28 16:19:26 2009 @@ -294,7 +294,7 @@ NewC = ConstantStruct::get(&NewOps[0], NewOps.size(), UserCS->getType()->isPacked()); } else if (isa(UserC)) { - NewC = Context.getConstantVector(&NewOps[0], NewOps.size()); + NewC = ConstantVector::get(&NewOps[0], NewOps.size()); } else { assert(isa(UserC) && "Must be a ConstantExpr."); NewC = cast(UserC)->getWithOperands(&NewOps[0], @@ -935,7 +935,7 @@ const Type *EltTy = VTy->getElementType(); for (unsigned i = 0; i != Size; ++i) Elts.push_back(ValueList.getConstantFwdRef(Record[i], EltTy)); - V = Context.getConstantVector(Elts); + V = ConstantVector::get(Elts); } else { V = Context.getUndef(CurTy); } Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp?rev=77366&r1=77365&r2=77366&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Tue Jul 28 16:19:26 2009 @@ -1849,7 +1849,7 @@ CV.push_back(Context->getUndef(OpNTy)); } } - Constant *CP = Context->getConstantVector(CV); + Constant *CP = ConstantVector::get(CV); SDValue CPIdx = DAG.getConstantPool(CP, TLI.getPointerTy()); unsigned Alignment = cast(CPIdx)->getAlignment(); return DAG.getLoad(VT, dl, DAG.getEntryNode(), CPIdx, Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp?rev=77366&r1=77365&r2=77366&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp Tue Jul 28 16:19:26 2009 @@ -2149,7 +2149,7 @@ const Type *ElTy = DestTy->getElementType(); unsigned VL = DestTy->getNumElements(); std::vector NZ(VL, ConstantFP::getNegativeZero(ElTy)); - Constant *CNZ = DAG.getContext()->getConstantVector(&NZ[0], NZ.size()); + Constant *CNZ = ConstantVector::get(&NZ[0], NZ.size()); if (CV == CNZ) { SDValue Op2 = getValue(I.getOperand(1)); setValue(&I, DAG.getNode(ISD::FNEG, getCurDebugLoc(), Modified: llvm/trunk/lib/Linker/LinkModules.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Linker/LinkModules.cpp?rev=77366&r1=77365&r2=77366&view=diff ============================================================================== --- llvm/trunk/lib/Linker/LinkModules.cpp (original) +++ llvm/trunk/lib/Linker/LinkModules.cpp Tue Jul 28 16:19:26 2009 @@ -384,7 +384,7 @@ for (unsigned i = 0, e = CP->getNumOperands(); i != e; ++i) Operands[i] = cast(RemapOperand(CP->getOperand(i), ValueMap, Context)); - Result = Context.getConstantVector(Operands); + Result = ConstantVector::get(Operands); } else if (const ConstantExpr *CE = dyn_cast(CPV)) { std::vector Ops; for (unsigned i = 0, e = CE->getNumOperands(); i != e; ++i) Modified: llvm/trunk/lib/Target/CellSPU/SPUISelDAGToDAG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/CellSPU/SPUISelDAGToDAG.cpp?rev=77366&r1=77365&r2=77366&view=diff ============================================================================== --- llvm/trunk/lib/Target/CellSPU/SPUISelDAGToDAG.cpp (original) +++ llvm/trunk/lib/Target/CellSPU/SPUISelDAGToDAG.cpp Tue Jul 28 16:19:26 2009 @@ -306,7 +306,7 @@ CV.push_back(const_cast (V->getConstantIntValue())); } - Constant *CP = CurDAG->getContext()->getConstantVector(CV); + Constant *CP = ConstantVector::get(CV); SDValue CPIdx = CurDAG->getConstantPool(CP, SPUtli.getPointerTy()); unsigned Alignment = cast(CPIdx)->getAlignment(); SDValue CGPoolOffset = Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.cpp?rev=77366&r1=77365&r2=77366&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original) +++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Tue Jul 28 16:19:26 2009 @@ -4909,7 +4909,7 @@ CV0.push_back(ConstantInt::get(*Context, APInt(32, 0x43300000))); CV0.push_back(ConstantInt::get(*Context, APInt(32, 0))); CV0.push_back(ConstantInt::get(*Context, APInt(32, 0))); - Constant *C0 = Context->getConstantVector(CV0); + Constant *C0 = ConstantVector::get(CV0); SDValue CPIdx0 = DAG.getConstantPool(C0, getPointerTy(), 16); std::vector CV1; @@ -4917,7 +4917,7 @@ ConstantFP::get(*Context, APFloat(APInt(64, 0x4530000000000000ULL)))); CV1.push_back( ConstantFP::get(*Context, APFloat(APInt(64, 0x4330000000000000ULL)))); - Constant *C1 = Context->getConstantVector(CV1); + Constant *C1 = ConstantVector::get(CV1); SDValue CPIdx1 = DAG.getConstantPool(C1, getPointerTy(), 16); SDValue XR1 = DAG.getNode(ISD::SCALAR_TO_VECTOR, dl, MVT::v4i32, @@ -5139,7 +5139,7 @@ CV.push_back(C); CV.push_back(C); } - Constant *C = Context->getConstantVector(CV); + Constant *C = ConstantVector::get(CV); SDValue CPIdx = DAG.getConstantPool(C, getPointerTy(), 16); SDValue Mask = DAG.getLoad(VT, dl, DAG.getEntryNode(), CPIdx, PseudoSourceValue::getConstantPool(), 0, @@ -5169,7 +5169,7 @@ CV.push_back(C); CV.push_back(C); } - Constant *C = Context->getConstantVector(CV); + Constant *C = ConstantVector::get(CV); SDValue CPIdx = DAG.getConstantPool(C, getPointerTy(), 16); SDValue Mask = DAG.getLoad(VT, dl, DAG.getEntryNode(), CPIdx, PseudoSourceValue::getConstantPool(), 0, @@ -5218,7 +5218,7 @@ CV.push_back(ConstantFP::get(*Context, APFloat(APInt(32, 0)))); CV.push_back(ConstantFP::get(*Context, APFloat(APInt(32, 0)))); } - Constant *C = Context->getConstantVector(CV); + Constant *C = ConstantVector::get(CV); SDValue CPIdx = DAG.getConstantPool(C, getPointerTy(), 16); SDValue Mask1 = DAG.getLoad(SrcVT, dl, DAG.getEntryNode(), CPIdx, PseudoSourceValue::getConstantPool(), 0, @@ -5247,7 +5247,7 @@ CV.push_back(ConstantFP::get(*Context, APFloat(APInt(32, 0)))); CV.push_back(ConstantFP::get(*Context, APFloat(APInt(32, 0)))); } - C = Context->getConstantVector(CV); + C = ConstantVector::get(CV); CPIdx = DAG.getConstantPool(C, getPointerTy(), 16); SDValue Mask2 = DAG.getLoad(VT, dl, DAG.getEntryNode(), CPIdx, PseudoSourceValue::getConstantPool(), 0, Modified: llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp?rev=77366&r1=77365&r2=77366&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp Tue Jul 28 16:19:26 2009 @@ -1458,7 +1458,7 @@ } // If we changed the constant, return it. - Constant *NewCP = Context->getConstantVector(Elts); + Constant *NewCP = ConstantVector::get(Elts); return NewCP != CP ? NewCP : 0; } else if (isa(V)) { // Simplify the CAZ to a ConstantVector where the non-demanded elements are @@ -1478,7 +1478,7 @@ Elts.push_back(Elt); } UndefElts = DemandedElts ^ EltMask; - return Context->getConstantVector(Elts); + return ConstantVector::get(Elts); } // Limit search depth. @@ -1597,7 +1597,7 @@ Elts.push_back(ConstantInt::get(Type::Int32Ty, Shuffle->getMaskValue(i))); } - I->setOperand(2, Context->getConstantVector(Elts)); + I->setOperand(2, ConstantVector::get(Elts)); MadeChange = true; } break; @@ -2926,7 +2926,7 @@ if (const VectorType *Ty = dyn_cast(I.getType())) { Constant *CI = ConstantInt::get(Ty->getElementType(), 1); std::vector Elts(Ty->getNumElements(), CI); - return ReplaceInstUsesWith(I, Context->getConstantVector(Elts)); + return ReplaceInstUsesWith(I, ConstantVector::get(Elts)); } Constant *CI = ConstantInt::get(I.getType(), 1); @@ -3259,7 +3259,7 @@ } } - Constant *NewRHSV = Context->getConstantVector(Elts); + Constant *NewRHSV = ConstantVector::get(Elts); if (NewRHSV != RHSV) { AddUsesToWorkList(I); I.setOperand(1, NewRHSV); @@ -12689,7 +12689,7 @@ Mask[InsertedIdx] = ConstantInt::get(Type::Int32Ty, ExtractedIdx); return new ShuffleVectorInst(EI->getOperand(0), VecOp, - Context->getConstantVector(Mask)); + ConstantVector::get(Mask)); } // If this insertelement isn't used by some other insertelement, turn it @@ -12701,7 +12701,7 @@ if (RHS == 0) RHS = Context->getUndef(LHS->getType()); // We now have a shuffle of LHS, RHS, Mask. return new ShuffleVectorInst(LHS, RHS, - Context->getConstantVector(Mask)); + ConstantVector::get(Mask)); } } } @@ -12766,7 +12766,7 @@ } SVI.setOperand(0, SVI.getOperand(1)); SVI.setOperand(1, Context->getUndef(RHS->getType())); - SVI.setOperand(2, Context->getConstantVector(Elts)); + SVI.setOperand(2, ConstantVector::get(Elts)); LHS = SVI.getOperand(0); RHS = SVI.getOperand(1); MadeChange = true; @@ -12823,7 +12823,7 @@ } return new ShuffleVectorInst(LHSSVI->getOperand(0), LHSSVI->getOperand(1), - Context->getConstantVector(Elts)); + ConstantVector::get(Elts)); } } } Modified: llvm/trunk/lib/Transforms/Scalar/ScalarReplAggregates.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/ScalarReplAggregates.cpp?rev=77366&r1=77365&r2=77366&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/ScalarReplAggregates.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/ScalarReplAggregates.cpp Tue Jul 28 16:19:26 2009 @@ -850,7 +850,7 @@ if (EltTy != ValTy) { unsigned NumElts = cast(ValTy)->getNumElements(); SmallVector Elts(NumElts, StoreVal); - StoreVal = Context.getConstantVector(&Elts[0], NumElts); + StoreVal = ConstantVector::get(&Elts[0], NumElts); } } new StoreInst(StoreVal, EltPtr, MI); Modified: llvm/trunk/lib/Transforms/Utils/ValueMapper.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/ValueMapper.cpp?rev=77366&r1=77365&r2=77366&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Utils/ValueMapper.cpp (original) +++ llvm/trunk/lib/Transforms/Utils/ValueMapper.cpp Tue Jul 28 16:19:26 2009 @@ -101,7 +101,7 @@ Values.push_back(cast(MV)); for (++i; i != e; ++i) Values.push_back(cast(MapValue(*i, VM, Context))); - return VM[V] = Context.getConstantVector(Values); + return VM[V] = ConstantVector::get(Values); } } return VM[V] = C; Modified: llvm/trunk/lib/VMCore/AutoUpgrade.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/AutoUpgrade.cpp?rev=77366&r1=77365&r2=77366&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/AutoUpgrade.cpp (original) +++ llvm/trunk/lib/VMCore/AutoUpgrade.cpp Tue Jul 28 16:19:26 2009 @@ -281,7 +281,7 @@ Idxs.push_back(ConstantInt::get(Type::Int32Ty, 2)); Idxs.push_back(ConstantInt::get(Type::Int32Ty, 1)); } - Value *Mask = Context.getConstantVector(Idxs); + Value *Mask = ConstantVector::get(Idxs); SI = new ShuffleVectorInst(Op0, Op1, Mask, "upgraded.", CI); } else if (isMovL) { Constant *Zero = ConstantInt::get(Type::Int32Ty, 0); @@ -289,14 +289,14 @@ Idxs.push_back(Zero); Idxs.push_back(Zero); Idxs.push_back(Zero); - Value *ZeroV = Context.getConstantVector(Idxs); + Value *ZeroV = ConstantVector::get(Idxs); Idxs.clear(); Idxs.push_back(ConstantInt::get(Type::Int32Ty, 4)); Idxs.push_back(ConstantInt::get(Type::Int32Ty, 5)); Idxs.push_back(ConstantInt::get(Type::Int32Ty, 2)); Idxs.push_back(ConstantInt::get(Type::Int32Ty, 3)); - Value *Mask = Context.getConstantVector(Idxs); + Value *Mask = ConstantVector::get(Idxs); SI = new ShuffleVectorInst(ZeroV, Op0, Mask, "upgraded.", CI); } else if (isMovSD || isUnpckhPD || isUnpcklPD || isPunpckhQPD || isPunpcklQPD) { @@ -311,7 +311,7 @@ Idxs.push_back(ConstantInt::get(Type::Int32Ty, 0)); Idxs.push_back(ConstantInt::get(Type::Int32Ty, 2)); } - Value *Mask = Context.getConstantVector(Idxs); + Value *Mask = ConstantVector::get(Idxs); SI = new ShuffleVectorInst(Op0, Op1, Mask, "upgraded.", CI); } else if (isShufPD) { Value *Op1 = CI->getOperand(2); @@ -319,7 +319,7 @@ Idxs.push_back(ConstantInt::get(Type::Int32Ty, MaskVal & 1)); Idxs.push_back(ConstantInt::get(Type::Int32Ty, ((MaskVal >> 1) & 1)+2)); - Value *Mask = Context.getConstantVector(Idxs); + Value *Mask = ConstantVector::get(Idxs); SI = new ShuffleVectorInst(Op0, Op1, Mask, "upgraded.", CI); } Modified: llvm/trunk/lib/VMCore/ConstantFold.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/ConstantFold.cpp?rev=77366&r1=77365&r2=77366&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/ConstantFold.cpp (original) +++ llvm/trunk/lib/VMCore/ConstantFold.cpp Tue Jul 28 16:19:26 2009 @@ -63,7 +63,7 @@ for (unsigned i = 0; i != NumElts; ++i) Result.push_back(Context.getConstantExprBitCast(CV->getOperand(i), DstEltTy)); - return Context.getConstantVector(Result); + return ConstantVector::get(Result); } /// This function determines which opcode to use to fold two constant cast @@ -145,7 +145,7 @@ // can only be handled by Analysis/ConstantFolding.cpp). if (isa(V) || isa(V)) return Context.getConstantExprBitCast( - Context.getConstantVector(&V, 1), DestPTy); + ConstantVector::get(&V, 1), DestPTy); } // Finally, implement bitcast folding now. The code below doesn't handle @@ -228,7 +228,7 @@ for (unsigned i = 0, e = CV->getType()->getNumElements(); i != e; ++i) res.push_back(Context.getConstantExprCast(opc, CV->getOperand(i), DstEltTy)); - return Context.getConstantVector(DestVecTy, res); + return ConstantVector::get(DestVecTy, res); } // We actually have to do a cast now. Perform the cast according to the @@ -374,7 +374,7 @@ (idxVal == i) ? Elt : Context.getUndef(Elt->getType()); Ops.push_back(const_cast(Op)); } - return Context.getConstantVector(Ops); + return ConstantVector::get(Ops); } if (isa(Val)) { // Insertion of scalar constant into vector aggregate zero @@ -392,7 +392,7 @@ (idxVal == i) ? Elt : Context.getNullValue(Elt->getType()); Ops.push_back(const_cast(Op)); } - return Context.getConstantVector(Ops); + return ConstantVector::get(Ops); } if (const ConstantVector *CVal = dyn_cast(Val)) { // Insertion of scalar constant into vector constant @@ -403,7 +403,7 @@ (idxVal == i) ? Elt : cast(CVal->getOperand(i)); Ops.push_back(const_cast(Op)); } - return Context.getConstantVector(Ops); + return ConstantVector::get(Ops); } return 0; @@ -459,7 +459,7 @@ Result.push_back(InElt); } - return Context.getConstantVector(&Result[0], Result.size()); + return ConstantVector::get(&Result[0], Result.size()); } Constant *llvm::ConstantFoldExtractValueInstruction(LLVMContext &Context, @@ -829,7 +829,7 @@ Res.push_back(Context.getConstantExprAdd(const_cast(C1), const_cast(C2))); } - return Context.getConstantVector(Res); + return ConstantVector::get(Res); case Instruction::FAdd: for (unsigned i = 0, e = VTy->getNumElements(); i != e; ++i) { C1 = CP1 ? CP1->getOperand(i) : Context.getNullValue(EltTy); @@ -837,7 +837,7 @@ Res.push_back(Context.getConstantExprFAdd(const_cast(C1), const_cast(C2))); } - return Context.getConstantVector(Res); + return ConstantVector::get(Res); case Instruction::Sub: for (unsigned i = 0, e = VTy->getNumElements(); i != e; ++i) { C1 = CP1 ? CP1->getOperand(i) : Context.getNullValue(EltTy); @@ -845,7 +845,7 @@ Res.push_back(Context.getConstantExprSub(const_cast(C1), const_cast(C2))); } - return Context.getConstantVector(Res); + return ConstantVector::get(Res); case Instruction::FSub: for (unsigned i = 0, e = VTy->getNumElements(); i != e; ++i) { C1 = CP1 ? CP1->getOperand(i) : Context.getNullValue(EltTy); @@ -853,7 +853,7 @@ Res.push_back(Context.getConstantExprFSub(const_cast(C1), const_cast(C2))); } - return Context.getConstantVector(Res); + return ConstantVector::get(Res); case Instruction::Mul: for (unsigned i = 0, e = VTy->getNumElements(); i != e; ++i) { C1 = CP1 ? CP1->getOperand(i) : Context.getNullValue(EltTy); @@ -861,7 +861,7 @@ Res.push_back(Context.getConstantExprMul(const_cast(C1), const_cast(C2))); } - return Context.getConstantVector(Res); + return ConstantVector::get(Res); case Instruction::FMul: for (unsigned i = 0, e = VTy->getNumElements(); i != e; ++i) { C1 = CP1 ? CP1->getOperand(i) : Context.getNullValue(EltTy); @@ -869,7 +869,7 @@ Res.push_back(Context.getConstantExprFMul(const_cast(C1), const_cast(C2))); } - return Context.getConstantVector(Res); + return ConstantVector::get(Res); case Instruction::UDiv: for (unsigned i = 0, e = VTy->getNumElements(); i != e; ++i) { C1 = CP1 ? CP1->getOperand(i) : Context.getNullValue(EltTy); @@ -877,7 +877,7 @@ Res.push_back(Context.getConstantExprUDiv(const_cast(C1), const_cast(C2))); } - return Context.getConstantVector(Res); + return ConstantVector::get(Res); case Instruction::SDiv: for (unsigned i = 0, e = VTy->getNumElements(); i != e; ++i) { C1 = CP1 ? CP1->getOperand(i) : Context.getNullValue(EltTy); @@ -885,7 +885,7 @@ Res.push_back(Context.getConstantExprSDiv(const_cast(C1), const_cast(C2))); } - return Context.getConstantVector(Res); + return ConstantVector::get(Res); case Instruction::FDiv: for (unsigned i = 0, e = VTy->getNumElements(); i != e; ++i) { C1 = CP1 ? CP1->getOperand(i) : Context.getNullValue(EltTy); @@ -893,7 +893,7 @@ Res.push_back(Context.getConstantExprFDiv(const_cast(C1), const_cast(C2))); } - return Context.getConstantVector(Res); + return ConstantVector::get(Res); case Instruction::URem: for (unsigned i = 0, e = VTy->getNumElements(); i != e; ++i) { C1 = CP1 ? CP1->getOperand(i) : Context.getNullValue(EltTy); @@ -901,7 +901,7 @@ Res.push_back(Context.getConstantExprURem(const_cast(C1), const_cast(C2))); } - return Context.getConstantVector(Res); + return ConstantVector::get(Res); case Instruction::SRem: for (unsigned i = 0, e = VTy->getNumElements(); i != e; ++i) { C1 = CP1 ? CP1->getOperand(i) : Context.getNullValue(EltTy); @@ -909,7 +909,7 @@ Res.push_back(Context.getConstantExprSRem(const_cast(C1), const_cast(C2))); } - return Context.getConstantVector(Res); + return ConstantVector::get(Res); case Instruction::FRem: for (unsigned i = 0, e = VTy->getNumElements(); i != e; ++i) { C1 = CP1 ? CP1->getOperand(i) : Context.getNullValue(EltTy); @@ -917,7 +917,7 @@ Res.push_back(Context.getConstantExprFRem(const_cast(C1), const_cast(C2))); } - return Context.getConstantVector(Res); + return ConstantVector::get(Res); case Instruction::And: for (unsigned i = 0, e = VTy->getNumElements(); i != e; ++i) { C1 = CP1 ? CP1->getOperand(i) : Context.getNullValue(EltTy); @@ -925,7 +925,7 @@ Res.push_back(Context.getConstantExprAnd(const_cast(C1), const_cast(C2))); } - return Context.getConstantVector(Res); + return ConstantVector::get(Res); case Instruction::Or: for (unsigned i = 0, e = VTy->getNumElements(); i != e; ++i) { C1 = CP1 ? CP1->getOperand(i) : Context.getNullValue(EltTy); @@ -933,7 +933,7 @@ Res.push_back(Context.getConstantExprOr(const_cast(C1), const_cast(C2))); } - return Context.getConstantVector(Res); + return ConstantVector::get(Res); case Instruction::Xor: for (unsigned i = 0, e = VTy->getNumElements(); i != e; ++i) { C1 = CP1 ? CP1->getOperand(i) : Context.getNullValue(EltTy); @@ -941,7 +941,7 @@ Res.push_back(Context.getConstantExprXor(const_cast(C1), const_cast(C2))); } - return Context.getConstantVector(Res); + return ConstantVector::get(Res); case Instruction::LShr: for (unsigned i = 0, e = VTy->getNumElements(); i != e; ++i) { C1 = CP1 ? CP1->getOperand(i) : Context.getNullValue(EltTy); @@ -949,7 +949,7 @@ Res.push_back(Context.getConstantExprLShr(const_cast(C1), const_cast(C2))); } - return Context.getConstantVector(Res); + return ConstantVector::get(Res); case Instruction::AShr: for (unsigned i = 0, e = VTy->getNumElements(); i != e; ++i) { C1 = CP1 ? CP1->getOperand(i) : Context.getNullValue(EltTy); @@ -957,7 +957,7 @@ Res.push_back(Context.getConstantExprAShr(const_cast(C1), const_cast(C2))); } - return Context.getConstantVector(Res); + return ConstantVector::get(Res); case Instruction::Shl: for (unsigned i = 0, e = VTy->getNumElements(); i != e; ++i) { C1 = CP1 ? CP1->getOperand(i) : Context.getNullValue(EltTy); @@ -965,7 +965,7 @@ Res.push_back(Context.getConstantExprShl(const_cast(C1), const_cast(C2))); } - return Context.getConstantVector(Res); + return ConstantVector::get(Res); } } } @@ -1496,7 +1496,7 @@ ResElts.push_back( Context.getConstantExprCompare(pred, C1Elts[i], C2Elts[i])); } - return Context.getConstantVector(&ResElts[0], ResElts.size()); + return ConstantVector::get(&ResElts[0], ResElts.size()); } if (C1->getType()->isFloatingPoint()) { Modified: llvm/trunk/lib/VMCore/Constants.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Constants.cpp?rev=77366&r1=77365&r2=77366&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/Constants.cpp (original) +++ llvm/trunk/lib/VMCore/Constants.cpp Tue Jul 28 16:19:26 2009 @@ -206,7 +206,7 @@ // For vectors, broadcast the value. if (const VectorType *VTy = dyn_cast(Ty)) - return Ty->getContext().getConstantVector( + return ConstantVector::get( std::vector(VTy->getNumElements(), C)); return C; @@ -232,7 +232,7 @@ // For vectors, broadcast the value. if (const VectorType *VTy = dyn_cast(Ty)) - return Ty->getContext().getConstantVector( + return ConstantVector::get( std::vector(VTy->getNumElements(), C)); return C; @@ -270,7 +270,7 @@ // For vectors, broadcast the value. if (const VectorType *VTy = dyn_cast(Ty)) - return Context.getConstantVector( + return ConstantVector::get( std::vector(VTy->getNumElements(), C)); return C; @@ -290,7 +290,7 @@ if (PTy->getElementType()->isFloatingPoint()) { std::vector zeros(PTy->getNumElements(), getNegativeZero(PTy->getElementType())); - return Context.getConstantVector(PTy, zeros); + return ConstantVector::get(PTy, zeros); } if (Ty->isFloatingPoint()) @@ -490,6 +490,46 @@ } } +// ConstantVector accessors. +Constant* ConstantVector::get(const VectorType* T, + const std::vector& V) { + assert(!V.empty() && "Vectors can't be empty"); + LLVMContext &Context = T->getContext(); + LLVMContextImpl *pImpl = Context.pImpl; + + // If this is an all-undef or alll-zero vector, return a + // ConstantAggregateZero or UndefValue. + Constant *C = V[0]; + bool isZero = C->isNullValue(); + bool isUndef = isa(C); + + if (isZero || isUndef) { + for (unsigned i = 1, e = V.size(); i != e; ++i) + if (V[i] != C) { + isZero = isUndef = false; + break; + } + } + + if (isZero) + return Context.getConstantAggregateZero(T); + if (isUndef) + return Context.getUndef(T); + + // Implicitly locked. + return pImpl->VectorConstants.getOrCreate(T, V); +} + +Constant* ConstantVector::get(const std::vector& V) { + assert(!V.empty() && "Cannot infer type if V is empty"); + return get(VectorType::get(V.front()->getType(),V.size()), V); +} + +Constant* ConstantVector::get(Constant* const* Vals, unsigned NumVals) { + // FIXME: make this the primary ctor method. + return get(std::vector(Vals, Vals+NumVals)); +} + namespace llvm { // We declare several classes private to this file, so use an anonymous @@ -1064,7 +1104,7 @@ // void ConstantVector::destroyConstant() { // Implicitly locked. - getType()->getContext().erase(this); + getType()->getContext().pImpl->VectorConstants.remove(this); destroyConstantImpl(); } @@ -2127,6 +2167,14 @@ destroyConstant(); } +static std::vector getValType(ConstantVector *CP) { + std::vector Elements; + Elements.reserve(CP->getNumOperands()); + for (unsigned i = 0, e = CP->getNumOperands(); i != e; ++i) + Elements.push_back(CP->getOperand(i)); + return Elements; +} + void ConstantVector::replaceUsesOfWithOnConstant(Value *From, Value *To, Use *U) { assert(isa(To) && "Cannot make Constant refer to non-constant!"); @@ -2139,8 +2187,7 @@ Values.push_back(Val); } - Constant *Replacement = - getType()->getContext().getConstantVector(getType(), Values); + Constant *Replacement = get(getType(), Values); assert(Replacement != this && "I didn't contain From!"); // Everyone using this now uses the replacement. Modified: llvm/trunk/lib/VMCore/Core.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Core.cpp?rev=77366&r1=77365&r2=77366&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/Core.cpp (original) +++ llvm/trunk/lib/VMCore/Core.cpp Tue Jul 28 16:19:26 2009 @@ -421,7 +421,7 @@ } LLVMValueRef LLVMConstVector(LLVMValueRef *ScalarConstantVals, unsigned Size) { - return wrap(getGlobalContext().getConstantVector( + return wrap(ConstantVector::get( unwrap(ScalarConstantVals, Size), Size)); } Modified: llvm/trunk/lib/VMCore/Instructions.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Instructions.cpp?rev=77366&r1=77365&r2=77366&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/Instructions.cpp (original) +++ llvm/trunk/lib/VMCore/Instructions.cpp Tue Jul 28 16:19:26 2009 @@ -1616,7 +1616,7 @@ Constant *C; if (const VectorType *PTy = dyn_cast(Op->getType())) { C = Context.getAllOnesValue(PTy->getElementType()); - C = Context.getConstantVector( + C = ConstantVector::get( std::vector(PTy->getNumElements(), C)); } else { C = Context.getAllOnesValue(Op->getType()); @@ -1633,7 +1633,7 @@ if (const VectorType *PTy = dyn_cast(Op->getType())) { // Create a vector of all ones values. Constant *Elt = Context.getAllOnesValue(PTy->getElementType()); - AllOnes = Context.getConstantVector( + AllOnes = ConstantVector::get( std::vector(PTy->getNumElements(), Elt)); } else { AllOnes = Context.getAllOnesValue(Op->getType()); Modified: llvm/trunk/lib/VMCore/LLVMContext.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/LLVMContext.cpp?rev=77366&r1=77365&r2=77366&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/LLVMContext.cpp (original) +++ llvm/trunk/lib/VMCore/LLVMContext.cpp Tue Jul 28 16:19:26 2009 @@ -72,7 +72,7 @@ const VectorType* VTy = cast(Ty); Elts.resize(VTy->getNumElements(), getAllOnesValue(VTy->getElementType())); assert(Elts[0] && "Not a vector integer type!"); - return cast(getConstantVector(Elts)); + return cast(ConstantVector::get(Elts)); } // UndefValue accessors. @@ -367,23 +367,6 @@ return getConstantExprCast(Instruction::PtrToInt, GEP, Type::Int64Ty); } -// ConstantVector accessors. -Constant* LLVMContext::getConstantVector(const VectorType* T, - const std::vector& V) { - return pImpl->getConstantVector(T, V); -} - -Constant* LLVMContext::getConstantVector(const std::vector& V) { - assert(!V.empty() && "Cannot infer type if V is empty"); - return getConstantVector(getVectorType(V.front()->getType(),V.size()), V); -} - -Constant* LLVMContext::getConstantVector(Constant* const* Vals, - unsigned NumVals) { - // FIXME: make this the primary ctor method. - return getConstantVector(std::vector(Vals, Vals+NumVals)); -} - // MDNode accessors MDNode* LLVMContext::getMDNode(Value* const* Vals, unsigned NumVals) { return pImpl->getMDNode(Vals, NumVals); @@ -488,7 +471,3 @@ void LLVMContext::erase(ConstantAggregateZero *Z) { pImpl->erase(Z); } - -void LLVMContext::erase(ConstantVector *V) { - pImpl->erase(V); -} Modified: llvm/trunk/lib/VMCore/LLVMContextImpl.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/LLVMContextImpl.cpp?rev=77366&r1=77365&r2=77366&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/LLVMContextImpl.cpp (original) +++ llvm/trunk/lib/VMCore/LLVMContextImpl.cpp Tue Jul 28 16:19:26 2009 @@ -21,15 +21,6 @@ static char getValType(ConstantAggregateZero *CPZ) { return 0; } -static std::vector getValType(ConstantVector *CP) { - std::vector Elements; - Elements.reserve(CP->getNumOperands()); - for (unsigned i = 0, e = CP->getNumOperands(); i != e; ++i) - Elements.push_back(CP->getOperand(i)); - return Elements; -} - - LLVMContextImpl::LLVMContextImpl(LLVMContext &C) : Context(C), TheTrueVal(0), TheFalseVal(0) { } @@ -77,32 +68,6 @@ return AggZeroConstants.getOrCreate(Ty, 0); } -Constant *LLVMContextImpl::getConstantVector(const VectorType *Ty, - const std::vector &V) { - assert(!V.empty() && "Vectors can't be empty"); - // If this is an all-undef or alll-zero vector, return a - // ConstantAggregateZero or UndefValue. - Constant *C = V[0]; - bool isZero = C->isNullValue(); - bool isUndef = isa(C); - - if (isZero || isUndef) { - for (unsigned i = 1, e = V.size(); i != e; ++i) - if (V[i] != C) { - isZero = isUndef = false; - break; - } - } - - if (isZero) - return Context.getConstantAggregateZero(Ty); - if (isUndef) - return Context.getUndef(Ty); - - // Implicitly locked. - return VectorConstants.getOrCreate(Ty, V); -} - // *** erase methods *** void LLVMContextImpl::erase(MDString *M) { @@ -118,7 +83,3 @@ void LLVMContextImpl::erase(ConstantAggregateZero *Z) { AggZeroConstants.remove(Z); } - -void LLVMContextImpl::erase(ConstantVector *V) { - VectorConstants.remove(V); -} Modified: llvm/trunk/lib/VMCore/LLVMContextImpl.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/LLVMContextImpl.h?rev=77366&r1=77365&r2=77366&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/LLVMContextImpl.h (original) +++ llvm/trunk/lib/VMCore/LLVMContextImpl.h Tue Jul 28 16:19:26 2009 @@ -117,7 +117,7 @@ std::vector C; for (unsigned i = 0, e = OldC->getNumOperands(); i != e; ++i) C.push_back(cast(OldC->getOperand(i))); - Constant *New = OldC->getContext().getConstantVector(NewTy, C); + Constant *New = ConstantVector::get(NewTy, C); assert(New != OldC && "Didn't replace constant??"); OldC->uncheckedReplaceAllUsesWith(New); OldC->destroyConstant(); // This constant is now dead, destroy it. @@ -460,6 +460,7 @@ friend class ConstantFP; friend class ConstantStruct; friend class ConstantArray; + friend class ConstantVector; public: LLVMContextImpl(LLVMContext &C); @@ -469,9 +470,6 @@ ConstantAggregateZero *getConstantAggregateZero(const Type *Ty); - Constant *getConstantVector(const VectorType *Ty, - const std::vector &V); - ConstantInt *getTrue() { if (TheTrueVal) return TheTrueVal; From resistor at mac.com Tue Jul 28 16:19:34 2009 From: resistor at mac.com (Owen Anderson) Date: Tue, 28 Jul 2009 21:19:34 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r77367 - in /llvm-gcc-4.2/trunk/gcc: config/arm/llvm-arm.cpp config/rs6000/llvm-rs6000.cpp llvm-convert.cpp Message-ID: <200907282119.n6SLJYbZ014167@zion.cs.uiuc.edu> Author: resistor Date: Tue Jul 28 16:19:34 2009 New Revision: 77367 URL: http://llvm.org/viewvc/llvm-project?rev=77367&view=rev Log: Update for LLVM API change. Modified: llvm-gcc-4.2/trunk/gcc/config/arm/llvm-arm.cpp llvm-gcc-4.2/trunk/gcc/config/rs6000/llvm-rs6000.cpp llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp Modified: llvm-gcc-4.2/trunk/gcc/config/arm/llvm-arm.cpp URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/arm/llvm-arm.cpp?rev=77367&r1=77366&r2=77367&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/config/arm/llvm-arm.cpp (original) +++ llvm-gcc-4.2/trunk/gcc/config/arm/llvm-arm.cpp Tue Jul 28 16:19:34 2009 @@ -151,7 +151,7 @@ for (unsigned i = 0; i != NUnits; ++i) Idxs.push_back(ConstantInt::get(Type::Int32Ty, 0)); Result = Builder.CreateShuffleVector(Result, Undef, - Context.getConstantVector(Idxs)); + ConstantVector::get(Idxs)); } return Result; } @@ -166,7 +166,7 @@ for (unsigned i = 0; i != NUnits; ++i) Idxs.push_back(ConstantInt::get(Type::Int32Ty, LaneVal)); return Builder.CreateShuffleVector(Vec, Context.getUndef(Vec->getType()), - Context.getConstantVector(Idxs)); + ConstantVector::get(Idxs)); } // NEON vector shift counts must be in the range 0..ElemBits-1 for left shifts @@ -1714,7 +1714,7 @@ for (unsigned i = 0; i != NUnits; ++i) Idxs.push_back(ConstantInt::get(Type::Int32Ty, i)); Result = Builder.CreateShuffleVector(Ops[0], Ops[1], - Context.getConstantVector(Idxs)); + ConstantVector::get(Idxs)); break; } @@ -1727,7 +1727,7 @@ Idxs.push_back(ConstantInt::get(Type::Int32Ty, Idx++)); Result = Builder.CreateShuffleVector(Ops[0], Context.getUndef(Ops[0]->getType()), - Context.getConstantVector(Idxs)); + ConstantVector::get(Idxs)); break; } @@ -1790,7 +1790,7 @@ for (unsigned i = 0; i != NUnits; ++i) Idxs.push_back(ConstantInt::get(Type::Int32Ty, i + ImmVal)); Result = Builder.CreateShuffleVector(Ops[0], Ops[1], - Context.getConstantVector(Idxs)); + ConstantVector::get(Idxs)); break; } @@ -1818,7 +1818,7 @@ } } Result = Builder.CreateShuffleVector(Ops[0], Context.getUndef(ResultType), - Context.getConstantVector(Idxs)); + ConstantVector::get(Idxs)); break; } @@ -1912,7 +1912,7 @@ } } Result = Builder.CreateShuffleVector(Ops[1], Ops[2], - Context.getConstantVector(Idxs)); + ConstantVector::get(Idxs)); Type *PtrTy = Result->getType()->getPointerTo(); Builder.CreateStore(Result, BitCastToType(Ops[0], PtrTy)); Result = 0; @@ -1928,7 +1928,7 @@ Idxs.push_back(ConstantInt::get(Type::Int32Ty, i + NUnits)); } Result = Builder.CreateShuffleVector(Ops[1], Ops[2], - Context.getConstantVector(Idxs)); + ConstantVector::get(Idxs)); Type *PtrTy = Result->getType()->getPointerTo(); Builder.CreateStore(Result, BitCastToType(Ops[0], PtrTy)); Result = 0; @@ -1944,7 +1944,7 @@ Idxs.push_back(ConstantInt::get(Type::Int32Ty, 2 * i + EvenOdd)); } Result = Builder.CreateShuffleVector(Ops[1], Ops[2], - Context.getConstantVector(Idxs)); + ConstantVector::get(Idxs)); Type *PtrTy = Result->getType()->getPointerTo(); Builder.CreateStore(Result, BitCastToType(Ops[0], PtrTy)); Result = 0; @@ -2058,7 +2058,7 @@ Idxs.push_back(ConstantInt::get(Type::Int32Ty, n * NUnits)); } Result = Builder.CreateShuffleVector(Result, Context.getUndef(VTy), - Context.getConstantVector(Idxs)); + ConstantVector::get(Idxs)); } Type *PtrToWideVec = Context.getPointerTypeUnqual(VTy); Builder.CreateStore(Result, BitCastToType(DestLoc->Ptr, PtrToWideVec)); Modified: llvm-gcc-4.2/trunk/gcc/config/rs6000/llvm-rs6000.cpp URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/rs6000/llvm-rs6000.cpp?rev=77367&r1=77366&r2=77367&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/config/rs6000/llvm-rs6000.cpp (original) +++ llvm-gcc-4.2/trunk/gcc/config/rs6000/llvm-rs6000.cpp Tue Jul 28 16:19:34 2009 @@ -301,7 +301,7 @@ VectorType *v4i32 = Context.getVectorType(Type::Int32Ty, 4); Ops[0] = Builder.CreateBitCast(Ops[0], v4i32, "tmp"); Constant *C = ConstantInt::get(Type::Int32Ty, 0x7FFFFFFF); - C = Context.getConstantVector(std::vector(4, C)); + C = ConstantVector::get(std::vector(4, C)); Result = Builder.CreateAnd(Ops[0], C, "tmp"); Result = Builder.CreateBitCast(Result, ResultType, "tmp"); return true; Modified: llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp?rev=77367&r1=77366&r2=77367&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp (original) +++ llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp Tue Jul 28 16:19:34 2009 @@ -4616,7 +4616,7 @@ std::vector CstOps; for (unsigned i = 0, e = Ops.size(); i != e; ++i) CstOps.push_back(cast(Ops[i])); - return Context.getConstantVector(CstOps); + return ConstantVector::get(CstOps); } // Otherwise, insertelement the values to build the vector. @@ -4675,7 +4675,7 @@ // Turn this into the appropriate shuffle operation. return Builder.CreateShuffleVector(InVec1, InVec2, - Context.getConstantVector(Idxs)); + ConstantVector::get(Idxs)); } //===----------------------------------------------------------------------===// @@ -7062,7 +7062,7 @@ Elts.push_back(Zero); } - return Context.getConstantVector(Elts); + return ConstantVector::get(Elts); } Constant *TreeConstantToLLVM::ConvertSTRING_CST(tree exp) { @@ -7304,7 +7304,7 @@ if (TREE_CODE(InitType) == VECTOR_TYPE) { assert(AllEltsSameType && "Vector of heterogeneous element types?"); - return Context.getConstantVector(ResultElts); + return ConstantVector::get(ResultElts); } if (AllEltsSameType) From deeppatel1987 at gmail.com Tue Jul 28 16:24:54 2009 From: deeppatel1987 at gmail.com (Sandeep Patel) Date: Tue, 28 Jul 2009 21:24:54 +0000 Subject: [llvm-commits] [llvm] r77340 - in /llvm/trunk: lib/Target/ARM/ARMInstrThumb2.td test/CodeGen/Thumb2/thumb2-lsr3.ll In-Reply-To: <05D6B1F4-A623-4AA9-9021-97B8ED7A95D8@apple.com> References: <200907281815.n6SIFctv007606@zion.cs.uiuc.edu> <305d6f60907281322r644d145ob3a9096c26e6a199@mail.gmail.com> <50A85D5F-3459-4763-B8A0-9C15D96E9BBD@apple.com> <305d6f60907281345q6f41e809w8166f84ee3c6afad@mail.gmail.com> <05D6B1F4-A623-4AA9-9021-97B8ED7A95D8@apple.com> Message-ID: <305d6f60907281424n673236a1r567aee25d6ae85ec@mail.gmail.com> Confirmed that about gas. Thanks. deep On Tue, Jul 28, 2009 at 8:57 PM, David Goodwin wrote: > We (Apple) should have the assembler fixed soon and then I'll revert > the workaround. gas should accept the current form as well so it > shouldn't be a problem. > > David > > On Jul 28, 2009, at 1:45 PM, Sandeep Patel wrote: > >> Could this be conditionalized for Darwin? gas seems to work for >> these cases. >> >> deep >> >> On Tue, Jul 28, 2009 at 8:28 PM, Bob Wilson >> wrote: >>> Apple's assembler doesn't recognize Thumb2 RRX instructions, e.g., >>> "rrx r0,r0". >>> >>> On Jul 28, 2009, at 1:22 PM, Sandeep Patel wrote: >>> >>>> For those without internal Radar access, could you elaborate? >>>> >>>> deep >>>> >>>> On Tue, Jul 28, 2009 at 6:15 PM, David >>>> Goodwin wrote: >>>>> Author: david_goodwin >>>>> Date: Tue Jul 28 13:15:38 2009 >>>>> New Revision: 77340 >>>>> >>>>> URL: http://llvm.org/viewvc/llvm-project?rev=77340&view=rev >>>>> Log: >>>>> Add workaround for . >>>>> >>>>> Modified: >>>>> ? ?llvm/trunk/lib/Target/ARM/ARMInstrThumb2.td >>>>> ? ?llvm/trunk/test/CodeGen/Thumb2/thumb2-lsr3.ll >>>>> >>>>> Modified: llvm/trunk/lib/Target/ARM/ARMInstrThumb2.td >>>>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMInstrThumb2.td?rev=77340&r1=77339&r2=77340&view=diff >>>>> >>>>> = >>>>> = >>>>> = >>>>> = >>>>> = >>>>> = >>>>> = >>>>> = >>>>> = >>>>> = >>>>> = >>>>> =================================================================== >>>>> --- llvm/trunk/lib/Target/ARM/ARMInstrThumb2.td (original) >>>>> +++ llvm/trunk/lib/Target/ARM/ARMInstrThumb2.td Tue Jul 28 13:15:38 >>>>> 2009 >>>>> @@ -714,8 +714,9 @@ >>>>> ?defm t2ASR ?: T2I_sh_ir<"asr", BinOpFrag<(sra ?node:$LHS, node: >>>>> $RHS)>>; >>>>> ?defm t2ROR ?: T2I_sh_ir<"ror", BinOpFrag<(rotr node:$LHS, node: >>>>> $RHS)>>; >>>>> >>>>> +// FIXME should be "rrx $dst,$src" once >>>>> is fixed >>>>> ?def t2MOVrx : T2sI<(outs GPR:$dst), (ins GPR:$src), >>>>> - ? ? ? ? ? ? ? ? ? "rrx", " $dst, $src", >>>>> + ? ? ? ? ? ? ? ? ? "mov", ".w $dst, $src, rrx", >>>>> ? ? ? ? ? ? ? ? ? ?[(set GPR:$dst, (ARMrrx GPR:$src))]>; >>>>> >>>>> ?let Defs = [CPSR] in { >>>>> >>>>> Modified: llvm/trunk/test/CodeGen/Thumb2/thumb2-lsr3.ll >>>>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Thumb2/thumb2-lsr3.ll?rev=77340&r1=77339&r2=77340&view=diff >>>>> >>>>> = >>>>> = >>>>> = >>>>> = >>>>> = >>>>> = >>>>> = >>>>> = >>>>> = >>>>> = >>>>> = >>>>> =================================================================== >>>>> --- llvm/trunk/test/CodeGen/Thumb2/thumb2-lsr3.ll (original) >>>>> +++ llvm/trunk/test/CodeGen/Thumb2/thumb2-lsr3.ll Tue Jul 28 >>>>> 13:15:38 2009 >>>>> @@ -2,7 +2,7 @@ >>>>> >>>>> ?define i1 @test1(i64 %poscnt, i32 %work) { >>>>> ?entry: >>>>> -; CHECK: rrx r0, r0 >>>>> +; CHECK: mov.w r0, r0, rrx >>>>> ?; CHECK: lsrs.w r1, r1, #1 >>>>> ? ? ? ?%0 = lshr i64 %poscnt, 1 >>>>> ? ? ? ?%1 = icmp eq i64 %0, 0 >>>>> @@ -11,7 +11,7 @@ >>>>> >>>>> ?define i1 @test2(i64 %poscnt, i32 %work) { >>>>> ?entry: >>>>> -; CHECK: rrx r0, r0 >>>>> +; CHECK: mov.w r0, r0, rrx >>>>> ?; CHECK: asrs.w r1, r1, #1 >>>>> ? ? ? ?%0 = ashr i64 %poscnt, 1 >>>>> ? ? ? ?%1 = icmp eq i64 %0, 0 >>>>> >>>>> >>>>> _______________________________________________ >>>>> llvm-commits mailing list >>>>> llvm-commits at cs.uiuc.edu >>>>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits >>>>> >>>> >>>> _______________________________________________ >>>> llvm-commits mailing list >>>> llvm-commits at cs.uiuc.edu >>>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits >>> >>> _______________________________________________ >>> llvm-commits mailing list >>> llvm-commits at cs.uiuc.edu >>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits >>> >> >> _______________________________________________ >> llvm-commits mailing list >> llvm-commits at cs.uiuc.edu >> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits > From deeppatel1987 at gmail.com Tue Jul 28 16:28:16 2009 From: deeppatel1987 at gmail.com (Sandeep Patel) Date: Tue, 28 Jul 2009 21:28:16 +0000 Subject: [llvm-commits] [llvm] r77363 - in /llvm/trunk: lib/Target/ARM/ARMInstrThumb2.td test/CodeGen/Thumb2/thumb2-orn.ll test/CodeGen/Thumb2/thumb2-orn2.ll In-Reply-To: <18401D0E-0E90-41B7-843E-9A9F088B1023@apple.com> References: <200907282051.n6SKpQJP013197@zion.cs.uiuc.edu> <8E7FD6A6-DB6A-442D-8AA4-C0FEDD3F23C5@apple.com> <491BE10B-5718-47EA-9F72-462FEE70FE9A@apple.com> <18401D0E-0E90-41B7-843E-9A9F088B1023@apple.com> Message-ID: <305d6f60907281428q2d615e5dj3b7c3d4585923f74@mail.gmail.com> Not to be a PITA about it, but this one also only applies to Darwin, and if I read it correctly, pessimizes code. deep On Tue, Jul 28, 2009 at 9:01 PM, David Goodwin wrote: > I'll be good from now on... > > On Jul 28, 2009, at 1:59 PM, Eric Christopher wrote: > >> >> On Jul 28, 2009, at 1:58 PM, David Goodwin wrote: >> >>> Another rdar in an llvm commit! Who is that loser? Anyway this is >>> another case of an instruction not being recognized by Apple's >>> assembler. I'll revert as soon as we get that fixed (should be soon). >> >> Could you maybe just put that in next time? :) >> >> Even I can't look at that radar ;) >> >> -eric >> _______________________________________________ >> llvm-commits mailing list >> llvm-commits at cs.uiuc.edu >> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits > From evan.cheng at apple.com Tue Jul 28 16:49:19 2009 From: evan.cheng at apple.com (Evan Cheng) Date: Tue, 28 Jul 2009 21:49:19 -0000 Subject: [llvm-commits] [llvm] r77369 - /llvm/trunk/lib/CodeGen/MachineInstr.cpp Message-ID: <200907282149.n6SLnJRX015284@zion.cs.uiuc.edu> Author: evancheng Date: Tue Jul 28 16:49:18 2009 New Revision: 77369 URL: http://llvm.org/viewvc/llvm-project?rev=77369&view=rev Log: Fix a typo. Modified: llvm/trunk/lib/CodeGen/MachineInstr.cpp Modified: llvm/trunk/lib/CodeGen/MachineInstr.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachineInstr.cpp?rev=77369&r1=77368&r2=77369&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/MachineInstr.cpp (original) +++ llvm/trunk/lib/CodeGen/MachineInstr.cpp Tue Jul 28 16:49:18 2009 @@ -889,7 +889,7 @@ // load. if (TID->mayLoad() && !TII->isInvariantLoad(this)) // Otherwise, this is a real load. If there is a store between the load and - // end of block, or if the laod is volatile, we can't move it. + // end of block, or if the load is volatile, we can't move it. return !SawStore && !hasVolatileMemoryRef(); return true; From dpatel at apple.com Tue Jul 28 16:49:47 2009 From: dpatel at apple.com (Devang Patel) Date: Tue, 28 Jul 2009 21:49:47 -0000 Subject: [llvm-commits] [llvm] r77370 - in /llvm/trunk: include/llvm/ lib/AsmParser/ lib/Bitcode/Reader/ lib/Bitcode/Writer/ lib/Target/ARM/AsmPrinter/ lib/Target/Alpha/AsmPrinter/ lib/Target/CellSPU/AsmPrinter/ lib/Target/Mips/AsmPrinter/ lib/Target/PowerPC/AsmPrinter/ lib/Target/Sparc/AsmPrinter/ lib/Target/X86/AsmPrinter/ lib/Transforms/Utils/ lib/VMCore/ Message-ID: <200907282149.n6SLnmHX015334@zion.cs.uiuc.edu> Author: dpatel Date: Tue Jul 28 16:49:47 2009 New Revision: 77370 URL: http://llvm.org/viewvc/llvm-project?rev=77370&view=rev Log: Rename MDNode.h header. It defines MDnode and other metadata classes. New name is Metadata.h. Added: llvm/trunk/include/llvm/Metadata.h - copied, changed from r77349, llvm/trunk/include/llvm/MDNode.h llvm/trunk/lib/VMCore/Metadata.cpp Removed: llvm/trunk/include/llvm/MDNode.h Modified: llvm/trunk/lib/AsmParser/LLParser.cpp llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp llvm/trunk/lib/Bitcode/Writer/BitcodeWriter.cpp llvm/trunk/lib/Bitcode/Writer/ValueEnumerator.cpp llvm/trunk/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp llvm/trunk/lib/Target/Alpha/AsmPrinter/AlphaAsmPrinter.cpp llvm/trunk/lib/Target/CellSPU/AsmPrinter/SPUAsmPrinter.cpp llvm/trunk/lib/Target/Mips/AsmPrinter/MipsAsmPrinter.cpp llvm/trunk/lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp llvm/trunk/lib/Target/Sparc/AsmPrinter/SparcAsmPrinter.cpp llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp llvm/trunk/lib/Transforms/Utils/ValueMapper.cpp llvm/trunk/lib/VMCore/AsmWriter.cpp llvm/trunk/lib/VMCore/CMakeLists.txt llvm/trunk/lib/VMCore/Constants.cpp llvm/trunk/lib/VMCore/LLVMContext.cpp llvm/trunk/lib/VMCore/LLVMContextImpl.cpp llvm/trunk/lib/VMCore/Value.cpp llvm/trunk/lib/VMCore/Verifier.cpp Removed: llvm/trunk/include/llvm/MDNode.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MDNode.h?rev=77369&view=auto ============================================================================== --- llvm/trunk/include/llvm/MDNode.h (original) +++ llvm/trunk/include/llvm/MDNode.h (removed) @@ -1,163 +0,0 @@ -//===-- llvm/Metadata.h - Constant class subclass definitions ---*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// -/// @file -/// This file contains the declarations for the subclasses of Constant, -/// which represent the different flavors of constant values that live in LLVM. -/// Note that Constants are immutable (once created they never change) and are -/// fully shared by structural equivalence. This means that two structurally -/// equivalent constants will always have the same address. Constant's are -/// created on demand as needed and never deleted: thus clients don't have to -/// worry about the lifetime of the objects. -// -//===----------------------------------------------------------------------===// - -#ifndef LLVM_MDNODE_H -#define LLVM_MDNODE_H - -#include "llvm/Constant.h" -#include "llvm/Type.h" -#include "llvm/ADT/FoldingSet.h" -#include "llvm/ADT/SmallVector.h" -#include "llvm/Support/ErrorHandling.h" -#include "llvm/Support/ValueHandle.h" - -namespace llvm { - -//===----------------------------------------------------------------------===// -// MetadataBase - A base class for MDNode and MDString. -class MetadataBase : public Value { -protected: - MetadataBase(const Type *Ty, unsigned scid) - : Value(Ty, scid) {} - -public: - /// getType() specialization - Type is always MetadataTy. - /// - inline const Type *getType() const { - return Type::MetadataTy; - } - - /// isNullValue - Return true if this is the value that would be returned by - /// getNullValue. This always returns false because getNullValue will never - /// produce metadata. - virtual bool isNullValue() const { - return false; - } - - /// Methods for support type inquiry through isa, cast, and dyn_cast: - static inline bool classof(const MDString *) { return true; } - static bool classof(const Value *V) { - return V->getValueID() == MDStringVal || V->getValueID() == MDNodeVal; - } -}; - -//===----------------------------------------------------------------------===// -/// MDString - a single uniqued string. -/// These are used to efficiently contain a byte sequence for metadata. -/// -class MDString : public MetadataBase { - MDString(const MDString &); // DO NOT IMPLEMENT - StringRef Str; - friend class LLVMContextImpl; - -protected: - explicit MDString(const char *begin, unsigned l) - : MetadataBase(Type::MetadataTy, Value::MDStringVal), Str(begin, l) {} - -public: - StringRef getString() const { return Str; } - - unsigned length() const { return Str.size(); } - - /// begin() - Pointer to the first byte of the string. - /// - const char *begin() const { return Str.begin(); } - - /// end() - Pointer to one byte past the end of the string. - /// - const char *end() const { return Str.end(); } - - /// Methods for support type inquiry through isa, cast, and dyn_cast: - static inline bool classof(const MDString *) { return true; } - static bool classof(const Value *V) { - return V->getValueID() == MDStringVal; - } -}; - -//===----------------------------------------------------------------------===// -/// MDNode - a tuple of other values. -/// These contain a list of the values that represent the metadata. -/// -class MDNode : public MetadataBase, public FoldingSetNode { - MDNode(const MDNode &); // DO NOT IMPLEMENT - - friend class LLVMContextImpl; - - void replaceElement(Value *From, Value *To); - - SmallVector Node; - typedef SmallVectorImpl::iterator elem_iterator; - -protected: - explicit MDNode(Value*const* Vals, unsigned NumVals); -public: - typedef SmallVectorImpl::const_iterator const_elem_iterator; - - Value *getElement(unsigned i) const { - return Node[i]; - } - - unsigned getNumElements() const { - return Node.size(); - } - - bool elem_empty() const { - return Node.empty(); - } - - const_elem_iterator elem_begin() const { - return Node.begin(); - } - - const_elem_iterator elem_end() const { - return Node.end(); - } - - /// getType() specialization - Type is always MetadataTy. - /// - inline const Type *getType() const { - return Type::MetadataTy; - } - - /// isNullValue - Return true if this is the value that would be returned by - /// getNullValue. This always returns false because getNullValue will never - /// produce metadata. - virtual bool isNullValue() const { - return false; - } - - /// Profile - calculate a unique identifier for this MDNode to collapse - /// duplicates - void Profile(FoldingSetNodeID &ID) const; - - virtual void replaceUsesOfWithOnConstant(Value *From, Value *To, Use *U) { - llvm_unreachable("This should never be called because MDNodes have no ops"); - } - - /// Methods for support type inquiry through isa, cast, and dyn_cast: - static inline bool classof(const MDNode *) { return true; } - static bool classof(const Value *V) { - return V->getValueID() == MDNodeVal; - } -}; - -} // end llvm namespace - -#endif Copied: llvm/trunk/include/llvm/Metadata.h (from r77349, llvm/trunk/include/llvm/MDNode.h) URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Metadata.h?p2=llvm/trunk/include/llvm/Metadata.h&p1=llvm/trunk/include/llvm/MDNode.h&r1=77349&r2=77370&rev=77370&view=diff ============================================================================== --- llvm/trunk/include/llvm/MDNode.h (original) +++ llvm/trunk/include/llvm/Metadata.h Tue Jul 28 16:49:47 2009 @@ -1,4 +1,4 @@ -//===-- llvm/Metadata.h - Constant class subclass definitions ---*- C++ -*-===// +//===-- llvm/Metadata.h - Metadata definitions ------------------*- C++ -*-===// // // The LLVM Compiler Infrastructure // @@ -8,13 +8,8 @@ //===----------------------------------------------------------------------===// // /// @file -/// This file contains the declarations for the subclasses of Constant, -/// which represent the different flavors of constant values that live in LLVM. -/// Note that Constants are immutable (once created they never change) and are -/// fully shared by structural equivalence. This means that two structurally -/// equivalent constants will always have the same address. Constant's are -/// created on demand as needed and never deleted: thus clients don't have to -/// worry about the lifetime of the objects. +/// This file contains the declarations for metadata subclasses. +/// They represent the different flavors of metadata that live in LLVM. // //===----------------------------------------------------------------------===// Modified: llvm/trunk/lib/AsmParser/LLParser.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/AsmParser/LLParser.cpp?rev=77370&r1=77369&r2=77370&view=diff ============================================================================== --- llvm/trunk/lib/AsmParser/LLParser.cpp (original) +++ llvm/trunk/lib/AsmParser/LLParser.cpp Tue Jul 28 16:49:47 2009 @@ -19,7 +19,7 @@ #include "llvm/InlineAsm.h" #include "llvm/Instructions.h" #include "llvm/LLVMContext.h" -#include "llvm/MDNode.h" +#include "llvm/Metadata.h" #include "llvm/Module.h" #include "llvm/Operator.h" #include "llvm/ValueSymbolTable.h" Modified: llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp?rev=77370&r1=77369&r2=77370&view=diff ============================================================================== --- llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp (original) +++ llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp Tue Jul 28 16:49:47 2009 @@ -18,7 +18,7 @@ #include "llvm/InlineAsm.h" #include "llvm/Instructions.h" #include "llvm/LLVMContext.h" -#include "llvm/MDNode.h" +#include "llvm/Metadata.h" #include "llvm/Module.h" #include "llvm/Operator.h" #include "llvm/AutoUpgrade.h" Modified: llvm/trunk/lib/Bitcode/Writer/BitcodeWriter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Bitcode/Writer/BitcodeWriter.cpp?rev=77370&r1=77369&r2=77370&view=diff ============================================================================== --- llvm/trunk/lib/Bitcode/Writer/BitcodeWriter.cpp (original) +++ llvm/trunk/lib/Bitcode/Writer/BitcodeWriter.cpp Tue Jul 28 16:49:47 2009 @@ -19,7 +19,7 @@ #include "llvm/DerivedTypes.h" #include "llvm/InlineAsm.h" #include "llvm/Instructions.h" -#include "llvm/MDNode.h" +#include "llvm/Metadata.h" #include "llvm/Module.h" #include "llvm/Operator.h" #include "llvm/TypeSymbolTable.h" Modified: llvm/trunk/lib/Bitcode/Writer/ValueEnumerator.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Bitcode/Writer/ValueEnumerator.cpp?rev=77370&r1=77369&r2=77370&view=diff ============================================================================== --- llvm/trunk/lib/Bitcode/Writer/ValueEnumerator.cpp (original) +++ llvm/trunk/lib/Bitcode/Writer/ValueEnumerator.cpp Tue Jul 28 16:49:47 2009 @@ -14,7 +14,7 @@ #include "ValueEnumerator.h" #include "llvm/Constants.h" #include "llvm/DerivedTypes.h" -#include "llvm/MDNode.h" +#include "llvm/Metadata.h" #include "llvm/Module.h" #include "llvm/TypeSymbolTable.h" #include "llvm/ValueSymbolTable.h" Modified: llvm/trunk/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp?rev=77370&r1=77369&r2=77370&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp (original) +++ llvm/trunk/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp Tue Jul 28 16:49:47 2009 @@ -21,7 +21,7 @@ #include "ARMMachineFunctionInfo.h" #include "llvm/Constants.h" #include "llvm/Module.h" -#include "llvm/MDNode.h" +#include "llvm/Metadata.h" #include "llvm/CodeGen/AsmPrinter.h" #include "llvm/CodeGen/DwarfWriter.h" #include "llvm/CodeGen/MachineModuleInfo.h" Modified: llvm/trunk/lib/Target/Alpha/AsmPrinter/AlphaAsmPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Alpha/AsmPrinter/AlphaAsmPrinter.cpp?rev=77370&r1=77369&r2=77370&view=diff ============================================================================== --- llvm/trunk/lib/Target/Alpha/AsmPrinter/AlphaAsmPrinter.cpp (original) +++ llvm/trunk/lib/Target/Alpha/AsmPrinter/AlphaAsmPrinter.cpp Tue Jul 28 16:49:47 2009 @@ -17,7 +17,7 @@ #include "AlphaInstrInfo.h" #include "AlphaTargetMachine.h" #include "llvm/Module.h" -#include "llvm/MDNode.h" +#include "llvm/Metadata.h" #include "llvm/Type.h" #include "llvm/Assembly/Writer.h" #include "llvm/CodeGen/AsmPrinter.h" Modified: llvm/trunk/lib/Target/CellSPU/AsmPrinter/SPUAsmPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/CellSPU/AsmPrinter/SPUAsmPrinter.cpp?rev=77370&r1=77369&r2=77370&view=diff ============================================================================== --- llvm/trunk/lib/Target/CellSPU/AsmPrinter/SPUAsmPrinter.cpp (original) +++ llvm/trunk/lib/Target/CellSPU/AsmPrinter/SPUAsmPrinter.cpp Tue Jul 28 16:49:47 2009 @@ -19,7 +19,7 @@ #include "llvm/Constants.h" #include "llvm/DerivedTypes.h" #include "llvm/Module.h" -#include "llvm/MDNode.h" +#include "llvm/Metadata.h" #include "llvm/Assembly/Writer.h" #include "llvm/CodeGen/AsmPrinter.h" #include "llvm/CodeGen/DwarfWriter.h" Modified: llvm/trunk/lib/Target/Mips/AsmPrinter/MipsAsmPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mips/AsmPrinter/MipsAsmPrinter.cpp?rev=77370&r1=77369&r2=77370&view=diff ============================================================================== --- llvm/trunk/lib/Target/Mips/AsmPrinter/MipsAsmPrinter.cpp (original) +++ llvm/trunk/lib/Target/Mips/AsmPrinter/MipsAsmPrinter.cpp Tue Jul 28 16:49:47 2009 @@ -22,7 +22,7 @@ #include "llvm/Constants.h" #include "llvm/DerivedTypes.h" #include "llvm/Module.h" -#include "llvm/MDNode.h" +#include "llvm/Metadata.h" #include "llvm/CodeGen/AsmPrinter.h" #include "llvm/CodeGen/DwarfWriter.h" #include "llvm/CodeGen/MachineFunctionPass.h" Modified: llvm/trunk/lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp?rev=77370&r1=77369&r2=77370&view=diff ============================================================================== --- llvm/trunk/lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp (original) +++ llvm/trunk/lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp Tue Jul 28 16:49:47 2009 @@ -24,7 +24,7 @@ #include "llvm/Constants.h" #include "llvm/DerivedTypes.h" #include "llvm/Module.h" -#include "llvm/MDNode.h" +#include "llvm/Metadata.h" #include "llvm/Assembly/Writer.h" #include "llvm/CodeGen/AsmPrinter.h" #include "llvm/CodeGen/DwarfWriter.h" Modified: llvm/trunk/lib/Target/Sparc/AsmPrinter/SparcAsmPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Sparc/AsmPrinter/SparcAsmPrinter.cpp?rev=77370&r1=77369&r2=77370&view=diff ============================================================================== --- llvm/trunk/lib/Target/Sparc/AsmPrinter/SparcAsmPrinter.cpp (original) +++ llvm/trunk/lib/Target/Sparc/AsmPrinter/SparcAsmPrinter.cpp Tue Jul 28 16:49:47 2009 @@ -19,7 +19,7 @@ #include "llvm/Constants.h" #include "llvm/DerivedTypes.h" #include "llvm/Module.h" -#include "llvm/MDNode.h" +#include "llvm/Metadata.h" #include "llvm/CodeGen/AsmPrinter.h" #include "llvm/CodeGen/DwarfWriter.h" #include "llvm/CodeGen/MachineFunctionPass.h" Modified: llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp?rev=77370&r1=77369&r2=77370&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp (original) +++ llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp Tue Jul 28 16:49:47 2009 @@ -23,7 +23,7 @@ #include "llvm/CallingConv.h" #include "llvm/DerivedTypes.h" #include "llvm/Module.h" -#include "llvm/MDNode.h" +#include "llvm/Metadata.h" #include "llvm/Type.h" #include "llvm/ADT/Statistic.h" #include "llvm/ADT/StringExtras.h" Modified: llvm/trunk/lib/Transforms/Utils/ValueMapper.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/ValueMapper.cpp?rev=77370&r1=77369&r2=77370&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Utils/ValueMapper.cpp (original) +++ llvm/trunk/lib/Transforms/Utils/ValueMapper.cpp Tue Jul 28 16:49:47 2009 @@ -19,7 +19,7 @@ #include "llvm/GlobalValue.h" #include "llvm/Instruction.h" #include "llvm/LLVMContext.h" -#include "llvm/MDNode.h" +#include "llvm/Metadata.h" #include "llvm/ADT/SmallVector.h" #include "llvm/Support/ErrorHandling.h" using namespace llvm; Modified: llvm/trunk/lib/VMCore/AsmWriter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/AsmWriter.cpp?rev=77370&r1=77369&r2=77370&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/AsmWriter.cpp (original) +++ llvm/trunk/lib/VMCore/AsmWriter.cpp Tue Jul 28 16:49:47 2009 @@ -24,7 +24,7 @@ #include "llvm/Instruction.h" #include "llvm/Instructions.h" #include "llvm/Operator.h" -#include "llvm/MDNode.h" +#include "llvm/Metadata.h" #include "llvm/Module.h" #include "llvm/ValueSymbolTable.h" #include "llvm/TypeSymbolTable.h" Modified: llvm/trunk/lib/VMCore/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/CMakeLists.txt?rev=77370&r1=77369&r2=77370&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/CMakeLists.txt (original) +++ llvm/trunk/lib/VMCore/CMakeLists.txt Tue Jul 28 16:49:47 2009 @@ -17,6 +17,7 @@ LLVMContextImpl.cpp LeakDetector.cpp Mangler.cpp + Metadata.cpp Module.cpp ModuleProvider.cpp Pass.cpp Modified: llvm/trunk/lib/VMCore/Constants.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Constants.cpp?rev=77370&r1=77369&r2=77370&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/Constants.cpp (original) +++ llvm/trunk/lib/VMCore/Constants.cpp Tue Jul 28 16:49:47 2009 @@ -17,7 +17,6 @@ #include "llvm/DerivedTypes.h" #include "llvm/GlobalValue.h" #include "llvm/Instructions.h" -#include "llvm/MDNode.h" #include "llvm/Module.h" #include "llvm/Operator.h" #include "llvm/ADT/FoldingSet.h" @@ -1225,20 +1224,6 @@ destroyConstantImpl(); } -//---- MDNode::get() implementation -// - -MDNode::MDNode(Value*const* Vals, unsigned NumVals) - : MetadataBase(Type::MetadataTy, Value::MDNodeVal) { - for (unsigned i = 0; i != NumVals; ++i) - Node.push_back(WeakVH(Vals[i])); -} - -void MDNode::Profile(FoldingSetNodeID &ID) const { - for (const_elem_iterator I = elem_begin(), E = elem_end(); I != E; ++I) - ID.AddPointer(*I); -} - //---- ConstantExpr::get() implementations... // @@ -2296,18 +2281,3 @@ destroyConstant(); } -void MDNode::replaceElement(Value *From, Value *To) { - SmallVector Values; - Values.reserve(getNumElements()); // Build replacement array... - for (unsigned i = 0, e = getNumElements(); i != e; ++i) { - Value *Val = getElement(i); - if (Val == From) Val = To; - Values.push_back(Val); - } - - MDNode *Replacement = - getType()->getContext().getMDNode(&Values[0], Values.size()); - assert(Replacement != this && "I didn't contain From!"); - - uncheckedReplaceAllUsesWith(Replacement); -} Modified: llvm/trunk/lib/VMCore/LLVMContext.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/LLVMContext.cpp?rev=77370&r1=77369&r2=77370&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/LLVMContext.cpp (original) +++ llvm/trunk/lib/VMCore/LLVMContext.cpp Tue Jul 28 16:49:47 2009 @@ -16,7 +16,7 @@ #include "llvm/Constants.h" #include "llvm/DerivedTypes.h" #include "llvm/Instruction.h" -#include "llvm/MDNode.h" +#include "llvm/Metadata.h" #include "llvm/Support/ManagedStatic.h" #include "LLVMContextImpl.h" #include Modified: llvm/trunk/lib/VMCore/LLVMContextImpl.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/LLVMContextImpl.cpp?rev=77370&r1=77369&r2=77370&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/LLVMContextImpl.cpp (original) +++ llvm/trunk/lib/VMCore/LLVMContextImpl.cpp Tue Jul 28 16:49:47 2009 @@ -16,7 +16,7 @@ #include "llvm/Constants.h" #include "llvm/DerivedTypes.h" #include "llvm/LLVMContext.h" -#include "llvm/MDNode.h" +#include "llvm/Metadata.h" using namespace llvm; static char getValType(ConstantAggregateZero *CPZ) { return 0; } Added: llvm/trunk/lib/VMCore/Metadata.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Metadata.cpp?rev=77370&view=auto ============================================================================== --- llvm/trunk/lib/VMCore/Metadata.cpp (added) +++ llvm/trunk/lib/VMCore/Metadata.cpp Tue Jul 28 16:49:47 2009 @@ -0,0 +1,45 @@ +//===-- Metadata.cpp - Implement Metadata classes -------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// This file implements the Metadata classes. +// +//===----------------------------------------------------------------------===// + +#include "llvm/Metadata.h" +using namespace llvm; + +//===----------------------------------------------------------------------===// +//MDNode implementation +// +MDNode::MDNode(Value*const* Vals, unsigned NumVals) + : MetadataBase(Type::MetadataTy, Value::MDNodeVal) { + for (unsigned i = 0; i != NumVals; ++i) + Node.push_back(WeakVH(Vals[i])); +} + +void MDNode::Profile(FoldingSetNodeID &ID) const { + for (const_elem_iterator I = elem_begin(), E = elem_end(); I != E; ++I) + ID.AddPointer(*I); +} + +void MDNode::replaceElement(Value *From, Value *To) { + SmallVector Values; + Values.reserve(getNumElements()); // Build replacement array... + for (unsigned i = 0, e = getNumElements(); i != e; ++i) { + Value *Val = getElement(i); + if (Val == From) Val = To; + Values.push_back(Val); + } + + MDNode *Replacement = + getType()->getContext().getMDNode(&Values[0], Values.size()); + assert(Replacement != this && "I didn't contain From!"); + + uncheckedReplaceAllUsesWith(Replacement); +} Modified: llvm/trunk/lib/VMCore/Value.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Value.cpp?rev=77370&r1=77369&r2=77370&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/Value.cpp (original) +++ llvm/trunk/lib/VMCore/Value.cpp Tue Jul 28 16:49:47 2009 @@ -18,7 +18,7 @@ #include "llvm/Instructions.h" #include "llvm/Operator.h" #include "llvm/Module.h" -#include "llvm/MDNode.h" +#include "llvm/Metadata.h" #include "llvm/ValueSymbolTable.h" #include "llvm/ADT/SmallString.h" #include "llvm/Support/Debug.h" Modified: llvm/trunk/lib/VMCore/Verifier.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Verifier.cpp?rev=77370&r1=77369&r2=77370&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/Verifier.cpp (original) +++ llvm/trunk/lib/VMCore/Verifier.cpp Tue Jul 28 16:49:47 2009 @@ -45,7 +45,7 @@ #include "llvm/DerivedTypes.h" #include "llvm/InlineAsm.h" #include "llvm/IntrinsicInst.h" -#include "llvm/MDNode.h" +#include "llvm/Metadata.h" #include "llvm/Module.h" #include "llvm/ModuleProvider.h" #include "llvm/Pass.h" From isanbard at gmail.com Tue Jul 28 16:50:32 2009 From: isanbard at gmail.com (Bill Wendling) Date: Tue, 28 Jul 2009 21:50:32 -0000 Subject: [llvm-commits] [llvm] r77371 - /llvm/trunk/include/llvm/Target/TargetAsmInfo.h Message-ID: <200907282150.n6SLoWKU015367@zion.cs.uiuc.edu> Author: void Date: Tue Jul 28 16:50:32 2009 New Revision: 77371 URL: http://llvm.org/viewvc/llvm-project?rev=77371&view=rev Log: Remove unused parameter name. Modified: llvm/trunk/include/llvm/Target/TargetAsmInfo.h Modified: llvm/trunk/include/llvm/Target/TargetAsmInfo.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetAsmInfo.h?rev=77371&r1=77370&r2=77371&view=diff ============================================================================== --- llvm/trunk/include/llvm/Target/TargetAsmInfo.h (original) +++ llvm/trunk/include/llvm/Target/TargetAsmInfo.h Tue Jul 28 16:50:32 2009 @@ -623,7 +623,7 @@ /// not to emit the UsedDirective for some symbols in llvm.used. // FIXME: REMOVE this (rdar://7071300) virtual bool emitUsedDirectiveFor(const GlobalValue *GV, - Mangler *Mang) const { + Mangler *) const { return (GV!=0); } From gohman at apple.com Tue Jul 28 16:50:52 2009 From: gohman at apple.com (Dan Gohman) Date: Tue, 28 Jul 2009 14:50:52 -0700 Subject: [llvm-commits] [patch] make Program::FindProgramByName not look in "." unless it's in $PATH In-Reply-To: <4A6ED729.1080005@googlemail.com> References: <4A6ED729.1080005@googlemail.com> Message-ID: <86FB09C9-E6ED-4342-B6A7-9135A98DC5F8@apple.com> On Jul 28, 2009, at 3:47 AM, Benjamin Kramer wrote: > Sorry, I've sent this to the wrong list. > > Dan Gohman writes: > >> The traditional behavior of sh(1) and friends is to use the given >> >> path verbatim if it contains any slashes, not just if it's >> >> absolute. >> > > Here's a patch which tries to match that behavior. I'm not touching > windows though, cmd.exe assumes that "." is always in %PATH%. > > Ok, this looks good to me, please commit! Dan From isanbard at gmail.com Tue Jul 28 16:53:17 2009 From: isanbard at gmail.com (Bill Wendling) Date: Tue, 28 Jul 2009 21:53:17 -0000 Subject: [llvm-commits] [llvm] r77372 - /llvm/trunk/lib/Target/X86/X86TargetAsmInfo.cpp Message-ID: <200907282153.n6SLrHpB015475@zion.cs.uiuc.edu> Author: void Date: Tue Jul 28 16:53:17 2009 New Revision: 77372 URL: http://llvm.org/viewvc/llvm-project?rev=77372&view=rev Log: Darwin outputs (DW_EH_PE_pcrel | DW_EH_PE_indirect | DW_EH_PE_sdata4) when we're dealing with Data. Modified: llvm/trunk/lib/Target/X86/X86TargetAsmInfo.cpp Modified: llvm/trunk/lib/Target/X86/X86TargetAsmInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86TargetAsmInfo.cpp?rev=77372&r1=77371&r2=77372&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86TargetAsmInfo.cpp (original) +++ llvm/trunk/lib/Target/X86/X86TargetAsmInfo.cpp Tue Jul 28 16:53:17 2009 @@ -94,10 +94,13 @@ unsigned X86DarwinTargetAsmInfo::PreferredEHDataFormat(DwarfEncoding::Target Reason, bool Global) const { - if (Reason == DwarfEncoding::Functions && Global) - return (DW_EH_PE_pcrel | DW_EH_PE_indirect | DW_EH_PE_sdata4); + if ((Reason == DwarfEncoding::Data || Reason == DwarfEncoding::Functions) + && Global) + return DW_EH_PE_pcrel | DW_EH_PE_indirect | DW_EH_PE_sdata4; + if (Reason == DwarfEncoding::CodeLabels || !Global) return DW_EH_PE_pcrel; + return DW_EH_PE_absptr; } From isanbard at gmail.com Tue Jul 28 16:54:03 2009 From: isanbard at gmail.com (Bill Wendling) Date: Tue, 28 Jul 2009 21:54:03 -0000 Subject: [llvm-commits] [llvm] r77373 - /llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp Message-ID: <200907282154.n6SLs3hD015517@zion.cs.uiuc.edu> Author: void Date: Tue Jul 28 16:54:03 2009 New Revision: 77373 URL: http://llvm.org/viewvc/llvm-project?rev=77373&view=rev Log: Use the preferred EH data format for the preferred EH data format. Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp?rev=77373&r1=77372&r2=77373&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp (original) +++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp Tue Jul 28 16:54:03 2009 @@ -520,14 +520,14 @@ for (unsigned i = 0; i != SizeAlign; ++i) { Asm->EmitInt8(0); Asm->EOL("Padding"); - } + } EmitLabel("exception", SubprogramCount); // Emit the header. Asm->EmitInt8(dwarf::DW_EH_PE_omit); Asm->EOL("LPStart format (DW_EH_PE_omit)"); - Asm->EmitInt8(dwarf::DW_EH_PE_absptr); + Asm->EmitInt8(TAI->PreferredEHDataFormat(DwarfEncoding::Data, true)); Asm->EOL("TType format (DW_EH_PE_absptr)"); Asm->EmitULEB128Bytes(TypeOffset); Asm->EOL("TType base offset"); From benny.kra at googlemail.com Tue Jul 28 17:03:24 2009 From: benny.kra at googlemail.com (Benjamin Kramer) Date: Tue, 28 Jul 2009 22:03:24 -0000 Subject: [llvm-commits] [llvm] r77375 - /llvm/trunk/unittests/VMCore/MetadataTest.cpp Message-ID: <200907282203.n6SM3OmZ015860@zion.cs.uiuc.edu> Author: d0k Date: Tue Jul 28 17:03:24 2009 New Revision: 77375 URL: http://llvm.org/viewvc/llvm-project?rev=77375&view=rev Log: fix unittest Modified: llvm/trunk/unittests/VMCore/MetadataTest.cpp Modified: llvm/trunk/unittests/VMCore/MetadataTest.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/VMCore/MetadataTest.cpp?rev=77375&r1=77374&r2=77375&view=diff ============================================================================== --- llvm/trunk/unittests/VMCore/MetadataTest.cpp (original) +++ llvm/trunk/unittests/VMCore/MetadataTest.cpp Tue Jul 28 17:03:24 2009 @@ -10,7 +10,7 @@ #include "gtest/gtest.h" #include "llvm/Constants.h" #include "llvm/Instructions.h" -#include "llvm/MDNode.h" +#include "llvm/Metadata.h" #include "llvm/Type.h" #include "llvm/Support/ValueHandle.h" #include From isanbard at gmail.com Tue Jul 28 17:03:50 2009 From: isanbard at gmail.com (Bill Wendling) Date: Tue, 28 Jul 2009 22:03:50 -0000 Subject: [llvm-commits] [llvm] r77376 - /llvm/trunk/lib/Target/PowerPC/PPCTargetAsmInfo.cpp Message-ID: <200907282203.n6SM3oHp015886@zion.cs.uiuc.edu> Author: void Date: Tue Jul 28 17:03:50 2009 New Revision: 77376 URL: http://llvm.org/viewvc/llvm-project?rev=77376&view=rev Log: Output the correct format for Darwin. Modified: llvm/trunk/lib/Target/PowerPC/PPCTargetAsmInfo.cpp Modified: llvm/trunk/lib/Target/PowerPC/PPCTargetAsmInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/PPCTargetAsmInfo.cpp?rev=77376&r1=77375&r2=77376&view=diff ============================================================================== --- llvm/trunk/lib/Target/PowerPC/PPCTargetAsmInfo.cpp (original) +++ llvm/trunk/lib/Target/PowerPC/PPCTargetAsmInfo.cpp Tue Jul 28 17:03:50 2009 @@ -41,12 +41,14 @@ unsigned PPCDarwinTargetAsmInfo::PreferredEHDataFormat(DwarfEncoding::Target Reason, bool Global) const { - if (Reason == DwarfEncoding::Functions && Global) - return (DW_EH_PE_pcrel | DW_EH_PE_indirect | DW_EH_PE_sdata4); - else if (Reason == DwarfEncoding::CodeLabels || !Global) + if ((Reason == DwarfEncoding::Data || Reason == DwarfEncoding::Functions) + && Global) + return DW_EH_PE_pcrel | DW_EH_PE_indirect | DW_EH_PE_sdata4; + + if (Reason == DwarfEncoding::CodeLabels || !Global) return DW_EH_PE_pcrel; - else - return DW_EH_PE_absptr; + + return DW_EH_PE_absptr; } const char *PPCDarwinTargetAsmInfo::getEHGlobalPrefix() const { From dpatel at apple.com Tue Jul 28 17:04:55 2009 From: dpatel at apple.com (Devang Patel) Date: Tue, 28 Jul 2009 22:04:55 -0000 Subject: [llvm-commits] [llvm] r77378 - in /llvm/trunk: include/llvm/Metadata.h lib/VMCore/Metadata.cpp Message-ID: <200907282204.n6SM4tPN015943@zion.cs.uiuc.edu> Author: dpatel Date: Tue Jul 28 17:04:55 2009 New Revision: 77378 URL: http://llvm.org/viewvc/llvm-project?rev=77378&view=rev Log: Remove unused method. Modified: llvm/trunk/include/llvm/Metadata.h llvm/trunk/lib/VMCore/Metadata.cpp Modified: llvm/trunk/include/llvm/Metadata.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Metadata.h?rev=77378&r1=77377&r2=77378&view=diff ============================================================================== --- llvm/trunk/include/llvm/Metadata.h (original) +++ llvm/trunk/include/llvm/Metadata.h Tue Jul 28 17:04:55 2009 @@ -95,8 +95,6 @@ friend class LLVMContextImpl; - void replaceElement(Value *From, Value *To); - SmallVector Node; typedef SmallVectorImpl::iterator elem_iterator; Modified: llvm/trunk/lib/VMCore/Metadata.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Metadata.cpp?rev=77378&r1=77377&r2=77378&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/Metadata.cpp (original) +++ llvm/trunk/lib/VMCore/Metadata.cpp Tue Jul 28 17:04:55 2009 @@ -27,19 +27,3 @@ for (const_elem_iterator I = elem_begin(), E = elem_end(); I != E; ++I) ID.AddPointer(*I); } - -void MDNode::replaceElement(Value *From, Value *To) { - SmallVector Values; - Values.reserve(getNumElements()); // Build replacement array... - for (unsigned i = 0, e = getNumElements(); i != e; ++i) { - Value *Val = getElement(i); - if (Val == From) Val = To; - Values.push_back(Val); - } - - MDNode *Replacement = - getType()->getContext().getMDNode(&Values[0], Values.size()); - assert(Replacement != this && "I didn't contain From!"); - - uncheckedReplaceAllUsesWith(Replacement); -} From benny.kra at googlemail.com Tue Jul 28 17:08:15 2009 From: benny.kra at googlemail.com (Benjamin Kramer) Date: Tue, 28 Jul 2009 22:08:15 -0000 Subject: [llvm-commits] [llvm] r77379 - /llvm/trunk/lib/System/Unix/Program.inc Message-ID: <200907282208.n6SM8Fn0016042@zion.cs.uiuc.edu> Author: d0k Date: Tue Jul 28 17:08:15 2009 New Revision: 77379 URL: http://llvm.org/viewvc/llvm-project?rev=77379&view=rev Log: Fix a fixme; don't take binaries from the working directory. This fixes clang on non-darwin platforms if a file called 'ld' or 'as' is in the working directory. Based on patch by Pawel Worach! Modified: llvm/trunk/lib/System/Unix/Program.inc Modified: llvm/trunk/lib/System/Unix/Program.inc URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/System/Unix/Program.inc?rev=77379&r1=77378&r2=77379&view=diff ============================================================================== --- llvm/trunk/lib/System/Unix/Program.inc (original) +++ llvm/trunk/lib/System/Unix/Program.inc Tue Jul 28 17:08:15 2009 @@ -45,9 +45,9 @@ Path temp; if (!temp.set(progName)) // invalid name return Path(); - // FIXME: have to check for absolute filename - we cannot assume anything - // about "." being in $PATH - if (temp.canExecute()) // already executable as is + // Use the given path verbatim if it contains any slashes; this matches + // the behavior of sh(1) and friends. + if (progName.find('/') != std::string::npos && temp.canExecute()) return temp; // At this point, the file name is valid and its not executable From david_goodwin at apple.com Tue Jul 28 17:12:21 2009 From: david_goodwin at apple.com (David Goodwin) Date: Tue, 28 Jul 2009 15:12:21 -0700 Subject: [llvm-commits] [llvm] r77363 - in /llvm/trunk: lib/Target/ARM/ARMInstrThumb2.td test/CodeGen/Thumb2/thumb2-orn.ll test/CodeGen/Thumb2/thumb2-orn2.ll In-Reply-To: <305d6f60907281428q2d615e5dj3b7c3d4585923f74@mail.gmail.com> References: <200907282051.n6SKpQJP013197@zion.cs.uiuc.edu> <8E7FD6A6-DB6A-442D-8AA4-C0FEDD3F23C5@apple.com> <491BE10B-5718-47EA-9F72-462FEE70FE9A@apple.com> <18401D0E-0E90-41B7-843E-9A9F088B1023@apple.com> <305d6f60907281428q2d615e5dj3b7c3d4585923f74@mail.gmail.com> Message-ID: Yes, I will remove the workaround soon. Is disabling ORN a problem? Thumb-2 doesn't yet work completely so I assume this (temporary and likely small) performance regression is not a big deal. David On Jul 28, 2009, at 2:28 PM, Sandeep Patel wrote: > Not to be a PITA about it, but this one also only applies to Darwin, > and if I read it correctly, pessimizes code. > > deep > > On Tue, Jul 28, 2009 at 9:01 PM, David > Goodwin wrote: >> I'll be good from now on... >> >> On Jul 28, 2009, at 1:59 PM, Eric Christopher wrote: >> >>> >>> On Jul 28, 2009, at 1:58 PM, David Goodwin wrote: >>> >>>> Another rdar in an llvm commit! Who is that loser? Anyway this is >>>> another case of an instruction not being recognized by Apple's >>>> assembler. I'll revert as soon as we get that fixed (should be >>>> soon). >>> >>> Could you maybe just put that in next time? :) >>> >>> Even I can't look at that radar ;) >>> >>> -eric >>> _______________________________________________ >>> llvm-commits mailing list >>> llvm-commits at cs.uiuc.edu >>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits >> >> _______________________________________________ >> llvm-commits mailing list >> llvm-commits at cs.uiuc.edu >> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits >> > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From devang.patel at gmail.com Tue Jul 28 17:15:23 2009 From: devang.patel at gmail.com (Devang Patel) Date: Tue, 28 Jul 2009 15:15:23 -0700 Subject: [llvm-commits] [llvm] r77375 - /llvm/trunk/unittests/VMCore/MetadataTest.cpp In-Reply-To: <200907282203.n6SM3OmZ015860@zion.cs.uiuc.edu> References: <200907282203.n6SM3OmZ015860@zion.cs.uiuc.edu> Message-ID: <352a1fb20907281515j1036d5fod12cd44058b187cd@mail.gmail.com> Thanks! - Devang On Tue, Jul 28, 2009 at 3:03 PM, Benjamin Kramer wrote: > Author: d0k > Date: Tue Jul 28 17:03:24 2009 > New Revision: 77375 > > URL: http://llvm.org/viewvc/llvm-project?rev=77375&view=rev > Log: > fix unittest > > Modified: > ? ?llvm/trunk/unittests/VMCore/MetadataTest.cpp > > Modified: llvm/trunk/unittests/VMCore/MetadataTest.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/VMCore/MetadataTest.cpp?rev=77375&r1=77374&r2=77375&view=diff > > ============================================================================== > --- llvm/trunk/unittests/VMCore/MetadataTest.cpp (original) > +++ llvm/trunk/unittests/VMCore/MetadataTest.cpp Tue Jul 28 17:03:24 2009 > @@ -10,7 +10,7 @@ > ?#include "gtest/gtest.h" > ?#include "llvm/Constants.h" > ?#include "llvm/Instructions.h" > -#include "llvm/MDNode.h" > +#include "llvm/Metadata.h" > ?#include "llvm/Type.h" > ?#include "llvm/Support/ValueHandle.h" > ?#include > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits > -- - Devang From deeppatel1987 at gmail.com Tue Jul 28 17:17:54 2009 From: deeppatel1987 at gmail.com (Sandeep Patel) Date: Tue, 28 Jul 2009 22:17:54 +0000 Subject: [llvm-commits] [llvm] r77363 - in /llvm/trunk: lib/Target/ARM/ARMInstrThumb2.td test/CodeGen/Thumb2/thumb2-orn.ll test/CodeGen/Thumb2/thumb2-orn2.ll In-Reply-To: References: <200907282051.n6SKpQJP013197@zion.cs.uiuc.edu> <8E7FD6A6-DB6A-442D-8AA4-C0FEDD3F23C5@apple.com> <491BE10B-5718-47EA-9F72-462FEE70FE9A@apple.com> <18401D0E-0E90-41B7-843E-9A9F088B1023@apple.com> <305d6f60907281428q2d615e5dj3b7c3d4585923f74@mail.gmail.com> Message-ID: <305d6f60907281517i74190a77kaebe55f431cb5f0e@mail.gmail.com> I had just wanted to remind you that other uses of the ARM backend exist, so it would be best to conditionalize Darwin-specific workarounds when possible. deep On Tue, Jul 28, 2009 at 10:12 PM, David Goodwin wrote: > Yes, I will remove the workaround soon. Is disabling ORN a problem? > Thumb-2 doesn't yet work completely so I assume this (temporary and > likely small) performance regression is not a big deal. > > David > > On Jul 28, 2009, at 2:28 PM, Sandeep Patel wrote: > >> Not to be a PITA about it, but this one also only applies to Darwin, >> and if I read it correctly, pessimizes code. >> >> deep >> >> On Tue, Jul 28, 2009 at 9:01 PM, David >> Goodwin wrote: >>> I'll be good from now on... >>> >>> On Jul 28, 2009, at 1:59 PM, Eric Christopher wrote: >>> >>>> >>>> On Jul 28, 2009, at 1:58 PM, David Goodwin wrote: >>>> >>>>> Another rdar in an llvm commit! Who is that loser? Anyway this is >>>>> another case of an instruction not being recognized by Apple's >>>>> assembler. I'll revert as soon as we get that fixed (should be >>>>> soon). >>>> >>>> Could you maybe just put that in next time? :) >>>> >>>> Even I can't look at that radar ;) >>>> >>>> -eric >>>> _______________________________________________ >>>> llvm-commits mailing list >>>> llvm-commits at cs.uiuc.edu >>>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits >>> >>> _______________________________________________ >>> llvm-commits mailing list >>> llvm-commits at cs.uiuc.edu >>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits >>> >> _______________________________________________ >> llvm-commits mailing list >> llvm-commits at cs.uiuc.edu >> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits > From simmon12 at illinois.edu Tue Jul 28 17:22:10 2009 From: simmon12 at illinois.edu (Patrick Simmons) Date: Tue, 28 Jul 2009 22:22:10 -0000 Subject: [llvm-commits] [poolalloc] r77380 - /poolalloc/trunk/include/poolalloc/PoolAllocate.h Message-ID: <200907282222.n6SMMAi5016546@zion.cs.uiuc.edu> Author: psimmons Date: Tue Jul 28 17:22:09 2009 New Revision: 77380 URL: http://llvm.org/viewvc/llvm-project?rev=77380&view=rev Log: Change default of new poolalloc constructor SAFECode flag to "true" to match the old constructor it is replacing. Modified: poolalloc/trunk/include/poolalloc/PoolAllocate.h Modified: poolalloc/trunk/include/poolalloc/PoolAllocate.h URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/include/poolalloc/PoolAllocate.h?rev=77380&r1=77379&r2=77380&view=diff ============================================================================== --- poolalloc/trunk/include/poolalloc/PoolAllocate.h (original) +++ poolalloc/trunk/include/poolalloc/PoolAllocate.h Tue Jul 28 17:22:09 2009 @@ -200,7 +200,7 @@ PoolAllocate (PASS_TYPE dsa_pass_to_use_ = PASS_DEFAULT, LIE_TYPE lie_preserve_passes_ = LIE_PRESERVE_DEFAULT, bool passAllArguments = false, - bool SAFECode = false, + bool SAFECode = true, intptr_t IDp = (intptr_t) (&ID)) : ModulePass((intptr_t)IDp), PassAllArguments(passAllArguments) From daniel at zuster.org Tue Jul 28 17:22:32 2009 From: daniel at zuster.org (Daniel Dunbar) Date: Tue, 28 Jul 2009 22:22:32 -0000 Subject: [llvm-commits] [llvm] r77381 - in /llvm/trunk: include/llvm/MC/MCAsmParser.h tools/llvm-mc/AsmParser.h Message-ID: <200907282222.n6SMMWpY016598@zion.cs.uiuc.edu> Author: ddunbar Date: Tue Jul 28 17:22:31 2009 New Revision: 77381 URL: http://llvm.org/viewvc/llvm-project?rev=77381&view=rev Log: Make expression parsing and error/warning reporting available through the generic MCAsmParser interface. Modified: llvm/trunk/include/llvm/MC/MCAsmParser.h llvm/trunk/tools/llvm-mc/AsmParser.h Modified: llvm/trunk/include/llvm/MC/MCAsmParser.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCAsmParser.h?rev=77381&r1=77380&r2=77381&view=diff ============================================================================== --- llvm/trunk/include/llvm/MC/MCAsmParser.h (original) +++ llvm/trunk/include/llvm/MC/MCAsmParser.h Tue Jul 28 17:22:31 2009 @@ -10,8 +10,13 @@ #ifndef LLVM_MC_MCASMPARSER_H #define LLVM_MC_MCASMPARSER_H +#include "llvm/Support/DataTypes.h" + namespace llvm { class MCAsmLexer; +class MCValue; +class SMLoc; +class Twine; /// MCAsmParser - Generic assembler parser interface, for use by target specific /// assembly parsers. @@ -25,6 +30,43 @@ virtual ~MCAsmParser(); virtual MCAsmLexer &getLexer() = 0; + + /// Warning - Emit a warning at the location \arg L, with the message \arg + /// Msg. + virtual void Warning(SMLoc L, const Twine &Msg) = 0; + + /// Warning - Emit an error at the location \arg L, with the message \arg + /// Msg. + /// + /// \return The return value is always true, as an idiomatic convenience to + /// clients. + virtual bool Error(SMLoc L, const Twine &Msg) = 0; + + /// ParseAbsoluteExpression - Parse an expression which must evaluate to an + /// absolute value. + /// + /// @param Res - The value of the absolute expression. The result is undefined + /// on error. + /// @result - False on success. + virtual bool ParseAbsoluteExpression(int64_t &Res) = 0; + + /// ParseRelocatableExpression - Parse an expression which must be + /// relocatable. + /// + /// @param Res - The relocatable expression value. The result is undefined on + /// error. + /// @result - False on success. + virtual bool ParseRelocatableExpression(MCValue &Res) = 0; + + /// ParseParenRelocatableExpression - Parse an expression which must be + /// relocatable, assuming that an initial '(' has already been consumed. + /// + /// @param Res - The relocatable expression value. The result is undefined on + /// error. + /// @result - False on success. + /// + /// @see ParseRelocatableExpression, ParseParenExpr. + virtual bool ParseParenRelocatableExpression(MCValue &Res) = 0; }; } // End llvm namespace Modified: llvm/trunk/tools/llvm-mc/AsmParser.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-mc/AsmParser.h?rev=77381&r1=77380&r2=77381&view=diff ============================================================================== --- llvm/trunk/tools/llvm-mc/AsmParser.h (original) +++ llvm/trunk/tools/llvm-mc/AsmParser.h Tue Jul 28 17:22:31 2009 @@ -48,41 +48,32 @@ TargetAsmParser &getTargetParser() const { return *TargetParser; } void setTargetParser(TargetAsmParser &P) { TargetParser = &P; } + /// @name MCAsmParser Interface + /// { + virtual MCAsmLexer &getLexer() { return Lexer; } + virtual void Warning(SMLoc L, const Twine &Meg); + + virtual bool Error(SMLoc L, const Twine &Msg); + + virtual bool ParseExpression(AsmExpr *&Res); + + virtual bool ParseAbsoluteExpression(int64_t &Res); + + virtual bool ParseRelocatableExpression(MCValue &Res); + + /// } + private: bool ParseStatement(); - void Warning(SMLoc L, const Twine &Msg); - bool Error(SMLoc L, const Twine &Msg); bool TokError(const char *Msg); void EatToEndOfStatement(); bool ParseAssignment(const StringRef &Name, bool IsDotSet); - /// ParseExpression - Parse a general assembly expression. - /// - /// @param Res - The resulting expression. The pointer value is null on error. - /// @result - False on success. - bool ParseExpression(AsmExpr *&Res); - - /// ParseAbsoluteExpression - Parse an expression which must evaluate to an - /// absolute value. - /// - /// @param Res - The value of the absolute expression. The result is undefined - /// on error. - /// @result - False on success. - bool ParseAbsoluteExpression(int64_t &Res); - - /// ParseRelocatableExpression - Parse an expression which must be - /// relocatable. - /// - /// @param Res - The relocatable expression value. The result is undefined on - /// error. - /// @result - False on success. - bool ParseRelocatableExpression(MCValue &Res); - /// ParseParenRelocatableExpression - Parse an expression which must be /// relocatable, assuming that an initial '(' has already been consumed. /// From isanbard at gmail.com Tue Jul 28 17:23:45 2009 From: isanbard at gmail.com (Bill Wendling) Date: Tue, 28 Jul 2009 22:23:45 -0000 Subject: [llvm-commits] [llvm] r77382 - /llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp Message-ID: <200907282223.n6SMNjlh016641@zion.cs.uiuc.edu> Author: void Date: Tue Jul 28 17:23:45 2009 New Revision: 77382 URL: http://llvm.org/viewvc/llvm-project?rev=77382&view=rev Log: Output the EH TType format and base offset only if there are types that we're going to emit. Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp?rev=77382&r1=77381&r2=77382&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp (original) +++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp Tue Jul 28 17:23:45 2009 @@ -527,18 +527,27 @@ // Emit the header. Asm->EmitInt8(dwarf::DW_EH_PE_omit); Asm->EOL("LPStart format (DW_EH_PE_omit)"); - Asm->EmitInt8(TAI->PreferredEHDataFormat(DwarfEncoding::Data, true)); - Asm->EOL("TType format (DW_EH_PE_absptr)"); - Asm->EmitULEB128Bytes(TypeOffset); - Asm->EOL("TType base offset"); + + if (!TypeInfos.empty() || !FilterIds.empty()) { + Asm->EmitInt8(TAI->PreferredEHDataFormat(DwarfEncoding::Data, true)); + // FIXME: The comment here should correspond with what PreferredEHDataFormat + // returned. + Asm->EOL("TType format (DW_EH_PE_xxxxx)"); + Asm->EmitULEB128Bytes(TypeOffset); + Asm->EOL("TType base offset"); + } else { + Asm->EmitInt8(dwarf::DW_EH_PE_omit); + Asm->EOL("TType format (DW_EH_PE_omit)"); + } + Asm->EmitInt8(dwarf::DW_EH_PE_udata4); Asm->EOL("Call site format (DW_EH_PE_udata4)"); Asm->EmitULEB128Bytes(SizeSites); Asm->EOL("Call-site table length"); // Emit the landing pad site information. - for (unsigned i = 0; i < CallSites.size(); ++i) { - CallSiteEntry &S = CallSites[i]; + for (unsigned i = 0, e = CallSites.size(); i < e; ++i) { + const CallSiteEntry &S = CallSites[i]; const char *BeginTag; unsigned BeginNumber; From dpatel at apple.com Tue Jul 28 17:30:52 2009 From: dpatel at apple.com (Devang Patel) Date: Tue, 28 Jul 2009 22:30:52 -0000 Subject: [llvm-commits] [llvm] r77383 - /llvm/trunk/include/llvm/Value.h Message-ID: <200907282230.n6SMUqOA016887@zion.cs.uiuc.edu> Author: dpatel Date: Tue Jul 28 17:30:52 2009 New Revision: 77383 URL: http://llvm.org/viewvc/llvm-project?rev=77383&view=rev Log: Clarify getName() comment. Modified: llvm/trunk/include/llvm/Value.h Modified: llvm/trunk/include/llvm/Value.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Value.h?rev=77383&r1=77382&r2=77383&view=diff ============================================================================== --- llvm/trunk/include/llvm/Value.h (original) +++ llvm/trunk/include/llvm/Value.h Tue Jul 28 17:30:52 2009 @@ -116,10 +116,10 @@ /// modified. /// /// This is currently guaranteed to return a StringRef for which data() points - /// to a valid null terminated string. This usage is deprecated, however, and - /// clients should not rely on it. If such behavior is needed, clients should - /// use getNameStr() or switch to an interface that does not depend on null - /// termination. + /// to a valid null terminated string. The use of StringRef.data() is + /// deprecated here, however, and clients should not rely on it. If such + /// behavior is needed, clients should use expensive getNameStr(), or switch + /// to an interface that does not depend on null termination. StringRef getName() const; /// getNameStr() - Return the name of the specified value, *constructing a From daniel at zuster.org Tue Jul 28 17:40:46 2009 From: daniel at zuster.org (Daniel Dunbar) Date: Tue, 28 Jul 2009 22:40:46 -0000 Subject: [llvm-commits] [llvm] r77384 - in /llvm/trunk: include/llvm/Target/TargetAsmParser.h lib/Target/X86/AsmParser/X86AsmParser.cpp tools/llvm-mc/AsmParser.cpp tools/llvm-mc/AsmParser.h tools/llvm-mc/MC-X86Specific.cpp tools/llvm-mc/llvm-mc.cpp Message-ID: <200907282240.n6SMekAt017237@zion.cs.uiuc.edu> Author: ddunbar Date: Tue Jul 28 17:40:46 2009 New Revision: 77384 URL: http://llvm.org/viewvc/llvm-project?rev=77384&view=rev Log: Move X86 instruction parsing into X86/AsmParser. Removed: llvm/trunk/tools/llvm-mc/MC-X86Specific.cpp Modified: llvm/trunk/include/llvm/Target/TargetAsmParser.h llvm/trunk/lib/Target/X86/AsmParser/X86AsmParser.cpp llvm/trunk/tools/llvm-mc/AsmParser.cpp llvm/trunk/tools/llvm-mc/AsmParser.h llvm/trunk/tools/llvm-mc/llvm-mc.cpp Modified: llvm/trunk/include/llvm/Target/TargetAsmParser.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetAsmParser.h?rev=77384&r1=77383&r2=77384&view=diff ============================================================================== --- llvm/trunk/include/llvm/Target/TargetAsmParser.h (original) +++ llvm/trunk/include/llvm/Target/TargetAsmParser.h Tue Jul 28 17:40:46 2009 @@ -43,8 +43,7 @@ /// \param Name - The instruction name. /// \param Inst [out] - On success, the parsed instruction. /// \return True on failure. - virtual bool ParseInstruction(MCAsmParser &AP, const StringRef &Name, - MCInst &Inst) = 0; + virtual bool ParseInstruction(const StringRef &Name, MCInst &Inst) = 0; }; } // End llvm namespace 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=77384&r1=77383&r2=77384&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/AsmParser/X86AsmParser.cpp (original) +++ llvm/trunk/lib/Target/X86/AsmParser/X86AsmParser.cpp Tue Jul 28 17:40:46 2009 @@ -9,52 +9,297 @@ #include "X86.h" #include "llvm/ADT/SmallVector.h" +#include "llvm/ADT/Twine.h" #include "llvm/MC/MCAsmLexer.h" #include "llvm/MC/MCAsmParser.h" +#include "llvm/MC/MCValue.h" +#include "llvm/Support/SourceMgr.h" #include "llvm/Target/TargetRegistry.h" #include "llvm/Target/TargetAsmParser.h" using namespace llvm; namespace { - struct X86Operand { - }; +class X86Operand; - class X86ATTAsmParser : public TargetAsmParser { - MCAsmParser &Parser; +class X86ATTAsmParser : public TargetAsmParser { + MCAsmParser &Parser; - private: - bool ParseOperand(X86Operand &Op); - - bool MatchInstruction(const StringRef &Name, - llvm::SmallVector &Operands, - MCInst &Inst); - - MCAsmLexer &getLexer() const { return Parser.getLexer(); } - - public: - X86ATTAsmParser(const Target &T, MCAsmParser &_Parser) - : TargetAsmParser(T), Parser(_Parser) {} - - virtual bool ParseInstruction(MCAsmParser &AP, const StringRef &Name, - MCInst &Inst); +private: + bool MatchInstruction(const StringRef &Name, + llvm::SmallVector &Operands, + MCInst &Inst); + + MCAsmParser &getParser() const { return Parser; } + + MCAsmLexer &getLexer() const { return Parser.getLexer(); } + + void Warning(SMLoc L, const Twine &Msg) { Parser.Warning(L, Msg); } + + bool Error(SMLoc L, const Twine &Msg) { return Parser.Error(L, Msg); } + + bool ParseRegister(X86Operand &Op); + + bool ParseOperand(X86Operand &Op); + + bool ParseMemOperand(X86Operand &Op); + +public: + X86ATTAsmParser(const Target &T, MCAsmParser &_Parser) + : TargetAsmParser(T), Parser(_Parser) {} + + virtual bool ParseInstruction(const StringRef &Name, MCInst &Inst); +}; + +/// X86Operand - Instances of this class represent a parsed X86 machine +/// instruction. +struct X86Operand { + enum { + Register, + Immediate, + Memory + } Kind; + + union { + struct { + unsigned RegNo; + } Reg; + + struct { + MCValue Val; + } Imm; + + struct { + unsigned SegReg; + MCValue Disp; + unsigned BaseReg; + unsigned IndexReg; + unsigned Scale; + } Mem; }; + + unsigned getReg() const { + assert(Kind == Register && "Invalid access!"); + return Reg.RegNo; + } + + static X86Operand CreateReg(unsigned RegNo) { + X86Operand Res; + Res.Kind = Register; + Res.Reg.RegNo = RegNo; + return Res; + } + static X86Operand CreateImm(MCValue Val) { + X86Operand Res; + Res.Kind = Immediate; + Res.Imm.Val = Val; + return Res; + } + static X86Operand CreateMem(unsigned SegReg, MCValue Disp, unsigned BaseReg, + unsigned IndexReg, unsigned Scale) { + // If there is no index register, we should never have a scale, and we + // should always have a scale (in {1,2,4,8}) if we do. + assert(((Scale == 0 && !IndexReg) || + (IndexReg && (Scale == 1 || Scale == 2 || + Scale == 4 || Scale == 8))) && + "Invalid scale!"); + X86Operand Res; + Res.Kind = Memory; + Res.Mem.SegReg = SegReg; + Res.Mem.Disp = Disp; + Res.Mem.BaseReg = BaseReg; + Res.Mem.IndexReg = IndexReg; + Res.Mem.Scale = Scale; + return Res; + } +}; + +} + +// + +bool X86ATTAsmParser::ParseRegister(X86Operand &Op) { + assert(getLexer().is(AsmToken::Register) && "Invalid token kind!"); + + // FIXME: Decode register number. + Op = X86Operand::CreateReg(123); + getLexer().Lex(); // Eat register token. + + return false; } bool X86ATTAsmParser::ParseOperand(X86Operand &Op) { - return true; + switch (getLexer().getKind()) { + default: + return ParseMemOperand(Op); + case AsmToken::Register: + // FIXME: if a segment register, this could either be just the seg reg, or + // the start of a memory operand. + return ParseRegister(Op); + case AsmToken::Dollar: { + // $42 -> immediate. + getLexer().Lex(); + MCValue Val; + if (getParser().ParseRelocatableExpression(Val)) + return true; + Op = X86Operand::CreateImm(Val); + return false; + } + case AsmToken::Star: { + getLexer().Lex(); // Eat the star. + + if (getLexer().is(AsmToken::Register)) { + if (ParseRegister(Op)) + return true; + } else if (ParseMemOperand(Op)) + return true; + + // FIXME: Note the '*' in the operand for use by the matcher. + return false; + } + } +} + +/// ParseMemOperand: segment: disp(basereg, indexreg, scale) +bool X86ATTAsmParser::ParseMemOperand(X86Operand &Op) { + // FIXME: If SegReg ':' (e.g. %gs:), eat and remember. + unsigned SegReg = 0; + + // We have to disambiguate a parenthesized expression "(4+5)" from the start + // of a memory operand with a missing displacement "(%ebx)" or "(,%eax)". The + // only way to do this without lookahead is to eat the ( and see what is after + // it. + MCValue Disp = MCValue::get(0, 0, 0); + if (getLexer().isNot(AsmToken::LParen)) { + if (getParser().ParseRelocatableExpression(Disp)) return true; + + // After parsing the base expression we could either have a parenthesized + // memory address or not. If not, return now. If so, eat the (. + if (getLexer().isNot(AsmToken::LParen)) { + Op = X86Operand::CreateMem(SegReg, Disp, 0, 0, 0); + return false; + } + + // Eat the '('. + getLexer().Lex(); + } else { + // Okay, we have a '('. We don't know if this is an expression or not, but + // so we have to eat the ( to see beyond it. + getLexer().Lex(); // Eat the '('. + + if (getLexer().is(AsmToken::Register) || getLexer().is(AsmToken::Comma)) { + // Nothing to do here, fall into the code below with the '(' part of the + // memory operand consumed. + } else { + // It must be an parenthesized expression, parse it now. + if (getParser().ParseParenRelocatableExpression(Disp)) + return true; + + // After parsing the base expression we could either have a parenthesized + // memory address or not. If not, return now. If so, eat the (. + if (getLexer().isNot(AsmToken::LParen)) { + Op = X86Operand::CreateMem(SegReg, Disp, 0, 0, 0); + return false; + } + + // Eat the '('. + getLexer().Lex(); + } + } + + // If we reached here, then we just ate the ( of the memory operand. Process + // the rest of the memory operand. + unsigned BaseReg = 0, IndexReg = 0, Scale = 0; + + if (getLexer().is(AsmToken::Register)) { + if (ParseRegister(Op)) + return true; + BaseReg = Op.getReg(); + } + + if (getLexer().is(AsmToken::Comma)) { + getLexer().Lex(); // Eat the comma. + + // Following the comma we should have either an index register, or a scale + // value. We don't support the later form, but we want to parse it + // correctly. + // + // Not that even though it would be completely consistent to support syntax + // like "1(%eax,,1)", the assembler doesn't. + if (getLexer().is(AsmToken::Register)) { + if (ParseRegister(Op)) + return true; + IndexReg = Op.getReg(); + Scale = 1; // If not specified, the scale defaults to 1. + + if (getLexer().isNot(AsmToken::RParen)) { + // Parse the scale amount: + // ::= ',' [scale-expression] + if (getLexer().isNot(AsmToken::Comma)) + return true; + getLexer().Lex(); // Eat the comma. + + if (getLexer().isNot(AsmToken::RParen)) { + SMLoc Loc = getLexer().getTok().getLoc(); + + int64_t ScaleVal; + if (getParser().ParseAbsoluteExpression(ScaleVal)) + return true; + + // Validate the scale amount. + if (ScaleVal != 1 && ScaleVal != 2 && ScaleVal != 4 && ScaleVal != 8) + return Error(Loc, "scale factor in address must be 1, 2, 4 or 8"); + Scale = (unsigned)ScaleVal; + } + } + } else if (getLexer().isNot(AsmToken::RParen)) { + // Otherwise we have the unsupported form of a scale amount without an + // index. + SMLoc Loc = getLexer().getTok().getLoc(); + + int64_t Value; + if (getParser().ParseAbsoluteExpression(Value)) + return true; + + return Error(Loc, "cannot have scale factor without index register"); + } + } + + // Ok, we've eaten the memory operand, verify we have a ')' and eat it too. + if (getLexer().isNot(AsmToken::RParen)) + return Error(getLexer().getTok().getLoc(), + "unexpected token in memory operand"); + getLexer().Lex(); // Eat the ')'. + + Op = X86Operand::CreateMem(SegReg, Disp, BaseReg, IndexReg, Scale); + return false; } -bool -X86ATTAsmParser::MatchInstruction(const StringRef &Name, +bool +X86ATTAsmParser::MatchInstruction(const StringRef &Name, llvm::SmallVector &Operands, MCInst &Inst) { return false; } -bool X86ATTAsmParser::ParseInstruction(MCAsmParser &AP, const StringRef &Name, - MCInst &Inst) { +bool X86ATTAsmParser::ParseInstruction(const StringRef &Name, MCInst &Inst) { llvm::SmallVector Operands; - + + if (getLexer().isNot(AsmToken::EndOfStatement)) { + // Read the first operand. + Operands.push_back(X86Operand()); + if (ParseOperand(Operands.back())) + return true; + + while (getLexer().is(AsmToken::Comma)) { + getLexer().Lex(); // Eat the comma. + + // Parse and remember the operand. + Operands.push_back(X86Operand()); + if (ParseOperand(Operands.back())) + return true; + } + } + return MatchInstruction(Name, Operands, Inst); } Modified: llvm/trunk/tools/llvm-mc/AsmParser.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-mc/AsmParser.cpp?rev=77384&r1=77383&r2=77384&view=diff ============================================================================== --- llvm/trunk/tools/llvm-mc/AsmParser.cpp (original) +++ llvm/trunk/tools/llvm-mc/AsmParser.cpp Tue Jul 28 17:40:46 2009 @@ -551,8 +551,7 @@ } MCInst Inst; - if (ParseX86InstOperands(IDVal, Inst) && - getTargetParser().ParseInstruction(*this, IDVal, Inst)) + if (getTargetParser().ParseInstruction(IDVal, Inst)) return true; if (Lexer.isNot(AsmToken::EndOfStatement)) Modified: llvm/trunk/tools/llvm-mc/AsmParser.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-mc/AsmParser.h?rev=77384&r1=77383&r2=77384&view=diff ============================================================================== --- llvm/trunk/tools/llvm-mc/AsmParser.h (original) +++ llvm/trunk/tools/llvm-mc/AsmParser.h Tue Jul 28 17:40:46 2009 @@ -28,9 +28,6 @@ class Twine; class AsmParser : public MCAsmParser { -public: - struct X86Operand; - private: AsmLexer Lexer; MCContext &Ctx; @@ -88,12 +85,6 @@ bool ParseBinOpRHS(unsigned Precedence, AsmExpr *&Res); bool ParseParenExpr(AsmExpr *&Res); - // X86 specific. - bool ParseX86InstOperands(const StringRef &InstName, MCInst &Inst); - bool ParseX86Operand(X86Operand &Op); - bool ParseX86MemOperand(X86Operand &Op); - bool ParseX86Register(X86Operand &Op); - // Directive Parsing. bool ParseDirectiveDarwinSection(); // Darwin specific ".section". bool ParseDirectiveSectionSwitch(const char *Section, Removed: llvm/trunk/tools/llvm-mc/MC-X86Specific.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-mc/MC-X86Specific.cpp?rev=77383&view=auto ============================================================================== --- llvm/trunk/tools/llvm-mc/MC-X86Specific.cpp (original) +++ llvm/trunk/tools/llvm-mc/MC-X86Specific.cpp (removed) @@ -1,267 +0,0 @@ -//===- MC-X86Specific.cpp - X86-Specific code for MC ----------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// -// This file implements X86-specific parsing, encoding and decoding stuff for -// MC. -// -//===----------------------------------------------------------------------===// - -#include "AsmParser.h" -#include "llvm/ADT/Twine.h" -#include "llvm/MC/MCInst.h" -#include "llvm/Support/SourceMgr.h" -using namespace llvm; - -/// X86Operand - Instances of this class represent one X86 machine instruction. -struct AsmParser::X86Operand { - enum { - Register, - Immediate, - Memory - } Kind; - - union { - struct { - unsigned RegNo; - } Reg; - - struct { - MCValue Val; - } Imm; - - struct { - unsigned SegReg; - MCValue Disp; - unsigned BaseReg; - unsigned IndexReg; - unsigned Scale; - } Mem; - }; - - unsigned getReg() const { - assert(Kind == Register && "Invalid access!"); - return Reg.RegNo; - } - - static X86Operand CreateReg(unsigned RegNo) { - X86Operand Res; - Res.Kind = Register; - Res.Reg.RegNo = RegNo; - return Res; - } - static X86Operand CreateImm(MCValue Val) { - X86Operand Res; - Res.Kind = Immediate; - Res.Imm.Val = Val; - return Res; - } - static X86Operand CreateMem(unsigned SegReg, MCValue Disp, unsigned BaseReg, - unsigned IndexReg, unsigned Scale) { - // If there is no index register, we should never have a scale, and we - // should always have a scale (in {1,2,4,8}) if we do. - assert(((Scale == 0 && !IndexReg) || - (IndexReg && (Scale == 1 || Scale == 2 || - Scale == 4 || Scale == 8))) && - "Invalid scale!"); - X86Operand Res; - Res.Kind = Memory; - Res.Mem.SegReg = SegReg; - Res.Mem.Disp = Disp; - Res.Mem.BaseReg = BaseReg; - Res.Mem.IndexReg = IndexReg; - Res.Mem.Scale = Scale; - return Res; - } -}; - -bool AsmParser::ParseX86Register(X86Operand &Op) { - assert(getLexer().is(AsmToken::Register) && "Invalid token kind!"); - - // FIXME: Decode register number. - Op = X86Operand::CreateReg(123); - getLexer().Lex(); // Eat register token. - - return false; -} - -bool AsmParser::ParseX86Operand(X86Operand &Op) { - switch (getLexer().getKind()) { - default: - return ParseX86MemOperand(Op); - case AsmToken::Register: - // FIXME: if a segment register, this could either be just the seg reg, or - // the start of a memory operand. - return ParseX86Register(Op); - case AsmToken::Dollar: { - // $42 -> immediate. - getLexer().Lex(); - MCValue Val; - if (ParseRelocatableExpression(Val)) - return true; - Op = X86Operand::CreateImm(Val); - return false; - } - case AsmToken::Star: { - getLexer().Lex(); // Eat the star. - - if (getLexer().is(AsmToken::Register)) { - if (ParseX86Register(Op)) - return true; - } else if (ParseX86MemOperand(Op)) - return true; - - // FIXME: Note the '*' in the operand for use by the matcher. - return false; - } - } -} - -/// ParseX86MemOperand: segment: disp(basereg, indexreg, scale) -bool AsmParser::ParseX86MemOperand(X86Operand &Op) { - // FIXME: If SegReg ':' (e.g. %gs:), eat and remember. - unsigned SegReg = 0; - - // We have to disambiguate a parenthesized expression "(4+5)" from the start - // of a memory operand with a missing displacement "(%ebx)" or "(,%eax)". The - // only way to do this without lookahead is to eat the ( and see what is after - // it. - MCValue Disp = MCValue::get(0, 0, 0); - if (getLexer().isNot(AsmToken::LParen)) { - if (ParseRelocatableExpression(Disp)) return true; - - // After parsing the base expression we could either have a parenthesized - // memory address or not. If not, return now. If so, eat the (. - if (getLexer().isNot(AsmToken::LParen)) { - Op = X86Operand::CreateMem(SegReg, Disp, 0, 0, 0); - return false; - } - - // Eat the '('. - getLexer().Lex(); - } else { - // Okay, we have a '('. We don't know if this is an expression or not, but - // so we have to eat the ( to see beyond it. - getLexer().Lex(); // Eat the '('. - - if (getLexer().is(AsmToken::Register) || getLexer().is(AsmToken::Comma)) { - // Nothing to do here, fall into the code below with the '(' part of the - // memory operand consumed. - } else { - // It must be an parenthesized expression, parse it now. - if (ParseParenRelocatableExpression(Disp)) - return true; - - // After parsing the base expression we could either have a parenthesized - // memory address or not. If not, return now. If so, eat the (. - if (getLexer().isNot(AsmToken::LParen)) { - Op = X86Operand::CreateMem(SegReg, Disp, 0, 0, 0); - return false; - } - - // Eat the '('. - getLexer().Lex(); - } - } - - // If we reached here, then we just ate the ( of the memory operand. Process - // the rest of the memory operand. - unsigned BaseReg = 0, IndexReg = 0, Scale = 0; - - if (getLexer().is(AsmToken::Register)) { - if (ParseX86Register(Op)) - return true; - BaseReg = Op.getReg(); - } - - if (getLexer().is(AsmToken::Comma)) { - getLexer().Lex(); // Eat the comma. - - // Following the comma we should have either an index register, or a scale - // value. We don't support the later form, but we want to parse it - // correctly. - // - // Not that even though it would be completely consistent to support syntax - // like "1(%eax,,1)", the assembler doesn't. - if (getLexer().is(AsmToken::Register)) { - if (ParseX86Register(Op)) - return true; - IndexReg = Op.getReg(); - Scale = 1; // If not specified, the scale defaults to 1. - - if (getLexer().isNot(AsmToken::RParen)) { - // Parse the scale amount: - // ::= ',' [scale-expression] - if (getLexer().isNot(AsmToken::Comma)) - return true; - getLexer().Lex(); // Eat the comma. - - if (getLexer().isNot(AsmToken::RParen)) { - int64_t ScaleVal; - if (ParseAbsoluteExpression(ScaleVal)) - return true; - - // Validate the scale amount. - if (ScaleVal != 1 && ScaleVal != 2 && ScaleVal != 4 && ScaleVal != 8) - return TokError("scale factor in address must be 1, 2, 4 or 8"); - Scale = (unsigned)ScaleVal; - } - } - } else if (getLexer().isNot(AsmToken::RParen)) { - // Otherwise we have the unsupported form of a scale amount without an - // index. - SMLoc Loc = getLexer().getTok().getLoc(); - - int64_t Value; - if (ParseAbsoluteExpression(Value)) - return true; - - return Error(Loc, "cannot have scale factor without index register"); - } - } - - // Ok, we've eaten the memory operand, verify we have a ')' and eat it too. - if (getLexer().isNot(AsmToken::RParen)) - return TokError("unexpected token in memory operand"); - getLexer().Lex(); // Eat the ')'. - - Op = X86Operand::CreateMem(SegReg, Disp, BaseReg, IndexReg, Scale); - return false; -} - -/// MatchX86Inst - Convert a parsed instruction name and operand list into a -/// concrete instruction. -static bool MatchX86Inst(const StringRef &Name, - llvm::SmallVector &Operands, - MCInst &Inst) { - return false; -} - -/// ParseX86InstOperands - Parse the operands of an X86 instruction and return -/// them as the operands of an MCInst. -bool AsmParser::ParseX86InstOperands(const StringRef &InstName, MCInst &Inst) { - llvm::SmallVector Operands; - - if (getLexer().isNot(AsmToken::EndOfStatement)) { - // Read the first operand. - Operands.push_back(X86Operand()); - if (ParseX86Operand(Operands.back())) - return true; - - while (getLexer().is(AsmToken::Comma)) { - getLexer().Lex(); // Eat the comma. - - // Parse and remember the operand. - Operands.push_back(X86Operand()); - if (ParseX86Operand(Operands.back())) - return true; - } - } - - return MatchX86Inst(InstName, Operands, Inst); -} Modified: llvm/trunk/tools/llvm-mc/llvm-mc.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-mc/llvm-mc.cpp?rev=77384&r1=77383&r2=77384&view=diff ============================================================================== --- llvm/trunk/tools/llvm-mc/llvm-mc.cpp (original) +++ llvm/trunk/tools/llvm-mc/llvm-mc.cpp Tue Jul 28 17:40:46 2009 @@ -196,6 +196,7 @@ OwningPtr TAP(GetTargetAsmParser(ProgName, Parser)); if (!TAP) return 1; + Parser.setTargetParser(*TAP.get()); return Parser.Run(); } From daniel at zuster.org Tue Jul 28 17:46:39 2009 From: daniel at zuster.org (Daniel Dunbar) Date: Tue, 28 Jul 2009 22:46:39 -0000 Subject: [llvm-commits] [llvm] r77385 - /llvm/trunk/tools/llvm-mc/CMakeLists.txt Message-ID: <200907282246.n6SMkd14017430@zion.cs.uiuc.edu> Author: ddunbar Date: Tue Jul 28 17:46:39 2009 New Revision: 77385 URL: http://llvm.org/viewvc/llvm-project?rev=77385&view=rev Log: Update CMakeLists Modified: llvm/trunk/tools/llvm-mc/CMakeLists.txt Modified: llvm/trunk/tools/llvm-mc/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-mc/CMakeLists.txt?rev=77385&r1=77384&r2=77385&view=diff ============================================================================== --- llvm/trunk/tools/llvm-mc/CMakeLists.txt (original) +++ llvm/trunk/tools/llvm-mc/CMakeLists.txt Tue Jul 28 17:46:39 2009 @@ -5,5 +5,4 @@ AsmExpr.cpp AsmLexer.cpp AsmParser.cpp - MC-X86Specific.cpp ) From sabre at nondot.org Tue Jul 28 17:54:04 2009 From: sabre at nondot.org (Chris Lattner) Date: Tue, 28 Jul 2009 22:54:04 -0000 Subject: [llvm-commits] [llvm] r77387 - /llvm/trunk/docs/CodingStandards.html Message-ID: <200907282254.n6SMs5dP017681@zion.cs.uiuc.edu> Author: lattner Date: Tue Jul 28 17:54:04 2009 New Revision: 77387 URL: http://llvm.org/viewvc/llvm-project?rev=77387&view=rev Log: discourage else after "noreturn" statements. Modified: llvm/trunk/docs/CodingStandards.html Modified: llvm/trunk/docs/CodingStandards.html URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/CodingStandards.html?rev=77387&r1=77386&r2=77387&view=diff ============================================================================== --- llvm/trunk/docs/CodingStandards.html (original) +++ llvm/trunk/docs/CodingStandards.html Tue Jul 28 17:54:04 2009 @@ -43,6 +43,8 @@ Private
  • Use Early Exits and 'continue' to Simplify Code
  • +
  • Don't use "else" after a + return
  • Turn Predicate Loops into Predicate Functions
  • @@ -624,6 +626,88 @@ + + + +
    + +

    For similar reasons above (reduction of indentation and easier reading), + please do not use "else" or "else if" after something that interrupts + control flow like return, break, continue, goto, etc. For example, this is + "bad":

    + +
    +
    +  case 'J': {
    +    if (Signed) {
    +      Type = Context.getsigjmp_bufType();
    +      if (Type.isNull()) {
    +        Error = ASTContext::GE_Missing_sigjmp_buf;
    +        return QualType();
    +      } else {
    +        break;
    +      }
    +    } else {
    +      Type = Context.getjmp_bufType();
    +      if (Type.isNull()) {
    +        Error = ASTContext::GE_Missing_jmp_buf;
    +        return QualType();
    +      } else {
    +        break;
    +      }
    +    }
    +  }
    +  }
    +
    +
    + +

    It is better to write this something like:

    + +
    +
    +  case 'J':
    +    if (Signed) {
    +      Type = Context.getsigjmp_bufType();
    +      if (Type.isNull()) {
    +        Error = ASTContext::GE_Missing_sigjmp_buf;
    +        return QualType();
    +      }
    +    } else {
    +      Type = Context.getjmp_bufType();
    +      if (Type.isNull()) {
    +        Error = ASTContext::GE_Missing_jmp_buf;
    +        return QualType();
    +      }
    +    }
    +    break;
    +
    +
    + +

    Or better yet (in this case), as:

    + +
    +
    +  case 'J':
    +    if (Signed)
    +      Type = Context.getsigjmp_bufType();
    +    else
    +      Type = Context.getjmp_bufType();
    +    
    +    if (Type.isNull()) {
    +      Error = Signed ? ASTContext::GE_Missing_sigjmp_buf :
    +                       ASTContext::GE_Missing_jmp_buf;
    +      return QualType();
    +    }
    +    break;
    +
    +
    + +

    The idea is to reduce indentation and the amount of code you have to keep + track of when reading the code.

    + +
    From david_goodwin at apple.com Tue Jul 28 18:08:37 2009 From: david_goodwin at apple.com (David Goodwin) Date: Tue, 28 Jul 2009 23:08:37 -0000 Subject: [llvm-commits] [llvm] r77389 - /llvm/trunk/tools/bugpoint/Miscompilation.cpp Message-ID: <200907282308.n6SN8bnc018133@zion.cs.uiuc.edu> Author: david_goodwin Date: Tue Jul 28 18:08:36 2009 New Revision: 77389 URL: http://llvm.org/viewvc/llvm-project?rev=77389&view=rev Log: Add a bugpoint flag to disable block extraction. Modified: llvm/trunk/tools/bugpoint/Miscompilation.cpp Modified: llvm/trunk/tools/bugpoint/Miscompilation.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/bugpoint/Miscompilation.cpp?rev=77389&r1=77388&r2=77389&view=diff ============================================================================== --- llvm/trunk/tools/bugpoint/Miscompilation.cpp (original) +++ llvm/trunk/tools/bugpoint/Miscompilation.cpp Tue Jul 28 18:08:36 2009 @@ -37,6 +37,10 @@ DisableLoopExtraction("disable-loop-extraction", cl::desc("Don't extract loops when searching for miscompilations"), cl::init(false)); + static llvm::cl::opt + DisableBlockExtraction("disable-block-extraction", + cl::desc("Don't extract blocks when searching for miscompilations"), + cl::init(false)); class ReduceMiscompilingPasses : public ListReducer { BugDriver &BD; @@ -556,7 +560,7 @@ outs() << '\n'; } - if (!BugpointIsInterrupted && + if (!BugpointIsInterrupted && !DisableBlockExtraction && ExtractBlocks(BD, TestFn, MiscompiledFunctions)) { // Okay, we extracted some blocks and the problem still appears. See if we // can eliminate some of the created functions from being candidates. From david_goodwin at apple.com Tue Jul 28 18:09:29 2009 From: david_goodwin at apple.com (David Goodwin) Date: Tue, 28 Jul 2009 23:09:29 -0000 Subject: [llvm-commits] [test-suite] r77390 - /test-suite/trunk/Makefile.programs Message-ID: <200907282309.n6SN9TXS018169@zion.cs.uiuc.edu> Author: david_goodwin Date: Tue Jul 28 18:09:29 2009 New Revision: 77390 URL: http://llvm.org/viewvc/llvm-project?rev=77390&view=rev Log: Add makefile variable DISABLE_BLOCK_EXTRACTION that can be used to disable bugpoint block extraction. Modified: test-suite/trunk/Makefile.programs Modified: test-suite/trunk/Makefile.programs URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/Makefile.programs?rev=77390&r1=77389&r2=77390&view=diff ============================================================================== --- test-suite/trunk/Makefile.programs (original) +++ test-suite/trunk/Makefile.programs Tue Jul 28 18:09:29 2009 @@ -527,6 +527,10 @@ BUGPOINT_OPTIONS += -disable-loop-extraction endif +ifdef DISABLE_BLOCK_EXTRACT +BUGPOINT_OPTIONS += -disable-block-extraction +endif + # Give bugpoint information about LDFLAGS to pass down to the actual link stage # of the program. BUGPOINT_OPTIONS += $(LDFLAGS:%=-Xlinker=%) $(EXTRA_OPTIONS:%=-Xlinker=%) From gohman at apple.com Tue Jul 28 18:22:02 2009 From: gohman at apple.com (Dan Gohman) Date: Tue, 28 Jul 2009 23:22:02 -0000 Subject: [llvm-commits] [llvm] r77392 - /llvm/trunk/lib/System/Unix/Path.inc Message-ID: <200907282322.n6SNM21g018590@zion.cs.uiuc.edu> Author: djg Date: Tue Jul 28 18:22:01 2009 New Revision: 77392 URL: http://llvm.org/viewvc/llvm-project?rev=77392&view=rev Log: It isn't necessary to use F_OK when using R_OK or similar. Modified: llvm/trunk/lib/System/Unix/Path.inc Modified: llvm/trunk/lib/System/Unix/Path.inc URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/System/Unix/Path.inc?rev=77392&r1=77391&r2=77392&view=diff ============================================================================== --- llvm/trunk/lib/System/Unix/Path.inc (original) +++ llvm/trunk/lib/System/Unix/Path.inc Tue Jul 28 18:22:01 2009 @@ -431,12 +431,12 @@ bool Path::canRead() const { - return 0 == access(path.c_str(), F_OK | R_OK ); + return 0 == access(path.c_str(), R_OK); } bool Path::canWrite() const { - return 0 == access(path.c_str(), F_OK | W_OK ); + return 0 == access(path.c_str(), W_OK); } bool From isanbard at gmail.com Tue Jul 28 18:22:13 2009 From: isanbard at gmail.com (Bill Wendling) Date: Tue, 28 Jul 2009 23:22:13 -0000 Subject: [llvm-commits] [llvm] r77393 - in /llvm/trunk/lib/CodeGen/AsmPrinter: DwarfException.cpp DwarfException.h Message-ID: <200907282322.n6SNMDup018608@zion.cs.uiuc.edu> Author: void Date: Tue Jul 28 18:22:13 2009 New Revision: 77393 URL: http://llvm.org/viewvc/llvm-project?rev=77393&view=rev Log: Split out large loop into it's very own method. No intended functionality change. Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.h Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp?rev=77393&r1=77392&r2=77393&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp (original) +++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp Tue Jul 28 18:22:13 2009 @@ -284,51 +284,44 @@ return LSize < RSize; } -void DwarfException::EmitExceptionTable() { - const std::vector &TypeInfos = MMI->getTypeInfos(); +// ComputeActionsTable - Compute the actions table and gather the first action +// index for each landing pad site. +unsigned +DwarfException::ComputeActionsTable(const SmallVectorImpl + &LandingPads, + SmallVectorImpl &Actions, + SmallVectorImpl &FirstActions) { const std::vector &FilterIds = MMI->getFilterIds(); - const std::vector &PadInfos = MMI->getLandingPads(); - if (PadInfos.empty()) return; - // Sort the landing pads in order of their type ids. This is used to fold - // duplicate actions. - SmallVector LandingPads; - LandingPads.reserve(PadInfos.size()); - for (unsigned i = 0, N = PadInfos.size(); i != N; ++i) - LandingPads.push_back(&PadInfos[i]); - std::sort(LandingPads.begin(), LandingPads.end(), PadLT); - - // Negative type ids index into FilterIds, positive type ids index into - // TypeInfos. The value written for a positive type id is just the type id - // itself. For a negative type id, however, the value written is the + // Negative type IDs index into FilterIds. Positive type IDs index into + // TypeInfos. The value written for a positive type ID is just the type ID + // itself. For a negative type ID, however, the value written is the // (negative) byte offset of the corresponding FilterIds entry. The byte - // offset is usually equal to the type id, because the FilterIds entries are - // written using a variable width encoding which outputs one byte per entry as - // long as the value written is not too large, but can differ. This kind of - // complication does not occur for positive type ids because type infos are + // offset is usually equal to the type ID (because the FilterIds entries are + // written using a variable width encoding, which outputs one byte per entry + // as long as the value written is not too large) but can differ. This kind + // of complication does not occur for positive type IDs because type infos are // output using a fixed width encoding. FilterOffsets[i] holds the byte // offset corresponding to FilterIds[i]. SmallVector FilterOffsets; FilterOffsets.reserve(FilterIds.size()); int Offset = -1; - for(std::vector::const_iterator I = FilterIds.begin(), - E = FilterIds.end(); I != E; ++I) { + for(std::vector::const_iterator + I = FilterIds.begin(), E = FilterIds.end(); I != E; ++I) { FilterOffsets.push_back(Offset); Offset -= TargetAsmInfo::getULEB128Size(*I); } - // Compute the actions table and gather the first action index for each - // landing pad site. - SmallVector Actions; - SmallVector FirstActions; FirstActions.reserve(LandingPads.size()); int FirstAction = 0; unsigned SizeActions = 0; - for (unsigned i = 0, N = LandingPads.size(); i != N; ++i) { - const LandingPadInfo *LP = LandingPads[i]; - const std::vector &TypeIds = LP->TypeIds; - const unsigned NumShared = i ? SharedTypeIds(LP, LandingPads[i-1]) : 0; + const LandingPadInfo *PrevLPI = 0; + for (SmallVector::const_iterator + I = LandingPads.begin(), E = LandingPads.end(); I != E; ++I) { + const LandingPadInfo *LPI = *I; + const std::vector &TypeIds = LPI->TypeIds; + const unsigned NumShared = PrevLPI ? SharedTypeIds(LPI, PrevLPI) : 0; unsigned SizeSiteActions = 0; if (NumShared < TypeIds.size()) { @@ -336,7 +329,7 @@ ActionEntry *PrevAction = 0; if (NumShared) { - const unsigned SizePrevIds = LandingPads[i-1]->TypeIds.size(); + const unsigned SizePrevIds = PrevLPI->TypeIds.size(); assert(Actions.size()); PrevAction = &Actions.back(); SizeAction = TargetAsmInfo::getSLEB128Size(PrevAction->NextAction) + @@ -351,9 +344,9 @@ } // Compute the actions. - for (unsigned I = NumShared, M = TypeIds.size(); I != M; ++I) { - int TypeID = TypeIds[I]; - assert(-1-TypeID < (int)FilterOffsets.size() && "Unknown filter id!"); + for (unsigned J = NumShared, M = TypeIds.size(); J != M; ++J) { + int TypeID = TypeIds[J]; + assert(-1 - TypeID < (int)FilterOffsets.size() && "Unknown filter id!"); int ValueForTypeID = TypeID < 0 ? FilterOffsets[-1 - TypeID] : TypeID; unsigned SizeTypeID = TargetAsmInfo::getSLEB128Size(ValueForTypeID); @@ -363,7 +356,6 @@ ActionEntry Action = {ValueForTypeID, NextAction, PrevAction}; Actions.push_back(Action); - PrevAction = &Actions.back(); } @@ -375,8 +367,33 @@ // Compute this sites contribution to size. SizeActions += SizeSiteActions; + + PrevLPI = LPI; } + return SizeActions; +} + +void DwarfException::EmitExceptionTable() { + const std::vector &TypeInfos = MMI->getTypeInfos(); + const std::vector &FilterIds = MMI->getFilterIds(); + const std::vector &PadInfos = MMI->getLandingPads(); + if (PadInfos.empty()) return; + + // Sort the landing pads in order of their type ids. This is used to fold + // duplicate actions. + SmallVector LandingPads; + LandingPads.reserve(PadInfos.size()); + for (unsigned i = 0, N = PadInfos.size(); i != N; ++i) + LandingPads.push_back(&PadInfos[i]); + std::sort(LandingPads.begin(), LandingPads.end(), PadLT); + + // Compute the actions table and gather the first action index for each + // landing pad site. + SmallVector Actions; + SmallVector FirstActions; + unsigned SizeActions = ComputeActionsTable(LandingPads, Actions, FirstActions); + // Compute the call-site table. The entry for an invoke has a try-range // containing the call, a non-zero landing pad and an appropriate action. The // entry for an ordinary call has a try-range containing the call and zero for @@ -384,7 +401,6 @@ // must not be contained in the try-range of any entry - they form gaps in the // table. Entries must be ordered by try-range address. SmallVector CallSites; - RangeMapType PadMap; // Invokes and nounwind calls have entries in PadMap (due to being bracketed Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.h?rev=77393&r1=77392&r2=77393&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.h (original) +++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.h Tue Jul 28 18:22:13 2009 @@ -113,13 +113,6 @@ static bool isPod() { return true; } }; - /// ActionEntry - Structure describing an entry in the actions table. - struct ActionEntry { - int ValueForTypeID; // The value to write - may not be equal to the type id. - int NextAction; - struct ActionEntry *Previous; - }; - /// PadRange - Structure holding a try-range and the associated landing pad. struct PadRange { // The index of the landing pad. @@ -130,16 +123,27 @@ typedef DenseMap RangeMapType; + /// ActionEntry - Structure describing an entry in the actions table. + struct ActionEntry { + int ValueForTypeID; // The value to write - may not be equal to the type id. + int NextAction; + struct ActionEntry *Previous; + }; + /// CallSiteEntry - Structure describing an entry in the call-site table. struct CallSiteEntry { // The 'try-range' is BeginLabel .. EndLabel. unsigned BeginLabel; // zero indicates the start of the function. unsigned EndLabel; // zero indicates the end of the function. + // The landing pad starts at PadLabel. unsigned PadLabel; // zero indicates that there is no landing pad. unsigned Action; }; + unsigned ComputeActionsTable(const SmallVectorImpl &LP, + SmallVectorImpl &Actions, + SmallVectorImpl &FirstActions); void EmitExceptionTable(); public: From isanbard at gmail.com Tue Jul 28 18:23:00 2009 From: isanbard at gmail.com (Bill Wendling) Date: Tue, 28 Jul 2009 23:23:00 -0000 Subject: [llvm-commits] [llvm] r77394 - in /llvm/trunk/lib/CodeGen/AsmPrinter: DwarfException.cpp DwarfException.h Message-ID: <200907282323.n6SNN0Dq018646@zion.cs.uiuc.edu> Author: void Date: Tue Jul 28 18:23:00 2009 New Revision: 77394 URL: http://llvm.org/viewvc/llvm-project?rev=77394&view=rev Log: Doxygenify comments. Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.h Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp?rev=77394&r1=77393&r2=77394&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp (original) +++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp Tue Jul 28 18:23:00 2009 @@ -284,8 +284,8 @@ return LSize < RSize; } -// ComputeActionsTable - Compute the actions table and gather the first action -// index for each landing pad site. +/// ComputeActionsTable - Compute the actions table and gather the first action +/// index for each landing pad site. unsigned DwarfException::ComputeActionsTable(const SmallVectorImpl &LandingPads, Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.h?rev=77394&r1=77393&r2=77394&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.h (original) +++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.h Tue Jul 28 18:23:00 2009 @@ -141,6 +141,8 @@ unsigned Action; }; + /// ComputeActionsTable - Compute the actions table and gather the first + /// action index for each landing pad site. unsigned ComputeActionsTable(const SmallVectorImpl &LP, SmallVectorImpl &Actions, SmallVectorImpl &FirstActions); From greened at obbligato.org Tue Jul 28 18:24:58 2009 From: greened at obbligato.org (David Greene) Date: Tue, 28 Jul 2009 23:24:58 -0000 Subject: [llvm-commits] [llvm] r77395 - /llvm/trunk/include/llvm/Support/raw_ostream.h Message-ID: <200907282324.n6SNOwXc018705@zion.cs.uiuc.edu> Author: greened Date: Tue Jul 28 18:24:58 2009 New Revision: 77395 URL: http://llvm.org/viewvc/llvm-project?rev=77395&view=rev Log: Add some protected interfaces to allow subclass access to the buffer. Modified: llvm/trunk/include/llvm/Support/raw_ostream.h Modified: llvm/trunk/include/llvm/Support/raw_ostream.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/raw_ostream.h?rev=77395&r1=77394&r2=77395&view=diff ============================================================================== --- llvm/trunk/include/llvm/Support/raw_ostream.h (original) +++ llvm/trunk/include/llvm/Support/raw_ostream.h Tue Jul 28 18:24:58 2009 @@ -242,6 +242,10 @@ /// been encountered. void error_detected() { Error = true; } + typedef char * iterator; + iterator begin(void) { return OutBufStart; } + iterator end(void) { return OutBufCur; } + //===--------------------------------------------------------------------===// // Private Interface //===--------------------------------------------------------------------===// From gohman at apple.com Tue Jul 28 18:25:18 2009 From: gohman at apple.com (Dan Gohman) Date: Tue, 28 Jul 2009 23:25:18 -0000 Subject: [llvm-commits] [llvm] r77396 - /llvm/trunk/lib/System/Unix/Program.inc Message-ID: <200907282325.n6SNPJZ5018729@zion.cs.uiuc.edu> Author: djg Date: Tue Jul 28 18:25:18 2009 New Revision: 77396 URL: http://llvm.org/viewvc/llvm-project?rev=77396&view=rev Log: On "Unix", if Program::FindProgramByName is given a name containing slashes, just go with it, regardless of whether it looks like it will be executable. This follows the behavior of sh(1) more closely. Modified: llvm/trunk/lib/System/Unix/Program.inc Modified: llvm/trunk/lib/System/Unix/Program.inc URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/System/Unix/Program.inc?rev=77396&r1=77395&r2=77396&view=diff ============================================================================== --- llvm/trunk/lib/System/Unix/Program.inc (original) +++ llvm/trunk/lib/System/Unix/Program.inc Tue Jul 28 18:25:18 2009 @@ -47,7 +47,7 @@ return Path(); // Use the given path verbatim if it contains any slashes; this matches // the behavior of sh(1) and friends. - if (progName.find('/') != std::string::npos && temp.canExecute()) + if (progName.find('/') != std::string::npos) return temp; // At this point, the file name is valid and its not executable From greened at obbligato.org Tue Jul 28 18:26:34 2009 From: greened at obbligato.org (David Greene) Date: Tue, 28 Jul 2009 23:26:34 -0000 Subject: [llvm-commits] [llvm] r77397 - in /llvm/trunk: include/llvm/Support/FormattedStream.h lib/Support/FormattedStream.cpp Message-ID: <200907282326.n6SNQYms018777@zion.cs.uiuc.edu> Author: greened Date: Tue Jul 28 18:26:34 2009 New Revision: 77397 URL: http://llvm.org/viewvc/llvm-project?rev=77397&view=rev Log: Improve performance of PadToColumn by eliminating flushes. Modified: llvm/trunk/include/llvm/Support/FormattedStream.h llvm/trunk/lib/Support/FormattedStream.cpp Modified: llvm/trunk/include/llvm/Support/FormattedStream.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/FormattedStream.h?rev=77397&r1=77396&r2=77397&view=diff ============================================================================== --- llvm/trunk/include/llvm/Support/FormattedStream.h (original) +++ llvm/trunk/include/llvm/Support/FormattedStream.h Tue Jul 28 18:26:34 2009 @@ -49,13 +49,13 @@ /// bool DeleteStream; - /// Column - The current output column of the stream. The column - /// scheme is zero-based. + /// ColumnFlushed - The current output column of the data that's + /// been flushed. The column scheme is zero-based. /// - unsigned Column; + unsigned ColumnFlushed; virtual void write_impl(const char *Ptr, size_t Size) { - ComputeColumn(Ptr, Size); + ComputeColumn(ColumnFlushed); TheStream->write(Ptr, Size); } @@ -67,10 +67,10 @@ return TheStream->tell() - TheStream->GetNumBytesInBuffer(); } - /// ComputeColumn - Examine the current output and figure out - /// which column we end up in after output. + /// ComputeColumn - Examine the current buffer and figure out + /// which column we're in. /// - void ComputeColumn(const char *Ptr, size_t Size); + void ComputeColumn(unsigned &Column); public: /// formatted_raw_ostream - Open the specified file for @@ -84,11 +84,11 @@ /// underneath it. /// formatted_raw_ostream(raw_ostream &Stream, bool Delete = false) - : raw_ostream(), TheStream(0), DeleteStream(false), Column(0) { + : raw_ostream(), TheStream(0), DeleteStream(false), ColumnFlushed(0) { setStream(Stream, Delete); } explicit formatted_raw_ostream() - : raw_ostream(), TheStream(0), DeleteStream(false), Column(0) {} + : raw_ostream(), TheStream(0), DeleteStream(false), ColumnFlushed(0) {} ~formatted_raw_ostream() { if (DeleteStream) Modified: llvm/trunk/lib/Support/FormattedStream.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/FormattedStream.cpp?rev=77397&r1=77396&r2=77397&view=diff ============================================================================== --- llvm/trunk/lib/Support/FormattedStream.cpp (original) +++ llvm/trunk/lib/Support/FormattedStream.cpp Tue Jul 28 18:26:34 2009 @@ -19,11 +19,11 @@ /// ComputeColumn - Examine the current output and figure out which /// column we end up in after output. /// -void formatted_raw_ostream::ComputeColumn(const char *Ptr, size_t Size) { +void formatted_raw_ostream::ComputeColumn(unsigned &Column) { // Keep track of the current column by scanning the string for // special characters - for (const char *epos = Ptr + Size; Ptr != epos; ++Ptr) { + for (const char *Ptr = begin(); Ptr != end(); ++Ptr) { ++Column; if (*Ptr == '\n' || *Ptr == '\r') Column = 0; @@ -38,8 +38,13 @@ /// \param MinPad - The minimum space to give after the most recent /// I/O, even if the current column + minpad > newcol. /// -void formatted_raw_ostream::PadToColumn(unsigned NewCol, unsigned MinPad) { - flush(); +void formatted_raw_ostream::PadToColumn(unsigned NewCol, unsigned MinPad) { + // Start out from the last flush position. + unsigned Column = ColumnFlushed; + + // Now figure out what's in the buffer and add it to the column + // count. + ComputeColumn(Column); // Output spaces until we reach the desired column. unsigned num = NewCol - Column; From a at bolka.at Tue Jul 28 18:40:40 2009 From: a at bolka.at (Andreas Bolka) Date: Tue, 28 Jul 2009 23:40:40 -0000 Subject: [llvm-commits] [llvm] r77398 - in /llvm/trunk/test/Analysis/LoopDependenceAnalysis: alias.ll siv-strong.ll siv-weak-crossing.ll siv-weak-zero.ll ziv.ll Message-ID: <200907282340.n6SNee8R019189@zion.cs.uiuc.edu> Author: abolka Date: Tue Jul 28 18:40:40 2009 New Revision: 77398 URL: http://llvm.org/viewvc/llvm-project?rev=77398&view=rev Log: Slightly reformat LDA tests to ease grepping. Modified: llvm/trunk/test/Analysis/LoopDependenceAnalysis/alias.ll llvm/trunk/test/Analysis/LoopDependenceAnalysis/siv-strong.ll llvm/trunk/test/Analysis/LoopDependenceAnalysis/siv-weak-crossing.ll llvm/trunk/test/Analysis/LoopDependenceAnalysis/siv-weak-zero.ll llvm/trunk/test/Analysis/LoopDependenceAnalysis/ziv.ll Modified: llvm/trunk/test/Analysis/LoopDependenceAnalysis/alias.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Analysis/LoopDependenceAnalysis/alias.ll?rev=77398&r1=77397&r2=77398&view=diff ============================================================================== --- llvm/trunk/test/Analysis/LoopDependenceAnalysis/alias.ll (original) +++ llvm/trunk/test/Analysis/LoopDependenceAnalysis/alias.ll Tue Jul 28 18:40:40 2009 @@ -1,6 +1,6 @@ ; RUN: llvm-as < %s | opt -disable-output -analyze -lda | FileCheck %s -; x[5] = x[6] // with x being a pointer passed as argument +;; x[5] = x[6] // with x being a pointer passed as argument define void @f1(i32* nocapture %xptr) nounwind { entry: @@ -21,7 +21,7 @@ ret void } -; x[5] = x[6] // with x being an array on the stack +;; x[5] = x[6] // with x being an array on the stack define void @foo(...) nounwind { entry: Modified: llvm/trunk/test/Analysis/LoopDependenceAnalysis/siv-strong.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Analysis/LoopDependenceAnalysis/siv-strong.ll?rev=77398&r1=77397&r2=77398&view=diff ============================================================================== --- llvm/trunk/test/Analysis/LoopDependenceAnalysis/siv-strong.ll (original) +++ llvm/trunk/test/Analysis/LoopDependenceAnalysis/siv-strong.ll Tue Jul 28 18:40:40 2009 @@ -3,8 +3,8 @@ @x = common global [256 x i32] zeroinitializer, align 4 @y = common global [256 x i32] zeroinitializer, align 4 -; for (i = 0; i < 256; i++) -; x[i] = x[i] + y[i] +;; for (i = 0; i < 256; i++) +;; x[i] = x[i] + y[i] define void @f1(...) nounwind { entry: @@ -28,8 +28,8 @@ ret void } -; for (i = 0; i < 256; i++) -; x[i+1] = x[i] + y[i] +;; for (i = 0; i < 256; i++) +;; x[i+1] = x[i] + y[i] define void @f2(...) nounwind { entry: @@ -54,8 +54,8 @@ ret void } -; for (i = 0; i < 10; i++) -; x[i+20] = x[i] + y[i] +;; for (i = 0; i < 10; i++) +;; x[i+20] = x[i] + y[i] define void @f3(...) nounwind { entry: Modified: llvm/trunk/test/Analysis/LoopDependenceAnalysis/siv-weak-crossing.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Analysis/LoopDependenceAnalysis/siv-weak-crossing.ll?rev=77398&r1=77397&r2=77398&view=diff ============================================================================== --- llvm/trunk/test/Analysis/LoopDependenceAnalysis/siv-weak-crossing.ll (original) +++ llvm/trunk/test/Analysis/LoopDependenceAnalysis/siv-weak-crossing.ll Tue Jul 28 18:40:40 2009 @@ -3,8 +3,8 @@ @x = common global [256 x i32] zeroinitializer, align 4 @y = common global [256 x i32] zeroinitializer, align 4 -; for (i = 0; i < 256; i++) -; x[i] = x[256 - i] + y[i] +;; for (i = 0; i < 256; i++) +;; x[i] = x[256 - i] + y[i] define void @f1(...) nounwind { entry: @@ -30,9 +30,9 @@ ret void } -; // the same example, using more realistic IR -; for (i = 0; i < 256; i++) -; x[i] = x[256 - i] + y[i] +;; // the same example, using more realistic IR +;; for (i = 0; i < 256; i++) +;; x[i] = x[256 - i] + y[i] define void @f2(...) nounwind { entry: @@ -58,8 +58,8 @@ ret void } -; for (i = 0; i < 100; i++) -; x[i] = x[256 - i] + y[i] +;; for (i = 0; i < 100; i++) +;; x[i] = x[256 - i] + y[i] define void @f3(...) nounwind { entry: Modified: llvm/trunk/test/Analysis/LoopDependenceAnalysis/siv-weak-zero.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Analysis/LoopDependenceAnalysis/siv-weak-zero.ll?rev=77398&r1=77397&r2=77398&view=diff ============================================================================== --- llvm/trunk/test/Analysis/LoopDependenceAnalysis/siv-weak-zero.ll (original) +++ llvm/trunk/test/Analysis/LoopDependenceAnalysis/siv-weak-zero.ll Tue Jul 28 18:40:40 2009 @@ -3,8 +3,8 @@ @x = common global [256 x i32] zeroinitializer, align 4 @y = common global [256 x i32] zeroinitializer, align 4 -; for (i = 0; i < 256; i++) -; x[i] = x[42] + y[i] +;; for (i = 0; i < 256; i++) +;; x[i] = x[42] + y[i] define void @f1(...) nounwind { entry: @@ -29,8 +29,8 @@ ret void } -; for (i = 0; i < 250; i++) -; x[i] = x[255] + y[i] +;; for (i = 0; i < 250; i++) +;; x[i] = x[255] + y[i] define void @f2(...) nounwind { entry: Modified: llvm/trunk/test/Analysis/LoopDependenceAnalysis/ziv.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Analysis/LoopDependenceAnalysis/ziv.ll?rev=77398&r1=77397&r2=77398&view=diff ============================================================================== --- llvm/trunk/test/Analysis/LoopDependenceAnalysis/ziv.ll (original) +++ llvm/trunk/test/Analysis/LoopDependenceAnalysis/ziv.ll Tue Jul 28 18:40:40 2009 @@ -2,7 +2,7 @@ @x = common global [256 x i32] zeroinitializer, align 4 -; x[5] = x[6] +;; x[5] = x[6] define void @f1(...) nounwind { entry: @@ -21,7 +21,7 @@ ret void } -; x[c] = x[c+1] // with c being a loop-invariant constant +;; x[c] = x[c+1] // with c being a loop-invariant constant define void @f2(i64 %c0) nounwind { entry: From isanbard at gmail.com Tue Jul 28 18:44:43 2009 From: isanbard at gmail.com (Bill Wendling) Date: Tue, 28 Jul 2009 23:44:43 -0000 Subject: [llvm-commits] [llvm] r77399 - /llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp Message-ID: <200907282344.n6SNihxe019311@zion.cs.uiuc.edu> Author: void Date: Tue Jul 28 18:44:43 2009 New Revision: 77399 URL: http://llvm.org/viewvc/llvm-project?rev=77399&view=rev Log: Cleanup code to use iterators instead of ".size()". Does any one else hate the name "const_reverse_iterator" as much as I do? Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp?rev=77399&r1=77398&r2=77399&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp (original) +++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp Tue Jul 28 18:44:43 2009 @@ -317,7 +317,7 @@ int FirstAction = 0; unsigned SizeActions = 0; const LandingPadInfo *PrevLPI = 0; - for (SmallVector::const_iterator + for (SmallVectorImpl::const_iterator I = LandingPads.begin(), E = LandingPads.end(); I != E; ++I) { const LandingPadInfo *LPI = *I; const std::vector &TypeIds = LPI->TypeIds; @@ -384,8 +384,10 @@ // duplicate actions. SmallVector LandingPads; LandingPads.reserve(PadInfos.size()); + for (unsigned i = 0, N = PadInfos.size(); i != N; ++i) LandingPads.push_back(&PadInfos[i]); + std::sort(LandingPads.begin(), LandingPads.end(), PadLT); // Compute the actions table and gather the first action index for each @@ -394,18 +396,10 @@ SmallVector FirstActions; unsigned SizeActions = ComputeActionsTable(LandingPads, Actions, FirstActions); - // Compute the call-site table. The entry for an invoke has a try-range - // containing the call, a non-zero landing pad and an appropriate action. The - // entry for an ordinary call has a try-range containing the call and zero for - // the landing pad and the action. Calls marked 'nounwind' have no entry and - // must not be contained in the try-range of any entry - they form gaps in the - // table. Entries must be ordered by try-range address. - SmallVector CallSites; - RangeMapType PadMap; - // Invokes and nounwind calls have entries in PadMap (due to being bracketed // by try-range labels when lowered). Ordinary calls do not, so appropriate // try-ranges for them need be deduced. + RangeMapType PadMap; for (unsigned i = 0, N = LandingPads.size(); i != N; ++i) { const LandingPadInfo *LandingPad = LandingPads[i]; for (unsigned j = 0, E = LandingPad->BeginLabels.size(); j != E; ++j) { @@ -416,6 +410,14 @@ } } + // Compute the call-site table. The entry for an invoke has a try-range + // containing the call, a non-zero landing pad and an appropriate action. The + // entry for an ordinary call has a try-range containing the call and zero for + // the landing pad and the action. Calls marked 'nounwind' have no entry and + // must not be contained in the try-range of any entry - they form gaps in the + // table. Entries must be ordered by try-range address. + SmallVector CallSites; + // The end label of the previous invoke or nounwind try-range. unsigned LastLabel = 0; @@ -423,7 +425,7 @@ // an ordinary call) between the end of the previous try-range and now. bool SawPotentiallyThrowing = false; - // Whether the last callsite entry was for an invoke. + // Whether the last CallSite entry was for an invoke. bool PreviousIsInvoke = false; // Visit all instructions in order of address. @@ -451,7 +453,6 @@ PadRange P = L->second; const LandingPadInfo *LandingPad = LandingPads[P.PadIndex]; - assert(BeginLabel == LandingPad->BeginLabels[P.RangeIndex] && "Inconsistent landing pad map!"); @@ -562,8 +563,9 @@ Asm->EOL("Call-site table length"); // Emit the landing pad site information. - for (unsigned i = 0, e = CallSites.size(); i < e; ++i) { - const CallSiteEntry &S = CallSites[i]; + for (SmallVectorImpl::const_iterator + I = CallSites.begin(), E = CallSites.end(); I != E; ++I) { + const CallSiteEntry &S = *I; const char *BeginTag; unsigned BeginNumber; @@ -600,9 +602,9 @@ } // Emit the actions. - for (unsigned I = 0, N = Actions.size(); I != N; ++I) { - ActionEntry &Action = Actions[I]; - + for (SmallVectorImpl::const_iterator + I = Actions.begin(), E = Actions.end(); I != E; ++I) { + const ActionEntry &Action = *I; Asm->EmitSLEB128Bytes(Action.ValueForTypeID); Asm->EOL("TypeInfo index"); Asm->EmitSLEB128Bytes(Action.NextAction); @@ -610,8 +612,9 @@ } // Emit the type ids. - for (unsigned M = TypeInfos.size(); M; --M) { - GlobalVariable *GV = TypeInfos[M - 1]; + for (std::vector::const_reverse_iterator + I = TypeInfos.rbegin(), E = TypeInfos.rend(); I != E; ++I) { + GlobalVariable *GV = *I; PrintRelDirective(); if (GV) { @@ -625,8 +628,9 @@ } // Emit the filter typeids. - for (unsigned j = 0, M = FilterIds.size(); j < M; ++j) { - unsigned TypeID = FilterIds[j]; + for (std::vector::const_iterator + I = FilterIds.begin(), E = FilterIds.end(); I < E; ++I) { + unsigned TypeID = *I; Asm->EmitULEB128Bytes(TypeID); Asm->EOL("Filter TypeInfo index"); } From david_goodwin at apple.com Tue Jul 28 18:52:33 2009 From: david_goodwin at apple.com (David Goodwin) Date: Tue, 28 Jul 2009 23:52:33 -0000 Subject: [llvm-commits] [llvm] r77401 - /llvm/trunk/lib/Target/ARM/Thumb2InstrInfo.cpp Message-ID: <200907282352.n6SNqYIY019569@zion.cs.uiuc.edu> Author: david_goodwin Date: Tue Jul 28 18:52:33 2009 New Revision: 77401 URL: http://llvm.org/viewvc/llvm-project?rev=77401&view=rev Log: Thumb-2: fix typo that caused incorrect stack elimination for VFP operations and very large stack frames. Modified: llvm/trunk/lib/Target/ARM/Thumb2InstrInfo.cpp Modified: llvm/trunk/lib/Target/ARM/Thumb2InstrInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/Thumb2InstrInfo.cpp?rev=77401&r1=77400&r2=77401&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/Thumb2InstrInfo.cpp (original) +++ llvm/trunk/lib/Target/ARM/Thumb2InstrInfo.cpp Tue Jul 28 18:52:33 2009 @@ -415,7 +415,7 @@ } // Otherwise, offset doesn't fit. Pull in what we can to simplify - ImmedOffset = Offset & Mask; + ImmedOffset = ImmedOffset & Mask; if (isSub) { if (AddrMode == ARMII::AddrMode5) // FIXME: Not consistent. From a at bolka.at Tue Jul 28 19:02:10 2009 From: a at bolka.at (Andreas Bolka) Date: Wed, 29 Jul 2009 00:02:10 -0000 Subject: [llvm-commits] [llvm] r77403 - /llvm/trunk/docs/LangRef.html Message-ID: <200907290002.n6T02A8U019880@zion.cs.uiuc.edu> Author: abolka Date: Tue Jul 28 19:02:05 2009 New Revision: 77403 URL: http://llvm.org/viewvc/llvm-project?rev=77403&view=rev Log: Fix a few typos and add links. Modified: llvm/trunk/docs/LangRef.html Modified: llvm/trunk/docs/LangRef.html URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/LangRef.html?rev=77403&r1=77402&r2=77403&view=diff ============================================================================== --- llvm/trunk/docs/LangRef.html (original) +++ llvm/trunk/docs/LangRef.html Tue Jul 28 19:02:05 2009 @@ -1251,38 +1251,42 @@
    -

    Any memory access must be done though a pointer value associated +

    Any memory access must be done through a pointer value associated with an address range of the memory access, otherwise the behavior is undefined. Pointer values are associated with address ranges according to the following rules:

      -
    • A pointer value formed from a getelementptr instruction is - associated with the addresses associated with the first operand of - the getelementptr.
    • -
    • An addresses of a global variable is associated with the address +
    • A pointer value formed from a + getelementptr instruction + is associated with the addresses associated with the first operand + of the getelementptr.
    • +
    • An address of a global variable is associated with the address range of the variable's storage.
    • The result value of an allocation instruction is associated with the address range of the allocated storage.
    • A null pointer in the default address-space is associated with - no addresses.
    • -
    • A pointer value formed by an inttoptr is associated with - all address ranges of all pointer values that contribute (directly - or indirectly) to the computation of the pointer's value.
    • -
    • The result value of a bitcast is associated with all + no address.
    • +
    • A pointer value formed by an + inttoptr is associated with all + address ranges of all pointer values that contribute (directly or + indirectly) to the computation of the pointer's value.
    • +
    • The result value of a + bitcast is associated with all addresses associated with the operand of the bitcast.
    • An integer constant other than zero or a pointer value returned from a function not defined within LLVM may be associated with address ranges allocated through mechanisms other than those provided by - LLVM. Such ranges shall not overlap with any ranges of address + LLVM. Such ranges shall not overlap with any ranges of addresses allocated by mechanisms provided by LLVM.

    LLVM IR does not associate types with memory. The result type of a -load merely indicates the size and alignment of the memory from -which to load, as well as the interpretation of the value. The first -operand of a store similarly only indicates the size and -alignment of the store.

    +load merely indicates the size and +alignment of the memory from which to load, as well as the +interpretation of the value. The first operand of a +store similarly only indicates the size +and alignment of the store.

    Consequently, type-based alias analysis, aka TBAA, aka -fstrict-aliasing, is not applicable to general unadorned From daniel at zuster.org Tue Jul 28 19:02:19 2009 From: daniel at zuster.org (Daniel Dunbar) Date: Wed, 29 Jul 2009 00:02:19 -0000 Subject: [llvm-commits] [llvm] r77404 - in /llvm/trunk: include/llvm/Target/Target.td lib/Target/X86/AsmParser/X86AsmParser.cpp lib/Target/X86/X86.td utils/TableGen/AsmMatcherEmitter.cpp utils/TableGen/CodeGenTarget.cpp utils/TableGen/CodeGenTarget.h Message-ID: <200907290002.n6T02KZD019901@zion.cs.uiuc.edu> Author: ddunbar Date: Tue Jul 28 19:02:19 2009 New Revision: 77404 URL: http://llvm.org/viewvc/llvm-project?rev=77404&view=rev Log: Match X86 register names to number. Modified: llvm/trunk/include/llvm/Target/Target.td llvm/trunk/lib/Target/X86/AsmParser/X86AsmParser.cpp llvm/trunk/lib/Target/X86/X86.td llvm/trunk/utils/TableGen/AsmMatcherEmitter.cpp llvm/trunk/utils/TableGen/CodeGenTarget.cpp llvm/trunk/utils/TableGen/CodeGenTarget.h Modified: llvm/trunk/include/llvm/Target/Target.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/Target.td?rev=77404&r1=77403&r2=77404&view=diff ============================================================================== --- llvm/trunk/include/llvm/Target/Target.td (original) +++ llvm/trunk/include/llvm/Target/Target.td Tue Jul 28 19:02:19 2009 @@ -411,6 +411,27 @@ } //===----------------------------------------------------------------------===// +// AsmParser - This class can be implemented by targets that wish to implement +// .s file parsing. +// +// Subtargets can have multiple different assembly parsers (e.g. AT&T vs Intel +// syntax on X86 for example). +// +class AsmParser { + // AsmWriterClassName - This specifies the suffix to use for the asmwriter + // class. Generated AsmWriter classes are always prefixed with the target + // name. + string AsmParserClassName = "AsmParser"; + + // Variant - AsmParsers can be of multiple different variants. Variants are + // used to support targets that need to parser multiple formats for the + // assembly language. + int Variant = 0; +} +def DefaultAsmParser : AsmParser; + + +//===----------------------------------------------------------------------===// // AsmWriter - This class can be implemented by targets that need to customize // the format of the .s file writer. // @@ -445,6 +466,9 @@ // InstructionSet - Instruction set description for this target. InstrInfo InstructionSet; + // AssemblyParsers - The AsmParser instances available for this target. + list AssemblyParsers = [DefaultAsmParser]; + // AssemblyWriters - The AsmWriter instances available for this target. list AssemblyWriters = [DefaultAsmWriter]; } 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=77404&r1=77403&r2=77404&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/AsmParser/X86AsmParser.cpp (original) +++ llvm/trunk/lib/Target/X86/AsmParser/X86AsmParser.cpp Tue Jul 28 19:02:19 2009 @@ -42,6 +42,13 @@ bool ParseOperand(X86Operand &Op); bool ParseMemOperand(X86Operand &Op); + + /// @name Auto-generated Match Functions + /// { + + bool MatchRegisterName(const StringRef &Name, unsigned &RegNo); + + /// } public: X86ATTAsmParser(const Target &T, MCAsmParser &_Parser) @@ -118,10 +125,17 @@ // bool X86ATTAsmParser::ParseRegister(X86Operand &Op) { - assert(getLexer().is(AsmToken::Register) && "Invalid token kind!"); + AsmToken Tok = getLexer().getTok(); + assert(Tok.is(AsmToken::Register) && "Invalid token kind!"); - // FIXME: Decode register number. - Op = X86Operand::CreateReg(123); + // FIXME: Validate register for the current architecture; we have to do + // validation later, so maybe there is no need for this here. + unsigned RegNo; + assert(Tok.getString().startswith("%") && "Invalid register name!"); + if (MatchRegisterName(Tok.getString().substr(1), RegNo)) + return Error(Tok.getLoc(), "invalid register name"); + + Op = X86Operand::CreateReg(RegNo); getLexer().Lex(); // Eat register token. return false; @@ -308,3 +322,5 @@ RegisterAsmParser X(TheX86_32Target); RegisterAsmParser Y(TheX86_64Target); } + +#include "X86GenAsmMatcher.inc" Modified: llvm/trunk/lib/Target/X86/X86.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86.td?rev=77404&r1=77403&r2=77404&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86.td (original) +++ llvm/trunk/lib/Target/X86/X86.td Tue Jul 28 19:02:19 2009 @@ -178,6 +178,12 @@ // Assembly Printers //===----------------------------------------------------------------------===// +// Currently the X86 assembly parser only supports ATT syntax. +def ATTAsmParser : AsmParser { + string AsmParserClassName = "ATTAsmParser"; + int Variant = 0; +} + // The X86 target supports two different syntaxes for emitting machine code. // This is controlled by the -x86-asm-syntax={att|intel} def ATTAsmWriter : AsmWriter { @@ -189,10 +195,11 @@ int Variant = 1; } - def X86 : Target { // Information about the instructions... let InstructionSet = X86InstrInfo; + let AssemblyParsers = [ATTAsmParser]; + let AssemblyWriters = [ATTAsmWriter, IntelAsmWriter]; } Modified: llvm/trunk/utils/TableGen/AsmMatcherEmitter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/AsmMatcherEmitter.cpp?rev=77404&r1=77403&r2=77404&view=diff ============================================================================== --- llvm/trunk/utils/TableGen/AsmMatcherEmitter.cpp (original) +++ llvm/trunk/utils/TableGen/AsmMatcherEmitter.cpp Tue Jul 28 19:02:19 2009 @@ -20,17 +20,17 @@ void AsmMatcherEmitter::run(raw_ostream &OS) { CodeGenTarget Target; const std::vector &Registers = Target.getRegisters(); + Record *AsmParser = Target.getAsmParser(); + std::string ClassName = AsmParser->getValueAsString("AsmParserClassName"); std::string Namespace = Registers[0].TheDef->getValueAsString("Namespace"); EmitSourceFileHeader("Assembly Matcher Source Fragment", OS); - OS << "namespace llvm {\n\n"; // Emit the function to match a register name to number. - if (!Namespace.empty()) - OS << "namespace " << Namespace << " {\n"; - OS << "bool MatchRegisterName(const std::string &Name, unsigned &RegNo) {\n"; + OS << "bool " << Target.getName() << ClassName + << "::MatchRegisterName(const StringRef &Name, unsigned &RegNo) {\n"; // FIXME: TableGen should have a fast string matcher generator. for (unsigned i = 0, e = Registers.size(); i != e; ++i) { @@ -44,8 +44,4 @@ } OS << " return true;\n"; OS << "}\n"; - - if (!Namespace.empty()) - OS << "}\n"; - OS << "} // End llvm namespace \n"; } Modified: llvm/trunk/utils/TableGen/CodeGenTarget.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/CodeGenTarget.cpp?rev=77404&r1=77403&r2=77404&view=diff ============================================================================== --- llvm/trunk/utils/TableGen/CodeGenTarget.cpp (original) +++ llvm/trunk/utils/TableGen/CodeGenTarget.cpp Tue Jul 28 19:02:19 2009 @@ -23,6 +23,10 @@ using namespace llvm; static cl::opt +AsmParserNum("asmparsernum", cl::init(0), + cl::desc("Make -gen-asm-parser emit assembly parser #N")); + +static cl::opt AsmWriterNum("asmwriternum", cl::init(0), cl::desc("Make -gen-asm-writer emit assembly writer #N")); @@ -133,6 +137,15 @@ return TargetRec->getValueAsDef("InstructionSet"); } +/// getAsmParser - Return the AssemblyParser definition for this target. +/// +Record *CodeGenTarget::getAsmParser() const { + std::vector LI = TargetRec->getValueAsListOfDefs("AssemblyParsers"); + if (AsmParserNum >= LI.size()) + throw "Target does not have an AsmParser #" + utostr(AsmParserNum) + "!"; + return LI[AsmParserNum]; +} + /// getAsmWriter - Return the AssemblyWriter definition for this target. /// Record *CodeGenTarget::getAsmWriter() const { Modified: llvm/trunk/utils/TableGen/CodeGenTarget.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/CodeGenTarget.h?rev=77404&r1=77403&r2=77404&view=diff ============================================================================== --- llvm/trunk/utils/TableGen/CodeGenTarget.h (original) +++ llvm/trunk/utils/TableGen/CodeGenTarget.h Tue Jul 28 19:02:19 2009 @@ -87,6 +87,10 @@ /// Record *getInstructionSet() const; + /// getAsmParser - Return the AssemblyParser definition for this target. + /// + Record *getAsmParser() const; + /// getAsmWriter - Return the AssemblyWriter definition for this target. /// Record *getAsmWriter() const; From gohman at apple.com Tue Jul 28 19:02:58 2009 From: gohman at apple.com (Dan Gohman) Date: Wed, 29 Jul 2009 00:02:58 -0000 Subject: [llvm-commits] [llvm] r77405 - /llvm/trunk/lib/System/Unix/Path.inc Message-ID: <200907290002.n6T02w5s019928@zion.cs.uiuc.edu> Author: djg Date: Tue Jul 28 19:02:58 2009 New Revision: 77405 URL: http://llvm.org/viewvc/llvm-project?rev=77405&view=rev Log: Remove another F_OK. Modified: llvm/trunk/lib/System/Unix/Path.inc Modified: llvm/trunk/lib/System/Unix/Path.inc URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/System/Unix/Path.inc?rev=77405&r1=77404&r2=77405&view=diff ============================================================================== --- llvm/trunk/lib/System/Unix/Path.inc (original) +++ llvm/trunk/lib/System/Unix/Path.inc Tue Jul 28 19:02:58 2009 @@ -636,7 +636,7 @@ static bool createDirectoryHelper(char* beg, char* end, bool create_parents) { - if (access(beg, F_OK | R_OK | W_OK) == 0) + if (access(beg, R_OK | W_OK) == 0) return false; if (create_parents) { From echristo at apple.com Tue Jul 28 19:28:05 2009 From: echristo at apple.com (Eric Christopher) Date: Wed, 29 Jul 2009 00:28:05 -0000 Subject: [llvm-commits] [llvm] r77407 - in /llvm/trunk: include/llvm/IntrinsicsX86.td lib/Target/X86/X86ISelLowering.cpp lib/Target/X86/X86ISelLowering.h lib/Target/X86/X86InstrSSE.td test/CodeGen/X86/sse41.ll Message-ID: <200907290028.n6T0S6VU020655@zion.cs.uiuc.edu> Author: echristo Date: Tue Jul 28 19:28:05 2009 New Revision: 77407 URL: http://llvm.org/viewvc/llvm-project?rev=77407&view=rev Log: Add support for gcc __builtin_ia32_ptest{z,c,nzc} intrinsics. Lower to ptest instruction plus setcc. Revamp ptest instruction. Add test. Modified: llvm/trunk/include/llvm/IntrinsicsX86.td llvm/trunk/lib/Target/X86/X86ISelLowering.cpp llvm/trunk/lib/Target/X86/X86ISelLowering.h llvm/trunk/lib/Target/X86/X86InstrSSE.td llvm/trunk/test/CodeGen/X86/sse41.ll Modified: llvm/trunk/include/llvm/IntrinsicsX86.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/IntrinsicsX86.td?rev=77407&r1=77406&r2=77407&view=diff ============================================================================== --- llvm/trunk/include/llvm/IntrinsicsX86.td (original) +++ llvm/trunk/include/llvm/IntrinsicsX86.td Tue Jul 28 19:28:05 2009 @@ -864,6 +864,18 @@ Intrinsic<[llvm_v2i64_ty], [llvm_ptr_ty], [IntrReadMem]>; } +// Test instruction with bitwise comparison. +let TargetPrefix = "x86" in { // All intrinsics start with "llvm.x86.". + def int_x86_sse41_ptestz : GCCBuiltin<"__builtin_ia32_ptestz128">, + Intrinsic<[llvm_i32_ty], [llvm_v4f32_ty, llvm_v4f32_ty], + [IntrNoMem]>; + def int_x86_sse41_ptestc : GCCBuiltin<"__builtin_ia32_ptestc128">, + Intrinsic<[llvm_i32_ty], [llvm_v4f32_ty, llvm_v4f32_ty], + [IntrNoMem]>; + def int_x86_sse41_ptestnzc : GCCBuiltin<"__builtin_ia32_ptestnzc128">, + Intrinsic<[llvm_i32_ty], [llvm_v4f32_ty, llvm_v4f32_ty], + [IntrNoMem]>; +} //===----------------------------------------------------------------------===// // MMX Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.cpp?rev=77407&r1=77406&r2=77407&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original) +++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Tue Jul 28 19:28:05 2009 @@ -6200,6 +6200,36 @@ DAG.getConstant(X86CC, MVT::i8), Cond); return DAG.getNode(ISD::ZERO_EXTEND, dl, MVT::i32, SetCC); } + // ptest intrinsics. The intrinsic these come from are designed to return + // a boolean value, not just an instruction so lower it to the ptest + // pattern and a conditional move to the result. + case Intrinsic::x86_sse41_ptestz: + case Intrinsic::x86_sse41_ptestc: + case Intrinsic::x86_sse41_ptestnzc:{ + unsigned X86CC = 0; + switch (IntNo) { + default: break; + case Intrinsic::x86_sse41_ptestz: + // ZF = 1 + X86CC = X86::COND_E; + break; + case Intrinsic::x86_sse41_ptestc: + // CF = 1 + X86CC = X86::COND_B; + break; + case Intrinsic::x86_sse41_ptestnzc: + // ZF and CF = 0 + X86CC = X86::COND_A; + break; + } + + SDValue LHS = Op.getOperand(1); + SDValue RHS = Op.getOperand(2); + SDValue Test = DAG.getNode(X86ISD::PTEST, dl, MVT::i32, LHS, RHS); + SDValue CC = DAG.getConstant(X86CC, MVT::i8); + SDValue SetCC = DAG.getNode(X86ISD::SETCC, dl, MVT::i8, CC, Test); + return DAG.getNode(ISD::ZERO_EXTEND, dl, MVT::i32, SetCC); + } // Fix vector shift instructions where the last operand is a non-immediate // i32 value. @@ -7048,6 +7078,7 @@ case X86ISD::INC: return "X86ISD::INC"; case X86ISD::DEC: return "X86ISD::DEC"; case X86ISD::MUL_IMM: return "X86ISD::MUL_IMM"; + case X86ISD::PTEST: return "X86ISD::PTEST"; } } Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.h?rev=77407&r1=77406&r2=77407&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86ISelLowering.h (original) +++ llvm/trunk/lib/Target/X86/X86ISelLowering.h Tue Jul 28 19:28:05 2009 @@ -244,7 +244,10 @@ INC, DEC, // MUL_IMM - X86 specific multiply by immediate. - MUL_IMM + MUL_IMM, + + // PTEST - Vector bitwise comparisons + PTEST }; } Modified: llvm/trunk/lib/Target/X86/X86InstrSSE.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86InstrSSE.td?rev=77407&r1=77406&r2=77407&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86InstrSSE.td (original) +++ llvm/trunk/lib/Target/X86/X86InstrSSE.td Tue Jul 28 19:28:05 2009 @@ -69,6 +69,9 @@ def X86pcmpgtd : SDNode<"X86ISD::PCMPGTD", SDTIntBinOp>; def X86pcmpgtq : SDNode<"X86ISD::PCMPGTQ", SDTIntBinOp>; +def SDTX86CmpPTest : SDTypeProfile<0, 2, [SDTCisVT<0, v4f32>, SDTCisVT<1, v4f32>]>; +def X86ptest : SDNode<"X86ISD::PTEST", SDTX86CmpPTest>; + //===----------------------------------------------------------------------===// // SSE Complex Patterns //===----------------------------------------------------------------------===// @@ -3618,11 +3621,17 @@ def : Pat<(int_x86_sse41_insertps VR128:$src1, VR128:$src2, imm:$src3), (INSERTPSrr VR128:$src1, VR128:$src2, imm:$src3)>; +// ptest instruction we'll lower to this in X86ISelLowering primarily from +// the intel intrinsic that corresponds to this. let Defs = [EFLAGS] in { def PTESTrr : SS48I<0x17, MRMSrcReg, (outs), (ins VR128:$src1, VR128:$src2), - "ptest \t{$src2, $src1|$src1, $src2}", []>, OpSize; + "ptest \t{$src2, $src1|$src1, $src2}", + [(X86ptest VR128:$src1, VR128:$src2), + (implicit EFLAGS)]>, OpSize; def PTESTrm : SS48I<0x17, MRMSrcMem, (outs), (ins VR128:$src1, i128mem:$src2), - "ptest \t{$src2, $src1|$src1, $src2}", []>, OpSize; + "ptest \t{$src2, $src1|$src1, $src2}", + [(X86ptest VR128:$src1, (load addr:$src2)), + (implicit EFLAGS)]>, OpSize; } def MOVNTDQArm : SS48I<0x2A, MRMSrcMem, (outs VR128:$dst), (ins i128mem:$src), Modified: llvm/trunk/test/CodeGen/X86/sse41.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/sse41.ll?rev=77407&r1=77406&r2=77407&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/X86/sse41.ll (original) +++ llvm/trunk/test/CodeGen/X86/sse41.ll Tue Jul 28 19:28:05 2009 @@ -181,4 +181,19 @@ ; X64: _insertps_3: ; X64: insertps $0, %xmm1, %xmm0 -} \ No newline at end of file +} + +define i32 @ptestz_1(<4 x float> %t1, <4 x float> %t2) nounwind { + %tmp1 = call i32 @llvm.x86.sse41.ptestz(<4 x float> %t1, <4 x float> %t2) nounwind readnone + ret i32 %tmp1 +; X32: _ptestz_1: +; X32: ptest %xmm1, %xmm0 +; X32: sete %al + +; X64: _ptestz_1: +; X64: ptest %xmm1, %xmm0 +; X64: sete %al +} + +declare i32 @llvm.x86.sse41.ptestz(<4 x float>, <4 x float>) nounwind readnone + From isanbard at gmail.com Tue Jul 28 19:31:35 2009 From: isanbard at gmail.com (Bill Wendling) Date: Wed, 29 Jul 2009 00:31:35 -0000 Subject: [llvm-commits] [llvm] r77408 - in /llvm/trunk/lib/CodeGen/AsmPrinter: DwarfException.cpp DwarfException.h Message-ID: <200907290031.n6T0VZL7020772@zion.cs.uiuc.edu> Author: void Date: Tue Jul 28 19:31:35 2009 New Revision: 77408 URL: http://llvm.org/viewvc/llvm-project?rev=77408&view=rev Log: - Temporarily unbreak the build by forcing the TType "absptr", which isn't correct. But what are you going to do? I'll fix this in the future. - Move another large loop into its own method. Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.h Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp?rev=77408&r1=77407&r2=77408&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp (original) +++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp Tue Jul 28 19:31:35 2009 @@ -286,11 +286,10 @@ /// ComputeActionsTable - Compute the actions table and gather the first action /// index for each landing pad site. -unsigned -DwarfException::ComputeActionsTable(const SmallVectorImpl - &LandingPads, - SmallVectorImpl &Actions, - SmallVectorImpl &FirstActions) { +unsigned DwarfException:: +ComputeActionsTable(const SmallVectorImpl &LandingPads, + SmallVectorImpl &Actions, + SmallVectorImpl &FirstActions) { const std::vector &FilterIds = MMI->getFilterIds(); // Negative type IDs index into FilterIds. Positive type IDs index into @@ -374,50 +373,18 @@ return SizeActions; } -void DwarfException::EmitExceptionTable() { - const std::vector &TypeInfos = MMI->getTypeInfos(); - const std::vector &FilterIds = MMI->getFilterIds(); - const std::vector &PadInfos = MMI->getLandingPads(); - if (PadInfos.empty()) return; - - // Sort the landing pads in order of their type ids. This is used to fold - // duplicate actions. - SmallVector LandingPads; - LandingPads.reserve(PadInfos.size()); - - for (unsigned i = 0, N = PadInfos.size(); i != N; ++i) - LandingPads.push_back(&PadInfos[i]); - - std::sort(LandingPads.begin(), LandingPads.end(), PadLT); - - // Compute the actions table and gather the first action index for each - // landing pad site. - SmallVector Actions; - SmallVector FirstActions; - unsigned SizeActions = ComputeActionsTable(LandingPads, Actions, FirstActions); - - // Invokes and nounwind calls have entries in PadMap (due to being bracketed - // by try-range labels when lowered). Ordinary calls do not, so appropriate - // try-ranges for them need be deduced. - RangeMapType PadMap; - for (unsigned i = 0, N = LandingPads.size(); i != N; ++i) { - const LandingPadInfo *LandingPad = LandingPads[i]; - for (unsigned j = 0, E = LandingPad->BeginLabels.size(); j != E; ++j) { - unsigned BeginLabel = LandingPad->BeginLabels[j]; - assert(!PadMap.count(BeginLabel) && "Duplicate landing pad labels!"); - PadRange P = { i, j }; - PadMap[BeginLabel] = P; - } - } - - // Compute the call-site table. The entry for an invoke has a try-range - // containing the call, a non-zero landing pad and an appropriate action. The - // entry for an ordinary call has a try-range containing the call and zero for - // the landing pad and the action. Calls marked 'nounwind' have no entry and - // must not be contained in the try-range of any entry - they form gaps in the - // table. Entries must be ordered by try-range address. - SmallVector CallSites; - +/// ComputeCallSiteTable - Compute the call-site table. The entry for an invoke +/// has a try-range containing the call, a non-zero landing pad and an +/// appropriate action. The entry for an ordinary call has a try-range +/// containing the call and zero for the landing pad and the action. Calls +/// marked 'nounwind' have no entry and must not be contained in the try-range +/// of any entry - they form gaps in the table. Entries must be ordered by +/// try-range address. +void DwarfException:: +ComputeCallSiteTable(SmallVectorImpl &CallSites, + const RangeMapType &PadMap, + const SmallVectorImpl &LandingPads, + const SmallVectorImpl &FirstActions) { // The end label of the previous invoke or nounwind try-range. unsigned LastLabel = 0; @@ -501,6 +468,47 @@ CallSiteEntry Site = {LastLabel, 0, 0, 0}; CallSites.push_back(Site); } +} + +void DwarfException::EmitExceptionTable() { + const std::vector &TypeInfos = MMI->getTypeInfos(); + const std::vector &FilterIds = MMI->getFilterIds(); + const std::vector &PadInfos = MMI->getLandingPads(); + if (PadInfos.empty()) return; + + // Sort the landing pads in order of their type ids. This is used to fold + // duplicate actions. + SmallVector LandingPads; + LandingPads.reserve(PadInfos.size()); + + for (unsigned i = 0, N = PadInfos.size(); i != N; ++i) + LandingPads.push_back(&PadInfos[i]); + + std::sort(LandingPads.begin(), LandingPads.end(), PadLT); + + // Compute the actions table and gather the first action index for each + // landing pad site. + SmallVector Actions; + SmallVector FirstActions; + unsigned SizeActions = ComputeActionsTable(LandingPads, Actions, FirstActions); + + // Invokes and nounwind calls have entries in PadMap (due to being bracketed + // by try-range labels when lowered). Ordinary calls do not, so appropriate + // try-ranges for them need be deduced. + RangeMapType PadMap; + for (unsigned i = 0, N = LandingPads.size(); i != N; ++i) { + const LandingPadInfo *LandingPad = LandingPads[i]; + for (unsigned j = 0, E = LandingPad->BeginLabels.size(); j != E; ++j) { + unsigned BeginLabel = LandingPad->BeginLabels[j]; + assert(!PadMap.count(BeginLabel) && "Duplicate landing pad labels!"); + PadRange P = { i, j }; + PadMap[BeginLabel] = P; + } + } + + // Compute the call-site table. + SmallVector CallSites; + ComputeCallSiteTable(CallSites, PadMap, LandingPads, FirstActions); // Final tallies. @@ -545,6 +553,7 @@ Asm->EmitInt8(dwarf::DW_EH_PE_omit); Asm->EOL("LPStart format (DW_EH_PE_omit)"); +#if 0 if (!TypeInfos.empty() || !FilterIds.empty()) { Asm->EmitInt8(TAI->PreferredEHDataFormat(DwarfEncoding::Data, true)); // FIXME: The comment here should correspond with what PreferredEHDataFormat @@ -556,6 +565,10 @@ Asm->EmitInt8(dwarf::DW_EH_PE_omit); Asm->EOL("TType format (DW_EH_PE_omit)"); } +#else + Asm->EmitInt8(dwarf::DW_EH_PE_absptr); + Asm->EOL("TType format (DW_EH_PE_absptr)"); +#endif Asm->EmitInt8(dwarf::DW_EH_PE_udata4); Asm->EOL("Call site format (DW_EH_PE_udata4)"); Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.h?rev=77408&r1=77407&r2=77408&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.h (original) +++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.h Tue Jul 28 19:31:35 2009 @@ -143,9 +143,21 @@ /// ComputeActionsTable - Compute the actions table and gather the first /// action index for each landing pad site. - unsigned ComputeActionsTable(const SmallVectorImpl &LP, + unsigned ComputeActionsTable(const SmallVectorImpl&LPs, SmallVectorImpl &Actions, SmallVectorImpl &FirstActions); + + /// ComputeCallSiteTable - Compute the call-site table. The entry for an + /// invoke has a try-range containing the call, a non-zero landing pad and an + /// appropriate action. The entry for an ordinary call has a try-range + /// containing the call and zero for the landing pad and the action. Calls + /// marked 'nounwind' have no entry and must not be contained in the try-range + /// of any entry - they form gaps in the table. Entries must be ordered by + /// try-range address. + void ComputeCallSiteTable(SmallVectorImpl &CallSites, + const RangeMapType &PadMap, + const SmallVectorImpl &LPs, + const SmallVectorImpl &FirstActions); void EmitExceptionTable(); public: From dpatel at apple.com Tue Jul 28 19:33:07 2009 From: dpatel at apple.com (Devang Patel) Date: Wed, 29 Jul 2009 00:33:07 -0000 Subject: [llvm-commits] [llvm] r77409 - in /llvm/trunk: include/llvm/Metadata.h include/llvm/Value.h lib/VMCore/Metadata.cpp Message-ID: <200907290033.n6T0X7pX020823@zion.cs.uiuc.edu> Author: dpatel Date: Tue Jul 28 19:33:07 2009 New Revision: 77409 URL: http://llvm.org/viewvc/llvm-project?rev=77409&view=rev Log: Add NamedMDNode. Modified: llvm/trunk/include/llvm/Metadata.h llvm/trunk/include/llvm/Value.h llvm/trunk/lib/VMCore/Metadata.cpp Modified: llvm/trunk/include/llvm/Metadata.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Metadata.h?rev=77409&r1=77408&r2=77409&view=diff ============================================================================== --- llvm/trunk/include/llvm/Metadata.h (original) +++ llvm/trunk/include/llvm/Metadata.h Tue Jul 28 19:33:07 2009 @@ -26,7 +26,7 @@ namespace llvm { //===----------------------------------------------------------------------===// -// MetadataBase - A base class for MDNode and MDString. +// MetadataBase - A base class for MDNode, MDString and NamedMDNode. class MetadataBase : public Value { protected: MetadataBase(const Type *Ty, unsigned scid) @@ -49,14 +49,15 @@ /// Methods for support type inquiry through isa, cast, and dyn_cast: static inline bool classof(const MDString *) { return true; } static bool classof(const Value *V) { - return V->getValueID() == MDStringVal || V->getValueID() == MDNodeVal; + return V->getValueID() == MDStringVal || V->getValueID() == MDNodeVal + || V->getValueID() == NamedMDNodeVal; } }; //===----------------------------------------------------------------------===// /// MDString - a single uniqued string. /// These are used to efficiently contain a byte sequence for metadata. -/// +/// MDString is always unnamd. class MDString : public MetadataBase { MDString(const MDString &); // DO NOT IMPLEMENT StringRef Str; @@ -89,7 +90,7 @@ //===----------------------------------------------------------------------===// /// MDNode - a tuple of other values. /// These contain a list of the values that represent the metadata. -/// +/// MDNode is always unnamed. class MDNode : public MetadataBase, public FoldingSetNode { MDNode(const MDNode &); // DO NOT IMPLEMENT @@ -151,6 +152,104 @@ } }; +//===----------------------------------------------------------------------===// +/// WeakMetadataVH - a weak value handle for metadata. +class WeakMetadataVH : public WeakVH { +public: + WeakMetadataVH() : WeakVH() {} + WeakMetadataVH(MetadataBase *M) : WeakVH(M) {} + WeakMetadataVH(const WeakMetadataVH &RHS) : WeakVH(RHS) {} + + operator Value*() const { + llvm_unreachable("WeakMetadataVH only handles Metadata"); + } + + operator MetadataBase*() const { + return cast(getValPtr()); + } +}; + +//===----------------------------------------------------------------------===// +/// NamedMDNode - a tuple of other metadata. +/// NamedMDNode is always named. All NamedMDNode element has a type of metadata. +class NamedMDNode : public MetadataBase { + NamedMDNode(const NamedMDNode &); // DO NOT IMPLEMENT + + friend class LLVMContextImpl; + + Module *Parent; + StringRef Name; + SmallVector Node; + typedef SmallVectorImpl::iterator elem_iterator; + +protected: + explicit NamedMDNode(const char *N, unsigned NameLength, + MetadataBase*const* Vals, unsigned NumVals, + Module *M = 0); +public: + static NamedMDNode *Create(const char *N, unsigned NamedLength, + MetadataBase*const*MDs, unsigned NumMDs, + Module *M = 0) { + return new NamedMDNode(N, NamedLength, MDs, NumMDs, M); + } + + typedef SmallVectorImpl::const_iterator const_elem_iterator; + + StringRef getName() const { return Name; } + + /// getParent - Get the module that holds this named metadata collection. + inline Module *getParent() { return Parent; } + inline const Module *getParent() const { return Parent; } + + Value *getElement(unsigned i) const { + return Node[i]; + } + + unsigned getNumElements() const { + return Node.size(); + } + + bool elem_empty() const { + return Node.empty(); + } + + const_elem_iterator elem_begin() const { + return Node.begin(); + } + + const_elem_iterator elem_end() const { + return Node.end(); + } + + /// getType() specialization - Type is always MetadataTy. + /// + inline const Type *getType() const { + return Type::MetadataTy; + } + + /// isNullValue - Return true if this is the value that would be returned by + /// getNullValue. This always returns false because getNullValue will never + /// produce metadata. + virtual bool isNullValue() const { + return false; + } + + /// Profile - calculate a unique identifier for this MDNode to collapse + /// duplicates + void Profile(FoldingSetNodeID &ID) const; + + virtual void replaceUsesOfWithOnConstant(Value *From, Value *To, Use *U) { + llvm_unreachable( + "This should never be called because NamedMDNodes have no ops"); + } + + /// Methods for support type inquiry through isa, cast, and dyn_cast: + static inline bool classof(const NamedMDNode *) { return true; } + static bool classof(const Value *V) { + return V->getValueID() == NamedMDNodeVal; + } +}; + } // end llvm namespace #endif Modified: llvm/trunk/include/llvm/Value.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Value.h?rev=77409&r1=77408&r2=77409&view=diff ============================================================================== --- llvm/trunk/include/llvm/Value.h (original) +++ llvm/trunk/include/llvm/Value.h Tue Jul 28 19:33:07 2009 @@ -219,6 +219,7 @@ ConstantPointerNullVal, // This is an instance of ConstantPointerNull MDNodeVal, // This is an instance of MDNode MDStringVal, // This is an instance of MDString + NamedMDNodeVal, // This is an instance of NamedMDNode InlineAsmVal, // This is an instance of InlineAsm PseudoSourceValueVal, // This is an instance of PseudoSourceValue InstructionVal, // This is an instance of Instruction Modified: llvm/trunk/lib/VMCore/Metadata.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Metadata.cpp?rev=77409&r1=77408&r2=77409&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/Metadata.cpp (original) +++ llvm/trunk/lib/VMCore/Metadata.cpp Tue Jul 28 19:33:07 2009 @@ -12,6 +12,7 @@ //===----------------------------------------------------------------------===// #include "llvm/Metadata.h" +#include "llvm/Module.h" using namespace llvm; //===----------------------------------------------------------------------===// @@ -27,3 +28,17 @@ for (const_elem_iterator I = elem_begin(), E = elem_end(); I != E; ++I) ID.AddPointer(*I); } + +//===----------------------------------------------------------------------===// +//NamedMDNode implementation +// +NamedMDNode::NamedMDNode(const char *N, unsigned NameLength, + MetadataBase*const* MDs, unsigned NumMDs, + Module *M) + : MetadataBase(Type::MetadataTy, Value::NamedMDNodeVal), + Parent(M), Name(N, NameLength) { + for (unsigned i = 0; i != NumMDs; ++i) + Node.push_back(WeakMetadataVH(MDs[i])); + + // FIXME : Add into the parent module. +} From dpatel at apple.com Tue Jul 28 19:34:03 2009 From: dpatel at apple.com (Devang Patel) Date: Wed, 29 Jul 2009 00:34:03 -0000 Subject: [llvm-commits] [llvm] r77410 - in /llvm/trunk/lib/AsmParser: LLLexer.cpp LLLexer.h LLParser.cpp LLParser.h LLToken.h Message-ID: <200907290034.n6T0Y3hu020859@zion.cs.uiuc.edu> Author: dpatel Date: Tue Jul 28 19:34:02 2009 New Revision: 77410 URL: http://llvm.org/viewvc/llvm-project?rev=77410&view=rev Log: Parse named metadata. Modified: 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/AsmParser/LLToken.h Modified: llvm/trunk/lib/AsmParser/LLLexer.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/AsmParser/LLLexer.cpp?rev=77410&r1=77409&r2=77410&view=diff ============================================================================== --- llvm/trunk/lib/AsmParser/LLLexer.cpp (original) +++ llvm/trunk/lib/AsmParser/LLLexer.cpp Tue Jul 28 19:34:02 2009 @@ -253,7 +253,7 @@ case ';': SkipLineComment(); return LexToken(); - case '!': return lltok::Metadata; + case '!': return LexMetadata(); case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': case '-': @@ -421,7 +421,23 @@ return false; } +/// LexMetadata: +/// !{...} +/// !42 +/// !foo +lltok::Kind LLLexer::LexMetadata() { + if (isalpha(CurPtr[0])) { + ++CurPtr; + while (isalnum(CurPtr[0]) || CurPtr[0] == '-' || CurPtr[0] == '$' || + CurPtr[0] == '.' || CurPtr[0] == '_') + ++CurPtr; + StrVal.assign(TokStart+1, CurPtr); // Skip ! + return lltok::NamedMD; + } + return lltok::Metadata; +} + /// LexIdentifier: Handle several related productions: /// Label [-a-zA-Z$._0-9]+: /// IntegerType i[0-9]+ Modified: llvm/trunk/lib/AsmParser/LLLexer.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/AsmParser/LLLexer.h?rev=77410&r1=77409&r2=77410&view=diff ============================================================================== --- llvm/trunk/lib/AsmParser/LLLexer.h (original) +++ llvm/trunk/lib/AsmParser/LLLexer.h Tue Jul 28 19:34:02 2009 @@ -75,6 +75,7 @@ lltok::Kind LexDigitOrNegative(); lltok::Kind LexPositive(); lltok::Kind LexAt(); + lltok::Kind LexMetadata(); lltok::Kind LexPercent(); lltok::Kind LexQuote(); lltok::Kind Lex0x(); Modified: llvm/trunk/lib/AsmParser/LLParser.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/AsmParser/LLParser.cpp?rev=77410&r1=77409&r2=77410&view=diff ============================================================================== --- llvm/trunk/lib/AsmParser/LLParser.cpp (original) +++ llvm/trunk/lib/AsmParser/LLParser.cpp Tue Jul 28 19:34:02 2009 @@ -121,6 +121,7 @@ case lltok::LocalVar: if (ParseNamedType()) return true; break; case lltok::GlobalVar: if (ParseNamedGlobal()) return true; break; case lltok::Metadata: if (ParseStandaloneMetadata()) return true; break; + case lltok::NamedMD: if (ParseNamedMetadata()) return true; break; // The Global variable production with no name can have many different // optional leading prefixes, the production is: @@ -409,6 +410,41 @@ return false; } +///ParseNamedMetadata: +/// !foo = !{ !1, !2 } +bool LLParser::ParseNamedMetadata() { + assert(Lex.getKind() == lltok::NamedMD); + Lex.Lex(); + std::string Name = Lex.getStrVal(); + + if (ParseToken(lltok::equal, "expected '=' here")) + return true; + + if (Lex.getKind() != lltok::Metadata) + return TokError("Expected '!' here"); + Lex.Lex(); + + if (Lex.getKind() != lltok::lbrace) + return TokError("Expected '{' here"); + Lex.Lex(); + SmallVector Elts; + do { + if (Lex.getKind() != lltok::Metadata) + return TokError("Expected '!' here"); + Lex.Lex(); + MetadataBase *N = 0; + if (ParseMDNode(N)) return true; + Elts.push_back(N); + } while (EatIfPresent(lltok::comma)); + + if (ParseToken(lltok::rbrace, "expected end of metadata node")) + return true; + + NamedMDNode::Create(Name.c_str(), Name.length(), + Elts.data(), Elts.size(), M); + return false; +} + /// ParseStandaloneMetadata: /// !42 = !{...} bool LLParser::ParseStandaloneMetadata() { Modified: llvm/trunk/lib/AsmParser/LLParser.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/AsmParser/LLParser.h?rev=77410&r1=77409&r2=77410&view=diff ============================================================================== --- llvm/trunk/lib/AsmParser/LLParser.h (original) +++ llvm/trunk/lib/AsmParser/LLParser.h Tue Jul 28 19:34:02 2009 @@ -148,6 +148,7 @@ bool HasLinkage, unsigned Visibility); bool ParseAlias(const std::string &Name, LocTy Loc, unsigned Visibility); bool ParseStandaloneMetadata(); + bool ParseNamedMetadata(); bool ParseMDString(MetadataBase *&S); bool ParseMDNode(MetadataBase *&N); Modified: llvm/trunk/lib/AsmParser/LLToken.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/AsmParser/LLToken.h?rev=77410&r1=77409&r2=77410&view=diff ============================================================================== --- llvm/trunk/lib/AsmParser/LLToken.h (original) +++ llvm/trunk/lib/AsmParser/LLToken.h Tue Jul 28 19:34:02 2009 @@ -125,6 +125,7 @@ GlobalVar, // @foo @"foo" LocalVar, // %foo %"foo" StringConstant, // "foo" + NamedMD, // !foo // Metadata valued tokens. Metadata, // !"foo" !{i8 42} From clattner at apple.com Tue Jul 28 19:42:52 2009 From: clattner at apple.com (Chris Lattner) Date: Tue, 28 Jul 2009 17:42:52 -0700 Subject: [llvm-commits] [llvm] r77410 - in /llvm/trunk/lib/AsmParser: LLLexer.cpp LLLexer.h LLParser.cpp LLParser.h LLToken.h In-Reply-To: <200907290034.n6T0Y3hu020859@zion.cs.uiuc.edu> References: <200907290034.n6T0Y3hu020859@zion.cs.uiuc.edu> Message-ID: <212C59E5-1678-4F82-8966-8C253E506301@apple.com> On Jul 28, 2009, at 5:34 PM, Devang Patel wrote: > Author: dpatel > Date: Tue Jul 28 19:34:02 2009 > New Revision: 77410 > > URL: http://llvm.org/viewvc/llvm-project?rev=77410&view=rev > Log: > Parse named metadata. Hi Devang, NamedMDNode should go on an ilist maintained by Module, right? -Chris From evan.cheng at apple.com Tue Jul 28 19:43:40 2009 From: evan.cheng at apple.com (Evan Cheng) Date: Tue, 28 Jul 2009 17:43:40 -0700 Subject: [llvm-commits] [llvm] r77363 - in /llvm/trunk: lib/Target/ARM/ARMInstrThumb2.td test/CodeGen/Thumb2/thumb2-orn.ll test/CodeGen/Thumb2/thumb2-orn2.ll In-Reply-To: <305d6f60907281517i74190a77kaebe55f431cb5f0e@mail.gmail.com> References: <200907282051.n6SKpQJP013197@zion.cs.uiuc.edu> <8E7FD6A6-DB6A-442D-8AA4-C0FEDD3F23C5@apple.com> <491BE10B-5718-47EA-9F72-462FEE70FE9A@apple.com> <18401D0E-0E90-41B7-843E-9A9F088B1023@apple.com> <305d6f60907281428q2d615e5dj3b7c3d4585923f74@mail.gmail.com> <305d6f60907281517i74190a77kaebe55f431cb5f0e@mail.gmail.com> Message-ID: <71613F49-7449-4B81-B657-DDEAB3D3F575@apple.com> On Jul 28, 2009, at 3:17 PM, Sandeep Patel wrote: > I had just wanted to remind you that other uses of the ARM backend > exist, so it would be best to conditionalize Darwin-specific > workarounds when possible. That makes sense. Ok, we are in rapid development mode so we want to make progress. You guys can help us fix these kind of problems. Evan > > deep > > On Tue, Jul 28, 2009 at 10:12 PM, David Goodwin > wrote: >> Yes, I will remove the workaround soon. Is disabling ORN a problem? >> Thumb-2 doesn't yet work completely so I assume this (temporary and >> likely small) performance regression is not a big deal. >> >> David >> >> On Jul 28, 2009, at 2:28 PM, Sandeep Patel wrote: >> >>> Not to be a PITA about it, but this one also only applies to Darwin, >>> and if I read it correctly, pessimizes code. >>> >>> deep >>> >>> On Tue, Jul 28, 2009 at 9:01 PM, David >>> Goodwin wrote: >>>> I'll be good from now on... >>>> >>>> On Jul 28, 2009, at 1:59 PM, Eric Christopher wrote: >>>> >>>>> >>>>> On Jul 28, 2009, at 1:58 PM, David Goodwin wrote: >>>>> >>>>>> Another rdar in an llvm commit! Who is that loser? Anyway this is >>>>>> another case of an instruction not being recognized by Apple's >>>>>> assembler. I'll revert as soon as we get that fixed (should be >>>>>> soon). >>>>> >>>>> Could you maybe just put that in next time? :) >>>>> >>>>> Even I can't look at that radar ;) >>>>> >>>>> -eric >>>>> _______________________________________________ >>>>> llvm-commits mailing list >>>>> llvm-commits at cs.uiuc.edu >>>>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits >>>> >>>> _______________________________________________ >>>> llvm-commits mailing list >>>> llvm-commits at cs.uiuc.edu >>>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits >>>> >>> _______________________________________________ >>> llvm-commits mailing list >>> llvm-commits at cs.uiuc.edu >>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits >> >> _______________________________________________ >> llvm-commits mailing list >> llvm-commits at cs.uiuc.edu >> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits >> > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From isanbard at gmail.com Tue Jul 28 19:50:05 2009 From: isanbard at gmail.com (Bill Wendling) Date: Wed, 29 Jul 2009 00:50:05 -0000 Subject: [llvm-commits] [llvm] r77412 - /llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp Message-ID: <200907290050.n6T0o51m021405@zion.cs.uiuc.edu> Author: void Date: Tue Jul 28 19:50:05 2009 New Revision: 77412 URL: http://llvm.org/viewvc/llvm-project?rev=77412&view=rev Log: Move comment to above method. Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp?rev=77412&r1=77411&r2=77412&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp (original) +++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp Tue Jul 28 19:50:05 2009 @@ -235,27 +235,6 @@ } } -/// EmitExceptionTable - Emit landing pads and actions. -/// -/// The general organization of the table is complex, but the basic concepts are -/// easy. First there is a header which describes the location and organization -/// of the three components that follow. -/// -/// 1. The landing pad site information describes the range of code covered by -/// the try. In our case it's an accumulation of the ranges covered by the -/// invokes in the try. There is also a reference to the landing pad that -/// handles the exception once processed. Finally an index into the actions -/// table. -/// 2. The action table, in our case, is composed of pairs of type ids and next -/// action offset. Starting with the action index from the landing pad -/// site, each type Id is checked for a match to the current exception. If -/// it matches then the exception and type id are passed on to the landing -/// pad. Otherwise the next action is looked up. This chain is terminated -/// with a next action of zero. If no type id is found the the frame is -/// unwound and handling continues. -/// 3. Type id table contains references to all the C++ typeinfo for all -/// catches in the function. This tables is reversed indexed base 1. - /// SharedTypeIds - How many leading type ids two landing pads have in common. unsigned DwarfException::SharedTypeIds(const LandingPadInfo *L, const LandingPadInfo *R) { @@ -470,6 +449,26 @@ } } +/// EmitExceptionTable - Emit landing pads and actions. +/// +/// The general organization of the table is complex, but the basic concepts are +/// easy. First there is a header which describes the location and organization +/// of the three components that follow. +/// +/// 1. The landing pad site information describes the range of code covered by +/// the try. In our case it's an accumulation of the ranges covered by the +/// invokes in the try. There is also a reference to the landing pad that +/// handles the exception once processed. Finally an index into the actions +/// table. +/// 2. The action table, in our case, is composed of pairs of type ids and next +/// action offset. Starting with the action index from the landing pad +/// site, each type Id is checked for a match to the current exception. If +/// it matches then the exception and type id are passed on to the landing +/// pad. Otherwise the next action is looked up. This chain is terminated +/// with a next action of zero. If no type id is found the the frame is +/// unwound and handling continues. +/// 3. Type id table contains references to all the C++ typeinfo for all +/// catches in the function. This tables is reversed indexed base 1. void DwarfException::EmitExceptionTable() { const std::vector &TypeInfos = MMI->getTypeInfos(); const std::vector &FilterIds = MMI->getFilterIds(); @@ -554,6 +553,7 @@ Asm->EOL("LPStart format (DW_EH_PE_omit)"); #if 0 + // FIXME: This should default to what the system wants, not just "absptr". if (!TypeInfos.empty() || !FilterIds.empty()) { Asm->EmitInt8(TAI->PreferredEHDataFormat(DwarfEncoding::Data, true)); // FIXME: The comment here should correspond with what PreferredEHDataFormat From echristo at apple.com Tue Jul 28 19:51:16 2009 From: echristo at apple.com (Eric Christopher) Date: Wed, 29 Jul 2009 00:51:16 -0000 Subject: [llvm-commits] [llvm] r77413 - /llvm/trunk/test/CodeGen/X86/sse41.ll Message-ID: <200907290051.n6T0pGAX021450@zion.cs.uiuc.edu> Author: echristo Date: Tue Jul 28 19:51:15 2009 New Revision: 77413 URL: http://llvm.org/viewvc/llvm-project?rev=77413&view=rev Log: Add a couple more tests for the ptest intrinsics to make sure we're grabbing them all correctly. Modified: llvm/trunk/test/CodeGen/X86/sse41.ll Modified: llvm/trunk/test/CodeGen/X86/sse41.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/sse41.ll?rev=77413&r1=77412&r2=77413&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/X86/sse41.ll (original) +++ llvm/trunk/test/CodeGen/X86/sse41.ll Tue Jul 28 19:51:15 2009 @@ -195,5 +195,32 @@ ; X64: sete %al } +define i32 @ptestz_2(<4 x float> %t1, <4 x float> %t2) nounwind { + %tmp1 = call i32 @llvm.x86.sse41.ptestc(<4 x float> %t1, <4 x float> %t2) nounwind readnone + ret i32 %tmp1 +; X32: _ptestz_2: +; X32: ptest %xmm1, %xmm0 +; X32: setb %al + +; X64: _ptestz_2: +; X64: ptest %xmm1, %xmm0 +; X64: setb %al +} + +define i32 @ptestz_3(<4 x float> %t1, <4 x float> %t2) nounwind { + %tmp1 = call i32 @llvm.x86.sse41.ptestnzc(<4 x float> %t1, <4 x float> %t2) nounwind readnone + ret i32 %tmp1 +; X32: _ptestz_3: +; X32: ptest %xmm1, %xmm0 +; X32: seta %al + +; X64: _ptestz_3: +; X64: ptest %xmm1, %xmm0 +; X64: seta %al +} + + declare i32 @llvm.x86.sse41.ptestz(<4 x float>, <4 x float>) nounwind readnone +declare i32 @llvm.x86.sse41.ptestc(<4 x float>, <4 x float>) nounwind readnone +declare i32 @llvm.x86.sse41.ptestnzc(<4 x float>, <4 x float>) nounwind readnone From isanbard at gmail.com Tue Jul 28 19:59:34 2009 From: isanbard at gmail.com (Bill Wendling) Date: Wed, 29 Jul 2009 00:59:34 -0000 Subject: [llvm-commits] [llvm] r77414 - in /llvm/trunk/lib/Target: PowerPC/PPCTargetAsmInfo.cpp X86/X86TargetAsmInfo.cpp Message-ID: <200907290059.n6T0xYQ9021697@zion.cs.uiuc.edu> Author: void Date: Tue Jul 28 19:59:34 2009 New Revision: 77414 URL: http://llvm.org/viewvc/llvm-project?rev=77414&view=rev Log: Change the "PreferredEHDataFormat" from "absptr" if we're on a Darwin system > Leopard. Modified: llvm/trunk/lib/Target/PowerPC/PPCTargetAsmInfo.cpp llvm/trunk/lib/Target/X86/X86TargetAsmInfo.cpp Modified: llvm/trunk/lib/Target/PowerPC/PPCTargetAsmInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/PPCTargetAsmInfo.cpp?rev=77414&r1=77413&r2=77414&view=diff ============================================================================== --- llvm/trunk/lib/Target/PowerPC/PPCTargetAsmInfo.cpp (original) +++ llvm/trunk/lib/Target/PowerPC/PPCTargetAsmInfo.cpp Tue Jul 28 19:59:34 2009 @@ -41,12 +41,16 @@ unsigned PPCDarwinTargetAsmInfo::PreferredEHDataFormat(DwarfEncoding::Target Reason, bool Global) const { - if ((Reason == DwarfEncoding::Data || Reason == DwarfEncoding::Functions) - && Global) - return DW_EH_PE_pcrel | DW_EH_PE_indirect | DW_EH_PE_sdata4; + const PPCSubtarget *Subtarget = &TM.getSubtarget(); - if (Reason == DwarfEncoding::CodeLabels || !Global) - return DW_EH_PE_pcrel; + if (Subtarget->getDarwinVers() > 9) { + if ((Reason == DwarfEncoding::Data || Reason == DwarfEncoding::Functions) + && Global) + return DW_EH_PE_pcrel | DW_EH_PE_indirect | DW_EH_PE_sdata4; + + if (Reason == DwarfEncoding::CodeLabels || !Global) + return DW_EH_PE_pcrel; + } return DW_EH_PE_absptr; } Modified: llvm/trunk/lib/Target/X86/X86TargetAsmInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86TargetAsmInfo.cpp?rev=77414&r1=77413&r2=77414&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86TargetAsmInfo.cpp (original) +++ llvm/trunk/lib/Target/X86/X86TargetAsmInfo.cpp Tue Jul 28 19:59:34 2009 @@ -94,12 +94,16 @@ unsigned X86DarwinTargetAsmInfo::PreferredEHDataFormat(DwarfEncoding::Target Reason, bool Global) const { - if ((Reason == DwarfEncoding::Data || Reason == DwarfEncoding::Functions) - && Global) - return DW_EH_PE_pcrel | DW_EH_PE_indirect | DW_EH_PE_sdata4; + const X86Subtarget *Subtarget = &TM.getSubtarget(); - if (Reason == DwarfEncoding::CodeLabels || !Global) - return DW_EH_PE_pcrel; + if (Subtarget->getDarwinVers() > 9) { + if ((Reason == DwarfEncoding::Data || Reason == DwarfEncoding::Functions) + && Global) + return DW_EH_PE_pcrel | DW_EH_PE_indirect | DW_EH_PE_sdata4; + + if (Reason == DwarfEncoding::CodeLabels || !Global) + return DW_EH_PE_pcrel; + } return DW_EH_PE_absptr; } From echristo at apple.com Tue Jul 28 20:01:20 2009 From: echristo at apple.com (Eric Christopher) Date: Wed, 29 Jul 2009 01:01:20 -0000 Subject: [llvm-commits] [llvm] r77415 - /llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Message-ID: <200907290101.n6T11KFx021759@zion.cs.uiuc.edu> Author: echristo Date: Tue Jul 28 20:01:19 2009 New Revision: 77415 URL: http://llvm.org/viewvc/llvm-project?rev=77415&view=rev Log: Fix comment. 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=77415&r1=77414&r2=77415&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original) +++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Tue Jul 28 20:01:19 2009 @@ -6201,8 +6201,8 @@ return DAG.getNode(ISD::ZERO_EXTEND, dl, MVT::i32, SetCC); } // ptest intrinsics. The intrinsic these come from are designed to return - // a boolean value, not just an instruction so lower it to the ptest - // pattern and a conditional move to the result. + // an integer value, not just an instruction so lower it to the ptest + // pattern and a setcc for the result. case Intrinsic::x86_sse41_ptestz: case Intrinsic::x86_sse41_ptestc: case Intrinsic::x86_sse41_ptestnzc:{ From evan.cheng at apple.com Tue Jul 28 20:57:19 2009 From: evan.cheng at apple.com (Evan Cheng) Date: Tue, 28 Jul 2009 18:57:19 -0700 Subject: [llvm-commits] [llvm] r77407 - in /llvm/trunk: include/llvm/IntrinsicsX86.td lib/Target/X86/X86ISelLowering.cpp lib/Target/X86/X86ISelLowering.h lib/Target/X86/X86InstrSSE.td test/CodeGen/X86/sse41.ll In-Reply-To: <200907290028.n6T0S6VU020655@zion.cs.uiuc.edu> References: <200907290028.n6T0S6VU020655@zion.cs.uiuc.edu> Message-ID: <4014B4D6-8F63-411E-8760-49A96A289D24@apple.com> Is there a way to make use of ptest for non-intrinsic form of comparison of two SSE values? Evan On Jul 28, 2009, at 5:28 PM, Eric Christopher wrote: > Author: echristo > Date: Tue Jul 28 19:28:05 2009 > New Revision: 77407 > > URL: http://llvm.org/viewvc/llvm-project?rev=77407&view=rev > Log: > Add support for gcc __builtin_ia32_ptest{z,c,nzc} intrinsics. Lower > to ptest instruction plus setcc. Revamp ptest instruction. Add test. > > Modified: > llvm/trunk/include/llvm/IntrinsicsX86.td > llvm/trunk/lib/Target/X86/X86ISelLowering.cpp > llvm/trunk/lib/Target/X86/X86ISelLowering.h > llvm/trunk/lib/Target/X86/X86InstrSSE.td > llvm/trunk/test/CodeGen/X86/sse41.ll > > Modified: llvm/trunk/include/llvm/IntrinsicsX86.td > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/IntrinsicsX86.td?rev=77407&r1=77406&r2=77407&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/include/llvm/IntrinsicsX86.td (original) > +++ llvm/trunk/include/llvm/IntrinsicsX86.td Tue Jul 28 19:28:05 2009 > @@ -864,6 +864,18 @@ > Intrinsic<[llvm_v2i64_ty], [llvm_ptr_ty], [IntrReadMem]>; > } > > +// Test instruction with bitwise comparison. > +let TargetPrefix = "x86" in { // All intrinsics start with > "llvm.x86.". > + def int_x86_sse41_ptestz : > GCCBuiltin<"__builtin_ia32_ptestz128">, > + Intrinsic<[llvm_i32_ty], [llvm_v4f32_ty, llvm_v4f32_ty], > + [IntrNoMem]>; > + def int_x86_sse41_ptestc : > GCCBuiltin<"__builtin_ia32_ptestc128">, > + Intrinsic<[llvm_i32_ty], [llvm_v4f32_ty, llvm_v4f32_ty], > + [IntrNoMem]>; > + def int_x86_sse41_ptestnzc : > GCCBuiltin<"__builtin_ia32_ptestnzc128">, > + Intrinsic<[llvm_i32_ty], [llvm_v4f32_ty, llvm_v4f32_ty], > + [IntrNoMem]>; > +} > > // > = > = > = > ----------------------------------------------------------------------= > ==// > // MMX > > Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.cpp?rev=77407&r1=77406&r2=77407&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original) > +++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Tue Jul 28 > 19:28:05 2009 > @@ -6200,6 +6200,36 @@ > DAG.getConstant(X86CC, MVT::i8), > Cond); > return DAG.getNode(ISD::ZERO_EXTEND, dl, MVT::i32, SetCC); > } > + // ptest intrinsics. The intrinsic these come from are designed > to return > + // a boolean value, not just an instruction so lower it to the > ptest > + // pattern and a conditional move to the result. > + case Intrinsic::x86_sse41_ptestz: > + case Intrinsic::x86_sse41_ptestc: > + case Intrinsic::x86_sse41_ptestnzc:{ > + unsigned X86CC = 0; > + switch (IntNo) { > + default: break; > + case Intrinsic::x86_sse41_ptestz: > + // ZF = 1 > + X86CC = X86::COND_E; > + break; > + case Intrinsic::x86_sse41_ptestc: > + // CF = 1 > + X86CC = X86::COND_B; > + break; > + case Intrinsic::x86_sse41_ptestnzc: > + // ZF and CF = 0 > + X86CC = X86::COND_A; > + break; > + } > + > + SDValue LHS = Op.getOperand(1); > + SDValue RHS = Op.getOperand(2); > + SDValue Test = DAG.getNode(X86ISD::PTEST, dl, MVT::i32, LHS, > RHS); > + SDValue CC = DAG.getConstant(X86CC, MVT::i8); > + SDValue SetCC = DAG.getNode(X86ISD::SETCC, dl, MVT::i8, CC, > Test); > + return DAG.getNode(ISD::ZERO_EXTEND, dl, MVT::i32, SetCC); > + } > > // Fix vector shift instructions where the last operand is a non- > immediate > // i32 value. > @@ -7048,6 +7078,7 @@ > case X86ISD::INC: return "X86ISD::INC"; > case X86ISD::DEC: return "X86ISD::DEC"; > case X86ISD::MUL_IMM: return "X86ISD::MUL_IMM"; > + case X86ISD::PTEST: return "X86ISD::PTEST"; > } > } > > > Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.h > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.h?rev=77407&r1=77406&r2=77407&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/lib/Target/X86/X86ISelLowering.h (original) > +++ llvm/trunk/lib/Target/X86/X86ISelLowering.h Tue Jul 28 19:28:05 > 2009 > @@ -244,7 +244,10 @@ > INC, DEC, > > // MUL_IMM - X86 specific multiply by immediate. > - MUL_IMM > + MUL_IMM, > + > + // PTEST - Vector bitwise comparisons > + PTEST > }; > } > > > Modified: llvm/trunk/lib/Target/X86/X86InstrSSE.td > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86InstrSSE.td?rev=77407&r1=77406&r2=77407&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/lib/Target/X86/X86InstrSSE.td (original) > +++ llvm/trunk/lib/Target/X86/X86InstrSSE.td Tue Jul 28 19:28:05 2009 > @@ -69,6 +69,9 @@ > def X86pcmpgtd : SDNode<"X86ISD::PCMPGTD", SDTIntBinOp>; > def X86pcmpgtq : SDNode<"X86ISD::PCMPGTQ", SDTIntBinOp>; > > +def SDTX86CmpPTest : SDTypeProfile<0, 2, [SDTCisVT<0, v4f32>, > SDTCisVT<1, v4f32>]>; > +def X86ptest : SDNode<"X86ISD::PTEST", SDTX86CmpPTest>; > + > // > = > = > = > ----------------------------------------------------------------------= > ==// > // SSE Complex Patterns > // > = > = > = > ----------------------------------------------------------------------= > ==// > @@ -3618,11 +3621,17 @@ > def : Pat<(int_x86_sse41_insertps VR128:$src1, VR128:$src2, imm: > $src3), > (INSERTPSrr VR128:$src1, VR128:$src2, imm:$src3)>; > > +// ptest instruction we'll lower to this in X86ISelLowering > primarily from > +// the intel intrinsic that corresponds to this. > let Defs = [EFLAGS] in { > def PTESTrr : SS48I<0x17, MRMSrcReg, (outs), (ins VR128:$src1, > VR128:$src2), > - "ptest \t{$src2, $src1|$src1, $src2}", []>, > OpSize; > + "ptest \t{$src2, $src1|$src1, $src2}", > + [(X86ptest VR128:$src1, VR128:$src2), > + (implicit EFLAGS)]>, OpSize; > def PTESTrm : SS48I<0x17, MRMSrcMem, (outs), (ins VR128:$src1, > i128mem:$src2), > - "ptest \t{$src2, $src1|$src1, $src2}", []>, > OpSize; > + "ptest \t{$src2, $src1|$src1, $src2}", > + [(X86ptest VR128:$src1, (load addr:$src2)), > + (implicit EFLAGS)]>, OpSize; > } > > def MOVNTDQArm : SS48I<0x2A, MRMSrcMem, (outs VR128:$dst), (ins > i128mem:$src), > > Modified: llvm/trunk/test/CodeGen/X86/sse41.ll > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/sse41.ll?rev=77407&r1=77406&r2=77407&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/test/CodeGen/X86/sse41.ll (original) > +++ llvm/trunk/test/CodeGen/X86/sse41.ll Tue Jul 28 19:28:05 2009 > @@ -181,4 +181,19 @@ > > ; X64: _insertps_3: > ; X64: insertps $0, %xmm1, %xmm0 > -} > \ No newline at end of file > +} > + > +define i32 @ptestz_1(<4 x float> %t1, <4 x float> %t2) nounwind { > + %tmp1 = call i32 @llvm.x86.sse41.ptestz(<4 x float> %t1, <4 > x float> %t2) nounwind readnone > + ret i32 %tmp1 > +; X32: _ptestz_1: > +; X32: ptest %xmm1, %xmm0 > +; X32: sete %al > + > +; X64: _ptestz_1: > +; X64: ptest %xmm1, %xmm0 > +; X64: sete %al > +} > + > +declare i32 @llvm.x86.sse41.ptestz(<4 x float>, <4 x float>) > nounwind readnone > + > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From echristo at apple.com Tue Jul 28 21:04:25 2009 From: echristo at apple.com (Eric Christopher) Date: Tue, 28 Jul 2009 19:04:25 -0700 Subject: [llvm-commits] [llvm] r77407 - in /llvm/trunk: include/llvm/IntrinsicsX86.td lib/Target/X86/X86ISelLowering.cpp lib/Target/X86/X86ISelLowering.h lib/Target/X86/X86InstrSSE.td test/CodeGen/X86/sse41.ll In-Reply-To: <4014B4D6-8F63-411E-8760-49A96A289D24@apple.com> References: <200907290028.n6T0S6VU020655@zion.cs.uiuc.edu> <4014B4D6-8F63-411E-8760-49A96A289D24@apple.com> Message-ID: <945A54B8-2176-4A39-AF93-805E42793E32@apple.com> On Jul 28, 2009, at 6:57 PM, Evan Cheng wrote: > Is there a way to make use of ptest for non-intrinsic form of > comparison of two SSE values? Qualified yes. I'm trying to figure out how to make this work for things like an & of two SSE values or the other two, just not sure how to do it yet. Another quick optimization that Dan suggested was trying to optimize code that looks like this: #include int foo (__m128i a, __m128i b) { if (_mm_testz_si128(a, b) != 0) return 4; return 8; } where we should be able to get rid of the extra (bonus!) setcc that we've got in the generated code (cruft removed): _foo: ptest %xmm1, %xmm0 sete %al movzbl %al, %eax testl %eax, %eax sete %al movzbl %al, %eax leal 4(,%eax,4), %eax ret Honestly it's the movzbl instructions that irritate me the most, but there's no setcc that will set an entire register :( -eric From devang.patel at gmail.com Tue Jul 28 21:05:56 2009 From: devang.patel at gmail.com (Devang Patel) Date: Tue, 28 Jul 2009 19:05:56 -0700 Subject: [llvm-commits] [llvm] r77410 - in /llvm/trunk/lib/AsmParser: LLLexer.cpp LLLexer.h LLParser.cpp LLParser.h LLToken.h In-Reply-To: <212C59E5-1678-4F82-8966-8C253E506301@apple.com> References: <200907290034.n6T0Y3hu020859@zion.cs.uiuc.edu> <212C59E5-1678-4F82-8966-8C253E506301@apple.com> Message-ID: <352a1fb20907281905r4a68f15o9b11ace33148ad64@mail.gmail.com> On Tue, Jul 28, 2009 at 5:42 PM, Chris Lattner wrote: > > On Jul 28, 2009, at 5:34 PM, Devang Patel wrote: > >> Author: dpatel >> Date: Tue Jul 28 19:34:02 2009 >> New Revision: 77410 >> >> URL: http://llvm.org/viewvc/llvm-project?rev=77410&view=rev >> Log: >> Parse named metadata. > > Hi Devang, > > NamedMDNode should go on an ilist maintained by Module, right? I am planning to use StringMap so that it is easier to search by name. - Devang From evan.cheng at apple.com Tue Jul 28 21:09:54 2009 From: evan.cheng at apple.com (Evan Cheng) Date: Tue, 28 Jul 2009 19:09:54 -0700 Subject: [llvm-commits] [llvm] r77407 - in /llvm/trunk: include/llvm/IntrinsicsX86.td lib/Target/X86/X86ISelLowering.cpp lib/Target/X86/X86ISelLowering.h lib/Target/X86/X86InstrSSE.td test/CodeGen/X86/sse41.ll In-Reply-To: <945A54B8-2176-4A39-AF93-805E42793E32@apple.com> References: <200907290028.n6T0S6VU020655@zion.cs.uiuc.edu> <4014B4D6-8F63-411E-8760-49A96A289D24@apple.com> <945A54B8-2176-4A39-AF93-805E42793E32@apple.com> Message-ID: Ok, I'll stop bugging you and let you figure all it out. :-) Evan On Jul 28, 2009, at 7:04 PM, Eric Christopher wrote: > > On Jul 28, 2009, at 6:57 PM, Evan Cheng wrote: > >> Is there a way to make use of ptest for non-intrinsic form of >> comparison of two SSE values? > > Qualified yes. I'm trying to figure out how to make this work for > things like an & of two SSE values or the other two, just not sure how > to do it yet. > > Another quick optimization that Dan suggested was trying to optimize > code that looks like this: > > #include > > int foo (__m128i a, __m128i b) > { > if (_mm_testz_si128(a, b) != 0) return 4; > > return 8; > } > > where we should be able to get rid of the extra (bonus!) setcc that > we've got in the generated code (cruft removed): > > _foo: > ptest %xmm1, %xmm0 > sete %al > movzbl %al, %eax > testl %eax, %eax > sete %al > movzbl %al, %eax > leal 4(,%eax,4), %eax > ret > > Honestly it's the movzbl instructions that irritate me the most, but > there's no setcc that will set an entire register :( > > -eric > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From echristo at apple.com Tue Jul 28 21:11:08 2009 From: echristo at apple.com (Eric Christopher) Date: Tue, 28 Jul 2009 19:11:08 -0700 Subject: [llvm-commits] [llvm] r77407 - in /llvm/trunk: include/llvm/IntrinsicsX86.td lib/Target/X86/X86ISelLowering.cpp lib/Target/X86/X86ISelLowering.h lib/Target/X86/X86InstrSSE.td test/CodeGen/X86/sse41.ll In-Reply-To: References: <200907290028.n6T0S6VU020655@zion.cs.uiuc.edu> <4014B4D6-8F63-411E-8760-49A96A289D24@apple.com> <945A54B8-2176-4A39-AF93-805E42793E32@apple.com> Message-ID: <4D8454AF-7B97-4058-BA86-94E401ABF4AD@apple.com> On Jul 28, 2009, at 7:09 PM, Evan Cheng wrote: > Ok, I'll stop bugging you and let you figure all it out. :-) Hey man, magical answers from on high are always welcome ;) -eric From evan.cheng at apple.com Tue Jul 28 21:18:14 2009 From: evan.cheng at apple.com (Evan Cheng) Date: Wed, 29 Jul 2009 02:18:14 -0000 Subject: [llvm-commits] [llvm] r77422 - in /llvm/trunk: lib/Target/ARM/ARMConstantIslandPass.cpp lib/Target/ARM/ARMISelLowering.cpp lib/Target/ARM/ARMISelLowering.h lib/Target/ARM/ARMInstrInfo.td lib/Target/ARM/ARMInstrThumb2.td lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp lib/Target/ARM/Thumb2InstrInfo.cpp test/CodeGen/Thumb2/thumb2-jtbl.ll test/CodeGen/Thumb2/thumb2-tbb.ll test/CodeGen/Thumb2/thumb2-tbh.ll Message-ID: <200907290218.n6T2IFM9024263@zion.cs.uiuc.edu> Author: evancheng Date: Tue Jul 28 21:18:14 2009 New Revision: 77422 URL: http://llvm.org/viewvc/llvm-project?rev=77422&view=rev Log: Optimize Thumb2 jumptable to use tbb / tbh when all the offsets fit in byte / halfword. Added: llvm/trunk/test/CodeGen/Thumb2/thumb2-tbb.ll - copied, changed from r77364, llvm/trunk/test/CodeGen/Thumb2/thumb2-jtbl.ll llvm/trunk/test/CodeGen/Thumb2/thumb2-tbh.ll Removed: llvm/trunk/test/CodeGen/Thumb2/thumb2-jtbl.ll Modified: llvm/trunk/lib/Target/ARM/ARMConstantIslandPass.cpp llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp llvm/trunk/lib/Target/ARM/ARMISelLowering.h llvm/trunk/lib/Target/ARM/ARMInstrInfo.td llvm/trunk/lib/Target/ARM/ARMInstrThumb2.td llvm/trunk/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp llvm/trunk/lib/Target/ARM/Thumb2InstrInfo.cpp Modified: llvm/trunk/lib/Target/ARM/ARMConstantIslandPass.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMConstantIslandPass.cpp?rev=77422&r1=77421&r2=77422&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMConstantIslandPass.cpp (original) +++ llvm/trunk/lib/Target/ARM/ARMConstantIslandPass.cpp Tue Jul 28 21:18:14 2009 @@ -21,6 +21,7 @@ #include "llvm/CodeGen/MachineConstantPool.h" #include "llvm/CodeGen/MachineFunctionPass.h" #include "llvm/CodeGen/MachineInstrBuilder.h" +#include "llvm/CodeGen/MachineJumpTableInfo.h" #include "llvm/Target/TargetData.h" #include "llvm/Target/TargetMachine.h" #include "llvm/Support/Compiler.h" @@ -35,6 +36,7 @@ STATISTIC(NumSplit, "Number of uncond branches inserted"); STATISTIC(NumCBrFixed, "Number of cond branches fixed"); STATISTIC(NumUBrFixed, "Number of uncond branches fixed"); +STATISTIC(NumTBs, "Number of table branches generated"); namespace { /// ARMConstantIslands - Due to limited PC-relative displacements, ARM @@ -122,6 +124,9 @@ /// SmallVector PushPopMIs; + /// T2JumpTables - Keep track of all the Thumb2 jumptable instructions. + SmallVector T2JumpTables; + /// HasFarJump - True if any far jump instruction has been emitted during /// the branch fix up pass. bool HasFarJump; @@ -135,17 +140,17 @@ static char ID; ARMConstantIslands() : MachineFunctionPass(&ID) {} - virtual bool runOnMachineFunction(MachineFunction &Fn); + virtual bool runOnMachineFunction(MachineFunction &MF); virtual const char *getPassName() const { return "ARM constant island placement and branch shortening pass"; } private: - void DoInitialPlacement(MachineFunction &Fn, + void DoInitialPlacement(MachineFunction &MF, std::vector &CPEMIs); CPEntry *findConstPoolEntry(unsigned CPI, const MachineInstr *CPEMI); - void InitialFunctionScan(MachineFunction &Fn, + void InitialFunctionScan(MachineFunction &MF, const std::vector &CPEMIs); MachineBasicBlock *SplitBlockBeforeInstr(MachineInstr *MI); void UpdateForInsertedWaterBlock(MachineBasicBlock *NewBB); @@ -158,7 +163,7 @@ std::vector::iterator IP); void CreateNewWater(unsigned CPUserIndex, unsigned UserOffset, MachineBasicBlock** NewMBB); - bool HandleConstantPoolUser(MachineFunction &Fn, unsigned CPUserIndex); + bool HandleConstantPoolUser(MachineFunction &MF, unsigned CPUserIndex); void RemoveDeadCPEMI(MachineInstr *CPEMI); bool RemoveUnusedCPEntries(); bool CPEIsInRange(MachineInstr *MI, unsigned UserOffset, @@ -169,27 +174,28 @@ bool OffsetIsInRange(unsigned UserOffset, unsigned TrialOffset, unsigned Disp, bool NegativeOK, bool IsSoImm = false); bool BBIsInRange(MachineInstr *MI, MachineBasicBlock *BB, unsigned Disp); - bool FixUpImmediateBr(MachineFunction &Fn, ImmBranch &Br); - bool FixUpConditionalBr(MachineFunction &Fn, ImmBranch &Br); - bool FixUpUnconditionalBr(MachineFunction &Fn, ImmBranch &Br); + bool FixUpImmediateBr(MachineFunction &MF, ImmBranch &Br); + bool FixUpConditionalBr(MachineFunction &MF, ImmBranch &Br); + bool FixUpUnconditionalBr(MachineFunction &MF, ImmBranch &Br); bool UndoLRSpillRestore(); + bool OptimizeThumb2JumpTables(MachineFunction &MF); unsigned GetOffsetOf(MachineInstr *MI) const; void dumpBBs(); - void verify(MachineFunction &Fn); + void verify(MachineFunction &MF); }; char ARMConstantIslands::ID = 0; } /// verify - check BBOffsets, BBSizes, alignment of islands -void ARMConstantIslands::verify(MachineFunction &Fn) { +void ARMConstantIslands::verify(MachineFunction &MF) { assert(BBOffsets.size() == BBSizes.size()); for (unsigned i = 1, e = BBOffsets.size(); i != e; ++i) assert(BBOffsets[i-1]+BBSizes[i-1] == BBOffsets[i]); if (!isThumb) return; #ifndef NDEBUG - for (MachineFunction::iterator MBBI = Fn.begin(), E = Fn.end(); + for (MachineFunction::iterator MBBI = MF.begin(), E = MF.end(); MBBI != E; ++MBBI) { MachineBasicBlock *MBB = MBBI; if (!MBB->empty() && @@ -216,11 +222,11 @@ return new ARMConstantIslands(); } -bool ARMConstantIslands::runOnMachineFunction(MachineFunction &Fn) { - MachineConstantPool &MCP = *Fn.getConstantPool(); +bool ARMConstantIslands::runOnMachineFunction(MachineFunction &MF) { + MachineConstantPool &MCP = *MF.getConstantPool(); - TII = Fn.getTarget().getInstrInfo(); - AFI = Fn.getInfo(); + TII = MF.getTarget().getInstrInfo(); + AFI = MF.getInfo(); isThumb = AFI->isThumbFunction(); isThumb1 = AFI->isThumb1OnlyFunction(); isThumb2 = AFI->isThumb2Function(); @@ -229,7 +235,7 @@ // Renumber all of the machine basic blocks in the function, guaranteeing that // the numbers agree with the position of the block in the function. - Fn.RenumberBlocks(); + MF.RenumberBlocks(); // Thumb1 functions containing constant pools get 2-byte alignment. // This is so we can keep exact track of where the alignment padding goes. @@ -242,7 +248,7 @@ // we put them all at the end of the function. std::vector CPEMIs; if (!MCP.isEmpty()) { - DoInitialPlacement(Fn, CPEMIs); + DoInitialPlacement(MF, CPEMIs); if (isThumb1) AFI->setAlign(2U); } @@ -253,7 +259,7 @@ // Do the initial scan of the function, building up information about the // sizes of each block, the location of all the water, and finding all of the // constant pool users. - InitialFunctionScan(Fn, CPEMIs); + InitialFunctionScan(MF, CPEMIs); CPEMIs.clear(); /// Remove dead constant pool entries. @@ -265,10 +271,10 @@ while (true) { bool Change = false; for (unsigned i = 0, e = CPUsers.size(); i != e; ++i) - Change |= HandleConstantPoolUser(Fn, i); + Change |= HandleConstantPoolUser(MF, i); DEBUG(dumpBBs()); for (unsigned i = 0, e = ImmBranches.size(); i != e; ++i) - Change |= FixUpImmediateBr(Fn, ImmBranches[i]); + Change |= FixUpImmediateBr(MF, ImmBranches[i]); DEBUG(dumpBBs()); if (!Change) break; @@ -276,13 +282,16 @@ } // After a while, this might be made debug-only, but it is not expensive. - verify(Fn); + verify(MF); // If LR has been forced spilled and no far jumps (i.e. BL) has been issued. // Undo the spill / restore of LR if possible. - if (!HasFarJump && AFI->isLRSpilledForFarJump() && isThumb) + if (isThumb && !HasFarJump && AFI->isLRSpilledForFarJump()) MadeChange |= UndoLRSpillRestore(); + // Let's see if we can use tbb / tbh to do jump tables. + MadeChange |= OptimizeThumb2JumpTables(MF); + BBSizes.clear(); BBOffsets.clear(); WaterList.clear(); @@ -290,24 +299,25 @@ CPEntries.clear(); ImmBranches.clear(); PushPopMIs.clear(); + T2JumpTables.clear(); return MadeChange; } /// DoInitialPlacement - Perform the initial placement of the constant pool /// entries. To start with, we put them all at the end of the function. -void ARMConstantIslands::DoInitialPlacement(MachineFunction &Fn, +void ARMConstantIslands::DoInitialPlacement(MachineFunction &MF, std::vector &CPEMIs) { // Create the basic block to hold the CPE's. - MachineBasicBlock *BB = Fn.CreateMachineBasicBlock(); - Fn.push_back(BB); + MachineBasicBlock *BB = MF.CreateMachineBasicBlock(); + MF.push_back(BB); // Add all of the constants from the constant pool to the end block, use an // identity mapping of CPI's to CPE's. const std::vector &CPs = - Fn.getConstantPool()->getConstants(); + MF.getConstantPool()->getConstants(); - const TargetData &TD = *Fn.getTarget().getTargetData(); + const TargetData &TD = *MF.getTarget().getTargetData(); for (unsigned i = 0, e = CPs.size(); i != e; ++i) { unsigned Size = TD.getTypeAllocSize(CPs[i].getType()); // Verify that all constant pool entries are a multiple of 4 bytes. If not, @@ -363,10 +373,10 @@ /// InitialFunctionScan - Do the initial scan of the function, building up /// information about the sizes of each block, the location of all the water, /// and finding all of the constant pool users. -void ARMConstantIslands::InitialFunctionScan(MachineFunction &Fn, +void ARMConstantIslands::InitialFunctionScan(MachineFunction &MF, const std::vector &CPEMIs) { unsigned Offset = 0; - for (MachineFunction::iterator MBBI = Fn.begin(), E = Fn.end(); + for (MachineFunction::iterator MBBI = MF.begin(), E = MF.end(); MBBI != E; ++MBBI) { MachineBasicBlock &MBB = *MBBI; @@ -388,15 +398,19 @@ unsigned Scale = 1; int UOpc = Opc; switch (Opc) { + default: + continue; // Ignore other JT branches case ARM::tBR_JTr: // A Thumb1 table jump may involve padding; for the offsets to // be right, functions containing these must be 4-byte aligned. AFI->setAlign(2U); if ((Offset+MBBSize)%4 != 0) + // FIXME: Add a pseudo ALIGN instruction instead. MBBSize += 2; // padding continue; // Does not get an entry in ImmBranches - default: - continue; // Ignore other JT branches + case ARM::t2BR_JT: + T2JumpTables.push_back(I); + continue; // Does not get an entry in ImmBranches case ARM::Bcc: isCond = true; UOpc = ARM::B; @@ -1041,7 +1055,7 @@ /// is out-of-range. If so, pick up the constant pool value and move it some /// place in-range. Return true if we changed any addresses (thus must run /// another pass of branch lengthening), false otherwise. -bool ARMConstantIslands::HandleConstantPoolUser(MachineFunction &Fn, +bool ARMConstantIslands::HandleConstantPoolUser(MachineFunction &MF, unsigned CPUserIndex) { CPUser &U = CPUsers[CPUserIndex]; MachineInstr *UserMI = U.MI; @@ -1074,8 +1088,8 @@ } // Okay, we know we can put an island before NewMBB now, do it! - MachineBasicBlock *NewIsland = Fn.CreateMachineBasicBlock(); - Fn.insert(NewMBB, NewIsland); + MachineBasicBlock *NewIsland = MF.CreateMachineBasicBlock(); + MF.insert(NewMBB, NewIsland); // Update internal data structures to account for the newly inserted MBB. UpdateForInsertedWaterBlock(NewIsland); @@ -1181,7 +1195,7 @@ /// FixUpImmediateBr - Fix up an immediate branch whose destination is too far /// away to fit in its displacement field. -bool ARMConstantIslands::FixUpImmediateBr(MachineFunction &Fn, ImmBranch &Br) { +bool ARMConstantIslands::FixUpImmediateBr(MachineFunction &MF, ImmBranch &Br) { MachineInstr *MI = Br.MI; MachineBasicBlock *DestBB = MI->getOperand(0).getMBB(); @@ -1190,8 +1204,8 @@ return false; if (!Br.isCond) - return FixUpUnconditionalBr(Fn, Br); - return FixUpConditionalBr(Fn, Br); + return FixUpUnconditionalBr(MF, Br); + return FixUpConditionalBr(MF, Br); } /// FixUpUnconditionalBr - Fix up an unconditional branch whose destination is @@ -1199,7 +1213,7 @@ /// spilled in the epilogue, then we can use BL to implement a far jump. /// Otherwise, add an intermediate branch instruction to a branch. bool -ARMConstantIslands::FixUpUnconditionalBr(MachineFunction &Fn, ImmBranch &Br) { +ARMConstantIslands::FixUpUnconditionalBr(MachineFunction &MF, ImmBranch &Br) { MachineInstr *MI = Br.MI; MachineBasicBlock *MBB = MI->getParent(); assert(isThumb && !isThumb2 && "Expected a Thumb1 function!"); @@ -1221,7 +1235,7 @@ /// far away to fit in its displacement field. It is converted to an inverse /// conditional branch + an unconditional branch to the destination. bool -ARMConstantIslands::FixUpConditionalBr(MachineFunction &Fn, ImmBranch &Br) { +ARMConstantIslands::FixUpConditionalBr(MachineFunction &MF, ImmBranch &Br) { MachineInstr *MI = Br.MI; MachineBasicBlock *DestBB = MI->getOperand(0).getMBB(); @@ -1320,3 +1334,95 @@ } return MadeChange; } + +bool ARMConstantIslands::OptimizeThumb2JumpTables(MachineFunction &MF) { + bool MadeChange = false; + + // FIXME: After the tables are shrunk, can we get rid some of the + // constantpool tables? + const MachineJumpTableInfo *MJTI = MF.getJumpTableInfo(); + const std::vector &JT = MJTI->getJumpTables(); + for (unsigned i = 0, e = T2JumpTables.size(); i != e; ++i) { + MachineInstr *MI = T2JumpTables[i]; + const TargetInstrDesc &TID = MI->getDesc(); + unsigned NumOps = TID.getNumOperands(); + unsigned JTOpIdx = NumOps - (TID.isPredicable() ? 3 : 2); + MachineOperand JTOP = MI->getOperand(JTOpIdx); + unsigned JTI = JTOP.getIndex(); + assert(JTI < JT.size()); + + bool ByteOk = true; + bool HalfWordOk = true; + unsigned JTOffset = GetOffsetOf(MI) + 4; + const std::vector &JTBBs = JT[JTI].MBBs; + for (unsigned j = 0, ee = JTBBs.size(); j != ee; ++j) { + MachineBasicBlock *MBB = JTBBs[j]; + unsigned DstOffset = BBOffsets[MBB->getNumber()]; + if (ByteOk && !OffsetIsInRange(JTOffset, DstOffset, (1<<8)-1, true, false)) + ByteOk = false; + if (HalfWordOk && + !OffsetIsInRange(JTOffset, DstOffset, (1<<16)-1, true, false)) + HalfWordOk = false; + if (!ByteOk && !HalfWordOk) + break; + } + + if (ByteOk || HalfWordOk) { + MachineBasicBlock *MBB = MI->getParent(); + unsigned BaseReg = MI->getOperand(0).getReg(); + bool BaseRegKill = MI->getOperand(0).isKill(); + if (!BaseRegKill) + continue; + unsigned IdxReg = MI->getOperand(1).getReg(); + bool IdxRegKill = MI->getOperand(1).isKill(); + MachineBasicBlock::iterator PrevI = MI; + if (PrevI == MBB->begin()) + continue; + + MachineInstr *AddrMI = --PrevI; + bool OptOk = true; + // Examine the instruction that calculate the jumptable entry address. + // If it's not the one just before the t2BR_JT, we won't delete it, then + // it's not worth doing the optimization. + for (unsigned k = 0, eee = AddrMI->getNumOperands(); k != eee; ++k) { + const MachineOperand &MO = AddrMI->getOperand(k); + if (!MO.isReg() || !MO.getReg()) + continue; + if (MO.isDef() && MO.getReg() != BaseReg) { + OptOk = false; + break; + } + if (MO.isUse() && !MO.isKill() && MO.getReg() != IdxReg) { + OptOk = false; + break; + } + } + if (!OptOk) + continue; + + // The previous instruction should be a t2LEApcrelJT, we want to delete + // it as well. + MachineInstr *LeaMI = --PrevI; + if (LeaMI->getOpcode() != ARM::t2LEApcrelJT || + LeaMI->getOperand(0).getReg() != BaseReg) + LeaMI = 0; + + if (OptOk) { + unsigned Opc = ByteOk ? ARM::t2TBB : ARM::t2TBH; + AddDefaultPred(BuildMI(MBB, MI->getDebugLoc(), TII->get(Opc)) + .addReg(IdxReg, getKillRegState(IdxRegKill)) + .addJumpTableIndex(JTI, JTOP.getTargetFlags()) + .addImm(MI->getOperand(JTOpIdx+1).getImm())); + + AddrMI->eraseFromParent(); + if (LeaMI) + LeaMI->eraseFromParent(); + MI->eraseFromParent(); + ++NumTBs; + MadeChange = true; + } + } + } + + return MadeChange; +} Modified: llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp?rev=77422&r1=77421&r2=77422&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp (original) +++ llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp Tue Jul 28 21:18:14 2009 @@ -409,6 +409,7 @@ case ARMISD::tCALL: return "ARMISD::tCALL"; case ARMISD::BRCOND: return "ARMISD::BRCOND"; case ARMISD::BR_JT: return "ARMISD::BR_JT"; + case ARMISD::BR2_JT: return "ARMISD::BR2_JT"; case ARMISD::RET_FLAG: return "ARMISD::RET_FLAG"; case ARMISD::PIC_ADD: return "ARMISD::PIC_ADD"; case ARMISD::CMP: return "ARMISD::CMP"; @@ -1718,7 +1719,8 @@ // which does another jump to the destination. This also makes it easier // to translate it to TBB / TBH later. // FIXME: This might not work if the function is extremely large. - return DAG.getNode(ARMISD::BR_JT, dl, MVT::Other, Chain, Addr, JTI, UId); + return DAG.getNode(ARMISD::BR2_JT, dl, MVT::Other, Chain, + Addr, Op.getOperand(2), JTI, UId); } if (getTargetMachine().getRelocationModel() == Reloc::PIC_) { Addr = DAG.getLoad((MVT)MVT::i32, dl, Chain, Addr, NULL, 0); Modified: llvm/trunk/lib/Target/ARM/ARMISelLowering.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMISelLowering.h?rev=77422&r1=77421&r2=77422&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMISelLowering.h (original) +++ llvm/trunk/lib/Target/ARM/ARMISelLowering.h Tue Jul 28 21:18:14 2009 @@ -40,6 +40,7 @@ tCALL, // Thumb function call. BRCOND, // Conditional branch. BR_JT, // Jumptable branch. + BR2_JT, // Jumptable branch (2 level - jumptable entry is a jump). RET_FLAG, // Return with a flag operand. PIC_ADD, // Add with a PC operand and a PIC label. Modified: llvm/trunk/lib/Target/ARM/ARMInstrInfo.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMInstrInfo.td?rev=77422&r1=77421&r2=77422&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMInstrInfo.td (original) +++ llvm/trunk/lib/Target/ARM/ARMInstrInfo.td Tue Jul 28 21:18:14 2009 @@ -34,6 +34,10 @@ [SDTCisPtrTy<0>, SDTCisVT<1, i32>, SDTCisVT<2, i32>]>; +def SDT_ARMBr2JT : SDTypeProfile<0, 4, + [SDTCisPtrTy<0>, SDTCisVT<1, i32>, + SDTCisVT<2, i32>, SDTCisVT<3, i32>]>; + def SDT_ARMCmp : SDTypeProfile<0, 2, [SDTCisSameAs<0, 1>]>; def SDT_ARMPICAdd : SDTypeProfile<1, 2, [SDTCisSameAs<0, 1>, @@ -71,6 +75,8 @@ def ARMbrjt : SDNode<"ARMISD::BR_JT", SDT_ARMBrJT, [SDNPHasChain]>; +def ARMbr2jt : SDNode<"ARMISD::BR2_JT", SDT_ARMBr2JT, + [SDNPHasChain]>; def ARMcmp : SDNode<"ARMISD::CMP", SDT_ARMCmp, [SDNPOutFlag]>; Modified: llvm/trunk/lib/Target/ARM/ARMInstrThumb2.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMInstrThumb2.td?rev=77422&r1=77421&r2=77422&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMInstrThumb2.td (original) +++ llvm/trunk/lib/Target/ARM/ARMInstrThumb2.td Tue Jul 28 21:18:14 2009 @@ -21,6 +21,11 @@ let PrintMethod = "printThumbITMask"; } +// Table branch address +def tb_addrmode : Operand { + let PrintMethod = "printTBAddrMode"; +} + // Shifted operands. No register controlled shifts for Thumb2. // Note: We do not support rrx shifted operands yet. def t2_so_reg : Operand, // reg imm @@ -1048,11 +1053,24 @@ "b.w $target", [(br bb:$target)]>; -let isNotDuplicable = 1, isIndirectBranch = 1 in +let isNotDuplicable = 1, isIndirectBranch = 1 in { def t2BR_JT : - T2JTI<(outs), (ins GPR:$target, jt2block_operand:$jt, i32imm:$id), + T2JTI<(outs), + (ins GPR:$target, GPR:$index, jt2block_operand:$jt, i32imm:$id), "mov pc, $target\n$jt", - [(ARMbrjt GPR:$target, tjumptable:$jt, imm:$id)]>; + [(ARMbr2jt GPR:$target, GPR:$index, tjumptable:$jt, imm:$id)]>; + +def t2TBB : + T2I<(outs), + (ins tb_addrmode:$index, jt2block_operand:$jt, i32imm:$id), + "tbb", " $index\n$jt", []>; + +def t2TBH : + T2I<(outs), + (ins tb_addrmode:$index, jt2block_operand:$jt, i32imm:$id), + "tbh", " $index\n$jt", []>; +} // isNotDuplicable, isIndirectBranch + } // isBranch, isTerminator, isBarrier // FIXME: should be able to write a pattern for ARMBrcond, but can't use Modified: llvm/trunk/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp?rev=77422&r1=77421&r2=77422&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp (original) +++ llvm/trunk/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp Tue Jul 28 21:18:14 2009 @@ -162,6 +162,7 @@ const char *Modifier); void printJTBlockOperand(const MachineInstr *MI, int OpNum); void printJT2BlockOperand(const MachineInstr *MI, int OpNum); + void printTBAddrMode(const MachineInstr *MI, int OpNum); virtual bool PrintAsmOperand(const MachineInstr *MI, unsigned OpNum, unsigned AsmVariant, const char *ExtraCode); @@ -964,15 +965,39 @@ const MachineJumpTableInfo *MJTI = MF->getJumpTableInfo(); const std::vector &JT = MJTI->getJumpTables(); const std::vector &JTBBs = JT[JTI].MBBs; + bool ByteOffset = false, HalfWordOffset = false; + if (MI->getOpcode() == ARM::t2TBB) + ByteOffset = true; + else if (MI->getOpcode() == ARM::t2TBH) + HalfWordOffset = true; + for (unsigned i = 0, e = JTBBs.size(); i != e; ++i) { MachineBasicBlock *MBB = JTBBs[i]; - O << "\tb.w "; - printBasicBlockLabel(MBB, false, false, false); + if (ByteOffset) + O << TAI->getData8bitsDirective(); + else if (HalfWordOffset) + O << TAI->getData16bitsDirective(); + if (ByteOffset || HalfWordOffset) { + O << '('; + printBasicBlockLabel(MBB, false, false, false); + O << "-" << TAI->getPrivateGlobalPrefix() << "JTI" << getFunctionNumber() + << '_' << JTI << '_' << MO2.getImm() << ")/2"; + } else { + O << "\tb.w "; + printBasicBlockLabel(MBB, false, false, false); + } if (i != e-1) O << '\n'; } } +void ARMAsmPrinter::printTBAddrMode(const MachineInstr *MI, int OpNum) { + O << "[pc, " << TRI->getAsmName(MI->getOperand(OpNum).getReg()); + if (MI->getOpcode() == ARM::t2TBH) + O << ", lsl #1"; + O << ']'; +} + bool ARMAsmPrinter::PrintAsmOperand(const MachineInstr *MI, unsigned OpNum, unsigned AsmVariant, const char *ExtraCode){ Modified: llvm/trunk/lib/Target/ARM/Thumb2InstrInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/Thumb2InstrInfo.cpp?rev=77422&r1=77421&r2=77422&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/Thumb2InstrInfo.cpp (original) +++ llvm/trunk/lib/Target/ARM/Thumb2InstrInfo.cpp Tue Jul 28 21:18:14 2009 @@ -40,6 +40,8 @@ case ARM::t2LDM_RET: case ARM::t2B: // Uncond branch. case ARM::t2BR_JT: // Jumptable branch. + case ARM::t2TBB: // Table branch byte. + case ARM::t2TBH: // Table branch halfword. case ARM::tBR_JTr: // Jumptable branch (16-bit version). case ARM::tBX_RET: case ARM::tBX_RET_vararg: Removed: llvm/trunk/test/CodeGen/Thumb2/thumb2-jtbl.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Thumb2/thumb2-jtbl.ll?rev=77421&view=auto ============================================================================== --- llvm/trunk/test/CodeGen/Thumb2/thumb2-jtbl.ll (original) +++ llvm/trunk/test/CodeGen/Thumb2/thumb2-jtbl.ll (removed) @@ -1,57 +0,0 @@ -; RUN: llvm-as < %s | llc -mtriple=thumbv7-apple-darwin | FileCheck %s -; RUN: llvm-as < %s | llc -mtriple=thumbv7-apple-darwin -relocation-model=pic | FileCheck %s - -define void @bar(i32 %n.u) { -entry: -; CHECK: bar: -; CHECK: mov pc -; CHECK: b.w LBB1_2 - - switch i32 %n.u, label %bb12 [i32 1, label %bb i32 2, label %bb6 i32 4, label %bb7 i32 5, label %bb8 i32 6, label %bb10 i32 7, label %bb1 i32 8, label %bb3 i32 9, label %bb4 i32 10, label %bb9 i32 11, label %bb2 i32 12, label %bb5 i32 13, label %bb11 ] -bb: - tail call void(...)* @foo1() - ret void -bb1: - tail call void(...)* @foo2() - ret void -bb2: - tail call void(...)* @foo6() - ret void -bb3: - tail call void(...)* @foo3() - ret void -bb4: - tail call void(...)* @foo4() - ret void -bb5: - tail call void(...)* @foo5() - ret void -bb6: - tail call void(...)* @foo1() - ret void -bb7: - tail call void(...)* @foo2() - ret void -bb8: - tail call void(...)* @foo6() - ret void -bb9: - tail call void(...)* @foo3() - ret void -bb10: - tail call void(...)* @foo4() - ret void -bb11: - tail call void(...)* @foo5() - ret void -bb12: - tail call void(...)* @foo6() - ret void -} - -declare void @foo1(...) -declare void @foo2(...) -declare void @foo6(...) -declare void @foo3(...) -declare void @foo4(...) -declare void @foo5(...) Copied: llvm/trunk/test/CodeGen/Thumb2/thumb2-tbb.ll (from r77364, llvm/trunk/test/CodeGen/Thumb2/thumb2-jtbl.ll) URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Thumb2/thumb2-tbb.ll?p2=llvm/trunk/test/CodeGen/Thumb2/thumb2-tbb.ll&p1=llvm/trunk/test/CodeGen/Thumb2/thumb2-jtbl.ll&r1=77364&r2=77422&rev=77422&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/Thumb2/thumb2-jtbl.ll (original) +++ llvm/trunk/test/CodeGen/Thumb2/thumb2-tbb.ll Tue Jul 28 21:18:14 2009 @@ -4,8 +4,7 @@ define void @bar(i32 %n.u) { entry: ; CHECK: bar: -; CHECK: mov pc -; CHECK: b.w LBB1_2 +; CHECK: tbb switch i32 %n.u, label %bb12 [i32 1, label %bb i32 2, label %bb6 i32 4, label %bb7 i32 5, label %bb8 i32 6, label %bb10 i32 7, label %bb1 i32 8, label %bb3 i32 9, label %bb4 i32 10, label %bb9 i32 11, label %bb2 i32 12, label %bb5 i32 13, label %bb11 ] bb: Added: llvm/trunk/test/CodeGen/Thumb2/thumb2-tbh.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Thumb2/thumb2-tbh.ll?rev=77422&view=auto ============================================================================== --- llvm/trunk/test/CodeGen/Thumb2/thumb2-tbh.ll (added) +++ llvm/trunk/test/CodeGen/Thumb2/thumb2-tbh.ll Tue Jul 28 21:18:14 2009 @@ -0,0 +1,86 @@ +; RUN: llvm-as < %s | llc -mtriple=thumbv7-apple-darwin -relocation-model=pic | FileCheck %s + + %struct.R_flstr = type { i32, i32, i8* } + %struct._T_tstr = type { i32, %struct.R_flstr*, %struct._T_tstr* } + at _C_nextcmd = external global i32 ; [#uses=3] + at .str31 = external constant [28 x i8], align 1 ; <[28 x i8]*> [#uses=1] + at _T_gtol = external global %struct._T_tstr* ; <%struct._T_tstr**> [#uses=2] + +declare arm_apcscc i32 @strlen(i8* nocapture) nounwind readonly + +declare arm_apcscc void @Z_fatal(i8*) noreturn nounwind + +declare arm_apcscc noalias i8* @calloc(i32, i32) nounwind + +define arm_apcscc i32 @main(i32 %argc, i8** nocapture %argv) nounwind { +; CHECK: main: +; CHECK: tbh +entry: + br label %bb42.i + +bb1.i2: ; preds = %bb42.i + br label %bb40.i + +bb5.i: ; preds = %bb42.i + %0 = or i32 %_Y_flags.1, 32 ; [#uses=1] + br label %bb40.i + +bb7.i: ; preds = %bb42.i + call arm_apcscc void @_T_addtol(%struct._T_tstr** @_T_gtol, i32 0, i8* null) nounwind + unreachable + +bb15.i: ; preds = %bb42.i + call arm_apcscc void @_T_addtol(%struct._T_tstr** @_T_gtol, i32 2, i8* null) nounwind + unreachable + +bb23.i: ; preds = %bb42.i + %1 = call arm_apcscc i32 @strlen(i8* null) nounwind readonly ; [#uses=0] + unreachable + +bb33.i: ; preds = %bb42.i + store i32 0, i32* @_C_nextcmd, align 4 + %2 = call arm_apcscc noalias i8* @calloc(i32 21, i32 1) nounwind ; [#uses=0] + unreachable + +bb34.i: ; preds = %bb42.i + %3 = load i32* @_C_nextcmd, align 4 ; [#uses=1] + %4 = add i32 %3, 1 ; [#uses=1] + store i32 %4, i32* @_C_nextcmd, align 4 + %5 = call arm_apcscc noalias i8* @calloc(i32 22, i32 1) nounwind ; [#uses=0] + unreachable + +bb35.i: ; preds = %bb42.i + %6 = call arm_apcscc noalias i8* @calloc(i32 20, i32 1) nounwind ; [#uses=0] + unreachable + +bb37.i: ; preds = %bb42.i + %7 = call arm_apcscc noalias i8* @calloc(i32 14, i32 1) nounwind ; [#uses=0] + unreachable + +bb39.i: ; preds = %bb42.i + call arm_apcscc void @Z_fatal(i8* getelementptr ([28 x i8]* @.str31, i32 0, i32 0)) nounwind + unreachable + +bb40.i: ; preds = %bb42.i, %bb5.i, %bb1.i2 + %_Y_flags.0 = phi i32 [ 0, %bb1.i2 ], [ %0, %bb5.i ], [ %_Y_flags.1, %bb42.i ] ; [#uses=1] + %_Y_eflag.b.0 = phi i1 [ %_Y_eflag.b.1, %bb1.i2 ], [ %_Y_eflag.b.1, %bb5.i ], [ true, %bb42.i ] ; [#uses=1] + br label %bb42.i + +bb42.i: ; preds = %bb40.i, %entry + %_Y_eflag.b.1 = phi i1 [ false, %entry ], [ %_Y_eflag.b.0, %bb40.i ] ; [#uses=2] + %_Y_flags.1 = phi i32 [ 0, %entry ], [ %_Y_flags.0, %bb40.i ] ; [#uses=2] + switch i32 undef, label %bb39.i [ + i32 67, label %bb33.i + i32 70, label %bb35.i + i32 77, label %bb37.i + i32 83, label %bb34.i + i32 97, label %bb7.i + i32 100, label %bb5.i + i32 101, label %bb40.i + i32 102, label %bb23.i + i32 105, label %bb15.i + i32 116, label %bb1.i2 + ] +} + +declare arm_apcscc void @_T_addtol(%struct._T_tstr** nocapture, i32, i8*) nounwind From eli.friedman at gmail.com Tue Jul 28 21:19:26 2009 From: eli.friedman at gmail.com (Eli Friedman) Date: Tue, 28 Jul 2009 19:19:26 -0700 Subject: [llvm-commits] [llvm] r77407 - in /llvm/trunk: include/llvm/IntrinsicsX86.td lib/Target/X86/X86ISelLowering.cpp lib/Target/X86/X86ISelLowering.h lib/Target/X86/X86InstrSSE.td test/CodeGen/X86/sse41.ll In-Reply-To: <945A54B8-2176-4A39-AF93-805E42793E32@apple.com> References: <200907290028.n6T0S6VU020655@zion.cs.uiuc.edu> <4014B4D6-8F63-411E-8760-49A96A289D24@apple.com> <945A54B8-2176-4A39-AF93-805E42793E32@apple.com> Message-ID: On Tue, Jul 28, 2009 at 7:04 PM, Eric Christopher wrote: > where we should be able to get rid of the extra (bonus!) setcc that > we've got in the generated code (cruft removed): > > _foo: > ? ? ? ?ptest ? %xmm1, %xmm0 > ? ? ? ?sete ? ?%al > ? ? ? ?movzbl ?%al, %eax > ? ? ? ?testl ? %eax, %eax > ? ? ? ?sete ? ?%al > ? ? ? ?movzbl ?%al, %eax > ? ? ? ?leal ? ?4(,%eax,4), %eax > ? ? ? ?ret The reason we don't optimize this already is that the normal setcc optimization doesn't handle the x86-specific nodes; it wouldn't be very hard to add an x86-specific dagcombine to handle this case, though. -Eli From daniel at zuster.org Tue Jul 28 22:04:23 2009 From: daniel at zuster.org (Daniel Dunbar) Date: Wed, 29 Jul 2009 03:04:23 -0000 Subject: [llvm-commits] [llvm] r77425 - in /llvm/trunk: include/llvm/Support/FormattedStream.h lib/Support/FormattedStream.cpp Message-ID: <200907290304.n6T34NjG025695@zion.cs.uiuc.edu> Author: ddunbar Date: Tue Jul 28 22:04:22 2009 New Revision: 77425 URL: http://llvm.org/viewvc/llvm-project?rev=77425&view=rev Log: Revert r77397, it causes significant regressions in llc performance. Modified: llvm/trunk/include/llvm/Support/FormattedStream.h llvm/trunk/lib/Support/FormattedStream.cpp Modified: llvm/trunk/include/llvm/Support/FormattedStream.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/FormattedStream.h?rev=77425&r1=77424&r2=77425&view=diff ============================================================================== --- llvm/trunk/include/llvm/Support/FormattedStream.h (original) +++ llvm/trunk/include/llvm/Support/FormattedStream.h Tue Jul 28 22:04:22 2009 @@ -49,13 +49,13 @@ /// bool DeleteStream; - /// ColumnFlushed - The current output column of the data that's - /// been flushed. The column scheme is zero-based. + /// Column - The current output column of the stream. The column + /// scheme is zero-based. /// - unsigned ColumnFlushed; + unsigned Column; virtual void write_impl(const char *Ptr, size_t Size) { - ComputeColumn(ColumnFlushed); + ComputeColumn(Ptr, Size); TheStream->write(Ptr, Size); } @@ -67,10 +67,10 @@ return TheStream->tell() - TheStream->GetNumBytesInBuffer(); } - /// ComputeColumn - Examine the current buffer and figure out - /// which column we're in. + /// ComputeColumn - Examine the current output and figure out + /// which column we end up in after output. /// - void ComputeColumn(unsigned &Column); + void ComputeColumn(const char *Ptr, size_t Size); public: /// formatted_raw_ostream - Open the specified file for @@ -84,11 +84,11 @@ /// underneath it. /// formatted_raw_ostream(raw_ostream &Stream, bool Delete = false) - : raw_ostream(), TheStream(0), DeleteStream(false), ColumnFlushed(0) { + : raw_ostream(), TheStream(0), DeleteStream(false), Column(0) { setStream(Stream, Delete); } explicit formatted_raw_ostream() - : raw_ostream(), TheStream(0), DeleteStream(false), ColumnFlushed(0) {} + : raw_ostream(), TheStream(0), DeleteStream(false), Column(0) {} ~formatted_raw_ostream() { if (DeleteStream) Modified: llvm/trunk/lib/Support/FormattedStream.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/FormattedStream.cpp?rev=77425&r1=77424&r2=77425&view=diff ============================================================================== --- llvm/trunk/lib/Support/FormattedStream.cpp (original) +++ llvm/trunk/lib/Support/FormattedStream.cpp Tue Jul 28 22:04:22 2009 @@ -19,11 +19,11 @@ /// ComputeColumn - Examine the current output and figure out which /// column we end up in after output. /// -void formatted_raw_ostream::ComputeColumn(unsigned &Column) { +void formatted_raw_ostream::ComputeColumn(const char *Ptr, size_t Size) { // Keep track of the current column by scanning the string for // special characters - for (const char *Ptr = begin(); Ptr != end(); ++Ptr) { + for (const char *epos = Ptr + Size; Ptr != epos; ++Ptr) { ++Column; if (*Ptr == '\n' || *Ptr == '\r') Column = 0; @@ -38,13 +38,8 @@ /// \param MinPad - The minimum space to give after the most recent /// I/O, even if the current column + minpad > newcol. /// -void formatted_raw_ostream::PadToColumn(unsigned NewCol, unsigned MinPad) { - // Start out from the last flush position. - unsigned Column = ColumnFlushed; - - // Now figure out what's in the buffer and add it to the column - // count. - ComputeColumn(Column); +void formatted_raw_ostream::PadToColumn(unsigned NewCol, unsigned MinPad) { + flush(); // Output spaces until we reach the desired column. unsigned num = NewCol - Column; From daniel at zuster.org Tue Jul 28 22:04:39 2009 From: daniel at zuster.org (Daniel Dunbar) Date: Tue, 28 Jul 2009 20:04:39 -0700 Subject: [llvm-commits] [llvm] r77397 - in /llvm/trunk: include/llvm/Support/FormattedStream.h lib/Support/FormattedStream.cpp In-Reply-To: <200907282326.n6SNQYms018777@zion.cs.uiuc.edu> References: <200907282326.n6SNQYms018777@zion.cs.uiuc.edu> Message-ID: <6a8523d60907282004hdb84ae1mf3798309df192581@mail.gmail.com> Hi David, On Tue, Jul 28, 2009 at 4:26 PM, David Greene wrote: > Author: greened > Date: Tue Jul 28 18:26:34 2009 > New Revision: 77397 > > URL: http://llvm.org/viewvc/llvm-project?rev=77397&view=rev > Log: > > Improve performance of PadToColumn by eliminating flushes. Did you time this? I had to revert this patch, it was causing significant regressions on nightlytest, and in my local timings (llc -fast-isel -regalloc=local on instcombine.bc) it was almost twice as slow! ddunbar at giles:regr-2009-07-28_19-23$ for r in llc.r7739*; do echo "-- $r --"; runN 10 ./$r -fast-isel -regalloc=local instcombine.bc -f -o /dev/null; done -- llc.r77396 -- name avg min med max SD total user 1.7877 1.6809 1.7959 1.9022 0.0668 17.8772 sys 0.2849 0.2735 0.2865 0.3035 0.0107 2.8489 wall 2.0794 1.9574 2.0865 2.2134 0.0775 20.7939 -- llc.r77397 -- name avg min med max SD total user 3.3274 3.1411 3.3089 3.5753 0.1541 33.2742 sys 0.0586 0.0596 0.0581 0.0617 0.0037 0.5862 wall 3.3922 3.2062 3.3750 3.6403 0.1550 33.9220 (runN is a timing tool of mine, like 'time' with more goodies) - Daniel > Modified: > ? ?llvm/trunk/include/llvm/Support/FormattedStream.h > ? ?llvm/trunk/lib/Support/FormattedStream.cpp > > Modified: llvm/trunk/include/llvm/Support/FormattedStream.h > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/FormattedStream.h?rev=77397&r1=77396&r2=77397&view=diff > > ============================================================================== > --- llvm/trunk/include/llvm/Support/FormattedStream.h (original) > +++ llvm/trunk/include/llvm/Support/FormattedStream.h Tue Jul 28 18:26:34 2009 > @@ -49,13 +49,13 @@ > ? ? /// > ? ? bool DeleteStream; > > - ? ?/// Column - The current output column of the stream. ?The column > - ? ?/// scheme is zero-based. > + ? ?/// ColumnFlushed - The current output column of the data that's > + ? ?/// been flushed. ?The column scheme is zero-based. > ? ? /// > - ? ?unsigned Column; > + ? ?unsigned ColumnFlushed; > > ? ? virtual void write_impl(const char *Ptr, size_t Size) { > - ? ? ?ComputeColumn(Ptr, Size); > + ? ? ?ComputeColumn(ColumnFlushed); > ? ? ? TheStream->write(Ptr, Size); > ? ? } > > @@ -67,10 +67,10 @@ > ? ? ? return TheStream->tell() - TheStream->GetNumBytesInBuffer(); > ? ? } > > - ? ?/// ComputeColumn - Examine the current output and figure out > - ? ?/// which column we end up in after output. > + ? ?/// ComputeColumn - Examine the current buffer and figure out > + ? ?/// which column we're in. > ? ? /// > - ? ?void ComputeColumn(const char *Ptr, size_t Size); > + ? ?void ComputeColumn(unsigned &Column); > > ? public: > ? ? /// formatted_raw_ostream - Open the specified file for > @@ -84,11 +84,11 @@ > ? ? /// underneath it. > ? ? /// > ? ? formatted_raw_ostream(raw_ostream &Stream, bool Delete = false) > - ? ? ?: raw_ostream(), TheStream(0), DeleteStream(false), Column(0) { > + ? ? ?: raw_ostream(), TheStream(0), DeleteStream(false), ColumnFlushed(0) { > ? ? ? setStream(Stream, Delete); > ? ? } > ? ? explicit formatted_raw_ostream() > - ? ? ?: raw_ostream(), TheStream(0), DeleteStream(false), Column(0) {} > + ? ? ?: raw_ostream(), TheStream(0), DeleteStream(false), ColumnFlushed(0) {} > > ? ? ~formatted_raw_ostream() { > ? ? ? if (DeleteStream) > > Modified: llvm/trunk/lib/Support/FormattedStream.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/FormattedStream.cpp?rev=77397&r1=77396&r2=77397&view=diff > > ============================================================================== > --- llvm/trunk/lib/Support/FormattedStream.cpp (original) > +++ llvm/trunk/lib/Support/FormattedStream.cpp Tue Jul 28 18:26:34 2009 > @@ -19,11 +19,11 @@ > ?/// ComputeColumn - Examine the current output and figure out which > ?/// column we end up in after output. > ?/// > -void formatted_raw_ostream::ComputeColumn(const char *Ptr, size_t Size) { > +void formatted_raw_ostream::ComputeColumn(unsigned &Column) { > ? // Keep track of the current column by scanning the string for > ? // special characters > > - ?for (const char *epos = Ptr + Size; Ptr != epos; ++Ptr) { > + ?for (const char *Ptr = begin(); Ptr != end(); ++Ptr) { > ? ? ++Column; > ? ? if (*Ptr == '\n' || *Ptr == '\r') > ? ? ? Column = 0; > @@ -38,8 +38,13 @@ > ?/// \param MinPad - The minimum space to give after the most recent > ?/// I/O, even if the current column + minpad > newcol. > ?/// > -void formatted_raw_ostream::PadToColumn(unsigned NewCol, unsigned MinPad) { > - ?flush(); > +void formatted_raw_ostream::PadToColumn(unsigned NewCol, unsigned MinPad) { > + ?// Start out from the last flush position. > + ?unsigned Column = ColumnFlushed; > + > + ?// Now figure out what's in the buffer and add it to the column > + ?// count. > + ?ComputeColumn(Column); > > ? // Output spaces until we reach the desired column. > ? unsigned num = NewCol - Column; > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits > From evan.cheng at apple.com Tue Jul 28 22:12:41 2009 From: evan.cheng at apple.com (Evan Cheng) Date: Wed, 29 Jul 2009 03:12:41 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r77426 - /llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386.cpp Message-ID: <200907290312.n6T3CfMr025900@zion.cs.uiuc.edu> Author: evancheng Date: Tue Jul 28 22:12:41 2009 New Revision: 77426 URL: http://llvm.org/viewvc/llvm-project?rev=77426&view=rev Log: Fix 80 col violation. Modified: llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386.cpp Modified: llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386.cpp URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386.cpp?rev=77426&r1=77425&r2=77426&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386.cpp (original) +++ llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386.cpp Tue Jul 28 22:12:41 2009 @@ -592,7 +592,8 @@ Intrinsic::getDeclaration(TheModule, Intrinsic::x86_sse_ldmxcsr); Value *Ptr = CreateTemporary(Type::Int32Ty); Builder.CreateStore(Ops[0], Ptr); - Ptr = Builder.CreateBitCast(Ptr, Context.getPointerTypeUnqual(Type::Int8Ty), "tmp"); + Ptr = Builder.CreateBitCast(Ptr, + Context.getPointerTypeUnqual(Type::Int8Ty), "tmp"); Result = Builder.CreateCall(ldmxcsr, Ptr); return true; } @@ -600,8 +601,8 @@ Function *stmxcsr = Intrinsic::getDeclaration(TheModule, Intrinsic::x86_sse_stmxcsr); Value *Ptr = CreateTemporary(Type::Int32Ty); - Value *BPtr = Builder.CreateBitCast(Ptr, Context.getPointerTypeUnqual(Type::Int8Ty), - "tmp"); + Value *BPtr = Builder.CreateBitCast(Ptr, + Context.getPointerTypeUnqual(Type::Int8Ty), "tmp"); Builder.CreateCall(stmxcsr, BPtr); Result = Builder.CreateLoad(Ptr, "tmp"); From evan.cheng at apple.com Tue Jul 28 22:50:40 2009 From: evan.cheng at apple.com (Evan Cheng) Date: Wed, 29 Jul 2009 03:50:40 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r77427 - /llvm-gcc-4.2/trunk/gcc/config/arm/llvm-arm.cpp Message-ID: <200907290350.n6T3oe2H027012@zion.cs.uiuc.edu> Author: evancheng Date: Tue Jul 28 22:50:39 2009 New Revision: 77427 URL: http://llvm.org/viewvc/llvm-project?rev=77427&view=rev Log: Unbreak the build. Modified: llvm-gcc-4.2/trunk/gcc/config/arm/llvm-arm.cpp Modified: llvm-gcc-4.2/trunk/gcc/config/arm/llvm-arm.cpp URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/arm/llvm-arm.cpp?rev=77427&r1=77426&r2=77427&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/config/arm/llvm-arm.cpp (original) +++ llvm-gcc-4.2/trunk/gcc/config/arm/llvm-arm.cpp Tue Jul 28 22:50:39 2009 @@ -119,7 +119,7 @@ std::vector CstOps; for (unsigned i = 0; i != NumElements; ++i) CstOps.push_back(Val); - return getGlobalContext().getConstantVector(CstOps); + return ConstantVector::get(CstOps); } /// BuildDup - Build a splat operation to duplicate a value into every From clattner at apple.com Tue Jul 28 23:28:16 2009 From: clattner at apple.com (Chris Lattner) Date: Tue, 28 Jul 2009 21:28:16 -0700 Subject: [llvm-commits] [llvm] r77410 - in /llvm/trunk/lib/AsmParser: LLLexer.cpp LLLexer.h LLParser.cpp LLParser.h LLToken.h In-Reply-To: <352a1fb20907281905r4a68f15o9b11ace33148ad64@mail.gmail.com> References: <200907290034.n6T0Y3hu020859@zion.cs.uiuc.edu> <212C59E5-1678-4F82-8966-8C253E506301@apple.com> <352a1fb20907281905r4a68f15o9b11ace33148ad64@mail.gmail.com> Message-ID: <778D19AB-48D0-4ED2-980E-6F8BB4C1D57D@apple.com> On Jul 28, 2009, at 7:05 PM, Devang Patel wrote: > On Tue, Jul 28, 2009 at 5:42 PM, Chris Lattner > wrote: >> >> On Jul 28, 2009, at 5:34 PM, Devang Patel wrote: >> >>> Author: dpatel >>> Date: Tue Jul 28 19:34:02 2009 >>> New Revision: 77410 >>> >>> URL: http://llvm.org/viewvc/llvm-project?rev=77410&view=rev >>> Log: >>> Parse named metadata. >> >> Hi Devang, >> >> NamedMDNode should go on an ilist maintained by Module, right? > > I am planning to use StringMap so that it is easier to search by name. Why not use the existing Module symbol table to do it? -Chris From evan.cheng at apple.com Tue Jul 28 23:32:33 2009 From: evan.cheng at apple.com (Evan Cheng) Date: Tue, 28 Jul 2009 21:32:33 -0700 Subject: [llvm-commits] [llvm] r77397 - in /llvm/trunk: include/llvm/Support/FormattedStream.h lib/Support/FormattedStream.cpp In-Reply-To: <6a8523d60907282004hdb84ae1mf3798309df192581@mail.gmail.com> References: <200907282326.n6SNQYms018777@zion.cs.uiuc.edu> <6a8523d60907282004hdb84ae1mf3798309df192581@mail.gmail.com> Message-ID: Have we recovered the previous lost compile time? Evan On Jul 28, 2009, at 8:04 PM, Daniel Dunbar wrote: > Hi David, > > On Tue, Jul 28, 2009 at 4:26 PM, David Greene > wrote: >> Author: greened >> Date: Tue Jul 28 18:26:34 2009 >> New Revision: 77397 >> >> URL: http://llvm.org/viewvc/llvm-project?rev=77397&view=rev >> Log: >> >> Improve performance of PadToColumn by eliminating flushes. > > Did you time this? I had to revert this patch, it was causing > significant regressions on nightlytest, and in my local timings (llc > -fast-isel -regalloc=local on instcombine.bc) it was almost twice as > slow! > > ddunbar at giles:regr-2009-07-28_19-23$ for r in llc.r7739*; do echo "-- > $r --"; runN 10 ./$r -fast-isel -regalloc=local instcombine.bc -f -o > /dev/null; done > -- llc.r77396 -- > name avg min med max SD total > user 1.7877 1.6809 1.7959 1.9022 0.0668 17.8772 > sys 0.2849 0.2735 0.2865 0.3035 0.0107 2.8489 > wall 2.0794 1.9574 2.0865 2.2134 0.0775 20.7939 > -- llc.r77397 -- > name avg min med max SD total > user 3.3274 3.1411 3.3089 3.5753 0.1541 33.2742 > sys 0.0586 0.0596 0.0581 0.0617 0.0037 0.5862 > wall 3.3922 3.2062 3.3750 3.6403 0.1550 33.9220 > > (runN is a timing tool of mine, like 'time' with more goodies) > > - Daniel > >> Modified: >> llvm/trunk/include/llvm/Support/FormattedStream.h >> llvm/trunk/lib/Support/FormattedStream.cpp >> >> Modified: llvm/trunk/include/llvm/Support/FormattedStream.h >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/FormattedStream.h?rev=77397&r1=77396&r2=77397&view=diff >> >> = >> = >> = >> = >> = >> = >> = >> = >> = >> ===================================================================== >> --- llvm/trunk/include/llvm/Support/FormattedStream.h (original) >> +++ llvm/trunk/include/llvm/Support/FormattedStream.h Tue Jul 28 >> 18:26:34 2009 >> @@ -49,13 +49,13 @@ >> /// >> bool DeleteStream; >> >> - /// Column - The current output column of the stream. The >> column >> - /// scheme is zero-based. >> + /// ColumnFlushed - The current output column of the data that's >> + /// been flushed. The column scheme is zero-based. >> /// >> - unsigned Column; >> + unsigned ColumnFlushed; >> >> virtual void write_impl(const char *Ptr, size_t Size) { >> - ComputeColumn(Ptr, Size); >> + ComputeColumn(ColumnFlushed); >> TheStream->write(Ptr, Size); >> } >> >> @@ -67,10 +67,10 @@ >> return TheStream->tell() - TheStream->GetNumBytesInBuffer(); >> } >> >> - /// ComputeColumn - Examine the current output and figure out >> - /// which column we end up in after output. >> + /// ComputeColumn - Examine the current buffer and figure out >> + /// which column we're in. >> /// >> - void ComputeColumn(const char *Ptr, size_t Size); >> + void ComputeColumn(unsigned &Column); >> >> public: >> /// formatted_raw_ostream - Open the specified file for >> @@ -84,11 +84,11 @@ >> /// underneath it. >> /// >> formatted_raw_ostream(raw_ostream &Stream, bool Delete = false) >> - : raw_ostream(), TheStream(0), DeleteStream(false), Column >> (0) { >> + : raw_ostream(), TheStream(0), DeleteStream(false), >> ColumnFlushed(0) { >> setStream(Stream, Delete); >> } >> explicit formatted_raw_ostream() >> - : raw_ostream(), TheStream(0), DeleteStream(false), Column >> (0) {} >> + : raw_ostream(), TheStream(0), DeleteStream(false), >> ColumnFlushed(0) {} >> >> ~formatted_raw_ostream() { >> if (DeleteStream) >> >> Modified: llvm/trunk/lib/Support/FormattedStream.cpp >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/FormattedStream.cpp?rev=77397&r1=77396&r2=77397&view=diff >> >> = >> = >> = >> = >> = >> = >> = >> = >> = >> ===================================================================== >> --- llvm/trunk/lib/Support/FormattedStream.cpp (original) >> +++ llvm/trunk/lib/Support/FormattedStream.cpp Tue Jul 28 18:26:34 >> 2009 >> @@ -19,11 +19,11 @@ >> /// ComputeColumn - Examine the current output and figure out which >> /// column we end up in after output. >> /// >> -void formatted_raw_ostream::ComputeColumn(const char *Ptr, size_t >> Size) { >> +void formatted_raw_ostream::ComputeColumn(unsigned &Column) { >> // Keep track of the current column by scanning the string for >> // special characters >> >> - for (const char *epos = Ptr + Size; Ptr != epos; ++Ptr) { >> + for (const char *Ptr = begin(); Ptr != end(); ++Ptr) { >> ++Column; >> if (*Ptr == '\n' || *Ptr == '\r') >> Column = 0; >> @@ -38,8 +38,13 @@ >> /// \param MinPad - The minimum space to give after the most recent >> /// I/O, even if the current column + minpad > newcol. >> /// >> -void formatted_raw_ostream::PadToColumn(unsigned NewCol, unsigned >> MinPad) { >> - flush(); >> +void formatted_raw_ostream::PadToColumn(unsigned NewCol, unsigned >> MinPad) { >> + // Start out from the last flush position. >> + unsigned Column = ColumnFlushed; >> + >> + // Now figure out what's in the buffer and add it to the column >> + // count. >> + ComputeColumn(Column); >> >> // Output spaces until we reach the desired column. >> unsigned num = NewCol - Column; >> >> >> _______________________________________________ >> llvm-commits mailing list >> llvm-commits at cs.uiuc.edu >> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits >> > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From clattner at apple.com Tue Jul 28 23:35:31 2009 From: clattner at apple.com (Chris Lattner) Date: Tue, 28 Jul 2009 21:35:31 -0700 Subject: [llvm-commits] [llvm] r77397 - in /llvm/trunk: include/llvm/Support/FormattedStream.h lib/Support/FormattedStream.cpp In-Reply-To: References: <200907282326.n6SNQYms018777@zion.cs.uiuc.edu> <6a8523d60907282004hdb84ae1mf3798309df192581@mail.gmail.com> Message-ID: <2C88990A-2D3A-4310-B116-5634F1B181DA@apple.com> On Jul 28, 2009, at 9:32 PM, Evan Cheng wrote: > Have we recovered the previous lost compile time? No, this patch made it worse because of the N^2 algorithm. -Chris > > > Evan > > On Jul 28, 2009, at 8:04 PM, Daniel Dunbar wrote: > >> Hi David, >> >> On Tue, Jul 28, 2009 at 4:26 PM, David Greene >> wrote: >>> Author: greened >>> Date: Tue Jul 28 18:26:34 2009 >>> New Revision: 77397 >>> >>> URL: http://llvm.org/viewvc/llvm-project?rev=77397&view=rev >>> Log: >>> >>> Improve performance of PadToColumn by eliminating flushes. >> >> Did you time this? I had to revert this patch, it was causing >> significant regressions on nightlytest, and in my local timings (llc >> -fast-isel -regalloc=local on instcombine.bc) it was almost twice as >> slow! >> >> ddunbar at giles:regr-2009-07-28_19-23$ for r in llc.r7739*; do echo "-- >> $r --"; runN 10 ./$r -fast-isel -regalloc=local instcombine.bc -f -o >> /dev/null; done >> -- llc.r77396 -- >> name avg min med max SD total >> user 1.7877 1.6809 1.7959 1.9022 0.0668 17.8772 >> sys 0.2849 0.2735 0.2865 0.3035 0.0107 2.8489 >> wall 2.0794 1.9574 2.0865 2.2134 0.0775 20.7939 >> -- llc.r77397 -- >> name avg min med max SD total >> user 3.3274 3.1411 3.3089 3.5753 0.1541 33.2742 >> sys 0.0586 0.0596 0.0581 0.0617 0.0037 0.5862 >> wall 3.3922 3.2062 3.3750 3.6403 0.1550 33.9220 >> >> (runN is a timing tool of mine, like 'time' with more goodies) >> >> - Daniel >> >>> Modified: >>> llvm/trunk/include/llvm/Support/FormattedStream.h >>> llvm/trunk/lib/Support/FormattedStream.cpp >>> >>> Modified: llvm/trunk/include/llvm/Support/FormattedStream.h >>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/FormattedStream.h?rev=77397&r1=77396&r2=77397&view=diff >>> >>> = >>> = >>> = >>> = >>> = >>> = >>> = >>> = >>> = >>> = >>> ==================================================================== >>> --- llvm/trunk/include/llvm/Support/FormattedStream.h (original) >>> +++ llvm/trunk/include/llvm/Support/FormattedStream.h Tue Jul 28 >>> 18:26:34 2009 >>> @@ -49,13 +49,13 @@ >>> /// >>> bool DeleteStream; >>> >>> - /// Column - The current output column of the stream. The >>> column >>> - /// scheme is zero-based. >>> + /// ColumnFlushed - The current output column of the data >>> that's >>> + /// been flushed. The column scheme is zero-based. >>> /// >>> - unsigned Column; >>> + unsigned ColumnFlushed; >>> >>> virtual void write_impl(const char *Ptr, size_t Size) { >>> - ComputeColumn(Ptr, Size); >>> + ComputeColumn(ColumnFlushed); >>> TheStream->write(Ptr, Size); >>> } >>> >>> @@ -67,10 +67,10 @@ >>> return TheStream->tell() - TheStream->GetNumBytesInBuffer(); >>> } >>> >>> - /// ComputeColumn - Examine the current output and figure out >>> - /// which column we end up in after output. >>> + /// ComputeColumn - Examine the current buffer and figure out >>> + /// which column we're in. >>> /// >>> - void ComputeColumn(const char *Ptr, size_t Size); >>> + void ComputeColumn(unsigned &Column); >>> >>> public: >>> /// formatted_raw_ostream - Open the specified file for >>> @@ -84,11 +84,11 @@ >>> /// underneath it. >>> /// >>> formatted_raw_ostream(raw_ostream &Stream, bool Delete = false) >>> - : raw_ostream(), TheStream(0), DeleteStream(false), Column >>> (0) { >>> + : raw_ostream(), TheStream(0), DeleteStream(false), >>> ColumnFlushed(0) { >>> setStream(Stream, Delete); >>> } >>> explicit formatted_raw_ostream() >>> - : raw_ostream(), TheStream(0), DeleteStream(false), Column >>> (0) {} >>> + : raw_ostream(), TheStream(0), DeleteStream(false), >>> ColumnFlushed(0) {} >>> >>> ~formatted_raw_ostream() { >>> if (DeleteStream) >>> >>> Modified: llvm/trunk/lib/Support/FormattedStream.cpp >>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/FormattedStream.cpp?rev=77397&r1=77396&r2=77397&view=diff >>> >>> = >>> = >>> = >>> = >>> = >>> = >>> = >>> = >>> = >>> = >>> ==================================================================== >>> --- llvm/trunk/lib/Support/FormattedStream.cpp (original) >>> +++ llvm/trunk/lib/Support/FormattedStream.cpp Tue Jul 28 18:26:34 >>> 2009 >>> @@ -19,11 +19,11 @@ >>> /// ComputeColumn - Examine the current output and figure out which >>> /// column we end up in after output. >>> /// >>> -void formatted_raw_ostream::ComputeColumn(const char *Ptr, size_t >>> Size) { >>> +void formatted_raw_ostream::ComputeColumn(unsigned &Column) { >>> // Keep track of the current column by scanning the string for >>> // special characters >>> >>> - for (const char *epos = Ptr + Size; Ptr != epos; ++Ptr) { >>> + for (const char *Ptr = begin(); Ptr != end(); ++Ptr) { >>> ++Column; >>> if (*Ptr == '\n' || *Ptr == '\r') >>> Column = 0; >>> @@ -38,8 +38,13 @@ >>> /// \param MinPad - The minimum space to give after the most recent >>> /// I/O, even if the current column + minpad > newcol. >>> /// >>> -void formatted_raw_ostream::PadToColumn(unsigned NewCol, unsigned >>> MinPad) { >>> - flush(); >>> +void formatted_raw_ostream::PadToColumn(unsigned NewCol, unsigned >>> MinPad) { >>> + // Start out from the last flush position. >>> + unsigned Column = ColumnFlushed; >>> + >>> + // Now figure out what's in the buffer and add it to the column >>> + // count. >>> + ComputeColumn(Column); >>> >>> // Output spaces until we reach the desired column. >>> unsigned num = NewCol - Column; >>> >>> >>> _______________________________________________ >>> llvm-commits mailing list >>> llvm-commits at cs.uiuc.edu >>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits >>> >> >> _______________________________________________ >> llvm-commits mailing list >> llvm-commits at cs.uiuc.edu >> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From clattner at apple.com Tue Jul 28 23:44:50 2009 From: clattner at apple.com (Chris Lattner) Date: Tue, 28 Jul 2009 21:44:50 -0700 Subject: [llvm-commits] [llvm] r77407 - in /llvm/trunk: include/llvm/IntrinsicsX86.td lib/Target/X86/X86ISelLowering.cpp lib/Target/X86/X86ISelLowering.h lib/Target/X86/X86InstrSSE.td test/CodeGen/X86/sse41.ll In-Reply-To: <200907290028.n6T0S6VU020655@zion.cs.uiuc.edu> References: <200907290028.n6T0S6VU020655@zion.cs.uiuc.edu> Message-ID: <677CE0D7-9423-444B-82A5-78F234F9012D@apple.com> On Jul 28, 2009, at 5:28 PM, Eric Christopher wrote: > Author: echristo > Date: Tue Jul 28 19:28:05 2009 > New Revision: 77407 > > URL: http://llvm.org/viewvc/llvm-project?rev=77407&view=rev > Log: > Add support for gcc __builtin_ia32_ptest{z,c,nzc} intrinsics. Lower > to ptest instruction plus setcc. Revamp ptest instruction. Add test. Nice. > + // ptest intrinsics. The intrinsic these come from are designed > to return > + // a boolean value, not just an instruction so lower it to the > ptest > + // pattern and a conditional move to the result. > + case Intrinsic::x86_sse41_ptestz: > + case Intrinsic::x86_sse41_ptestc: > + case Intrinsic::x86_sse41_ptestnzc:{ > + unsigned X86CC = 0; > + switch (IntNo) { > + default: break; Please make "default" abort with: llvm_unreachable("unknown condition"); or something. > +// ptest instruction we'll lower to this in X86ISelLowering > primarily from > +// the intel intrinsic that corresponds to this. > let Defs = [EFLAGS] in { > def PTESTrr : SS48I<0x17, MRMSrcReg, (outs), (ins VR128:$src1, > VR128:$src2), > - "ptest \t{$src2, $src1|$src1, $src2}", []>, > OpSize; > + "ptest \t{$src2, $src1|$src1, $src2}", > + [(X86ptest VR128:$src1, VR128:$src2), > + (implicit EFLAGS)]>, OpSize; Do we really need "Defs = EFLAGS" *and* "implicit EFLAGS"? It seems like the later one should be enough, though I don't actually know if that's true. Evan or Dan would know. Something not new in this patch, but: def X86ptest : SDNode<"X86ISD::PTEST", SDTX86CmpPTest>; From my understanding, I think that ptest is commutative (but maybe only for "z", but not the others?). If unconditionally true, you can declare this with [SDNPCommutative] as a third argument to SDNode and the instruction should be figured out to be commutative. If only true in some cases, more trickery will be required. For something like this: define i32 @test(<4 x float> %t1, <4 x float> *%t2) nounwind { %x = load <4x float>* %t2 %tmp1 = call i32 @llvm.x86.sse41.ptestz(<4 x float> %x, <4 x float> %t1) nounwind readnone ret i32 %tmp1 } declare i32 @llvm.x86.sse41.ptestz(<4 x float>, <4 x float>) nounwind readnone It should allow the instruction to fold the load instead of producing: _test: movl 4(%esp), %eax movaps (%eax), %xmm1 ptest %xmm0, %xmm1 sete %al movzbl %al, %eax ret Does "ptest" need to be added to the load folding table in case it is isel'd as reg/reg but an operand gets spilled (thus the regalloc should fold the load by forming reg/mem)? Overall, very nice job! -Chris From evan.cheng at apple.com Tue Jul 28 23:48:12 2009 From: evan.cheng at apple.com (Evan Cheng) Date: Tue, 28 Jul 2009 21:48:12 -0700 Subject: [llvm-commits] [llvm] r77397 - in /llvm/trunk: include/llvm/Support/FormattedStream.h lib/Support/FormattedStream.cpp In-Reply-To: <2C88990A-2D3A-4310-B116-5634F1B181DA@apple.com> References: <200907282326.n6SNQYms018777@zion.cs.uiuc.edu> <6a8523d60907282004hdb84ae1mf3798309df192581@mail.gmail.com> <2C88990A-2D3A-4310-B116-5634F1B181DA@apple.com> Message-ID: <750B4DE6-E485-4D9A-9CE2-E07B72844532@apple.com> Ok. David, I'm going to revert AsmWriterEmitter.cpp back to 74742 for now. Please re-commit as you have fixed the efficiency problem. Thanks, Evan On Jul 28, 2009, at 9:35 PM, Chris Lattner wrote: > > On Jul 28, 2009, at 9:32 PM, Evan Cheng wrote: > >> Have we recovered the previous lost compile time? > > No, this patch made it worse because of the N^2 algorithm. > > -Chris > >> >> >> Evan >> >> On Jul 28, 2009, at 8:04 PM, Daniel Dunbar wrote: >> >>> Hi David, >>> >>> On Tue, Jul 28, 2009 at 4:26 PM, David Greene >>> wrote: >>>> Author: greened >>>> Date: Tue Jul 28 18:26:34 2009 >>>> New Revision: 77397 >>>> >>>> URL: http://llvm.org/viewvc/llvm-project?rev=77397&view=rev >>>> Log: >>>> >>>> Improve performance of PadToColumn by eliminating flushes. >>> >>> Did you time this? I had to revert this patch, it was causing >>> significant regressions on nightlytest, and in my local timings (llc >>> -fast-isel -regalloc=local on instcombine.bc) it was almost twice as >>> slow! >>> >>> ddunbar at giles:regr-2009-07-28_19-23$ for r in llc.r7739*; do echo >>> "-- >>> $r --"; runN 10 ./$r -fast-isel -regalloc=local instcombine.bc -f -o >>> /dev/null; done >>> -- llc.r77396 -- >>> name avg min med max SD total >>> user 1.7877 1.6809 1.7959 1.9022 0.0668 17.8772 >>> sys 0.2849 0.2735 0.2865 0.3035 0.0107 2.8489 >>> wall 2.0794 1.9574 2.0865 2.2134 0.0775 20.7939 >>> -- llc.r77397 -- >>> name avg min med max SD total >>> user 3.3274 3.1411 3.3089 3.5753 0.1541 33.2742 >>> sys 0.0586 0.0596 0.0581 0.0617 0.0037 0.5862 >>> wall 3.3922 3.2062 3.3750 3.6403 0.1550 33.9220 >>> >>> (runN is a timing tool of mine, like 'time' with more goodies) >>> >>> - Daniel >>> >>>> Modified: >>>> llvm/trunk/include/llvm/Support/FormattedStream.h >>>> llvm/trunk/lib/Support/FormattedStream.cpp >>>> >>>> Modified: llvm/trunk/include/llvm/Support/FormattedStream.h >>>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/FormattedStream.h?rev=77397&r1=77396&r2=77397&view=diff >>>> >>>> = >>>> = >>>> = >>>> = >>>> = >>>> = >>>> = >>>> = >>>> = >>>> = >>>> = >>>> =================================================================== >>>> --- llvm/trunk/include/llvm/Support/FormattedStream.h (original) >>>> +++ llvm/trunk/include/llvm/Support/FormattedStream.h Tue Jul 28 >>>> 18:26:34 2009 >>>> @@ -49,13 +49,13 @@ >>>> /// >>>> bool DeleteStream; >>>> >>>> - /// Column - The current output column of the stream. The >>>> column >>>> - /// scheme is zero-based. >>>> + /// ColumnFlushed - The current output column of the data >>>> that's >>>> + /// been flushed. The column scheme is zero-based. >>>> /// >>>> - unsigned Column; >>>> + unsigned ColumnFlushed; >>>> >>>> virtual void write_impl(const char *Ptr, size_t Size) { >>>> - ComputeColumn(Ptr, Size); >>>> + ComputeColumn(ColumnFlushed); >>>> TheStream->write(Ptr, Size); >>>> } >>>> >>>> @@ -67,10 +67,10 @@ >>>> return TheStream->tell() - TheStream->GetNumBytesInBuffer(); >>>> } >>>> >>>> - /// ComputeColumn - Examine the current output and figure out >>>> - /// which column we end up in after output. >>>> + /// ComputeColumn - Examine the current buffer and figure out >>>> + /// which column we're in. >>>> /// >>>> - void ComputeColumn(const char *Ptr, size_t Size); >>>> + void ComputeColumn(unsigned &Column); >>>> >>>> public: >>>> /// formatted_raw_ostream - Open the specified file for >>>> @@ -84,11 +84,11 @@ >>>> /// underneath it. >>>> /// >>>> formatted_raw_ostream(raw_ostream &Stream, bool Delete = false) >>>> - : raw_ostream(), TheStream(0), DeleteStream(false), Column >>>> (0) { >>>> + : raw_ostream(), TheStream(0), DeleteStream(false), >>>> ColumnFlushed(0) { >>>> setStream(Stream, Delete); >>>> } >>>> explicit formatted_raw_ostream() >>>> - : raw_ostream(), TheStream(0), DeleteStream(false), Column >>>> (0) {} >>>> + : raw_ostream(), TheStream(0), DeleteStream(false), >>>> ColumnFlushed(0) {} >>>> >>>> ~formatted_raw_ostream() { >>>> if (DeleteStream) >>>> >>>> Modified: llvm/trunk/lib/Support/FormattedStream.cpp >>>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/FormattedStream.cpp?rev=77397&r1=77396&r2=77397&view=diff >>>> >>>> = >>>> = >>>> = >>>> = >>>> = >>>> = >>>> = >>>> = >>>> = >>>> = >>>> = >>>> =================================================================== >>>> --- llvm/trunk/lib/Support/FormattedStream.cpp (original) >>>> +++ llvm/trunk/lib/Support/FormattedStream.cpp Tue Jul 28 18:26:34 >>>> 2009 >>>> @@ -19,11 +19,11 @@ >>>> /// ComputeColumn - Examine the current output and figure out which >>>> /// column we end up in after output. >>>> /// >>>> -void formatted_raw_ostream::ComputeColumn(const char *Ptr, size_t >>>> Size) { >>>> +void formatted_raw_ostream::ComputeColumn(unsigned &Column) { >>>> // Keep track of the current column by scanning the string for >>>> // special characters >>>> >>>> - for (const char *epos = Ptr + Size; Ptr != epos; ++Ptr) { >>>> + for (const char *Ptr = begin(); Ptr != end(); ++Ptr) { >>>> ++Column; >>>> if (*Ptr == '\n' || *Ptr == '\r') >>>> Column = 0; >>>> @@ -38,8 +38,13 @@ >>>> /// \param MinPad - The minimum space to give after the most recent >>>> /// I/O, even if the current column + minpad > newcol. >>>> /// >>>> -void formatted_raw_ostream::PadToColumn(unsigned NewCol, unsigned >>>> MinPad) { >>>> - flush(); >>>> +void formatted_raw_ostream::PadToColumn(unsigned NewCol, unsigned >>>> MinPad) { >>>> + // Start out from the last flush position. >>>> + unsigned Column = ColumnFlushed; >>>> + >>>> + // Now figure out what's in the buffer and add it to the column >>>> + // count. >>>> + ComputeColumn(Column); >>>> >>>> // Output spaces until we reach the desired column. >>>> unsigned num = NewCol - Column; >>>> >>>> >>>> _______________________________________________ >>>> llvm-commits mailing list >>>> llvm-commits at cs.uiuc.edu >>>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits >>>> >>> >>> _______________________________________________ >>> llvm-commits mailing list >>> llvm-commits at cs.uiuc.edu >>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits >> >> _______________________________________________ >> llvm-commits mailing list >> llvm-commits at cs.uiuc.edu >> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From isanbard at gmail.com Tue Jul 28 23:51:52 2009 From: isanbard at gmail.com (Bill Wendling) Date: Tue, 28 Jul 2009 21:51:52 -0700 Subject: [llvm-commits] [llvm-gcc-4.2] r77276 - /llvm-gcc-4.2/trunk/gcc/objc/objc-act.c In-Reply-To: <206FF0C9-90BD-4993-91C9-1376F7F1AFF4@apple.com> References: <200907272350.n6RNow4H026564@zion.cs.uiuc.edu> <206FF0C9-90BD-4993-91C9-1376F7F1AFF4@apple.com> Message-ID: <464C7886-5D8F-4CFA-82C0-EF50D8C7A6EA@gmail.com> On Jul 28, 2009, at 10:26 AM, Chris Lattner wrote: > On Jul 27, 2009, at 4:50 PM, Bill Wendling wrote: > >> Author: void >> Date: Mon Jul 27 18:50:57 2009 >> New Revision: 77276 >> >> URL: http://llvm.org/viewvc/llvm-project?rev=77276&view=rev >> Log: >> LTO was stripping some Objective-C metadata symbols because IPSCCP >> thought that >> they were dead. They weren't in the llvm.used list. Mark them as >> "preserve" so >> that they're placed into the list. >> >> The testcase for this is the SingleSource/UnitTests/ObjC/protocols.m >> file in >> the test suite. > > Thanks Bill. At some point, we have to get objc metadata into > llvm.used.compiler instead of llvm.used. Out of curiosity, is this on > your todo list? :) > It is. :-) But it's been given a slightly lower priority to other things. -bw From sabre at nondot.org Tue Jul 28 23:54:45 2009 From: sabre at nondot.org (Chris Lattner) Date: Wed, 29 Jul 2009 04:54:45 -0000 Subject: [llvm-commits] [llvm] r77429 - /llvm/trunk/lib/Target/TargetLoweringObjectFile.cpp Message-ID: <200907290454.n6T4sjSH028891@zion.cs.uiuc.edu> Author: lattner Date: Tue Jul 28 23:54:38 2009 New Revision: 77429 URL: http://llvm.org/viewvc/llvm-project?rev=77429&view=rev Log: remove some completely wrong code. 1 is never < 16. It turns out that GCC appears to put strings of any length into the ELF cstring equivalent, so just rip out the code. Modified: llvm/trunk/lib/Target/TargetLoweringObjectFile.cpp Modified: llvm/trunk/lib/Target/TargetLoweringObjectFile.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/TargetLoweringObjectFile.cpp?rev=77429&r1=77428&r2=77429&view=diff ============================================================================== --- llvm/trunk/lib/Target/TargetLoweringObjectFile.cpp (original) +++ llvm/trunk/lib/Target/TargetLoweringObjectFile.cpp Tue Jul 28 23:54:38 2009 @@ -412,28 +412,18 @@ if (Kind.isText()) return TextSection; if (Kind.isMergeableCString()) { - //Constant *C = cast(GV)->getInitializer(); + assert(CStringSection_ && "Should have string section prefix"); - // FIXME: This is completely wrong. Why is it comparing the size of the - // character type to 1? - /// cast(C->getType())->getNumElements(); - uint64_t Size = 1; - if (Size <= 16) { - assert(CStringSection_ && "Should have string section prefix"); - - // We also need alignment here. - // FIXME: this is getting the alignment of the character, not the - // alignment of the global! - unsigned Align = - TM.getTargetData()->getPreferredAlignment(cast(GV)); - - std::string Name = CStringSection_->getName() + utostr(Size) + '.' + - utostr(Align); - return getOrCreateSection(Name.c_str(), false, - SectionKind::MergeableCString); - } + // We also need alignment here. + // FIXME: this is getting the alignment of the character, not the + // alignment of the global! + unsigned Align = + TM.getTargetData()->getPreferredAlignment(cast(GV)); - return ReadOnlySection; + std::string Name = CStringSection_->getName() + utostr(Size) + '.' + + utostr(Align); + return getOrCreateSection(Name.c_str(), false, + SectionKind::MergeableCString); } if (Kind.isMergeableConst()) { From sabre at nondot.org Tue Jul 28 23:55:09 2009 From: sabre at nondot.org (Chris Lattner) Date: Wed, 29 Jul 2009 04:55:09 -0000 Subject: [llvm-commits] [llvm] r77430 - /llvm/trunk/lib/Target/TargetLoweringObjectFile.cpp Message-ID: <200907290455.n6T4t9Ot028916@zion.cs.uiuc.edu> Author: lattner Date: Tue Jul 28 23:55:08 2009 New Revision: 77430 URL: http://llvm.org/viewvc/llvm-project?rev=77430&view=rev Log: constant prop a utostr. Modified: llvm/trunk/lib/Target/TargetLoweringObjectFile.cpp Modified: llvm/trunk/lib/Target/TargetLoweringObjectFile.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/TargetLoweringObjectFile.cpp?rev=77430&r1=77429&r2=77430&view=diff ============================================================================== --- llvm/trunk/lib/Target/TargetLoweringObjectFile.cpp (original) +++ llvm/trunk/lib/Target/TargetLoweringObjectFile.cpp Tue Jul 28 23:55:08 2009 @@ -420,8 +420,7 @@ unsigned Align = TM.getTargetData()->getPreferredAlignment(cast(GV)); - std::string Name = CStringSection_->getName() + utostr(Size) + '.' + - utostr(Align); + std::string Name = CStringSection_->getName() + "1." + utostr(Align); return getOrCreateSection(Name.c_str(), false, SectionKind::MergeableCString); } From evan.cheng at apple.com Wed Jul 29 00:06:12 2009 From: evan.cheng at apple.com (Evan Cheng) Date: Wed, 29 Jul 2009 05:06:12 -0000 Subject: [llvm-commits] [llvm] r77431 - /llvm/trunk/utils/TableGen/AsmWriterEmitter.cpp Message-ID: <200907290506.n6T56CCS029248@zion.cs.uiuc.edu> Author: evancheng Date: Wed Jul 29 00:06:11 2009 New Revision: 77431 URL: http://llvm.org/viewvc/llvm-project?rev=77431&view=rev Log: Revert AsmWriterEmitter.cpp to 74742. The recent changes are causing serious compile time regression. Modified: llvm/trunk/utils/TableGen/AsmWriterEmitter.cpp Modified: llvm/trunk/utils/TableGen/AsmWriterEmitter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/AsmWriterEmitter.cpp?rev=77431&r1=77430&r2=77431&view=diff ============================================================================== --- llvm/trunk/utils/TableGen/AsmWriterEmitter.cpp (original) +++ llvm/trunk/utils/TableGen/AsmWriterEmitter.cpp Wed Jul 29 00:06:11 2009 @@ -19,7 +19,6 @@ #include "llvm/Support/Debug.h" #include "llvm/Support/MathExtras.h" #include -#include #include using namespace llvm; @@ -33,11 +32,7 @@ // This should be an anon namespace, this works around a GCC warning. namespace llvm { struct AsmWriterOperand { - enum OpType { - isLiteralTextOperand, - isMachineInstrOperand, - isLiteralStatementOperand - } OperandType; + enum { isLiteralTextOperand, isMachineInstrOperand } OperandType; /// Str - For isLiteralTextOperand, this IS the literal text. For /// isMachineInstrOperand, this is the PrinterMethodName for the operand. @@ -52,16 +47,14 @@ std::string MiModifier; // To make VS STL happy - AsmWriterOperand(OpType op = isLiteralTextOperand):OperandType(op) {} + AsmWriterOperand():OperandType(isLiteralTextOperand) {} - AsmWriterOperand(const std::string &LitStr, - OpType op = isLiteralTextOperand) - : OperandType(op), Str(LitStr) {} + explicit AsmWriterOperand(const std::string &LitStr) + : OperandType(isLiteralTextOperand), Str(LitStr) {} AsmWriterOperand(const std::string &Printer, unsigned OpNo, - const std::string &Modifier, - OpType op = isMachineInstrOperand) - : OperandType(op), Str(Printer), MIOpNo(OpNo), + const std::string &Modifier) + : OperandType(isMachineInstrOperand), Str(Printer), MIOpNo(OpNo), MiModifier(Modifier) {} bool operator!=(const AsmWriterOperand &Other) const { @@ -85,29 +78,6 @@ std::vector Operands; const CodeGenInstruction *CGI; - /// MAX_GROUP_NESTING_LEVEL - The maximum number of group nesting - /// levels we ever expect to see in an asm operand. - static const int MAX_GROUP_NESTING_LEVEL = 10; - - /// GroupLevel - The level of nesting of the current operand - /// group, such as [reg + (reg + offset)]. -1 means we are not in - /// a group. - int GroupLevel; - - /// GroupDelim - Remember the delimeter for a group operand. - char GroupDelim[MAX_GROUP_NESTING_LEVEL]; - - /// ReadingWhitespace - Tell whether we just read some whitespace. - bool ReadingWhitespace; - - /// InGroup - Determine whether we are in the middle of an - /// operand group. - bool InGroup() const { return GroupLevel != -1; } - - /// InWhitespace - Determine whether we are in the middle of - /// emitting whitespace. - bool InWhitespace() const { return ReadingWhitespace; } - AsmWriterInst(const CodeGenInstruction &CGI, unsigned Variant); /// MatchesAllButOneOp - If this instruction is exactly identical to the @@ -133,18 +103,6 @@ if (OperandType == isLiteralTextOperand) return "O << \"" + Str + "\"; "; - if (OperandType == isLiteralStatementOperand) { - return Str; - } - - if (OperandType == isLiteralStatementOperand) { - return Str; - } - - if (OperandType == isLiteralStatementOperand) { - return Str; - } - std::string Result = Str + "(MI"; if (MIOpNo != ~0U) Result += ", " + utostr(MIOpNo); @@ -157,8 +115,7 @@ /// ParseAsmString - Parse the specified Instruction's AsmString into this /// AsmWriterInst. /// -AsmWriterInst::AsmWriterInst(const CodeGenInstruction &CGI, unsigned Variant) - : GroupLevel(-1), ReadingWhitespace(false) { +AsmWriterInst::AsmWriterInst(const CodeGenInstruction &CGI, unsigned Variant) { this->CGI = &CGI; unsigned CurVariant = ~0U; // ~0 if we are outside a {.|.|.} region, other #. @@ -173,92 +130,15 @@ if (DollarPos == std::string::npos) DollarPos = AsmString.size(); // Emit a constant string fragment. - - // TODO: Recognize an operand separator to determine when to pad - // to the next operator. if (DollarPos != LastEmitted) { if (CurVariant == Variant || CurVariant == ~0U) { for (; LastEmitted != DollarPos; ++LastEmitted) switch (AsmString[LastEmitted]) { - case '\n': - assert(!InGroup() && "Missing matching group delimeter"); - ReadingWhitespace = false; - AddLiteralString("\\n"); - break; - case '\t': - if (!InGroup()) { - ReadingWhitespace = true; - } - AddLiteralString("\\t"); - break; - case '"': - if (InWhitespace() && !InGroup()) - Operands.push_back( - AsmWriterOperand( - "O.PadToColumn(TAI->getOperandColumn(OperandColumn++));\n", - AsmWriterOperand::isLiteralStatementOperand)); - ReadingWhitespace = false; - AddLiteralString("\\\""); - break; - case '\\': - if (InWhitespace() && !InGroup()) - Operands.push_back( - AsmWriterOperand( - "O.PadToColumn(TAI->getOperandColumn(OperandColumn++));\n", - AsmWriterOperand::isLiteralStatementOperand)); - ReadingWhitespace = false; - AddLiteralString("\\\\"); - break; - - case '(': // Fallthrough - case '[': - if (InWhitespace() && !InGroup()) - Operands.push_back( - AsmWriterOperand( - "O.PadToColumn(TAI->getOperandColumn(OperandColumn++));\n", - AsmWriterOperand::isLiteralStatementOperand)); - ReadingWhitespace = false; - - ++GroupLevel; - assert(GroupLevel < MAX_GROUP_NESTING_LEVEL - && "Exceeded maximum operand group nesting level"); - GroupDelim[GroupLevel] = AsmString[LastEmitted]; - AddLiteralString(std::string(1, AsmString[LastEmitted])); - break; - - case ')': // Fallthrough - case ']': - if (InWhitespace() && !InGroup()) - Operands.push_back( - AsmWriterOperand( - "O.PadToColumn(TAI->getOperandColumn(OperandColumn++));\n", - AsmWriterOperand::isLiteralStatementOperand)); - ReadingWhitespace = false; - - if (AsmString[LastEmitted] == ')') - assert(GroupDelim[GroupLevel] == '(' && "Mismatched delimeters"); - else - assert(GroupDelim[GroupLevel] == '[' && "Mismatched delimeters"); - - --GroupLevel; - assert(GroupLevel > -2 && "Too many end delimeters!"); - AddLiteralString(std::string(1, AsmString[LastEmitted])); - break; - + case '\n': AddLiteralString("\\n"); break; + case '\t': AddLiteralString("\\t"); break; + case '"': AddLiteralString("\\\""); break; + case '\\': AddLiteralString("\\\\"); break; default: - if (AsmString[LastEmitted] != ' ' && - AsmString[LastEmitted] != '\t') { - if (!InGroup() && InWhitespace()) - Operands.push_back( - AsmWriterOperand( - "O.PadToColumn(TAI->getOperandColumn(OperandColumn++));\n", - AsmWriterOperand::isLiteralStatementOperand)); - ReadingWhitespace = false; - } - else - if (!InGroup()) - ReadingWhitespace = true; - AddLiteralString(std::string(1, AsmString[LastEmitted])); break; } @@ -269,33 +149,11 @@ if (DollarPos+1 != AsmString.size() && (CurVariant == Variant || CurVariant == ~0U)) { if (AsmString[DollarPos+1] == 'n') { - assert(!InGroup() && "Missing matching group delimeter"); - ReadingWhitespace = false; AddLiteralString("\\n"); } else if (AsmString[DollarPos+1] == 't') { - if (!InGroup()) { - ReadingWhitespace = true; - } AddLiteralString("\\t"); } else if (std::string("${|}\\").find(AsmString[DollarPos+1]) != std::string::npos) { - if (InWhitespace() && !InGroup()) - Operands.push_back( - AsmWriterOperand( - "O.PadToColumn(TAI->getOperandColumn(OperandColumn++));\n", - AsmWriterOperand::isLiteralStatementOperand)); - ReadingWhitespace = false; - - if (AsmString[DollarPos+1] == '{') { - ++GroupLevel; - assert(GroupLevel < MAX_GROUP_NESTING_LEVEL - && "Exceeded maximum operand group nesting level"); - GroupDelim[GroupLevel] = AsmString[DollarPos+1]; - } else if (AsmString[DollarPos+1] == '}') { - assert(GroupDelim[GroupLevel] == '{' && "Mismatched delimeters"); - --GroupLevel; - assert(GroupLevel > -2 && "Too many end delimeters!"); - } AddLiteralString(std::string(1, AsmString[DollarPos+1])); } else { throw "Non-supported escaped character found in instruction '" + @@ -324,27 +182,13 @@ CurVariant = ~0U; } else if (DollarPos+1 != AsmString.size() && AsmString[DollarPos+1] == '$') { - if (CurVariant == Variant || CurVariant == ~0U) { - if (InWhitespace() && !InGroup()) - Operands.push_back( - AsmWriterOperand( - "O.PadToColumn(TAI->getOperandColumn(OperandColumn++));\n", - AsmWriterOperand::isLiteralStatementOperand)); - ReadingWhitespace = false; + if (CurVariant == Variant || CurVariant == ~0U) AddLiteralString("$"); // "$$" -> $ - } LastEmitted = DollarPos+2; } else { - if (InWhitespace() && !InGroup()) - Operands.push_back( - AsmWriterOperand( - "O.PadToColumn(TAI->getOperandColumn(OperandColumn++));\n", - AsmWriterOperand::isLiteralStatementOperand)); - ReadingWhitespace = false; - // Get the name of the variable. std::string::size_type VarEnd = DollarPos+1; - + // handle ${foo}bar as $foo by detecting whether the character following // the dollar sign is a curly brace. If so, advance VarEnd and DollarPos // so the variable name does not contain the leading curly brace. @@ -416,9 +260,6 @@ } } - Operands.push_back( - AsmWriterOperand("EmitComments(*MI);\n", - AsmWriterOperand::isLiteralStatementOperand)); AddLiteralString("\\n"); } @@ -516,6 +357,7 @@ } O << "\n"; } + O << " break;\n"; } @@ -543,9 +385,8 @@ Command = " " + Inst->Operands[0].getCode() + "\n"; // If this is the last operand, emit a return. - if (Inst->Operands.size() == 1) { + if (Inst->Operands.size() == 1) Command += " return true;\n"; - } // Check to see if we already have 'Command' in UniqueOperandCommands. // If not, add it. @@ -590,10 +431,7 @@ // Otherwise, scan to see if all of the other instructions in this command // set share the operand. bool AllSame = true; - // Keep track of the maximum, number of operands or any - // instruction we see in the group. - size_t MaxSize = FirstInst->Operands.size(); - + for (NIT = std::find(NIT+1, InstIdxs.end(), CommandIdx); NIT != InstIdxs.end(); NIT = std::find(NIT+1, InstIdxs.end(), CommandIdx)) { @@ -601,11 +439,6 @@ // matches, we're ok, otherwise bail out. const AsmWriterInst *OtherInst = getAsmWriterInstByID(NIT-InstIdxs.begin()); - - if (OtherInst && - OtherInst->Operands.size() > FirstInst->Operands.size()) - MaxSize = std::max(MaxSize, OtherInst->Operands.size()); - if (!OtherInst || OtherInst->Operands.size() == Op || OtherInst->Operands[Op] != FirstInst->Operands[Op]) { AllSame = false; @@ -619,12 +452,8 @@ std::string Command = " " + FirstInst->Operands[Op].getCode() + "\n"; // If this is the last operand, emit a return after the code. - if (FirstInst->Operands.size() == Op+1 && - // Don't early-out too soon. Other instructions in this - // group may have more operands. - FirstInst->Operands.size() == MaxSize) { + if (FirstInst->Operands.size() == Op+1) Command += " return true;\n"; - } UniqueOperandCommands[CommandIdx] += Command; InstOpsUsed[CommandIdx]++; @@ -738,7 +567,7 @@ UniqueOperandCommands.push_back(" return true;\n"); isFirst = false; } - + std::vector InstIdxs; std::vector NumInstOpsHandled; FindUniqueOperandCommands(UniqueOperandCommands, InstIdxs, @@ -846,28 +675,8 @@ O << " // Emit the opcode for the instruction.\n" << " unsigned Bits = OpInfo[MI->getOpcode()];\n" - << " if (Bits == 0) return false;\n\n"; - - O << " unsigned OperandColumn = 1;\n\n" - << " if (TAI->getOperandColumn(1) > 0) {\n" - << " // Don't emit trailing whitespace, let the column padding do it. This\n" - << " // guarantees that a stray long opcode + tab won't upset the alignment.\n" - << " unsigned OpLength = std::strlen(AsmStrs+(Bits & " << (1 << AsmStrBits)-1 << "));\n" - << " if (OpLength > 0 &&\n" - << " ((AsmStrs+(Bits & " << (1 << AsmStrBits)-1 << "))[OpLength-1] == ' ' ||\n" - << " (AsmStrs+(Bits & " << (1 << AsmStrBits)-1 << "))[OpLength-1] == '\\t')) {\n" - << " do {\n" - << " --OpLength;\n" - << " } while ((AsmStrs+(Bits & " << (1 << AsmStrBits)-1 << "))[OpLength-1] == ' ' ||\n" - << " (AsmStrs+(Bits & " << (1 << AsmStrBits)-1 << "))[OpLength-1] == '\\t');\n" - << " for (unsigned Idx = 0; Idx < OpLength; ++Idx)\n" - << " O << (AsmStrs+(Bits & " << (1 << AsmStrBits)-1 << "))[Idx];\n" - << " O.PadToColumn(TAI->getOperandColumn(OperandColumn++), 1);\n" - << " }\n" - << " } else {\n" - << " O << AsmStrs+(Bits & " << (1 << AsmStrBits)-1 << ");\n" - << " }\n\n"; - + << " if (Bits == 0) return false;\n" + << " O << AsmStrs+(Bits & " << (1 << AsmStrBits)-1 << ");\n\n"; // Output the table driven operand information. BitsLeft = 32-AsmStrBits; @@ -932,7 +741,6 @@ O << " }\n"; O << " return true;\n"; } - - O << " return true;\n"; + O << "}\n"; } From sabre at nondot.org Wed Jul 29 00:09:31 2009 From: sabre at nondot.org (Chris Lattner) Date: Wed, 29 Jul 2009 05:09:31 -0000 Subject: [llvm-commits] [llvm] r77432 - in /llvm/trunk: include/llvm/Target/ lib/CodeGen/ lib/CodeGen/AsmPrinter/ lib/Target/ lib/Target/ARM/AsmPrinter/ lib/Target/Alpha/AsmPrinter/ lib/Target/CellSPU/AsmPrinter/ lib/Target/MSP430/ lib/Target/Mips/AsmPrinter/ lib/Target/PIC16/ lib/Target/PowerPC/AsmPrinter/ lib/Target/Sparc/AsmPrinter/ lib/Target/SystemZ/AsmPrinter/ lib/Target/X86/AsmPrinter/ lib/Target/XCore/ Message-ID: <200907290509.n6T59WhO029366@zion.cs.uiuc.edu> Author: lattner Date: Wed Jul 29 00:09:30 2009 New Revision: 77432 URL: http://llvm.org/viewvc/llvm-project?rev=77432&view=rev Log: pass the mangler down into the various SectionForGlobal methods. No functionality change. Modified: llvm/trunk/include/llvm/Target/TargetLoweringObjectFile.h llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp llvm/trunk/lib/CodeGen/ELFWriter.cpp llvm/trunk/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp llvm/trunk/lib/Target/Alpha/AsmPrinter/AlphaAsmPrinter.cpp llvm/trunk/lib/Target/CellSPU/AsmPrinter/SPUAsmPrinter.cpp llvm/trunk/lib/Target/MSP430/MSP430AsmPrinter.cpp llvm/trunk/lib/Target/Mips/AsmPrinter/MipsAsmPrinter.cpp llvm/trunk/lib/Target/PIC16/PIC16AsmPrinter.cpp llvm/trunk/lib/Target/PIC16/PIC16TargetObjectFile.cpp llvm/trunk/lib/Target/PIC16/PIC16TargetObjectFile.h llvm/trunk/lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp llvm/trunk/lib/Target/Sparc/AsmPrinter/SparcAsmPrinter.cpp llvm/trunk/lib/Target/SystemZ/AsmPrinter/SystemZAsmPrinter.cpp llvm/trunk/lib/Target/TargetLoweringObjectFile.cpp llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp llvm/trunk/lib/Target/XCore/XCoreAsmPrinter.cpp Modified: llvm/trunk/include/llvm/Target/TargetLoweringObjectFile.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetLoweringObjectFile.h?rev=77432&r1=77431&r2=77432&view=diff ============================================================================== --- llvm/trunk/include/llvm/Target/TargetLoweringObjectFile.h (original) +++ llvm/trunk/include/llvm/Target/TargetLoweringObjectFile.h Wed Jul 29 00:09:30 2009 @@ -88,6 +88,7 @@ /// the specified global variable or function definition. This should not /// be passed external (or available externally) globals. const Section *SectionForGlobal(const GlobalValue *GV, + Mangler *Mang, const TargetMachine &TM) const; /// getSpecialCasedSectionGlobals - Allow the target to completely override @@ -95,7 +96,7 @@ /// FIXME: ELIMINATE this by making PIC16 implement ADDRESS with /// getFlagsForNamedSection. virtual const Section * - getSpecialCasedSectionGlobals(const GlobalValue *GV, + getSpecialCasedSectionGlobals(const GlobalValue *GV, Mangler *Mang, SectionKind Kind) const { return 0; } @@ -108,9 +109,9 @@ } protected: - virtual const Section *SelectSectionForGlobal(const GlobalValue *GV, - SectionKind Kind, - const TargetMachine &TM) const; + virtual const Section * + SelectSectionForGlobal(const GlobalValue *GV, SectionKind Kind, + Mangler *Mang, const TargetMachine &TM) const; }; @@ -136,9 +137,9 @@ void getSectionFlagsAsString(SectionKind Kind, SmallVectorImpl &Str) const; - virtual const Section* SelectSectionForGlobal(const GlobalValue *GV, - SectionKind Kind, - const TargetMachine &TM) const; + virtual const Section * + SelectSectionForGlobal(const GlobalValue *GV, SectionKind Kind, + Mangler *Mang, const TargetMachine &TM) const; protected: const Section *DataRelSection; const Section *DataRelLocalSection; @@ -161,9 +162,9 @@ const Section *SixteenByteConstantSection; public: TargetLoweringObjectFileMachO(const TargetMachine &TM); - virtual const Section *SelectSectionForGlobal(const GlobalValue *GV, - SectionKind Kind, - const TargetMachine &TM) const; + virtual const Section * + SelectSectionForGlobal(const GlobalValue *GV, SectionKind Kind, + Mangler *Mang, const TargetMachine &TM) const; virtual const Section * getSectionForMergeableConstant(SectionKind Kind) const; @@ -179,7 +180,7 @@ virtual const Section * SelectSectionForGlobal(const GlobalValue *GV, SectionKind Kind, - const TargetMachine &TM) const; + Mangler *Mang, const TargetMachine &TM) const; }; } // end namespace llvm Modified: llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp?rev=77432&r1=77431&r2=77432&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp (original) +++ llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp Wed Jul 29 00:09:30 2009 @@ -412,10 +412,11 @@ // the appropriate section. TargetLowering *LoweringInfo = TM.getTargetLowering(); - const char* JumpTableDataSection = TAI->getJumpTableDataSection(); + const char *JumpTableDataSection = TAI->getJumpTableDataSection(); const Function *F = MF.getFunction(); - const Section *FuncSection = getObjFileLowering().SectionForGlobal(F, TM); + const Section *FuncSection = + getObjFileLowering().SectionForGlobal(F, Mang, TM); bool JTInDiffSection = false; if ((IsPic && !(LoweringInfo && LoweringInfo->usesGlobalOffsetTable())) || Modified: llvm/trunk/lib/CodeGen/ELFWriter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/ELFWriter.cpp?rev=77432&r1=77431&r2=77432&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/ELFWriter.cpp (original) +++ llvm/trunk/lib/CodeGen/ELFWriter.cpp Wed Jul 29 00:09:30 2009 @@ -326,7 +326,7 @@ TM.getTargetLowering()->getObjFileLowering(); // Get the ELF section where this global belongs from TLOF - const Section *S = TLOF.SectionForGlobal(GV, TM); + const Section *S = TLOF.SectionForGlobal(GV, Mang, TM); unsigned SectionFlags = getElfSectionFlags(S->getKind()); // The symbol align should update the section alignment if needed Modified: llvm/trunk/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp?rev=77432&r1=77431&r2=77432&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp (original) +++ llvm/trunk/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp Wed Jul 29 00:09:30 2009 @@ -1153,7 +1153,8 @@ if (Subtarget->isTargetELF()) O << "\t.type " << name << ",%object\n"; - const Section *TheSection = getObjFileLowering().SectionForGlobal(GVar, TM); + const Section *TheSection = + getObjFileLowering().SectionForGlobal(GVar, Mang, TM); SwitchToSection(TheSection); // FIXME: get this stuff from section kind flags. @@ -1180,7 +1181,7 @@ O << TAI->getCOMMDirective() << name << "," << Size << ',' << Align; } else { - SwitchToSection(getObjFileLowering().SectionForGlobal(GVar, TM)); + SwitchToSection(getObjFileLowering().SectionForGlobal(GVar, Mang,TM)); O << "\t.globl " << name << '\n' << TAI->getWeakDefDirective() << name << '\n'; EmitAlignment(Align, GVar); Modified: llvm/trunk/lib/Target/Alpha/AsmPrinter/AlphaAsmPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Alpha/AsmPrinter/AlphaAsmPrinter.cpp?rev=77432&r1=77431&r2=77432&view=diff ============================================================================== --- llvm/trunk/lib/Target/Alpha/AsmPrinter/AlphaAsmPrinter.cpp (original) +++ llvm/trunk/lib/Target/Alpha/AsmPrinter/AlphaAsmPrinter.cpp Wed Jul 29 00:09:30 2009 @@ -139,7 +139,7 @@ // Print out labels for the function. const Function *F = MF.getFunction(); - SwitchToSection(getObjFileLowering().SectionForGlobal(F, TM)); + SwitchToSection(getObjFileLowering().SectionForGlobal(F, Mang, TM)); EmitAlignment(MF.getAlignment(), F); switch (F->getLinkage()) { @@ -215,7 +215,7 @@ unsigned Align = TD->getPreferredAlignmentLog(GVar); // 0: Switch to section - SwitchToSection(getObjFileLowering().SectionForGlobal(GVar, TM)); + SwitchToSection(getObjFileLowering().SectionForGlobal(GVar, Mang, TM)); // 1: Check visibility printVisibility(name, GVar->getVisibility()); Modified: llvm/trunk/lib/Target/CellSPU/AsmPrinter/SPUAsmPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/CellSPU/AsmPrinter/SPUAsmPrinter.cpp?rev=77432&r1=77431&r2=77432&view=diff ============================================================================== --- llvm/trunk/lib/Target/CellSPU/AsmPrinter/SPUAsmPrinter.cpp (original) +++ llvm/trunk/lib/Target/CellSPU/AsmPrinter/SPUAsmPrinter.cpp Wed Jul 29 00:09:30 2009 @@ -428,7 +428,7 @@ // Print out labels for the function. const Function *F = MF.getFunction(); - SwitchToSection(getObjFileLowering().SectionForGlobal(F, TM)); + SwitchToSection(getObjFileLowering().SectionForGlobal(F, Mang, TM)); EmitAlignment(MF.getAlignment(), F); switch (F->getLinkage()) { @@ -526,7 +526,7 @@ unsigned Size = TD->getTypeAllocSize(Type); unsigned Align = TD->getPreferredAlignmentLog(GVar); - SwitchToSection(getObjFileLowering().SectionForGlobal(GVar, TM)); + SwitchToSection(getObjFileLowering().SectionForGlobal(GVar, Mang, TM)); if (C->isNullValue() && /* FIXME: Verify correct */ !GVar->hasSection() && Modified: llvm/trunk/lib/Target/MSP430/MSP430AsmPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/MSP430/MSP430AsmPrinter.cpp?rev=77432&r1=77431&r2=77432&view=diff ============================================================================== --- llvm/trunk/lib/Target/MSP430/MSP430AsmPrinter.cpp (original) +++ llvm/trunk/lib/Target/MSP430/MSP430AsmPrinter.cpp Wed Jul 29 00:09:30 2009 @@ -78,7 +78,7 @@ void MSP430AsmPrinter::emitFunctionHeader(const MachineFunction &MF) { const Function *F = MF.getFunction(); - SwitchToSection(getObjFileLowering().SectionForGlobal(F, TM)); + SwitchToSection(getObjFileLowering().SectionForGlobal(F, Mang, TM)); unsigned FnAlign = MF.getAlignment(); EmitAlignment(FnAlign, F); Modified: llvm/trunk/lib/Target/Mips/AsmPrinter/MipsAsmPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mips/AsmPrinter/MipsAsmPrinter.cpp?rev=77432&r1=77431&r2=77432&view=diff ============================================================================== --- llvm/trunk/lib/Target/Mips/AsmPrinter/MipsAsmPrinter.cpp (original) +++ llvm/trunk/lib/Target/Mips/AsmPrinter/MipsAsmPrinter.cpp Wed Jul 29 00:09:30 2009 @@ -178,9 +178,7 @@ //===----------------------------------------------------------------------===// /// Frame Directive -void MipsAsmPrinter:: -emitFrameDirective(MachineFunction &MF) -{ +void MipsAsmPrinter::emitFrameDirective(MachineFunction &MF) { const TargetRegisterInfo &RI = *TM.getRegisterInfo(); unsigned stackReg = RI.getFrameRegister(MF); @@ -195,9 +193,7 @@ } /// Emit Set directives. -const char * MipsAsmPrinter:: -emitCurrentABIString(void) -{ +const char *MipsAsmPrinter::emitCurrentABIString() { switch(Subtarget->getTargetABI()) { case MipsSubtarget::O32: return "abi32"; case MipsSubtarget::O64: return "abiO64"; @@ -215,7 +211,7 @@ void MipsAsmPrinter::emitFunctionStart(MachineFunction &MF) { // Print out the label for the function. const Function *F = MF.getFunction(); - SwitchToSection(getObjFileLowering().SectionForGlobal(F, TM)); + SwitchToSection(getObjFileLowering().SectionForGlobal(F, Mang, TM)); // 2 bits aligned EmitAlignment(MF.getAlignment(), F); @@ -237,9 +233,7 @@ } /// Emit the directives used by GAS on the end of functions -void MipsAsmPrinter:: -emitFunctionEnd(MachineFunction &MF) -{ +void MipsAsmPrinter::emitFunctionEnd(MachineFunction &MF) { // There are instruction for this macros, but they must // always be at the function end, and we can't emit and // break with BB logic. @@ -253,9 +247,7 @@ /// runOnMachineFunction - This uses the printMachineInstruction() /// method to print assembly for each instruction. -bool MipsAsmPrinter:: -runOnMachineFunction(MachineFunction &MF) -{ +bool MipsAsmPrinter::runOnMachineFunction(MachineFunction &MF) { this->MF = &MF; SetupMachineFunction(MF); @@ -300,10 +292,8 @@ } // Print out an operand for an inline asm expression. -bool MipsAsmPrinter:: -PrintAsmOperand(const MachineInstr *MI, unsigned OpNo, - unsigned AsmVariant, const char *ExtraCode) -{ +bool MipsAsmPrinter::PrintAsmOperand(const MachineInstr *MI, unsigned OpNo, + unsigned AsmVariant,const char *ExtraCode){ // Does this asm operand have a single letter operand modifier? if (ExtraCode && ExtraCode[0]) return true; // Unknown modifier. @@ -312,9 +302,7 @@ return false; } -void MipsAsmPrinter:: -printOperand(const MachineInstr *MI, int opNum) -{ +void MipsAsmPrinter::printOperand(const MachineInstr *MI, int opNum) { const MachineOperand &MO = MI->getOperand(opNum); const TargetRegisterInfo &RI = *TM.getRegisterInfo(); bool closeP = false; @@ -398,8 +386,7 @@ if (closeP) O << ")"; } -void MipsAsmPrinter:: -printUnsignedImm(const MachineInstr *MI, int opNum) { +void MipsAsmPrinter::printUnsignedImm(const MachineInstr *MI, int opNum) { const MachineOperand &MO = MI->getOperand(opNum); if (MO.getType() == MachineOperand::MO_Immediate) O << (unsigned short int)MO.getImm(); @@ -484,7 +471,7 @@ printVisibility(name, GVar->getVisibility()); - SwitchToSection(getObjFileLowering().SectionForGlobal(GVar, TM)); + SwitchToSection(getObjFileLowering().SectionForGlobal(GVar, Mang, TM)); if (C->isNullValue() && !GVar->hasSection()) { if (!GVar->isThreadLocal() && Modified: llvm/trunk/lib/Target/PIC16/PIC16AsmPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PIC16/PIC16AsmPrinter.cpp?rev=77432&r1=77431&r2=77432&view=diff ============================================================================== --- llvm/trunk/lib/Target/PIC16/PIC16AsmPrinter.cpp (original) +++ llvm/trunk/lib/Target/PIC16/PIC16AsmPrinter.cpp Wed Jul 29 00:09:30 2009 @@ -223,7 +223,7 @@ // Set the section names for all globals. for (Module::global_iterator I = M.global_begin(), E = M.global_end(); I != E; ++I) - I->setSection(getObjFileLowering().SectionForGlobal(I, TM)->getName()); + I->setSection(getObjFileLowering().SectionForGlobal(I, Mang,TM)->getName()); DbgInfo.BeginModule(M); EmitFunctionDecls(M); Modified: llvm/trunk/lib/Target/PIC16/PIC16TargetObjectFile.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PIC16/PIC16TargetObjectFile.cpp?rev=77432&r1=77431&r2=77432&view=diff ============================================================================== --- llvm/trunk/lib/Target/PIC16/PIC16TargetObjectFile.cpp (original) +++ llvm/trunk/lib/Target/PIC16/PIC16TargetObjectFile.cpp Wed Jul 29 00:09:30 2009 @@ -165,12 +165,13 @@ const Section* PIC16TargetObjectFile::SelectSectionForGlobal(const GlobalValue *GV1, SectionKind Kind, + Mangler *Mang, const TargetMachine &TM) const { // We select the section based on the initializer here, so it really // has to be a GlobalVariable. const GlobalVariable *GV = dyn_cast(GV1); if (!GV) - return TargetLoweringObjectFile::SelectSectionForGlobal(GV1, Kind, TM); + return TargetLoweringObjectFile::SelectSectionForGlobal(GV1, Kind, Mang,TM); // Record External Var Decls. if (GV->isDeclaration()) { @@ -204,7 +205,7 @@ return getROSectionForGlobal(GV); // Else let the default implementation take care of it. - return TargetLoweringObjectFile::SelectSectionForGlobal(GV, Kind, TM); + return TargetLoweringObjectFile::SelectSectionForGlobal(GV, Kind, Mang,TM); } PIC16TargetObjectFile::~PIC16TargetObjectFile() { @@ -225,6 +226,7 @@ /// section assignment of a global. const Section * PIC16TargetObjectFile::getSpecialCasedSectionGlobals(const GlobalValue *GV, + Mangler *Mang, SectionKind Kind) const { // If GV has a sectin name or section address create that section now. if (GV->hasSection()) { @@ -235,11 +237,11 @@ std::string AddrStr = "Address="; if (SectName.compare(0, AddrStr.length(), AddrStr) == 0) { std::string SectAddr = SectName.substr(AddrStr.length()); - return CreateSectionForGlobal(GVar, SectAddr); + return CreateSectionForGlobal(GVar, Mang, SectAddr); } // Create the section specified with section attribute. - return CreateSectionForGlobal(GVar); + return CreateSectionForGlobal(GVar, Mang); } } @@ -250,6 +252,7 @@ // section at that address else create by name. const Section * PIC16TargetObjectFile::CreateSectionForGlobal(const GlobalVariable *GV, + Mangler *Mang, const std::string &Addr) const { // See if this is an uninitialized global. const Constant *C = GV->getInitializer(); @@ -265,7 +268,7 @@ return CreateROSectionForGlobal(GV, Addr); // Else let the default implementation take care of it. - return TargetLoweringObjectFile::SectionForGlobal(GV, TM); + return TargetLoweringObjectFile::SectionForGlobal(GV, Mang, TM); } // Create uninitialized section for a variable. Modified: llvm/trunk/lib/Target/PIC16/PIC16TargetObjectFile.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PIC16/PIC16TargetObjectFile.h?rev=77432&r1=77431&r2=77432&view=diff ============================================================================== --- llvm/trunk/lib/Target/PIC16/PIC16TargetObjectFile.h (original) +++ llvm/trunk/lib/Target/PIC16/PIC16TargetObjectFile.h Wed Jul 29 00:09:30 2009 @@ -59,10 +59,11 @@ /// getSpecialCasedSectionGlobals - Allow the target to completely override /// section assignment of a global. virtual const Section * - getSpecialCasedSectionGlobals(const GlobalValue *GV, + getSpecialCasedSectionGlobals(const GlobalValue *GV, Mangler *Mang, SectionKind Kind) const; virtual const Section *SelectSectionForGlobal(const GlobalValue *GV, SectionKind Kind, + Mangler *Mang, const TargetMachine&) const; private: std::string getSectionNameForSym(const std::string &Sym) const; @@ -78,6 +79,7 @@ const Section *CreateROSectionForGlobal(const GlobalVariable *GV, std::string Addr = "") const; const Section *CreateSectionForGlobal(const GlobalVariable *GV, + Mangler *Mang, const std::string &Addr = "") const; public: void SetSectionForGVs(Module &M); Modified: llvm/trunk/lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp?rev=77432&r1=77431&r2=77432&view=diff ============================================================================== --- llvm/trunk/lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp (original) +++ llvm/trunk/lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp Wed Jul 29 00:09:30 2009 @@ -591,7 +591,7 @@ // Print out labels for the function. const Function *F = MF.getFunction(); - SwitchToSection(getObjFileLowering().SectionForGlobal(F, TM)); + SwitchToSection(getObjFileLowering().SectionForGlobal(F, Mang, TM)); switch (F->getLinkage()) { default: llvm_unreachable("Unknown linkage type!"); @@ -640,7 +640,7 @@ // Print out jump tables referenced by the function. EmitJumpTableInfo(MF.getJumpTableInfo(), MF); - SwitchToSection(getObjFileLowering().SectionForGlobal(F, TM)); + SwitchToSection(getObjFileLowering().SectionForGlobal(F, Mang, TM)); // Emit post-function debug information. DW->EndFunction(&MF); @@ -682,7 +682,7 @@ unsigned Size = TD->getTypeAllocSize(Type); unsigned Align = TD->getPreferredAlignmentLog(GVar); - SwitchToSection(getObjFileLowering().SectionForGlobal(GVar, TM)); + SwitchToSection(getObjFileLowering().SectionForGlobal(GVar, Mang, TM)); if (C->isNullValue() && /* FIXME: Verify correct */ !GVar->hasSection() && @@ -763,7 +763,7 @@ // Print out labels for the function. const Function *F = MF.getFunction(); - SwitchToSection(getObjFileLowering().SectionForGlobal(F, TM)); + SwitchToSection(getObjFileLowering().SectionForGlobal(F, Mang, TM)); switch (F->getLinkage()) { default: llvm_unreachable("Unknown linkage type!"); @@ -892,7 +892,8 @@ unsigned Size = TD->getTypeAllocSize(Type); unsigned Align = TD->getPreferredAlignmentLog(GVar); - const Section *TheSection = getObjFileLowering().SectionForGlobal(GVar, TM); + const Section *TheSection = + getObjFileLowering().SectionForGlobal(GVar, Mang, TM); SwitchToSection(TheSection); if (C->isNullValue() && /* FIXME: Verify correct */ Modified: llvm/trunk/lib/Target/Sparc/AsmPrinter/SparcAsmPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Sparc/AsmPrinter/SparcAsmPrinter.cpp?rev=77432&r1=77431&r2=77432&view=diff ============================================================================== --- llvm/trunk/lib/Target/Sparc/AsmPrinter/SparcAsmPrinter.cpp (original) +++ llvm/trunk/lib/Target/Sparc/AsmPrinter/SparcAsmPrinter.cpp Wed Jul 29 00:09:30 2009 @@ -96,7 +96,7 @@ // Print out the label for the function. const Function *F = MF.getFunction(); - SwitchToSection(getObjFileLowering().SectionForGlobal(F, TM)); + SwitchToSection(getObjFileLowering().SectionForGlobal(F, Mang, TM)); EmitAlignment(MF.getAlignment(), F); O << "\t.globl\t" << CurrentFnName << '\n'; @@ -230,7 +230,7 @@ printVisibility(name, GVar->getVisibility()); - SwitchToSection(getObjFileLowering().SectionForGlobal(GVar, TM)); + SwitchToSection(getObjFileLowering().SectionForGlobal(GVar, Mang, TM)); if (C->isNullValue() && !GVar->hasSection()) { if (!GVar->isThreadLocal() && Modified: llvm/trunk/lib/Target/SystemZ/AsmPrinter/SystemZAsmPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/SystemZ/AsmPrinter/SystemZAsmPrinter.cpp?rev=77432&r1=77431&r2=77432&view=diff ============================================================================== --- llvm/trunk/lib/Target/SystemZ/AsmPrinter/SystemZAsmPrinter.cpp (original) +++ llvm/trunk/lib/Target/SystemZ/AsmPrinter/SystemZAsmPrinter.cpp Wed Jul 29 00:09:30 2009 @@ -83,7 +83,7 @@ unsigned FnAlign = MF.getAlignment(); const Function *F = MF.getFunction(); - SwitchToSection(getObjFileLowering().SectionForGlobal(F, TM)); + SwitchToSection(getObjFileLowering().SectionForGlobal(F, Mang, TM)); EmitAlignment(FnAlign, F); @@ -331,7 +331,7 @@ O << "\t.type\t" << name << ", at object\n"; - SwitchToSection(getObjFileLowering().SectionForGlobal(GVar, TM)); + SwitchToSection(getObjFileLowering().SectionForGlobal(GVar, Mang, TM)); if (C->isNullValue() && !GVar->hasSection() && !GVar->isThreadLocal() && Modified: llvm/trunk/lib/Target/TargetLoweringObjectFile.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/TargetLoweringObjectFile.cpp?rev=77432&r1=77431&r2=77432&view=diff ============================================================================== --- llvm/trunk/lib/Target/TargetLoweringObjectFile.cpp (original) +++ llvm/trunk/lib/Target/TargetLoweringObjectFile.cpp Wed Jul 29 00:09:30 2009 @@ -176,7 +176,8 @@ /// the specified global variable or function definition. This should not /// be passed external (or available externally) globals. const Section *TargetLoweringObjectFile:: -SectionForGlobal(const GlobalValue *GV, const TargetMachine &TM) const { +SectionForGlobal(const GlobalValue *GV, Mangler *Mang, + const TargetMachine &TM) const { assert(!GV->isDeclaration() && !GV->hasAvailableExternallyLinkage() && "Can only be used for global definitions"); @@ -190,7 +191,7 @@ if (GV->hasSection()) { // If the target has special section hacks for specifically named globals, // return them now. - if (const Section *TS = getSpecialCasedSectionGlobals(GV, Kind)) + if (const Section *TS = getSpecialCasedSectionGlobals(GV, Mang, Kind)) return TS; // If the target has magic semantics for certain section names, make sure to @@ -203,13 +204,14 @@ // Use default section depending on the 'type' of global - return SelectSectionForGlobal(GV, Kind, TM); + return SelectSectionForGlobal(GV, Kind, Mang, TM); } // Lame default implementation. Calculate the section name for global. const Section* TargetLoweringObjectFile::SelectSectionForGlobal(const GlobalValue *GV, SectionKind Kind, + Mangler *Mang, const TargetMachine &TM) const{ assert(!Kind.isThreadLocal() && "Doesn't support TLS"); @@ -399,7 +401,7 @@ const Section *TargetLoweringObjectFileELF:: SelectSectionForGlobal(const GlobalValue *GV, SectionKind Kind, - const TargetMachine &TM) const { + Mangler *Mang, const TargetMachine &TM) const { // If this global is linkonce/weak and the target handles this by emitting it // into a 'uniqued' section name, create and return the section now. @@ -411,6 +413,7 @@ } if (Kind.isText()) return TextSection; + if (Kind.isMergeableCString()) { assert(CStringSection_ && "Should have string section prefix"); @@ -510,10 +513,9 @@ false, SectionKind::DataRel); } -const Section * -TargetLoweringObjectFileMachO::SelectSectionForGlobal(const GlobalValue *GV, - SectionKind Kind, - const TargetMachine &TM) const { +const Section *TargetLoweringObjectFileMachO:: +SelectSectionForGlobal(const GlobalValue *GV, SectionKind Kind, + Mangler *Mang, const TargetMachine &TM) const { assert(!Kind.isThreadLocal() && "Darwin doesn't support TLS"); if (Kind.isText()) @@ -616,7 +618,7 @@ const Section *TargetLoweringObjectFileCOFF:: SelectSectionForGlobal(const GlobalValue *GV, SectionKind Kind, - const TargetMachine &TM) const { + Mangler *Mang, const TargetMachine &TM) const { assert(!Kind.isThreadLocal() && "Doesn't support TLS"); // If this global is linkonce/weak and the target handles this by emitting it Modified: llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp?rev=77432&r1=77431&r2=77432&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp (original) +++ llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp Wed Jul 29 00:09:30 2009 @@ -167,7 +167,7 @@ if (Subtarget->isTargetCygMing()) DecorateCygMingName(CurrentFnName, F); - SwitchToSection(getObjFileLowering().SectionForGlobal(F, TM)); + SwitchToSection(getObjFileLowering().SectionForGlobal(F, Mang, TM)); switch (F->getLinkage()) { default: llvm_unreachable("Unknown linkage type!"); case Function::InternalLinkage: // Symbols default to internal. @@ -783,7 +783,8 @@ if (Subtarget->isTargetELF()) O << "\t.type\t" << name << ", at object\n"; - const Section *TheSection = getObjFileLowering().SectionForGlobal(GVar, TM); + const Section *TheSection = + getObjFileLowering().SectionForGlobal(GVar, Mang, TM); SwitchToSection(TheSection); if (C->isNullValue() && !GVar->hasSection() && Modified: llvm/trunk/lib/Target/XCore/XCoreAsmPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/XCore/XCoreAsmPrinter.cpp?rev=77432&r1=77431&r2=77432&view=diff ============================================================================== --- llvm/trunk/lib/Target/XCore/XCoreAsmPrinter.cpp (original) +++ llvm/trunk/lib/Target/XCore/XCoreAsmPrinter.cpp Wed Jul 29 00:09:30 2009 @@ -134,7 +134,7 @@ const TargetData *TD = TM.getTargetData(); - SwitchToSection(getObjFileLowering().SectionForGlobal(GV, TM)); + SwitchToSection(getObjFileLowering().SectionForGlobal(GV, Mang, TM)); std::string name = Mang->getMangledName(GV); Constant *C = GV->getInitializer(); @@ -205,7 +205,7 @@ // Print out the label for the function. const Function *F = MF.getFunction(); - SwitchToSection(getObjFileLowering().SectionForGlobal(F, TM)); + SwitchToSection(getObjFileLowering().SectionForGlobal(F, Mang, TM)); // Mark the start of the function O << "\t.cc_top " << CurrentFnName << ".function," << CurrentFnName << "\n"; From eli.friedman at gmail.com Wed Jul 29 00:10:47 2009 From: eli.friedman at gmail.com (Eli Friedman) Date: Tue, 28 Jul 2009 22:10:47 -0700 Subject: [llvm-commits] [llvm] r77407 - in /llvm/trunk: include/llvm/IntrinsicsX86.td lib/Target/X86/X86ISelLowering.cpp lib/Target/X86/X86ISelLowering.h lib/Target/X86/X86InstrSSE.td test/CodeGen/X86/sse41.ll In-Reply-To: <677CE0D7-9423-444B-82A5-78F234F9012D@apple.com> References: <200907290028.n6T0S6VU020655@zion.cs.uiuc.edu> <677CE0D7-9423-444B-82A5-78F234F9012D@apple.com> Message-ID: On Tue, Jul 28, 2009 at 9:44 PM, Chris Lattner wrote: > ?From my understanding, I think that ptest is commutative (but maybe > only for "z", but not the others?). ?If unconditionally true, you can > declare this with [SDNPCommutative] as a third argument to SDNode and > the instruction should be figured out to be commutative. ?If only true > in some cases, more trickery will be required. For PTEST, the ZF flag is commutative, but the CF flag is not. > It should allow the instruction to fold the load instead of producing: > > _test: > ? ? ? ?movl ? ?4(%esp), %eax > ? ? ? ?movaps ?(%eax), %xmm1 > ? ? ? ?ptest ? %xmm0, %xmm1 > ? ? ? ?sete ? ?%al > ? ? ? ?movzbl ?%al, %eax > ? ? ? ?ret > > Does "ptest" need to be added to the load folding table in case it is > isel'd as reg/reg but an operand gets spilled (thus the regalloc > should fold the load by forming reg/mem)? I think the issue here is that it doesn't know it's safe to commute the ptest... -Eli From nicholas at mxc.ca Wed Jul 29 00:17:51 2009 From: nicholas at mxc.ca (Nick Lewycky) Date: Wed, 29 Jul 2009 05:17:51 -0000 Subject: [llvm-commits] [llvm] r77433 - in /llvm/trunk: lib/Transforms/Scalar/SimplifyLibCalls.cpp test/Transforms/SimplifyLibCalls/2009-07-28-Exit.ll Message-ID: <200907290517.n6T5HpMS029627@zion.cs.uiuc.edu> Author: nicholas Date: Wed Jul 29 00:17:50 2009 New Revision: 77433 URL: http://llvm.org/viewvc/llvm-project?rev=77433&view=rev Log: Bulk erasing instructions without RAUWing them is unsafe. Instead, break them into a new BB that has no predecessors. Added: llvm/trunk/test/Transforms/SimplifyLibCalls/2009-07-28-Exit.ll Modified: llvm/trunk/lib/Transforms/Scalar/SimplifyLibCalls.cpp Modified: llvm/trunk/lib/Transforms/Scalar/SimplifyLibCalls.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/SimplifyLibCalls.cpp?rev=77433&r1=77432&r2=77433&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/SimplifyLibCalls.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/SimplifyLibCalls.cpp Wed Jul 29 00:17:50 2009 @@ -519,17 +519,19 @@ TerminatorInst *OldTI = CI->getParent()->getTerminator(); - // Create the return after the call. - ReturnInst *RI = B.CreateRet(CI->getOperand(1)); - // Drop all successor phi node entries. for (unsigned i = 0, e = OldTI->getNumSuccessors(); i != e; ++i) OldTI->getSuccessor(i)->removePredecessor(CI->getParent()); - // Erase all instructions from after our return instruction until the end of - // the block. - BasicBlock::iterator FirstDead = RI; ++FirstDead; - CI->getParent()->getInstList().erase(FirstDead, CI->getParent()->end()); + // Split the basic block after the call to exit. + BasicBlock::iterator FirstDead = CI; ++FirstDead; + CI->getParent()->splitBasicBlock(FirstDead); + B.SetInsertPoint(B.GetInsertBlock()); + + // Remove the branch that splitBB created and insert a return instead. + CI->getParent()->getTerminator()->eraseFromParent(); + B.CreateRet(CI->getOperand(1)); + return CI; } }; Added: llvm/trunk/test/Transforms/SimplifyLibCalls/2009-07-28-Exit.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/SimplifyLibCalls/2009-07-28-Exit.ll?rev=77433&view=auto ============================================================================== --- llvm/trunk/test/Transforms/SimplifyLibCalls/2009-07-28-Exit.ll (added) +++ llvm/trunk/test/Transforms/SimplifyLibCalls/2009-07-28-Exit.ll Wed Jul 29 00:17:50 2009 @@ -0,0 +1,179 @@ +; RUN: llvm-as < %s | opt -simplify-libcalls +; PR4641 + + %struct.__sFILE = type { i8*, i32, i32, i16, i16, %struct.__sbuf, i32, i8*, i32 (i8*)*, i32 (i8*, i8*, i32)*, i64 (i8*, i64, i32)*, i32 (i8*, i8*, i32)*, %struct.__sbuf, i8*, i32, [3 x i8], [1 x i8], %struct.__sbuf, i32, i64, %struct.pthread_mutex*, %struct.pthread*, i32, i32, %union.anon } + %struct.__sbuf = type { i8*, i32, [4 x i8] } + %struct.pthread = type opaque + %struct.pthread_mutex = type opaque + %union.anon = type { i64, [120 x i8] } + at .str13 = external constant [2 x i8] ; <[2 x i8]*> [#uses=1] + at .str14 = external constant [2 x i8] ; <[2 x i8]*> [#uses=1] + +define i32 @main(i32 %argc, i8** %argv) nounwind { +entry: + br i1 undef, label %if.then.i, label %xmalloc.exit + +if.then.i: ; preds = %entry + unreachable + +xmalloc.exit: ; preds = %entry + br i1 undef, label %if.then.i11, label %xmalloc.exit13 + +if.then.i11: ; preds = %xmalloc.exit + unreachable + +xmalloc.exit13: ; preds = %xmalloc.exit + br label %while.cond + +while.cond: ; preds = %sw.bb124, %if.end59, %if.end, %while.cond, %xmalloc.exit13 + switch i32 undef, label %sw.default [ + i32 -1, label %for.cond + i32 0, label %while.cond + i32 4097, label %sw.bb36 + i32 102, label %sw.bb55 + i32 111, label %sw.bb55 + i32 108, label %sw.bb62 + i32 99, label %sw.bb84 + i32 86, label %sw.bb114 + i32 66, label %sw.bb124 + ] + +sw.bb36: ; preds = %while.cond + br i1 undef, label %if.end, label %if.then + +if.then: ; preds = %sw.bb36 + unreachable + +if.end: ; preds = %sw.bb36 + br label %while.cond + +sw.bb55: ; preds = %while.cond, %while.cond + br i1 undef, label %if.end59, label %if.then58 + +if.then58: ; preds = %sw.bb55 + br label %if.end59 + +if.end59: ; preds = %if.then58, %sw.bb55 + br label %while.cond + +sw.bb62: ; preds = %while.cond + unreachable + +sw.bb84: ; preds = %while.cond + unreachable + +sw.bb114: ; preds = %while.cond + unreachable + +sw.bb124: ; preds = %while.cond + br label %while.cond + +sw.default: ; preds = %while.cond + unreachable + +for.cond: ; preds = %while.cond + br i1 undef, label %if.end167, label %if.then8.i + +if.then8.i: ; preds = %for.cond + unreachable + +if.end167: ; preds = %for.cond + br i1 undef, label %if.then174, label %if.end175 + +if.then174: ; preds = %if.end167 + unreachable + +if.end175: ; preds = %if.end167 + br i1 undef, label %if.then179, label %if.end181 + +if.then179: ; preds = %if.end175 + unreachable + +if.end181: ; preds = %if.end175 + br i1 undef, label %if.then.i.i189, label %while.cond.i194 + +if.then.i.i189: ; preds = %if.end181 + unreachable + +while.cond.i194: ; preds = %if.end181 + br i1 undef, label %while.body.i198, label %for.cond.i.i202 + +while.body.i198: ; preds = %while.cond.i194 + unreachable + +for.cond.i.i202: ; preds = %while.cond.i194 + br i1 undef, label %if.end197, label %if.then191 + +if.then191: ; preds = %for.cond.i.i202 + unreachable + +if.end197: ; preds = %for.cond.i.i202 + br label %for.cond.i144 + +for.cond.i144: ; preds = %for.body.i145, %if.end197 + br i1 undef, label %for.body.i145, label %for.cond24.i + +for.body.i145: ; preds = %for.cond.i144 + br label %for.cond.i144 + +for.cond24.i: ; preds = %for.cond.i144 + br label %for.cond78.i + +for.cond78.i: ; preds = %for.body84.i, %for.cond24.i + br i1 undef, label %for.end94.i, label %for.body84.i + +for.body84.i: ; preds = %for.cond78.i + br label %for.cond78.i + +for.end94.i: ; preds = %for.cond78.i + br i1 undef, label %if.then.i.i139, label %linebuffer_init.exit142 + +if.then.i.i139: ; preds = %for.end94.i + br label %linebuffer_init.exit142 + +linebuffer_init.exit142: ; preds = %if.then.i.i139, %for.end94.i + br i1 undef, label %if.then.i.i124, label %linebuffer_init.exit129 + +if.then.i.i124: ; preds = %linebuffer_init.exit142 + unreachable + +linebuffer_init.exit129: ; preds = %linebuffer_init.exit142 + br i1 undef, label %if.then.i.i110, label %linebuffer_init.exit113 + +if.then.i.i110: ; preds = %linebuffer_init.exit129 + unreachable + +linebuffer_init.exit113: ; preds = %linebuffer_init.exit129 + br i1 undef, label %if.then.i.i98, label %linebuffer_init.exit + +if.then.i.i98: ; preds = %linebuffer_init.exit113 + br label %linebuffer_init.exit + +linebuffer_init.exit: ; preds = %if.then.i.i98, %linebuffer_init.exit113 + br i1 undef, label %if.then227, label %while.cond.i50 + +if.then227: ; preds = %linebuffer_init.exit + unreachable + +while.cond.i50: ; preds = %linebuffer_init.exit + br i1 undef, label %while.end339, label %while.body334 + +while.body334: ; preds = %while.cond.i50 + unreachable + +while.end339: ; preds = %while.cond.i50 + br i1 undef, label %if.then344, label %if.end346 + +if.then344: ; preds = %while.end339 + unreachable + +if.end346: ; preds = %while.end339 + call void @exit(i32 0) nounwind + %cond392 = select i1 undef, i8* getelementptr ([2 x i8]* @.str13, i32 0, i32 0), i8* getelementptr ([2 x i8]* @.str14, i32 0, i32 0) ; [#uses=1] + %call393 = call %struct.__sFILE* @fopen(i8* undef, i8* %cond392) nounwind ; <%struct.__sFILE*> [#uses=0] + unreachable +} + +declare %struct.__sFILE* @fopen(i8*, i8*) + +declare void @exit(i32) From sabre at nondot.org Wed Jul 29 00:20:34 2009 From: sabre at nondot.org (Chris Lattner) Date: Wed, 29 Jul 2009 05:20:34 -0000 Subject: [llvm-commits] [llvm] r77434 - in /llvm/trunk: lib/Target/TargetLoweringObjectFile.cpp test/CodeGen/X86/global-sections.ll Message-ID: <200907290520.n6T5KYYH029775@zion.cs.uiuc.edu> Author: lattner Date: Wed Jul 29 00:20:33 2009 New Revision: 77434 URL: http://llvm.org/viewvc/llvm-project?rev=77434&view=rev Log: fix PR4584 with a trivial patch now that the pieces are in place. Modified: llvm/trunk/lib/Target/TargetLoweringObjectFile.cpp llvm/trunk/test/CodeGen/X86/global-sections.ll Modified: llvm/trunk/lib/Target/TargetLoweringObjectFile.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/TargetLoweringObjectFile.cpp?rev=77434&r1=77433&r2=77434&view=diff ============================================================================== --- llvm/trunk/lib/Target/TargetLoweringObjectFile.cpp (original) +++ llvm/trunk/lib/Target/TargetLoweringObjectFile.cpp Wed Jul 29 00:20:33 2009 @@ -16,6 +16,7 @@ #include "llvm/Constants.h" #include "llvm/DerivedTypes.h" #include "llvm/GlobalVariable.h" +#include "llvm/Support/Mangler.h" #include "llvm/Target/TargetMachine.h" #include "llvm/Target/TargetData.h" #include "llvm/Target/TargetOptions.h" @@ -407,9 +408,8 @@ // into a 'uniqued' section name, create and return the section now. if (Kind.isWeak()) { const char *Prefix = getSectionPrefixForUniqueGlobal(Kind); - // FIXME: Use mangler interface (PR4584). - std::string Name = Prefix+GV->getNameStr(); - return getOrCreateSection(Name.c_str(), false, Kind.getKind()); + std::string Name = Mang->makeNameProper(GV->getNameStr()); + return getOrCreateSection((Prefix+Name).c_str(), false, Kind.getKind()); } if (Kind.isText()) return TextSection; Modified: llvm/trunk/test/CodeGen/X86/global-sections.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/global-sections.ll?rev=77434&r1=77433&r2=77434&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/X86/global-sections.ll (original) +++ llvm/trunk/test/CodeGen/X86/global-sections.ll Wed Jul 29 00:20:33 2009 @@ -55,3 +55,16 @@ ; DARWIN: _G5: ; DARWIN: .long 47 + +; PR4584 +@"foo bar" = linkonce global i32 42 + +; LINUX: .type foo_20_bar, at object +; LINUX:.section .gnu.linkonce.d.foo_20_bar,"aw", at progbits +; LINUX: .weak foo_20_bar +; LINUX: foo_20_bar: + +; DARWIN: .section __DATA,__datacoal_nt,coalesced +; DARWIN: .globl "_foo bar" +; DARWIN: .weak_definition "_foo bar" +; DARWIN: "_foo bar": From sabre at nondot.org Wed Jul 29 00:25:43 2009 From: sabre at nondot.org (Chris Lattner) Date: Wed, 29 Jul 2009 05:25:43 -0000 Subject: [llvm-commits] [llvm] r77435 - /llvm/trunk/lib/Target/TargetLoweringObjectFile.cpp Message-ID: <200907290525.n6T5PhQk029967@zion.cs.uiuc.edu> Author: lattner Date: Wed Jul 29 00:25:42 2009 New Revision: 77435 URL: http://llvm.org/viewvc/llvm-project?rev=77435&view=rev Log: mingw uses .data and .text, not _data and _text. Modified: llvm/trunk/lib/Target/TargetLoweringObjectFile.cpp Modified: llvm/trunk/lib/Target/TargetLoweringObjectFile.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/TargetLoweringObjectFile.cpp?rev=77435&r1=77434&r2=77435&view=diff ============================================================================== --- llvm/trunk/lib/Target/TargetLoweringObjectFile.cpp (original) +++ llvm/trunk/lib/Target/TargetLoweringObjectFile.cpp Wed Jul 29 00:25:42 2009 @@ -590,8 +590,8 @@ //===----------------------------------------------------------------------===// TargetLoweringObjectFileCOFF::TargetLoweringObjectFileCOFF() { - TextSection = getOrCreateSection("_text", true, SectionKind::Text); - DataSection = getOrCreateSection("_data", true, SectionKind::DataRel); + TextSection = getOrCreateSection("\t.text", true, SectionKind::Text); + DataSection = getOrCreateSection("\t.data", true, SectionKind::DataRel); } void TargetLoweringObjectFileCOFF:: From clattner at apple.com Wed Jul 29 00:28:29 2009 From: clattner at apple.com (Chris Lattner) Date: Tue, 28 Jul 2009 22:28:29 -0700 Subject: [llvm-commits] [llvm-gcc-4.2] r77276 - /llvm-gcc-4.2/trunk/gcc/objc/objc-act.c In-Reply-To: <464C7886-5D8F-4CFA-82C0-EF50D8C7A6EA@gmail.com> References: <200907272350.n6RNow4H026564@zion.cs.uiuc.edu> <206FF0C9-90BD-4993-91C9-1376F7F1AFF4@apple.com> <464C7886-5D8F-4CFA-82C0-EF50D8C7A6EA@gmail.com> Message-ID: <20E5FF59-8DB5-4FBE-ABA9-252B450763C5@apple.com> On Jul 28, 2009, at 9:51 PM, Bill Wendling wrote: >> >> Thanks Bill. At some point, we have to get objc metadata into >> llvm.used.compiler instead of llvm.used. Out of curiosity, is this >> on >> your todo list? :) >> > It is. :-) But it's been given a slightly lower priority to other > things. Ok, thanks! -Chris From clattner at apple.com Wed Jul 29 00:29:55 2009 From: clattner at apple.com (Chris Lattner) Date: Tue, 28 Jul 2009 22:29:55 -0700 Subject: [llvm-commits] [llvm] r77407 - in /llvm/trunk: include/llvm/IntrinsicsX86.td lib/Target/X86/X86ISelLowering.cpp lib/Target/X86/X86ISelLowering.h lib/Target/X86/X86InstrSSE.td test/CodeGen/X86/sse41.ll In-Reply-To: References: <200907290028.n6T0S6VU020655@zion.cs.uiuc.edu> <677CE0D7-9423-444B-82A5-78F234F9012D@apple.com> Message-ID: On Jul 28, 2009, at 10:10 PM, Eli Friedman wrote: > On Tue, Jul 28, 2009 at 9:44 PM, Chris Lattner > wrote: >> From my understanding, I think that ptest is commutative (but maybe >> only for "z", but not the others?). If unconditionally true, you can >> declare this with [SDNPCommutative] as a third argument to SDNode and >> the instruction should be figured out to be commutative. If only >> true >> in some cases, more trickery will be required. > > For PTEST, the ZF flag is commutative, but the CF flag is not. Ok, that's what I feared. This means that we need conditional flag liveness stuff? Is there a way to know (e.g. in regalloc, when doing a spill) that only one flag is used? Do we have flag subregs? Perhaps this should just go in the readme-sse.txt file to worry about later. -Chris > > >> It should allow the instruction to fold the load instead of >> producing: >> >> _test: >> movl 4(%esp), %eax >> movaps (%eax), %xmm1 >> ptest %xmm0, %xmm1 >> sete %al >> movzbl %al, %eax >> ret >> >> Does "ptest" need to be added to the load folding table in case it is >> isel'd as reg/reg but an operand gets spilled (thus the regalloc >> should fold the load by forming reg/mem)? > > I think the issue here is that it doesn't know it's safe to commute > the ptest... > > -Eli > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From sabre at nondot.org Wed Jul 29 00:32:08 2009 From: sabre at nondot.org (Chris Lattner) Date: Wed, 29 Jul 2009 05:32:08 -0000 Subject: [llvm-commits] [llvm] r77436 - /llvm/trunk/test/Transforms/SimplifyLibCalls/2009-07-28-Exit.ll Message-ID: <200907290532.n6T5W8MX030156@zion.cs.uiuc.edu> Author: lattner Date: Wed Jul 29 00:32:07 2009 New Revision: 77436 URL: http://llvm.org/viewvc/llvm-project?rev=77436&view=rev Log: don't dump .bc file to stdout, and simplify this to a trivial testcase. Modified: llvm/trunk/test/Transforms/SimplifyLibCalls/2009-07-28-Exit.ll Modified: llvm/trunk/test/Transforms/SimplifyLibCalls/2009-07-28-Exit.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/SimplifyLibCalls/2009-07-28-Exit.ll?rev=77436&r1=77435&r2=77436&view=diff ============================================================================== --- llvm/trunk/test/Transforms/SimplifyLibCalls/2009-07-28-Exit.ll (original) +++ llvm/trunk/test/Transforms/SimplifyLibCalls/2009-07-28-Exit.ll Wed Jul 29 00:32:07 2009 @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -simplify-libcalls +; RUN: llvm-as < %s | opt -simplify-libcalls | llvm-dis ; PR4641 %struct.__sFILE = type { i8*, i32, i32, i16, i16, %struct.__sbuf, i32, i8*, i32 (i8*)*, i32 (i8*, i8*, i32)*, i64 (i8*, i64, i32)*, i32 (i8*, i8*, i32)*, %struct.__sbuf, i8*, i32, [3 x i8], [1 x i8], %struct.__sbuf, i32, i64, %struct.pthread_mutex*, %struct.pthread*, i32, i32, %union.anon } @@ -11,163 +11,6 @@ define i32 @main(i32 %argc, i8** %argv) nounwind { entry: - br i1 undef, label %if.then.i, label %xmalloc.exit - -if.then.i: ; preds = %entry - unreachable - -xmalloc.exit: ; preds = %entry - br i1 undef, label %if.then.i11, label %xmalloc.exit13 - -if.then.i11: ; preds = %xmalloc.exit - unreachable - -xmalloc.exit13: ; preds = %xmalloc.exit - br label %while.cond - -while.cond: ; preds = %sw.bb124, %if.end59, %if.end, %while.cond, %xmalloc.exit13 - switch i32 undef, label %sw.default [ - i32 -1, label %for.cond - i32 0, label %while.cond - i32 4097, label %sw.bb36 - i32 102, label %sw.bb55 - i32 111, label %sw.bb55 - i32 108, label %sw.bb62 - i32 99, label %sw.bb84 - i32 86, label %sw.bb114 - i32 66, label %sw.bb124 - ] - -sw.bb36: ; preds = %while.cond - br i1 undef, label %if.end, label %if.then - -if.then: ; preds = %sw.bb36 - unreachable - -if.end: ; preds = %sw.bb36 - br label %while.cond - -sw.bb55: ; preds = %while.cond, %while.cond - br i1 undef, label %if.end59, label %if.then58 - -if.then58: ; preds = %sw.bb55 - br label %if.end59 - -if.end59: ; preds = %if.then58, %sw.bb55 - br label %while.cond - -sw.bb62: ; preds = %while.cond - unreachable - -sw.bb84: ; preds = %while.cond - unreachable - -sw.bb114: ; preds = %while.cond - unreachable - -sw.bb124: ; preds = %while.cond - br label %while.cond - -sw.default: ; preds = %while.cond - unreachable - -for.cond: ; preds = %while.cond - br i1 undef, label %if.end167, label %if.then8.i - -if.then8.i: ; preds = %for.cond - unreachable - -if.end167: ; preds = %for.cond - br i1 undef, label %if.then174, label %if.end175 - -if.then174: ; preds = %if.end167 - unreachable - -if.end175: ; preds = %if.end167 - br i1 undef, label %if.then179, label %if.end181 - -if.then179: ; preds = %if.end175 - unreachable - -if.end181: ; preds = %if.end175 - br i1 undef, label %if.then.i.i189, label %while.cond.i194 - -if.then.i.i189: ; preds = %if.end181 - unreachable - -while.cond.i194: ; preds = %if.end181 - br i1 undef, label %while.body.i198, label %for.cond.i.i202 - -while.body.i198: ; preds = %while.cond.i194 - unreachable - -for.cond.i.i202: ; preds = %while.cond.i194 - br i1 undef, label %if.end197, label %if.then191 - -if.then191: ; preds = %for.cond.i.i202 - unreachable - -if.end197: ; preds = %for.cond.i.i202 - br label %for.cond.i144 - -for.cond.i144: ; preds = %for.body.i145, %if.end197 - br i1 undef, label %for.body.i145, label %for.cond24.i - -for.body.i145: ; preds = %for.cond.i144 - br label %for.cond.i144 - -for.cond24.i: ; preds = %for.cond.i144 - br label %for.cond78.i - -for.cond78.i: ; preds = %for.body84.i, %for.cond24.i - br i1 undef, label %for.end94.i, label %for.body84.i - -for.body84.i: ; preds = %for.cond78.i - br label %for.cond78.i - -for.end94.i: ; preds = %for.cond78.i - br i1 undef, label %if.then.i.i139, label %linebuffer_init.exit142 - -if.then.i.i139: ; preds = %for.end94.i - br label %linebuffer_init.exit142 - -linebuffer_init.exit142: ; preds = %if.then.i.i139, %for.end94.i - br i1 undef, label %if.then.i.i124, label %linebuffer_init.exit129 - -if.then.i.i124: ; preds = %linebuffer_init.exit142 - unreachable - -linebuffer_init.exit129: ; preds = %linebuffer_init.exit142 - br i1 undef, label %if.then.i.i110, label %linebuffer_init.exit113 - -if.then.i.i110: ; preds = %linebuffer_init.exit129 - unreachable - -linebuffer_init.exit113: ; preds = %linebuffer_init.exit129 - br i1 undef, label %if.then.i.i98, label %linebuffer_init.exit - -if.then.i.i98: ; preds = %linebuffer_init.exit113 - br label %linebuffer_init.exit - -linebuffer_init.exit: ; preds = %if.then.i.i98, %linebuffer_init.exit113 - br i1 undef, label %if.then227, label %while.cond.i50 - -if.then227: ; preds = %linebuffer_init.exit - unreachable - -while.cond.i50: ; preds = %linebuffer_init.exit - br i1 undef, label %while.end339, label %while.body334 - -while.body334: ; preds = %while.cond.i50 - unreachable - -while.end339: ; preds = %while.cond.i50 - br i1 undef, label %if.then344, label %if.end346 - -if.then344: ; preds = %while.end339 - unreachable - -if.end346: ; preds = %while.end339 call void @exit(i32 0) nounwind %cond392 = select i1 undef, i8* getelementptr ([2 x i8]* @.str13, i32 0, i32 0), i8* getelementptr ([2 x i8]* @.str14, i32 0, i32 0) ; [#uses=1] %call393 = call %struct.__sFILE* @fopen(i8* undef, i8* %cond392) nounwind ; <%struct.__sFILE*> [#uses=0] From rjmccall at apple.com Wed Jul 29 00:20:57 2009 From: rjmccall at apple.com (John McCall) Date: Tue, 28 Jul 2009 22:20:57 -0700 Subject: [llvm-commits] [llvm] r77407 - in /llvm/trunk: include/llvm/IntrinsicsX86.td lib/Target/X86/X86ISelLowering.cpp lib/Target/X86/X86ISelLowering.h lib/Target/X86/X86InstrSSE.td test/CodeGen/X86/sse41.ll In-Reply-To: <945A54B8-2176-4A39-AF93-805E42793E32@apple.com> References: <200907290028.n6T0S6VU020655@zion.cs.uiuc.edu> <4014B4D6-8F63-411E-8760-49A96A289D24@apple.com> <945A54B8-2176-4A39-AF93-805E42793E32@apple.com> Message-ID: <4A6FDC39.1090301@apple.com> Eric Christopher wrote: > _foo: > ptest %xmm1, %xmm0 > sete %al > movzbl %al, %eax > testl %eax, %eax > sete %al > movzbl %al, %eax > leal 4(,%eax,4), %eax > ret > > Honestly it's the movzbl instructions that irritate me the most, but > there's no setcc that will set an entire register :( > I'm just a naive front-end guy, but shouldn't we be optimizing movzbl %al, %eax testl %eax, %eax into testb %al, %al ? John. From a at bolka.at Wed Jul 29 00:35:53 2009 From: a at bolka.at (Andreas Bolka) Date: Wed, 29 Jul 2009 05:35:53 -0000 Subject: [llvm-commits] [llvm] r77437 - in /llvm/trunk: include/llvm/Analysis/LoopDependenceAnalysis.h lib/Analysis/LoopDependenceAnalysis.cpp Message-ID: <200907290535.n6T5Zs34030263@zion.cs.uiuc.edu> Author: abolka Date: Wed Jul 29 00:35:53 2009 New Revision: 77437 URL: http://llvm.org/viewvc/llvm-project?rev=77437&view=rev Log: Skeleton for pairwise subscript testing. Modified: llvm/trunk/include/llvm/Analysis/LoopDependenceAnalysis.h llvm/trunk/lib/Analysis/LoopDependenceAnalysis.cpp Modified: llvm/trunk/include/llvm/Analysis/LoopDependenceAnalysis.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/LoopDependenceAnalysis.h?rev=77437&r1=77436&r2=77437&view=diff ============================================================================== --- llvm/trunk/include/llvm/Analysis/LoopDependenceAnalysis.h (original) +++ llvm/trunk/include/llvm/Analysis/LoopDependenceAnalysis.h Wed Jul 29 00:35:53 2009 @@ -21,6 +21,7 @@ #define LLVM_ANALYSIS_LOOP_DEPENDENCE_ANALYSIS_H #include "llvm/ADT/FoldingSet.h" +#include "llvm/ADT/SmallVector.h" #include "llvm/Analysis/LoopPass.h" #include "llvm/Support/Allocator.h" #include @@ -30,6 +31,7 @@ class AliasAnalysis; class AnalysisUsage; class ScalarEvolution; +class SCEV; class Value; class raw_ostream; @@ -43,17 +45,21 @@ /// TODO: doc enum DependenceResult { Independent = 0, Dependent = 1, Unknown = 2 }; + /// TODO: doc + struct Subscript { + /// TODO: Add distance, direction, breaking conditions, ... + }; + /// DependencePair - Represents a data dependence relation between to memory /// reference instructions. - /// - /// TODO: add subscripts vector struct DependencePair : public FastFoldingSetNode { Value *A; Value *B; DependenceResult Result; + SmallVector Subscripts; DependencePair(const FoldingSetNodeID &ID, Value *a, Value *b) : - FastFoldingSetNode(ID), A(a), B(b), Result(Unknown) {} + FastFoldingSetNode(ID), A(a), B(b), Result(Unknown), Subscripts() {} }; /// findOrInsertDependencePair - Return true if a DependencePair for the @@ -62,7 +68,8 @@ bool findOrInsertDependencePair(Value*, Value*, DependencePair*&); /// TODO: doc - DependenceResult analysePair(DependencePair *P) const; + DependenceResult analyseSubscript(const SCEV*, const SCEV*, Subscript*) const; + DependenceResult analysePair(DependencePair*) const; public: static char ID; // Class identification, replacement for typeinfo @@ -88,7 +95,6 @@ BumpPtrAllocator PairAllocator; }; // class LoopDependenceAnalysis - // createLoopDependenceAnalysisPass - This creates an instance of the // LoopDependenceAnalysis pass. // Modified: llvm/trunk/lib/Analysis/LoopDependenceAnalysis.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/LoopDependenceAnalysis.cpp?rev=77437&r1=77436&r2=77437&view=diff ============================================================================== --- llvm/trunk/lib/Analysis/LoopDependenceAnalysis.cpp (original) +++ llvm/trunk/lib/Analysis/LoopDependenceAnalysis.cpp Wed Jul 29 00:35:53 2009 @@ -15,6 +15,8 @@ // // TODO: adapt as implementation progresses. // +// TODO: document lingo (pair, subscript, index) +// //===----------------------------------------------------------------------===// #define DEBUG_TYPE "lda" @@ -24,6 +26,7 @@ #include "llvm/Analysis/LoopPass.h" #include "llvm/Analysis/ScalarEvolution.h" #include "llvm/Instructions.h" +#include "llvm/Operator.h" #include "llvm/Support/Allocator.h" #include "llvm/Support/Debug.h" #include "llvm/Support/ErrorHandling.h" @@ -87,6 +90,10 @@ bObj, AA->getTypeStoreSize(bObj->getType())); } +static inline const SCEV *GetZeroSCEV(ScalarEvolution *SE) { + return SE->getConstant(Type::Int32Ty, 0L); +} + //===----------------------------------------------------------------------===// // Dependence Testing //===----------------------------------------------------------------------===// @@ -117,6 +124,13 @@ } LoopDependenceAnalysis::DependenceResult +LoopDependenceAnalysis::analyseSubscript(const SCEV *A, + const SCEV *B, + Subscript *S) const { + return Unknown; // TODO: Implement. +} + +LoopDependenceAnalysis::DependenceResult LoopDependenceAnalysis::analysePair(DependencePair *P) const { DEBUG(errs() << "Analysing:\n" << *P->A << "\n" << *P->B << "\n"); @@ -145,9 +159,37 @@ break; // The underlying objects alias, test accesses for dependence. } - // We failed to analyse this pair to get a more specific answer. - DEBUG(errs() << "---> [?] cannot analyse\n"); - return Unknown; + const GEPOperator *aGEP = dyn_cast(aPtr); + const GEPOperator *bGEP = dyn_cast(bPtr); + + if (!aGEP || !bGEP) + return Unknown; + + // FIXME: Is filtering coupled subscripts necessary? + + // Analyse indices pairwise (FIXME: use GetGEPOperands from BasicAA), adding + // trailing zeroes to the smaller GEP, if needed. + GEPOperator::const_op_iterator aIdx = aGEP->idx_begin(), + aEnd = aGEP->idx_end(), + bIdx = bGEP->idx_begin(), + bEnd = bGEP->idx_end(); + while (aIdx != aEnd && bIdx != bEnd) { + const SCEV* aSCEV = (aIdx != aEnd) ? SE->getSCEV(*aIdx) : GetZeroSCEV(SE); + const SCEV* bSCEV = (bIdx != bEnd) ? SE->getSCEV(*bIdx) : GetZeroSCEV(SE); + Subscript subscript; + DependenceResult result = analyseSubscript(aSCEV, bSCEV, &subscript); + if (result != Dependent) { + // We either proved independence or failed to analyse this subscript. + // Further subscripts will not improve the situation, so abort early. + return result; + } + P->Subscripts.push_back(subscript); + if (aIdx != aEnd) ++aIdx; + if (bIdx != bEnd) ++bIdx; + } + // Either there were no subscripts or all subscripts were analysed to be + // dependent; in both cases we know the accesses are dependent. + return Dependent; } bool LoopDependenceAnalysis::depends(Value *A, Value *B) { From evan.cheng at apple.com Wed Jul 29 00:42:35 2009 From: evan.cheng at apple.com (Evan Cheng) Date: Tue, 28 Jul 2009 22:42:35 -0700 Subject: [llvm-commits] [llvm] r77407 - in /llvm/trunk: include/llvm/IntrinsicsX86.td lib/Target/X86/X86ISelLowering.cpp lib/Target/X86/X86ISelLowering.h lib/Target/X86/X86InstrSSE.td test/CodeGen/X86/sse41.ll In-Reply-To: <677CE0D7-9423-444B-82A5-78F234F9012D@apple.com> References: <200907290028.n6T0S6VU020655@zion.cs.uiuc.edu> <677CE0D7-9423-444B-82A5-78F234F9012D@apple.com> Message-ID: <14A7D336-A40D-46DC-AFE2-6F3154B50576@apple.com> On Jul 28, 2009, at 9:44 PM, Chris Lattner wrote: > >> +// ptest instruction we'll lower to this in X86ISelLowering >> primarily from >> +// the intel intrinsic that corresponds to this. >> let Defs = [EFLAGS] in { >> def PTESTrr : SS48I<0x17, MRMSrcReg, (outs), (ins VR128:$src1, >> VR128:$src2), >> - "ptest \t{$src2, $src1|$src1, $src2}", []>, >> OpSize; >> + "ptest \t{$src2, $src1|$src1, $src2}", >> + [(X86ptest VR128:$src1, VR128:$src2), >> + (implicit EFLAGS)]>, OpSize; > > Do we really need "Defs = EFLAGS" *and* "implicit EFLAGS"? It seems > like the later one should be enough, though I don't actually know if > that's true. Evan or Dan would know. Unfortunately both are needed (yes we should fix it at some point). Defs = [EFLAGS] is saying the instruction implicitly defines EFLAGS. (implicit EFLAGS) is telling tablegen / scheduler the instruction produces an extra result that maps to the physical register EFLAGS. That is the syntax we use to model physical register dependency. Evan > > > Something not new in this patch, but: > > def X86ptest : SDNode<"X86ISD::PTEST", SDTX86CmpPTest>; > > From my understanding, I think that ptest is commutative (but maybe > only for "z", but not the others?). If unconditionally true, you can > declare this with [SDNPCommutative] as a third argument to SDNode and > the instruction should be figured out to be commutative. If only true > in some cases, more trickery will be required. > > For something like this: > > define i32 @test(<4 x float> %t1, <4 x float> *%t2) nounwind { > %x = load <4x float>* %t2 > %tmp1 = call i32 @llvm.x86.sse41.ptestz(<4 x float> %x, <4 x > float> %t1) nounwind readnone > ret i32 %tmp1 > } > > declare i32 @llvm.x86.sse41.ptestz(<4 x float>, <4 x float>) nounwind > readnone > > It should allow the instruction to fold the load instead of producing: > > _test: > movl 4(%esp), %eax > movaps (%eax), %xmm1 > ptest %xmm0, %xmm1 > sete %al > movzbl %al, %eax > ret > > Does "ptest" need to be added to the load folding table in case it is > isel'd as reg/reg but an operand gets spilled (thus the regalloc > should fold the load by forming reg/mem)? > > Overall, very nice job! > > -Chris > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20090728/2a7d69a3/attachment.html From evan.cheng at apple.com Wed Jul 29 00:44:09 2009 From: evan.cheng at apple.com (Evan Cheng) Date: Tue, 28 Jul 2009 22:44:09 -0700 Subject: [llvm-commits] [llvm] r77407 - in /llvm/trunk: include/llvm/IntrinsicsX86.td lib/Target/X86/X86ISelLowering.cpp lib/Target/X86/X86ISelLowering.h lib/Target/X86/X86InstrSSE.td test/CodeGen/X86/sse41.ll In-Reply-To: References: <200907290028.n6T0S6VU020655@zion.cs.uiuc.edu> <677CE0D7-9423-444B-82A5-78F234F9012D@apple.com> Message-ID: On Jul 28, 2009, at 10:29 PM, Chris Lattner wrote: > > On Jul 28, 2009, at 10:10 PM, Eli Friedman wrote: > >> On Tue, Jul 28, 2009 at 9:44 PM, Chris Lattner >> wrote: >>> From my understanding, I think that ptest is commutative (but maybe >>> only for "z", but not the others?). If unconditionally true, you >>> can >>> declare this with [SDNPCommutative] as a third argument to SDNode >>> and >>> the instruction should be figured out to be commutative. If only >>> true >>> in some cases, more trickery will be required. >> >> For PTEST, the ZF flag is commutative, but the CF flag is not. > > Ok, that's what I feared. This means that we need conditional flag > liveness stuff? Is there a way to know (e.g. in regalloc, when doing > a spill) that only one flag is used? Do we have flag subregs? Not yet. If we care about this, the solution is to lower ptestz and ptestc, ptestnzc to different x86isd nodes. Evan > > Perhaps this should just go in the readme-sse.txt file to worry about > later. > > -Chris > >> >> >>> It should allow the instruction to fold the load instead of >>> producing: >>> >>> _test: >>> movl 4(%esp), %eax >>> movaps (%eax), %xmm1 >>> ptest %xmm0, %xmm1 >>> sete %al >>> movzbl %al, %eax >>> ret >>> >>> Does "ptest" need to be added to the load folding table in case it >>> is >>> isel'd as reg/reg but an operand gets spilled (thus the regalloc >>> should fold the load by forming reg/mem)? >> >> I think the issue here is that it doesn't know it's safe to commute >> the ptest... >> >> -Eli >> >> _______________________________________________ >> llvm-commits mailing list >> llvm-commits at cs.uiuc.edu >> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From sabre at nondot.org Wed Jul 29 00:48:10 2009 From: sabre at nondot.org (Chris Lattner) Date: Wed, 29 Jul 2009 05:48:10 -0000 Subject: [llvm-commits] [llvm] r77438 - /llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Message-ID: <200907290548.n6T5mABT030599@zion.cs.uiuc.edu> Author: lattner Date: Wed Jul 29 00:48:09 2009 New Revision: 77438 URL: http://llvm.org/viewvc/llvm-project?rev=77438&view=rev Log: whitespace cleanup. 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=77438&r1=77437&r2=77438&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original) +++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Wed Jul 29 00:48:09 2009 @@ -4752,10 +4752,9 @@ SDValue ShOpLo = Op.getOperand(0); SDValue ShOpHi = Op.getOperand(1); SDValue ShAmt = Op.getOperand(2); - SDValue Tmp1 = isSRA ? - DAG.getNode(ISD::SRA, dl, VT, ShOpHi, - DAG.getConstant(VTBits - 1, MVT::i8)) : - DAG.getConstant(0, VT); + SDValue Tmp1 = isSRA ? DAG.getNode(ISD::SRA, dl, VT, ShOpHi, + DAG.getConstant(VTBits - 1, MVT::i8)) + : DAG.getConstant(0, VT); SDValue Tmp2, Tmp3; if (Op.getOpcode() == ISD::SHL_PARTS) { @@ -4767,9 +4766,9 @@ } SDValue AndNode = DAG.getNode(ISD::AND, dl, MVT::i8, ShAmt, - DAG.getConstant(VTBits, MVT::i8)); + DAG.getConstant(VTBits, MVT::i8)); SDValue Cond = DAG.getNode(X86ISD::CMP, dl, VT, - AndNode, DAG.getConstant(0, MVT::i8)); + AndNode, DAG.getConstant(0, MVT::i8)); SDValue Hi, Lo; SDValue CC = DAG.getConstant(X86::COND_NE, MVT::i8); From clattner at apple.com Wed Jul 29 00:49:04 2009 From: clattner at apple.com (Chris Lattner) Date: Tue, 28 Jul 2009 22:49:04 -0700 Subject: [llvm-commits] [llvm] r77407 - in /llvm/trunk: include/llvm/IntrinsicsX86.td lib/Target/X86/X86ISelLowering.cpp lib/Target/X86/X86ISelLowering.h lib/Target/X86/X86InstrSSE.td test/CodeGen/X86/sse41.ll In-Reply-To: References: <200907290028.n6T0S6VU020655@zion.cs.uiuc.edu> <677CE0D7-9423-444B-82A5-78F234F9012D@apple.com> Message-ID: <94249837-D0CD-467E-B36E-4B4B6A6271BC@apple.com> On Jul 28, 2009, at 10:44 PM, Evan Cheng wrote: >> Ok, that's what I feared. This means that we need conditional flag >> liveness stuff? Is there a way to know (e.g. in regalloc, when doing >> a spill) that only one flag is used? Do we have flag subregs? > > Not yet. > > If we care about this, the solution is to lower ptestz and ptestc, > ptestnzc to different x86isd nodes. Yes, that would work for commuting at isel time to match the load. This wouldn't work for commuting to fold a reload. -Chris From evan.cheng at apple.com Wed Jul 29 00:51:10 2009 From: evan.cheng at apple.com (Evan Cheng) Date: Tue, 28 Jul 2009 22:51:10 -0700 Subject: [llvm-commits] [llvm] r77407 - in /llvm/trunk: include/llvm/IntrinsicsX86.td lib/Target/X86/X86ISelLowering.cpp lib/Target/X86/X86ISelLowering.h lib/Target/X86/X86InstrSSE.td test/CodeGen/X86/sse41.ll In-Reply-To: <4A6FDC39.1090301@apple.com> References: <200907290028.n6T0S6VU020655@zion.cs.uiuc.edu> <4014B4D6-8F63-411E-8760-49A96A289D24@apple.com> <945A54B8-2176-4A39-AF93-805E42793E32@apple.com> <4A6FDC39.1090301@apple.com> Message-ID: <4F28BEFF-0AEA-425A-9562-085D419B559B@apple.com> On Jul 28, 2009, at 10:20 PM, John McCall wrote: > Eric Christopher wrote: >> _foo: >> ptest %xmm1, %xmm0 >> sete %al >> movzbl %al, %eax >> testl %eax, %eax >> sete %al >> movzbl %al, %eax >> leal 4(,%eax,4), %eax >> ret >> >> Honestly it's the movzbl instructions that irritate me the most, but >> there's no setcc that will set an entire register :( >> > > I'm just a naive front-end guy, but shouldn't we be optimizing > movzbl %al, %eax > testl %eax, %eax > into > testb %al, %al > ? Yes, we should fix it. Can one of you file a bug? Thanks, Evan > > John. > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From clattner at apple.com Wed Jul 29 00:52:47 2009 From: clattner at apple.com (Chris Lattner) Date: Tue, 28 Jul 2009 22:52:47 -0700 Subject: [llvm-commits] [llvm] r77407 - in /llvm/trunk: include/llvm/IntrinsicsX86.td lib/Target/X86/X86ISelLowering.cpp lib/Target/X86/X86ISelLowering.h lib/Target/X86/X86InstrSSE.td test/CodeGen/X86/sse41.ll In-Reply-To: <4A6FDC39.1090301@apple.com> References: <200907290028.n6T0S6VU020655@zion.cs.uiuc.edu> <4014B4D6-8F63-411E-8760-49A96A289D24@apple.com> <945A54B8-2176-4A39-AF93-805E42793E32@apple.com> <4A6FDC39.1090301@apple.com> Message-ID: On Jul 28, 2009, at 10:20 PM, John McCall wrote: > Eric Christopher wrote: >> _foo: >> ptest %xmm1, %xmm0 >> sete %al >> movzbl %al, %eax >> testl %eax, %eax >> sete %al >> movzbl %al, %eax >> leal 4(,%eax,4), %eax >> ret >> >> Honestly it's the movzbl instructions that irritate me the most, but >> there's no setcc that will set an entire register :( >> > > I'm just a naive front-end guy, but shouldn't we be optimizing > movzbl %al, %eax > testl %eax, %eax > into > testb %al, %al > ? Yes, that would be a very sensible thing to do! This is actually a phase ordering thing that is occurring. In dagcombine1, we have: -------------- next part -------------- A non-text attachment was scrubbed... Name: pastedGraphic.png Type: image/png Size: 50410 bytes Desc: not available Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20090728/39e8acd7/attachment.png -------------- next part -------------- After dagcombine1, the ptestz and setcc's get lowered, and we have: -------------- next part -------------- A non-text attachment was scrubbed... Name: pastedGraphic.png Type: image/png Size: 38994 bytes Desc: not available Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20090728/39e8acd7/attachment-0001.png -------------- next part -------------- At this point, shrinking the X86ISD::CMPs is both more annoying (because we don't easily know what flags are live) and target specific. Two possible approaches: 1. The intrinsic could be declared to return i8 instead of i32, that would be a hack around the problem, but would work be reasonable since the X86 setcc instructions set an i8. 2. We could lower the ptestz intrinisic at sdisel time instead of in legalize like we do for call and arguments. I don't see a reason not to do #2: it seems like a general win for intrinsics that are lowered like this. What do you guys think? -Chris From evan.cheng at apple.com Wed Jul 29 00:58:21 2009 From: evan.cheng at apple.com (Evan Cheng) Date: Tue, 28 Jul 2009 22:58:21 -0700 Subject: [llvm-commits] [llvm] r77407 - in /llvm/trunk: include/llvm/IntrinsicsX86.td lib/Target/X86/X86ISelLowering.cpp lib/Target/X86/X86ISelLowering.h lib/Target/X86/X86InstrSSE.td test/CodeGen/X86/sse41.ll In-Reply-To: References: <200907290028.n6T0S6VU020655@zion.cs.uiuc.edu> <4014B4D6-8F63-411E-8760-49A96A289D24@apple.com> <945A54B8-2176-4A39-AF93-805E42793E32@apple.com> <4A6FDC39.1090301@apple.com> Message-ID: <0BED72EF-B78A-46C6-9FA7-515070E3ADD5@apple.com> On Jul 28, 2009, at 10:52 PM, Chris Lattner wrote: > > > Yes, that would be a very sensible thing to do! This is actually a > phase ordering thing that is occurring. In dagcombine1, we have: > > > > > After dagcombine1, the ptestz and setcc's get lowered, and we have: > > > > > > At this point, shrinking the X86ISD::CMPs is both more annoying > (because we don't easily know what flags are live) and target > specific. > > Two possible approaches: > > 1. The intrinsic could be declared to return i8 instead of i32, that > would be a hack around the problem, but would work be reasonable > since the X86 setcc instructions set an i8. > > 2. We could lower the ptestz intrinisic at sdisel time instead of in > legalize like we do for call and arguments. > > I don't see a reason not to do #2: it seems like a general win for > intrinsics that are lowered like this. What do you guys think? #2 makes sense to me. Evan > > -Chris_______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From clattner at apple.com Wed Jul 29 01:14:31 2009 From: clattner at apple.com (Chris Lattner) Date: Tue, 28 Jul 2009 23:14:31 -0700 Subject: [llvm-commits] [PATCH] Analog Devices Blackfin back-end In-Reply-To: <764D793B-7F49-46C2-8063-4CE1D054EA31@2pi.dk> References: <764D793B-7F49-46C2-8063-4CE1D054EA31@2pi.dk> Message-ID: On Jul 23, 2009, at 11:48 PM, Jakob Stoklund Olesen wrote: > Hi, > > Finally my blackfin back-end is ready to be included in the main > tree. It is still experimental. I have compiled most of CodeGen/ > Generic as well as my own test cases. The blackfin assembler (bfin- > elf-as) is happy with the output, but I have not yet tested it on > real hardware. I have access to blackfin hardware, so I can do that > later. There is a GNU tool-chain at http://blackfin.uclinux.org/ Cool, the autoconf patch is fine, feel free to add it now if it won't break anything. A "cumulative" patch is preferred, but the delta wasn't that big and I'm not trying to do a final review, just give some tips. Some minor picky stuff: +// Force static initialization. +extern "C" void LLVMInitializeBlackfinAsmPrinter() +{ + TargetRegistry::RegisterAsmPrinter(TheBlackfinTarget, + createBlackfinCodePrinterPass); +} You also are inconsistent about putting the return type: +SDNode* +BlackfinDAGToDAGISel::Select(SDValue Op) +{ Please put the name and return type on the same line if there is room, e.g.: +SDNode *BlackfinDAGToDAGISel::Select(SDValue Op) { Please use K&R style bracketing, where the { goes on the same line as the function name. + if (MI->getOperand(opNum+1).isImm() + && MI->getOperand(opNum+1).getImm() == 0) + return; Please use && on the previous line, like so: + if (MI->getOperand(opNum+1).isImm() && + MI->getOperand(opNum+1).getImm() == 0) + return; Please consistently indent by 2: + default: return true; // Unknown modifier. + case 'r': + break; + } Please just use Bfin:: in isCC for consistency: +static inline bool +isCC(const TargetRegisterClass *RC) +{ + using namespace Bfin; + return RC == &AnyCCRegClass || AnyCCRegClass.hasSubClass(RC); +} + +static inline bool +isDCC(const TargetRegisterClass *RC) +{ + return RC == &Bfin::DRegClass || Bfin::DRegClass.hasSubClass(RC) || isCC(RC); +} On that note, the Bfin target name space is kind of a weird contraction for it, I don't have a strong opinion on it either way, but maybe BF would be better? Your call, do whatever you like. Instead of: +void +BlackfinInstrInfo::storeRegToStackSlot(MachineBasicBlock &MBB, ... + if (inClass(Bfin::DPRegClass, SrcReg, RC)) { + BuildMI(MBB, I, DL, get(Bfin::STORE32fi)) + .addReg(SrcReg, getKillRegState(isKill)) + .addFrameIndex(FI) + .addImm(0); + } + else if (inClass(Bfin::D16RegClass, SrcReg, RC)) { + BuildMI(MBB, I, DL, get(Bfin::STORE16fi)) + .addReg(SrcReg, getKillRegState(isKill)) + .addFrameIndex(FI) + .addImm(0); + } + else if (inClass(Bfin::AnyCCRegClass, SrcReg, RC)) { + BuildMI(MBB, I, DL, get(Bfin::STORE8fi)) + .addReg(SrcReg, getKillRegState(isKill)) + .addFrameIndex(FI) + .addImm(0); + } + else { + llvm_unreachable("Cannot store regclass to stack slot"); + } How about using early exits, giving something like: + if (inClass(Bfin::DPRegClass, SrcReg, RC)) { + BuildMI(MBB, I, DL, get(Bfin::STORE32fi)) + .addReg(SrcReg, getKillRegState(isKill)) + .addFrameIndex(FI) + .addImm(0); return; + } + if (inClass(Bfin::D16RegClass, SrcReg, RC)) { + BuildMI(MBB, I, DL, get(Bfin::STORE16fi)) + .addReg(SrcReg, getKillRegState(isKill)) + .addFrameIndex(FI) + .addImm(0); return; + } + if (inClass(Bfin::AnyCCRegClass, SrcReg, RC)) { + BuildMI(MBB, I, DL, get(Bfin::STORE8fi)) + .addReg(SrcReg, getKillRegState(isKill)) + .addFrameIndex(FI) + .addImm(0); return; + } llvm_unreachable("Cannot store regclass to stack slot"); likewise in loadRegFromStackSlot. BlackfinRegisterInfo::emitPrologue looks like it could benefit from "early return". Some more substantial comments: + +def LOAD8z32p_inc: F1<(outs D:$dst, P:$ptr_wb), (ins P:$ptr), + "$dst = B[$ptr++] (Z);", []>; +def LOAD8z32p_dec: F1<(outs D:$dst, P:$ptr_wb), (ins P:$ptr), + "$dst = B[$ptr--] (Z);", []>; + +def LOAD8s32p_inc: F1<(outs D:$dst, P:$ptr_wb), (ins P:$ptr), + "$dst = B[$ptr++] (X);", []>; +def LOAD8s32p_dec: F1<(outs D:$dst, P:$ptr_wb), (ins P:$ptr), + "$dst = B[$ptr--] (X);", []>; It seems that bfin has a number of common "kinds" of instruction, could these benefit from a multipattern to factor them? +def SRAi: F1<(outs D:$dst), (ins D:$src, i16imm:$amount), + "$dst >>>= $amount;", + [(set D:$dst, (sra D:$src, (i16 uimm5:$amount)))]>; + +def SRAr: F1<(outs D:$dst), (ins D:$src, D:$amount), + "$dst >>>= $amount;", + [(set D:$dst, (sra D:$src, D:$amount))]>; likewise, handling r+i forms of instructions cries out for a multipattern. Overall, this seems like a pretty clean and nice target in my quick first look! -Chris From nicholas at mxc.ca Wed Jul 29 01:14:53 2009 From: nicholas at mxc.ca (Nick Lewycky) Date: Wed, 29 Jul 2009 06:14:53 -0000 Subject: [llvm-commits] [llvm] r77439 - /llvm/trunk/test/Transforms/SimplifyLibCalls/2009-07-28-Exit.ll Message-ID: <200907290614.n6T6ErdA031394@zion.cs.uiuc.edu> Author: nicholas Date: Wed Jul 29 01:14:52 2009 New Revision: 77439 URL: http://llvm.org/viewvc/llvm-project?rev=77439&view=rev Log: Just discard the output, no need to turn it back into text. Modified: llvm/trunk/test/Transforms/SimplifyLibCalls/2009-07-28-Exit.ll Modified: llvm/trunk/test/Transforms/SimplifyLibCalls/2009-07-28-Exit.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/SimplifyLibCalls/2009-07-28-Exit.ll?rev=77439&r1=77438&r2=77439&view=diff ============================================================================== --- llvm/trunk/test/Transforms/SimplifyLibCalls/2009-07-28-Exit.ll (original) +++ llvm/trunk/test/Transforms/SimplifyLibCalls/2009-07-28-Exit.ll Wed Jul 29 01:14:52 2009 @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -simplify-libcalls | llvm-dis +; RUN: llvm-as < %s | opt -simplify-libcalls -disable-output ; PR4641 %struct.__sFILE = type { i8*, i32, i32, i16, i16, %struct.__sbuf, i32, i8*, i32 (i8*)*, i32 (i8*, i8*, i32)*, i64 (i8*, i64, i32)*, i32 (i8*, i8*, i32)*, %struct.__sbuf, i8*, i32, [3 x i8], [1 x i8], %struct.__sbuf, i32, i64, %struct.pthread_mutex*, %struct.pthread*, i32, i32, %union.anon } From sabre at nondot.org Wed Jul 29 01:19:14 2009 From: sabre at nondot.org (Chris Lattner) Date: Wed, 29 Jul 2009 06:19:14 -0000 Subject: [llvm-commits] [llvm] r77440 - /llvm/trunk/docs/index.html Message-ID: <200907290619.n6T6JECx031533@zion.cs.uiuc.edu> Author: lattner Date: Wed Jul 29 01:19:14 2009 New Revision: 77440 URL: http://llvm.org/viewvc/llvm-project?rev=77440&view=rev Log: link to a newer preso Modified: llvm/trunk/docs/index.html Modified: llvm/trunk/docs/index.html URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/index.html?rev=77440&r1=77439&r2=77440&view=diff ============================================================================== --- llvm/trunk/docs/index.html (original) +++ llvm/trunk/docs/index.html Wed Jul 29 01:19:14 2009 @@ -41,13 +41,13 @@

    From clattner at apple.com Wed Jul 29 01:20:05 2009 From: clattner at apple.com (Chris Lattner) Date: Tue, 28 Jul 2009 23:20:05 -0700 Subject: [llvm-commits] [llvm] r77407 - in /llvm/trunk: include/llvm/IntrinsicsX86.td lib/Target/X86/X86ISelLowering.cpp lib/Target/X86/X86ISelLowering.h lib/Target/X86/X86InstrSSE.td test/CodeGen/X86/sse41.ll In-Reply-To: <0BED72EF-B78A-46C6-9FA7-515070E3ADD5@apple.com> References: <200907290028.n6T0S6VU020655@zion.cs.uiuc.edu> <4014B4D6-8F63-411E-8760-49A96A289D24@apple.com> <945A54B8-2176-4A39-AF93-805E42793E32@apple.com> <4A6FDC39.1090301@apple.com> <0BED72EF-B78A-46C6-9FA7-515070E3ADD5@apple.com> Message-ID: <26E2B162-1288-4103-AE57-718086DC36A0@apple.com> On Jul 28, 2009, at 10:58 PM, Evan Cheng wrote: >> >> Two possible approaches: >> >> 1. The intrinsic could be declared to return i8 instead of i32, that >> would be a hack around the problem, but would work be reasonable >> since the X86 setcc instructions set an i8. >> >> 2. We could lower the ptestz intrinisic at sdisel time instead of in >> legalize like we do for call and arguments. >> >> I don't see a reason not to do #2: it seems like a general win for >> intrinsics that are lowered like this. What do you guys think? > > #2 makes sense to me. Can you file a bug about it? ;-) -Chris From sabre at nondot.org Wed Jul 29 01:29:53 2009 From: sabre at nondot.org (Chris Lattner) Date: Wed, 29 Jul 2009 06:29:53 -0000 Subject: [llvm-commits] [llvm] r77441 - /llvm/trunk/lib/Target/X86/AsmParser/X86AsmParser.cpp Message-ID: <200907290629.n6T6TrFK031874@zion.cs.uiuc.edu> Author: lattner Date: Wed Jul 29 01:29:53 2009 New Revision: 77441 URL: http://llvm.org/viewvc/llvm-project?rev=77441&view=rev Log: minor smallvector cleanups Modified: llvm/trunk/lib/Target/X86/AsmParser/X86AsmParser.cpp 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=77441&r1=77440&r2=77441&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/AsmParser/X86AsmParser.cpp (original) +++ llvm/trunk/lib/Target/X86/AsmParser/X86AsmParser.cpp Wed Jul 29 01:29:53 2009 @@ -26,7 +26,7 @@ private: bool MatchInstruction(const StringRef &Name, - llvm::SmallVector &Operands, + SmallVectorImpl &Operands, MCInst &Inst); MCAsmParser &getParser() const { return Parser; } @@ -290,13 +290,13 @@ bool X86ATTAsmParser::MatchInstruction(const StringRef &Name, - llvm::SmallVector &Operands, + SmallVectorImpl &Operands, MCInst &Inst) { return false; } bool X86ATTAsmParser::ParseInstruction(const StringRef &Name, MCInst &Inst) { - llvm::SmallVector Operands; + SmallVector Operands; if (getLexer().isNot(AsmToken::EndOfStatement)) { // Read the first operand. From sabre at nondot.org Wed Jul 29 01:33:53 2009 From: sabre at nondot.org (Chris Lattner) Date: Wed, 29 Jul 2009 06:33:53 -0000 Subject: [llvm-commits] [llvm] r77442 - /llvm/trunk/lib/Target/X86/AsmParser/X86AsmParser.cpp Message-ID: <200907290633.n6T6Xrhx032009@zion.cs.uiuc.edu> Author: lattner Date: Wed Jul 29 01:33:53 2009 New Revision: 77442 URL: http://llvm.org/viewvc/llvm-project?rev=77442&view=rev Log: more syntactic cleanups. Modified: llvm/trunk/lib/Target/X86/AsmParser/X86AsmParser.cpp 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=77442&r1=77441&r2=77442&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/AsmParser/X86AsmParser.cpp (original) +++ llvm/trunk/lib/Target/X86/AsmParser/X86AsmParser.cpp Wed Jul 29 01:33:53 2009 @@ -56,6 +56,11 @@ virtual bool ParseInstruction(const StringRef &Name, MCInst &Inst); }; + +} // end anonymous namespace + + +namespace { /// X86Operand - Instances of this class represent a parsed X86 machine /// instruction. @@ -120,12 +125,11 @@ } }; -} +} // end anonymous namespace. -// bool X86ATTAsmParser::ParseRegister(X86Operand &Op) { - AsmToken Tok = getLexer().getTok(); + const AsmToken &Tok = getLexer().getTok(); assert(Tok.is(AsmToken::Register) && "Invalid token kind!"); // FIXME: Validate register for the current architecture; we have to do @@ -158,7 +162,7 @@ Op = X86Operand::CreateImm(Val); return false; } - case AsmToken::Star: { + case AsmToken::Star: getLexer().Lex(); // Eat the star. if (getLexer().is(AsmToken::Register)) { @@ -170,7 +174,6 @@ // FIXME: Note the '*' in the operand for use by the matcher. return false; } - } } /// ParseMemOperand: segment: disp(basereg, indexreg, scale) From sabre at nondot.org Wed Jul 29 01:44:13 2009 From: sabre at nondot.org (Chris Lattner) Date: Wed, 29 Jul 2009 06:44:13 -0000 Subject: [llvm-commits] [llvm] r77443 - /llvm/trunk/docs/LangRef.html Message-ID: <200907290644.n6T6iDC7032362@zion.cs.uiuc.edu> Author: lattner Date: Wed Jul 29 01:44:13 2009 New Revision: 77443 URL: http://llvm.org/viewvc/llvm-project?rev=77443&view=rev Log: some wording changes. Modified: llvm/trunk/docs/LangRef.html Modified: llvm/trunk/docs/LangRef.html URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/LangRef.html?rev=77443&r1=77442&r2=77443&view=diff ============================================================================== --- llvm/trunk/docs/LangRef.html (original) +++ llvm/trunk/docs/LangRef.html Wed Jul 29 01:44:13 2009 @@ -3917,7 +3917,7 @@
    Arguments:

    The first argument is always a pointer, and forms the basis of the - calculation. The remaining arguments are indices, that indicate which of the + calculation. The remaining arguments are indices that indicate which of the elements of the aggregate object are indexed. The interpretation of each index is dependent on the type being indexed into. The first index always indexes the pointer value given as the first argument, the second index @@ -3929,9 +3929,10 @@ calculation.

    The type of each index argument depends on the type it is indexing into. - When indexing into a (packed) structure, only i32 integer + When indexing into a (optionally packed) structure, only i32 integer constants are allowed. When indexing into an array, pointer or - vector, integers of any width are allowed (also non-constants).

    + vector, integers of any width are allowed, and they are not required to be + constant.

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

    From daniel at zuster.org Wed Jul 29 01:45:15 2009 From: daniel at zuster.org (Daniel Dunbar) Date: Wed, 29 Jul 2009 06:45:15 -0000 Subject: [llvm-commits] [llvm] r77444 - /llvm/trunk/lib/Support/raw_ostream.cpp Message-ID: <200907290645.n6T6jF5Z032406@zion.cs.uiuc.edu> Author: ddunbar Date: Wed Jul 29 01:45:14 2009 New Revision: 77444 URL: http://llvm.org/viewvc/llvm-project?rev=77444&view=rev Log: raw_ostream: Follow the 32-bit path when printing "small" decimal numbers. Modified: llvm/trunk/lib/Support/raw_ostream.cpp Modified: llvm/trunk/lib/Support/raw_ostream.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/raw_ostream.cpp?rev=77444&r1=77443&r2=77444&view=diff ============================================================================== --- llvm/trunk/lib/Support/raw_ostream.cpp (original) +++ llvm/trunk/lib/Support/raw_ostream.cpp Wed Jul 29 01:45:14 2009 @@ -89,6 +89,10 @@ } raw_ostream &raw_ostream::operator<<(unsigned long long N) { + // Output using 32-bit div/mod when possible. + if (N == static_cast(N)) + return this->operator<<(static_cast(N)); + // Zero is a special case. if (N == 0) return *this << '0'; From clattner at apple.com Wed Jul 29 01:48:11 2009 From: clattner at apple.com (Chris Lattner) Date: Tue, 28 Jul 2009 23:48:11 -0700 Subject: [llvm-commits] [llvm] r77259 - in /llvm/trunk: docs/LangRef.html include/llvm/Bitcode/LLVMBitCodes.h include/llvm/Operator.h lib/AsmParser/LLLexer.cpp lib/AsmParser/LLParser.cpp lib/AsmParser/LLToken.h lib/Bitcode/Reader/BitcodeReader.cpp lib/Bitcode/Writer/BitcodeWriter.cpp lib/VMCore/AsmWriter.cpp test/Assembler/flags-plain.ll test/Assembler/flags.ll In-Reply-To: <200907272153.n6RLrkuk023065@zion.cs.uiuc.edu> References: <200907272153.n6RLrkuk023065@zion.cs.uiuc.edu> Message-ID: <597EA260-27B6-4545-B4B6-F84554804A0D@apple.com> On Jul 27, 2009, at 2:53 PM, Dan Gohman wrote: > URL: http://llvm.org/viewvc/llvm-project?rev=77259&view=rev > Log: > Add a new keyword 'inbounds' for use with getelementptr. See the > LangRef.html changes for details. The langref changes look nice. The choice of "inbounds" is a little strange to me, isn't this flag mostly about wrapping behavior when overflow happens? Will "inbounds" be the default generated by the llvm-gcc/clang front- ends? If so, it would be nice to invert the sense of the bit so it doesn't show up in all the .ll files making them really noisy. > +++ llvm/trunk/lib/AsmParser/LLParser.cpp Mon Jul 27 16:53:46 2009 > @@ -2039,7 +2039,11 @@ > case lltok::kw_select: { > unsigned Opc = Lex.getUIntVal(); > SmallVector Elts; > + bool InBounds = false; > Lex.Lex(); > + if (Opc == Instruction::GetElementPtr) > + if (EatIfPresent(lltok::kw_inbounds)) > + InBounds = true; Please use: InBounds = EatIfPresent(lltok::kw_inbounds); > bool LLParser::ParseGetElementPtr(Instruction *&Inst, > PerFunctionState &PFS) { > Value *Ptr, *Val; LocTy Loc, EltLoc; > + bool InBounds = false; > + > + if (EatIfPresent(lltok::kw_inbounds)) > + InBounds = true; Likewise. Thanks Dan, -Chris From daniel at zuster.org Wed Jul 29 02:08:44 2009 From: daniel at zuster.org (Daniel Dunbar) Date: Wed, 29 Jul 2009 07:08:44 -0000 Subject: [llvm-commits] [llvm] r77445 - in /llvm/trunk: include/llvm/ADT/Twine.h lib/Support/Twine.cpp unittests/ADT/TwineTest.cpp Message-ID: <200907290708.n6T78i1o000802@zion.cs.uiuc.edu> Author: ddunbar Date: Wed Jul 29 02:08:44 2009 New Revision: 77445 URL: http://llvm.org/viewvc/llvm-project?rev=77445&view=rev Log: Twines: Support numeric conversion directly (uitostr, etc). - Provides static constructors for doing number to string conversions without using temporaries. - There are several ways to do this, I think given the Twine constraints this is the simplest one. - One FIXME for fast number -> hex conversion. - Added another comment on one last major bit of perf work Twines need, which is to make raw_svector_ostream more efficient. Modified: llvm/trunk/include/llvm/ADT/Twine.h llvm/trunk/lib/Support/Twine.cpp llvm/trunk/unittests/ADT/TwineTest.cpp Modified: llvm/trunk/include/llvm/ADT/Twine.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/Twine.h?rev=77445&r1=77444&r2=77445&view=diff ============================================================================== --- llvm/trunk/include/llvm/ADT/Twine.h (original) +++ llvm/trunk/include/llvm/ADT/Twine.h Wed Jul 29 02:08:44 2009 @@ -86,6 +86,9 @@ /// The empty string. EmptyKind, + /// A pointer to a Twine instance. + TwineKind, + /// A pointer to a C string instance. CStringKind, @@ -95,8 +98,16 @@ /// A pointer to a StringRef instance. StringRefKind, - /// A pointer to a Twine instance. - TwineKind + /// A pointer to a uint64_t value, to render as an unsigned decimal + /// integer. + UDecKind, + + /// A pointer to a uint64_t value, to render as an unsigned hexadecimal + /// integer. + UHexKind, + + /// A pointer to a uint64_t value, to render as a signed decimal integer. + SDecKind }; private: @@ -232,12 +243,6 @@ assert(isValid() && "Invalid twine!"); } - /// Create a 'null' string, which is an empty string that always - /// concatenates to form another empty string. - static Twine createNull() { - return Twine(NullKind); - } - // FIXME: Unfortunately, to make sure this is as efficient as possible we // need extra binary constructors from particular types. We can't rely on // the compiler to be smart enough to fold operator+()/concat() down to the @@ -255,6 +260,38 @@ assert(isValid() && "Invalid twine!"); } + /// Create a 'null' string, which is an empty string that always + /// concatenates to form another empty string. + static Twine createNull() { + return Twine(NullKind); + } + + /// @} + /// @name Numeric Conversions + /// @{ + + /// Construct a twine to print \arg Val as an unsigned decimal integer. + static Twine utostr(const uint64_t &Val) { + return Twine(&Val, UDecKind, 0, EmptyKind); + } + + /// Construct a twine to print \arg Val as a signed decimal integer. + static Twine itostr(const int64_t &Val) { + return Twine(&Val, SDecKind, 0, EmptyKind); + } + + // Construct a twine to print \arg Val as an unsigned hexadecimal integer. + static Twine utohexstr(const uint64_t &Val) { + return Twine(&Val, UHexKind, 0, EmptyKind); + } + + // Construct a twine to print \arg Val as an unsigned hexadecimal + // integer. This routine is provided as a convenience to sign extend values + // before printing. + static Twine itohexstr(const int64_t &Val) { + return Twine(&Val, UHexKind, 0, EmptyKind); + } + /// @} /// @name String Operations /// @{ Modified: llvm/trunk/lib/Support/Twine.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/Twine.cpp?rev=77445&r1=77444&r2=77445&view=diff ============================================================================== --- llvm/trunk/lib/Support/Twine.cpp (original) +++ llvm/trunk/lib/Support/Twine.cpp Wed Jul 29 02:08:44 2009 @@ -19,6 +19,13 @@ } void Twine::toVector(SmallVectorImpl &Out) const { + // FIXME: This is very inefficient, since we are creating a large raw_ostream + // buffer -- hitting malloc, which we were supposed to avoid -- all when we + // have this pretty little small vector available. + // + // The best way to fix this is to make raw_svector_ostream do the right thing + // and be efficient, by augmenting the base raw_ostream with the ability to + // have the buffer managed by a concrete implementation. raw_svector_ostream OS(Out); print(OS); } @@ -28,6 +35,9 @@ switch (Kind) { case Twine::NullKind: break; case Twine::EmptyKind: break; + case Twine::TwineKind: + static_cast(Ptr)->print(OS); + break; case Twine::CStringKind: OS << static_cast(Ptr); break; @@ -37,8 +47,15 @@ case Twine::StringRefKind: OS << *static_cast(Ptr); break; - case Twine::TwineKind: - static_cast(Ptr)->print(OS); + case Twine::UDecKind: + OS << *static_cast(Ptr); + break; + case Twine::SDecKind: + OS << *static_cast(Ptr); + break; + case Twine::UHexKind: + // FIXME: Add raw_ostream functionality for this. + OS << ::utohexstr(*static_cast(Ptr)); break; } } @@ -50,21 +67,30 @@ OS << "null"; break; case Twine::EmptyKind: OS << "empty"; break; + case Twine::TwineKind: + OS << "rope:"; + static_cast(Ptr)->printRepr(OS); + break; case Twine::CStringKind: - OS << "cstring:\"" - << static_cast(Ptr) << "\""; + OS << "cstring:\"" + << static_cast(Ptr) << "\""; break; case Twine::StdStringKind: - OS << "std::string:\"" - << *static_cast(Ptr) << "\""; + OS << "std::string:\"" + << static_cast(Ptr) << "\""; break; case Twine::StringRefKind: - OS << "stringref:\"" - << *static_cast(Ptr) << "\""; + OS << "stringref:\"" + << static_cast(Ptr) << "\""; break; - case Twine::TwineKind: - OS << "rope:"; - static_cast(Ptr)->printRepr(OS); + case Twine::UDecKind: + OS << "udec:" << static_cast(Ptr) << "\""; + break; + case Twine::SDecKind: + OS << "sdec:" << static_cast(Ptr) << "\""; + break; + case Twine::UHexKind: + OS << "uhex:" << static_cast(Ptr) << "\""; break; } } Modified: llvm/trunk/unittests/ADT/TwineTest.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/ADT/TwineTest.cpp?rev=77445&r1=77444&r2=77445&view=diff ============================================================================== --- llvm/trunk/unittests/ADT/TwineTest.cpp (original) +++ llvm/trunk/unittests/ADT/TwineTest.cpp Wed Jul 29 02:08:44 2009 @@ -30,6 +30,18 @@ EXPECT_EQ("hi", Twine(StringRef("hithere", 2)).str()); } +TEST(TwineTest, Numbers) { + EXPECT_EQ("123", Twine::utostr(123).str()); + EXPECT_EQ("-123", Twine::itostr(-123).str()); + EXPECT_EQ("123", Twine::utostr(123).str()); + EXPECT_EQ("-123", Twine::itostr(-123).str()); + EXPECT_EQ("123", Twine::utostr((char) 123).str()); + EXPECT_EQ("-123", Twine::itostr((char) -123).str()); + + EXPECT_EQ("7B", Twine::utohexstr(123).str()); + EXPECT_EQ("FFFFFFFFFFFFFF85", Twine::itohexstr(-123).str()); +} + TEST(TwineTest, Concat) { // Check verse repr, since we care about the actual representation not just // the result. From eli.friedman at gmail.com Wed Jul 29 04:04:25 2009 From: eli.friedman at gmail.com (Eli Friedman) Date: Wed, 29 Jul 2009 02:04:25 -0700 Subject: [llvm-commits] [llvm] r77259 - in /llvm/trunk: docs/LangRef.html include/llvm/Bitcode/LLVMBitCodes.h include/llvm/Operator.h lib/AsmParser/LLLexer.cpp lib/AsmParser/LLParser.cpp lib/AsmParser/LLToken.h lib/Bitcode/Reader/BitcodeReader.cpp lib/Bit Message-ID: On Tue, Jul 28, 2009 at 11:48 PM, Chris Lattner wrote: > Will "inbounds" be the default generated by the llvm-gcc/clang front- > ends? If so, it would be nice to invert the sense of the bit so it > doesn't show up in all the .ll files making them really noisy. Dunno... this is probably worth discussing on llvmdev. We're certainly within the C standard to do so, but it could potentially break code. -Eli From benny.kra at googlemail.com Wed Jul 29 06:21:45 2009 From: benny.kra at googlemail.com (Benjamin Kramer) Date: Wed, 29 Jul 2009 11:21:45 -0000 Subject: [llvm-commits] [llvm] r77450 - /llvm/trunk/include/llvm/ADT/Twine.h Message-ID: <200907291121.n6TBLoG4021177@zion.cs.uiuc.edu> Author: d0k Date: Wed Jul 29 06:21:25 2009 New Revision: 77450 URL: http://llvm.org/viewvc/llvm-project?rev=77450&view=rev Log: MSVC build fix. Patch by Olaf Krzikalla! Modified: llvm/trunk/include/llvm/ADT/Twine.h Modified: llvm/trunk/include/llvm/ADT/Twine.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/Twine.h?rev=77450&r1=77449&r2=77450&view=diff ============================================================================== --- llvm/trunk/include/llvm/ADT/Twine.h (original) +++ llvm/trunk/include/llvm/ADT/Twine.h Wed Jul 29 06:21:25 2009 @@ -11,6 +11,7 @@ #define LLVM_ADT_TWINE_H #include "llvm/ADT/StringRef.h" +#include "llvm/Support/DataTypes.h" #include #include From dpatel at apple.com Wed Jul 29 10:24:55 2009 From: dpatel at apple.com (Devang Patel) Date: Wed, 29 Jul 2009 15:24:55 -0000 Subject: [llvm-commits] [llvm] r77455 - /llvm/trunk/include/llvm/Metadata.h Message-ID: <200907291524.n6TFOvUC028850@zion.cs.uiuc.edu> Author: dpatel Date: Wed Jul 29 10:24:54 2009 New Revision: 77455 URL: http://llvm.org/viewvc/llvm-project?rev=77455&view=rev Log: trim include list. Modified: llvm/trunk/include/llvm/Metadata.h Modified: llvm/trunk/include/llvm/Metadata.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Metadata.h?rev=77455&r1=77454&r2=77455&view=diff ============================================================================== --- llvm/trunk/include/llvm/Metadata.h (original) +++ llvm/trunk/include/llvm/Metadata.h Wed Jul 29 10:24:54 2009 @@ -16,7 +16,7 @@ #ifndef LLVM_MDNODE_H #define LLVM_MDNODE_H -#include "llvm/Constant.h" +#include "llvm/Value.h" #include "llvm/Type.h" #include "llvm/ADT/FoldingSet.h" #include "llvm/ADT/SmallVector.h" @@ -24,6 +24,7 @@ #include "llvm/Support/ValueHandle.h" namespace llvm { +class Constant; //===----------------------------------------------------------------------===// // MetadataBase - A base class for MDNode, MDString and NamedMDNode. From stoklund at 2pi.dk Wed Jul 29 10:43:50 2009 From: stoklund at 2pi.dk (Jakob Stoklund Olesen) Date: Wed, 29 Jul 2009 17:43:50 +0200 Subject: [llvm-commits] [PATCH] Analog Devices Blackfin back-end In-Reply-To: References: <764D793B-7F49-46C2-8063-4CE1D054EA31@2pi.dk> Message-ID: <033C191F-BB5F-4F04-8118-708D2A758900@2pi.dk> On 29/07/2009, at 08.14, Chris Lattner wrote: > Cool, the autoconf patch is fine, feel free to add it now if it > won't break anything. I think it will break the build if it goes in before the Target/ Blackfin directory is created. > A "cumulative" patch is preferred, but the delta wasn't that big and > I'm not trying to do a final review, just give some tips. I will fix these issues and then submit a full patch. > Please put the name and return type on the same line if there is > room, e.g.: > > +SDNode *BlackfinDAGToDAGISel::Select(SDValue Op) { > > Please use K&R style bracketing, where the { goes on the same line > as the function name. No problem. I will use the same style as the rest of lib/Target. BTW, that's not K&R style: http://en.wikipedia.org/wiki/Indent_style#K.26R_style > + if (MI->getOperand(opNum+1).isImm() > + && MI->getOperand(opNum+1).getImm() == 0) > + return; > > Please use && on the previous line, like so: > > + if (MI->getOperand(opNum+1).isImm() && > + MI->getOperand(opNum+1).getImm() == 0) > + return; Much better. > Please consistently indent by 2: > > + default: return true; // Unknown modifier. > + case 'r': > + break; > + } Heh, that is copied verbatim from the Sparc target. Will fix. > Please just use Bfin:: in isCC for consistency: > > +static inline bool > +isCC(const TargetRegisterClass *RC) > +{ > + using namespace Bfin; > + return RC == &AnyCCRegClass || AnyCCRegClass.hasSubClass(RC); > +} > + > +static inline bool > +isDCC(const TargetRegisterClass *RC) > +{ > + return RC == &Bfin::DRegClass || Bfin::DRegClass.hasSubClass(RC) > || isCC(RC); > +} Will fix. > On that note, the Bfin target name space is kind of a weird > contraction for it, I don't have a strong opinion on it either way, > but maybe BF would be better? Your call, do whatever you like. All the other targets use an all-caps abbreviation, so that is probably a good idea. The "bfin" contraction comes from GCC: - march=bfin and predefined __bfin__ macro. [...] > How about using early exits, giving something like: > > + if (inClass(Bfin::DPRegClass, SrcReg, RC)) { > + BuildMI(MBB, I, DL, get(Bfin::STORE32fi)) > + .addReg(SrcReg, getKillRegState(isKill)) > + .addFrameIndex(FI) > + .addImm(0); > return; > + } Will fix. > It seems that bfin has a number of common "kinds" of instruction, > could these benefit from a multipattern to factor them? Yes, maybe. The instruction set is oddly irregular so you often get only two instructions per multipattern. But I haven't really looked for these opportunities, I will see what I can find. Thanks, /jakob From dpatel at apple.com Wed Jul 29 10:53:09 2009 From: dpatel at apple.com (Devang Patel) Date: Wed, 29 Jul 2009 15:53:09 -0000 Subject: [llvm-commits] [llvm] r77457 - /llvm/trunk/include/llvm/Module.h Message-ID: <200907291553.n6TFrCRB029962@zion.cs.uiuc.edu> Author: dpatel Date: Wed Jul 29 10:52:49 2009 New Revision: 77457 URL: http://llvm.org/viewvc/llvm-project?rev=77457&view=rev Log: Fix comment. Modified: llvm/trunk/include/llvm/Module.h Modified: llvm/trunk/include/llvm/Module.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Module.h?rev=77457&r1=77456&r2=77457&view=diff ============================================================================== --- llvm/trunk/include/llvm/Module.h (original) +++ llvm/trunk/include/llvm/Module.h Wed Jul 29 10:52:49 2009 @@ -388,7 +388,7 @@ alias_iterator alias_end () { return AliasList.end(); } /// Get a constant iterator to the last alias. const_alias_iterator alias_end () const { return AliasList.end(); } - /// Determine how many functions are in the Module's list of aliases. + /// Determine how many aliases are in the Module's list of aliases. size_t alias_size () const { return AliasList.size(); } /// Determine if the list of aliases is empty. bool alias_empty() const { return AliasList.empty(); } From gohman at apple.com Wed Jul 29 10:58:42 2009 From: gohman at apple.com (Dan Gohman) Date: Wed, 29 Jul 2009 15:58:42 -0000 Subject: [llvm-commits] [llvm] r77459 - /llvm/trunk/lib/AsmParser/LLParser.cpp Message-ID: <200907291558.n6TFwiFc030127@zion.cs.uiuc.edu> Author: djg Date: Wed Jul 29 10:58:36 2009 New Revision: 77459 URL: http://llvm.org/viewvc/llvm-project?rev=77459&view=rev Log: Minor code simplification. Modified: llvm/trunk/lib/AsmParser/LLParser.cpp Modified: llvm/trunk/lib/AsmParser/LLParser.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/AsmParser/LLParser.cpp?rev=77459&r1=77458&r2=77459&view=diff ============================================================================== --- llvm/trunk/lib/AsmParser/LLParser.cpp (original) +++ llvm/trunk/lib/AsmParser/LLParser.cpp Wed Jul 29 10:58:36 2009 @@ -2078,8 +2078,7 @@ bool InBounds = false; Lex.Lex(); if (Opc == Instruction::GetElementPtr) - if (EatIfPresent(lltok::kw_inbounds)) - InBounds = true; + InBounds = EatIfPresent(lltok::kw_inbounds); if (ParseToken(lltok::lparen, "expected '(' in constantexpr") || ParseGlobalValueVector(Elts) || ParseToken(lltok::rparen, "expected ')' in constantexpr")) @@ -3413,10 +3412,8 @@ /// ::= 'getelementptr' 'inbounds'? TypeAndValue (',' TypeAndValue)* bool LLParser::ParseGetElementPtr(Instruction *&Inst, PerFunctionState &PFS) { Value *Ptr, *Val; LocTy Loc, EltLoc; - bool InBounds = false; - if (EatIfPresent(lltok::kw_inbounds)) - InBounds = true; + bool InBounds = EatIfPresent(lltok::kw_inbounds); if (ParseTypeAndValue(Ptr, Loc, PFS)) return true; From gohman at apple.com Wed Jul 29 11:00:31 2009 From: gohman at apple.com (Dan Gohman) Date: Wed, 29 Jul 2009 16:00:31 -0000 Subject: [llvm-commits] [llvm] r77460 - /llvm/trunk/docs/LangRef.html Message-ID: <200907291600.n6TG0Wo6030195@zion.cs.uiuc.edu> Author: djg Date: Wed Jul 29 11:00:30 2009 New Revision: 77460 URL: http://llvm.org/viewvc/llvm-project?rev=77460&view=rev Log: Add one-past-the-end language to the inbounds keyword. Modified: llvm/trunk/docs/LangRef.html Modified: llvm/trunk/docs/LangRef.html URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/LangRef.html?rev=77460&r1=77459&r2=77460&view=diff ============================================================================== --- llvm/trunk/docs/LangRef.html (original) +++ llvm/trunk/docs/LangRef.html Wed Jul 29 11:00:30 2009 @@ -3998,10 +3998,13 @@

    If the inbounds keyword is present, the result value of the - getelementptr is undefined if the base pointer is not pointing - into an allocated object, or if any of the addresses formed by successive - addition of the offsets implied by the indices to the base address is - outside of the allocated object into which the base pointer points.

    + getelementptr is undefined if the base pointer is not an + in bounds address of an allocated object, or if any of the addresses + formed by successive addition of the offsets implied by the indices to + the base address are not an in bounds address of that allocated + object. + The in bounds addresses for an allocated object are all the addresses + that point into the object, plus the address one past the end.

    If the inbounds keyword is not present, the offsets are added to the base address with silently-wrapping two's complement arithmetic, and From dag at cray.com Wed Jul 29 11:03:00 2009 From: dag at cray.com (David Greene) Date: Wed, 29 Jul 2009 11:03:00 -0500 Subject: [llvm-commits] =?iso-8859-1?q?=5Bllvm=5D_r77397_-_in_/llvm/trunk?= =?iso-8859-1?q?=3A_include/llvm/Support/FormattedStream=2Eh=09lib/Support?= =?iso-8859-1?q?/FormattedStream=2Ecpp?= In-Reply-To: <750B4DE6-E485-4D9A-9CE2-E07B72844532@apple.com> References: <200907282326.n6SNQYms018777@zion.cs.uiuc.edu> <2C88990A-2D3A-4310-B116-5634F1B181DA@apple.com> <750B4DE6-E485-4D9A-9CE2-E07B72844532@apple.com> Message-ID: <200907291103.01091.dag@cray.com> On Tuesday 28 July 2009 23:48, Evan Cheng wrote: > Ok. David, I'm going to revert AsmWriterEmitter.cpp back to 74742 for > now. Please re-commit as you have fixed the efficiency problem. As you know, I can't SEE the efficiency problem. I'm flying blind. And I was following Chris' suggestion to commit the patch I had with the understanding that more fixes were coming. Honestly, this is getting very frustrating. Aren't we in development right now? Regressions are going to happen. This kind of compile time regression shouldn't be a huge problem especially when we have a solution. Oh well, guess I have to spend more time re-doing what I've already done. -Dave From greened at obbligato.org Wed Jul 29 11:08:35 2009 From: greened at obbligato.org (David Greene) Date: Wed, 29 Jul 2009 16:08:35 -0000 Subject: [llvm-commits] [llvm] r77461 - in /llvm/trunk: include/llvm/Support/FormattedStream.h lib/Support/FormattedStream.cpp Message-ID: <200907291608.n6TG8bIU030437@zion.cs.uiuc.edu> Author: greened Date: Wed Jul 29 11:08:27 2009 New Revision: 77461 URL: http://llvm.org/viewvc/llvm-project?rev=77461&view=rev Log: Re-apply previous changes and improve column padding performance some more. Modified: llvm/trunk/include/llvm/Support/FormattedStream.h llvm/trunk/lib/Support/FormattedStream.cpp Modified: llvm/trunk/include/llvm/Support/FormattedStream.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/FormattedStream.h?rev=77461&r1=77460&r2=77461&view=diff ============================================================================== --- llvm/trunk/include/llvm/Support/FormattedStream.h (original) +++ llvm/trunk/include/llvm/Support/FormattedStream.h Wed Jul 29 11:08:27 2009 @@ -49,14 +49,21 @@ /// bool DeleteStream; - /// Column - The current output column of the stream. The column - /// scheme is zero-based. + /// ColumnScanned - The current output column of the data that's + /// been flushed and the portion of the buffer that's been + /// scanned. The column scheme is zero-based. /// - unsigned Column; + unsigned ColumnScanned; + + /// Scanned - This points to one past the last character in the + /// buffer we've scanned. + /// + iterator Scanned; virtual void write_impl(const char *Ptr, size_t Size) { - ComputeColumn(Ptr, Size); + ComputeColumn(); TheStream->write(Ptr, Size); + Scanned = begin(); } /// current_pos - Return the current position within the stream, @@ -70,7 +77,7 @@ /// ComputeColumn - Examine the current output and figure out /// which column we end up in after output. /// - void ComputeColumn(const char *Ptr, size_t Size); + void ComputeColumn(); public: /// formatted_raw_ostream - Open the specified file for @@ -84,13 +91,16 @@ /// underneath it. /// formatted_raw_ostream(raw_ostream &Stream, bool Delete = false) - : raw_ostream(), TheStream(0), DeleteStream(false), Column(0) { + : raw_ostream(), TheStream(0), DeleteStream(false), ColumnScanned(0) { setStream(Stream, Delete); } explicit formatted_raw_ostream() - : raw_ostream(), TheStream(0), DeleteStream(false), Column(0) {} + : raw_ostream(), TheStream(0), DeleteStream(false), ColumnScanned(0) { + Scanned = begin(); + } ~formatted_raw_ostream() { + flush(); if (DeleteStream) delete TheStream; } @@ -110,6 +120,8 @@ if (size_t BufferSize = TheStream->GetNumBytesInBuffer()) SetBufferSize(BufferSize); TheStream->SetUnbuffered(); + + Scanned = begin(); } /// PadToColumn - Align the output to some column number. Modified: llvm/trunk/lib/Support/FormattedStream.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/FormattedStream.cpp?rev=77461&r1=77460&r2=77461&view=diff ============================================================================== --- llvm/trunk/lib/Support/FormattedStream.cpp (original) +++ llvm/trunk/lib/Support/FormattedStream.cpp Wed Jul 29 11:08:27 2009 @@ -19,16 +19,23 @@ /// ComputeColumn - Examine the current output and figure out which /// column we end up in after output. /// -void formatted_raw_ostream::ComputeColumn(const char *Ptr, size_t Size) { +void formatted_raw_ostream::ComputeColumn() { // Keep track of the current column by scanning the string for // special characters - for (const char *epos = Ptr + Size; Ptr != epos; ++Ptr) { - ++Column; - if (*Ptr == '\n' || *Ptr == '\r') - Column = 0; - else if (*Ptr == '\t') - Column += (8 - (Column & 0x7)) & 0x7; + // The buffer may have been allocated underneath us. + if (Scanned == 0 && GetNumBytesInBuffer() != 0) { + Scanned = begin(); + } + + while (Scanned != end()) { + ++ColumnScanned; + if (*Scanned == '\n' || *Scanned == '\r') + ColumnScanned = 0; + else if (*Scanned == '\t') + // Assumes tab stop = 8 characters. + ColumnScanned += (8 - (ColumnScanned & 0x7)) & 0x7; + ++Scanned; } } @@ -38,21 +45,18 @@ /// \param MinPad - The minimum space to give after the most recent /// I/O, even if the current column + minpad > newcol. /// -void formatted_raw_ostream::PadToColumn(unsigned NewCol, unsigned MinPad) { - flush(); +void formatted_raw_ostream::PadToColumn(unsigned NewCol, unsigned MinPad) { + // Figure out what's in the buffer and add it to the column count. + ComputeColumn(); // Output spaces until we reach the desired column. - unsigned num = NewCol - Column; - if (NewCol < Column || num < MinPad) + unsigned num = NewCol - ColumnScanned; + if (NewCol < ColumnScanned || num < MinPad) num = MinPad; // Keep a buffer of spaces handy to speed up processing. - static char Spaces[MAX_COLUMN_PAD]; - static bool Initialized = false; - if (!Initialized) { - std::fill_n(Spaces, MAX_COLUMN_PAD, ' '), - Initialized = true; - } + const char *Spaces = " " + " "; assert(num < MAX_COLUMN_PAD && "Unexpectedly large column padding"); From bob.wilson at apple.com Wed Jul 29 11:25:56 2009 From: bob.wilson at apple.com (Bob Wilson) Date: Wed, 29 Jul 2009 16:25:56 -0000 Subject: [llvm-commits] [llvm] r77466 - /llvm/trunk/lib/VMCore/Verifier.cpp Message-ID: <200907291625.n6TGPuKB030997@zion.cs.uiuc.edu> Author: bwilson Date: Wed Jul 29 11:25:56 2009 New Revision: 77466 URL: http://llvm.org/viewvc/llvm-project?rev=77466&view=rev Log: Fix an assumption that there is a single return value when verifying overloaded types for intrinsic parameters. Modified: llvm/trunk/lib/VMCore/Verifier.cpp Modified: llvm/trunk/lib/VMCore/Verifier.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Verifier.cpp?rev=77466&r1=77465&r2=77466&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/Verifier.cpp (original) +++ llvm/trunk/lib/VMCore/Verifier.cpp Wed Jul 29 11:25:56 2009 @@ -1544,9 +1544,9 @@ return false; } } else { - if (Ty != FTy->getParamType(Match - 1)) { + if (Ty != FTy->getParamType(Match - NumRets)) { CheckFailed(IntrinsicParam(ArgNo, NumRets) + " does not " - "match parameter %" + utostr(Match - 1) + ".", F); + "match parameter %" + utostr(Match - NumRets) + ".", F); return false; } } From gohman at apple.com Wed Jul 29 11:26:13 2009 From: gohman at apple.com (Dan Gohman) Date: Wed, 29 Jul 2009 09:26:13 -0700 Subject: [llvm-commits] [llvm] r77259 - in /llvm/trunk: docs/LangRef.html include/llvm/Bitcode/LLVMBitCodes.h include/llvm/Operator.h lib/AsmParser/LLLexer.cpp lib/AsmParser/LLParser.cpp lib/AsmParser/LLToken.h lib/Bitcode/Reader/BitcodeReader.cpp lib/Bitcode/Writer/BitcodeWriter.cpp lib/VMCore/AsmWriter.cpp test/Assembler/flags-plain.ll test/Assembler/flags.ll In-Reply-To: <597EA260-27B6-4545-B4B6-F84554804A0D@apple.com> References: <200907272153.n6RLrkuk023065@zion.cs.uiuc.edu> <597EA260-27B6-4545-B4B6-F84554804A0D@apple.com> Message-ID: On Jul 28, 2009, at 11:48 PM, Chris Lattner wrote: > > On Jul 27, 2009, at 2:53 PM, Dan Gohman wrote: >> URL: http://llvm.org/viewvc/llvm-project?rev=77259&view=rev >> Log: >> Add a new keyword 'inbounds' for use with getelementptr. See the >> LangRef.html changes for details. > > The langref changes look nice. The choice of "inbounds" is a little > strange to me, isn't this flag mostly about wrapping behavior when > overflow happens? It turns out that avoiding wrapping and staying in bounds are basically the same thing, since LLVM doesn't specify where in the address space it will allocate an object. > > Will "inbounds" be the default generated by the llvm-gcc/clang front- > ends? If so, it would be nice to invert the sense of the bit so it > doesn't show up in all the .ll files making them really noisy. I'm planning for it to be the default behavior. I'm open to discussion; there are pros and cons either way. Dan From bob.wilson at apple.com Wed Jul 29 11:36:02 2009 From: bob.wilson at apple.com (Bob Wilson) Date: Wed, 29 Jul 2009 16:36:02 -0000 Subject: [llvm-commits] [llvm] r77467 - /llvm/trunk/utils/TableGen/IntrinsicEmitter.cpp Message-ID: <200907291636.n6TGa3YL031311@zion.cs.uiuc.edu> Author: bwilson Date: Wed Jul 29 11:35:59 2009 New Revision: 77467 URL: http://llvm.org/viewvc/llvm-project?rev=77467&view=rev Log: Fix the verifier to handle intrinsics with LLVMMatchType parameters, where the return type of the intrinsic is not overloaded, i.e., where the type being matched is some other parameter. The argument to LLVMMatchType is an index into the list of overloaded types (ignoring the fixed types), but VerifyIntrinsicPrototype is expecting its arguments for LLVMMatchType parameters to be indices into the combined list of _all_ return values and parameters, not just the overloaded ones. This patch changes TableGen to keep track for each overloaded type of the corresponding index into the list of return values and parameters. It then generates the values expected by VerifyIntrinsicPrototype. Modified: llvm/trunk/utils/TableGen/IntrinsicEmitter.cpp Modified: llvm/trunk/utils/TableGen/IntrinsicEmitter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/IntrinsicEmitter.cpp?rev=77467&r1=77466&r2=77467&view=diff ============================================================================== --- llvm/trunk/utils/TableGen/IntrinsicEmitter.cpp (original) +++ llvm/trunk/utils/TableGen/IntrinsicEmitter.cpp Wed Jul 29 11:35:59 2009 @@ -304,6 +304,7 @@ const RecPair &ArgTypes = I->first; const std::vector &RetTys = ArgTypes.first; const std::vector &ParamTys = ArgTypes.second; + std::vector OverloadedTypeIndices; OS << " VerifyIntrinsicPrototype(ID, IF, " << RetTys.size() << ", " << ParamTys.size(); @@ -315,6 +316,9 @@ if (ArgType->isSubClassOf("LLVMMatchType")) { unsigned Number = ArgType->getValueAsInt("Number"); + assert(Number < OverloadedTypeIndices.size() && + "Invalid matching number!"); + Number = OverloadedTypeIndices[Number]; if (ArgType->isSubClassOf("LLVMExtendedElementVectorType")) OS << "~(ExtendedElementVectorType | " << Number << ")"; else if (ArgType->isSubClassOf("LLVMTruncatedElementVectorType")) @@ -325,6 +329,9 @@ MVT::SimpleValueType VT = getValueType(ArgType->getValueAsDef("VT")); OS << getEnumName(VT); + if (VT == MVT::iAny || VT == MVT::fAny || VT == MVT::iPTRAny) + OverloadedTypeIndices.push_back(j); + if (VT == MVT::isVoid && j != 0 && j != je - 1) throw "Var arg type not last argument"; } @@ -337,6 +344,9 @@ if (ArgType->isSubClassOf("LLVMMatchType")) { unsigned Number = ArgType->getValueAsInt("Number"); + assert(Number < OverloadedTypeIndices.size() && + "Invalid matching number!"); + Number = OverloadedTypeIndices[Number]; if (ArgType->isSubClassOf("LLVMExtendedElementVectorType")) OS << "~(ExtendedElementVectorType | " << Number << ")"; else if (ArgType->isSubClassOf("LLVMTruncatedElementVectorType")) @@ -347,6 +357,9 @@ MVT::SimpleValueType VT = getValueType(ArgType->getValueAsDef("VT")); OS << getEnumName(VT); + if (VT == MVT::iAny || VT == MVT::fAny || VT == MVT::iPTRAny) + OverloadedTypeIndices.push_back(j + RetTys.size()); + if (VT == MVT::isVoid && j != 0 && j != je - 1) throw "Var arg type not last argument"; } From bob.wilson at apple.com Wed Jul 29 11:39:22 2009 From: bob.wilson at apple.com (Bob Wilson) Date: Wed, 29 Jul 2009 16:39:22 -0000 Subject: [llvm-commits] [llvm] r77468 - in /llvm/trunk: include/llvm/IntrinsicsARM.td lib/Target/ARM/ARMInstrNEON.td test/CodeGen/ARM/vld1.ll test/CodeGen/ARM/vst1.ll Message-ID: <200907291639.n6TGdN3g031413@zion.cs.uiuc.edu> Author: bwilson Date: Wed Jul 29 11:39:22 2009 New Revision: 77468 URL: http://llvm.org/viewvc/llvm-project?rev=77468&view=rev Log: Change Neon VLDn intrinsics to return multiple values instead of really wide vectors. Likewise, change VSTn intrinsics to take separate arguments for each vector in a multi-vector struct. Adjust tests accordingly. Modified: llvm/trunk/include/llvm/IntrinsicsARM.td llvm/trunk/lib/Target/ARM/ARMInstrNEON.td llvm/trunk/test/CodeGen/ARM/vld1.ll llvm/trunk/test/CodeGen/ARM/vst1.ll Modified: llvm/trunk/include/llvm/IntrinsicsARM.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/IntrinsicsARM.td?rev=77468&r1=77467&r2=77468&view=diff ============================================================================== --- llvm/trunk/include/llvm/IntrinsicsARM.td (original) +++ llvm/trunk/include/llvm/IntrinsicsARM.td Wed Jul 29 11:39:22 2009 @@ -291,20 +291,56 @@ let TargetPrefix = "arm" in { // De-interleaving vector loads from N-element structures. - def int_arm_neon_vldi : Intrinsic<[llvm_anyint_ty], - [llvm_ptr_ty, llvm_i32_ty], - [IntrReadArgMem]>; - def int_arm_neon_vldf : Intrinsic<[llvm_anyfloat_ty], - [llvm_ptr_ty, llvm_i32_ty], - [IntrReadArgMem]>; + def int_arm_neon_vld1i : Intrinsic<[llvm_anyint_ty], + [llvm_ptr_ty], [IntrReadArgMem]>; + def int_arm_neon_vld1f : Intrinsic<[llvm_anyfloat_ty], + [llvm_ptr_ty], [IntrReadArgMem]>; + def int_arm_neon_vld2i : Intrinsic<[llvm_anyint_ty, LLVMMatchType<0>], + [llvm_ptr_ty], [IntrReadArgMem]>; + def int_arm_neon_vld2f : Intrinsic<[llvm_anyfloat_ty, LLVMMatchType<0>], + [llvm_ptr_ty], [IntrReadArgMem]>; + def int_arm_neon_vld3i : Intrinsic<[llvm_anyint_ty, LLVMMatchType<0>, + LLVMMatchType<0>], + [llvm_ptr_ty], [IntrReadArgMem]>; + def int_arm_neon_vld3f : Intrinsic<[llvm_anyfloat_ty, LLVMMatchType<0>, + LLVMMatchType<0>], + [llvm_ptr_ty], [IntrReadArgMem]>; + def int_arm_neon_vld4i : Intrinsic<[llvm_anyint_ty, LLVMMatchType<0>, + LLVMMatchType<0>, LLVMMatchType<0>], + [llvm_ptr_ty], [IntrReadArgMem]>; + def int_arm_neon_vld4f : Intrinsic<[llvm_anyfloat_ty, LLVMMatchType<0>, + LLVMMatchType<0>, LLVMMatchType<0>], + [llvm_ptr_ty], [IntrReadArgMem]>; // Interleaving vector stores from N-element structures. - def int_arm_neon_vsti : Intrinsic<[llvm_void_ty], - [llvm_ptr_ty, llvm_anyint_ty, llvm_i32_ty], - [IntrWriteArgMem]>; - def int_arm_neon_vstf : Intrinsic<[llvm_void_ty], - [llvm_ptr_ty, llvm_anyfloat_ty,llvm_i32_ty], - [IntrWriteArgMem]>; + def int_arm_neon_vst1i : Intrinsic<[llvm_void_ty], + [llvm_ptr_ty, llvm_anyint_ty], + [IntrWriteArgMem]>; + def int_arm_neon_vst1f : Intrinsic<[llvm_void_ty], + [llvm_ptr_ty, llvm_anyfloat_ty], + [IntrWriteArgMem]>; + def int_arm_neon_vst2i : Intrinsic<[llvm_void_ty], + [llvm_ptr_ty, llvm_anyint_ty, + LLVMMatchType<0>], [IntrWriteArgMem]>; + def int_arm_neon_vst2f : Intrinsic<[llvm_void_ty], + [llvm_ptr_ty, llvm_anyfloat_ty, + LLVMMatchType<0>], [IntrWriteArgMem]>; + def int_arm_neon_vst3i : Intrinsic<[llvm_void_ty], + [llvm_ptr_ty, llvm_anyint_ty, + LLVMMatchType<0>, LLVMMatchType<0>], + [IntrWriteArgMem]>; + def int_arm_neon_vst3f : Intrinsic<[llvm_void_ty], + [llvm_ptr_ty, llvm_anyfloat_ty, + LLVMMatchType<0>, LLVMMatchType<0>], + [IntrWriteArgMem]>; + def int_arm_neon_vst4i : Intrinsic<[llvm_void_ty], + [llvm_ptr_ty, llvm_anyint_ty, + LLVMMatchType<0>, LLVMMatchType<0>, + LLVMMatchType<0>], [IntrWriteArgMem]>; + def int_arm_neon_vst4f : Intrinsic<[llvm_void_ty], + [llvm_ptr_ty, llvm_anyfloat_ty, + LLVMMatchType<0>, LLVMMatchType<0>, + LLVMMatchType<0>], [IntrWriteArgMem]>; // Vector Table Lookup def int_arm_neon_vtbl : Intrinsic<[llvm_v8i8_ty], Modified: llvm/trunk/lib/Target/ARM/ARMInstrNEON.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMInstrNEON.td?rev=77468&r1=77467&r2=77468&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMInstrNEON.td (original) +++ llvm/trunk/lib/Target/ARM/ARMInstrNEON.td Wed Jul 29 11:39:22 2009 @@ -135,45 +135,45 @@ class VLD1D : NLdSt<(outs DPR:$dst), (ins addrmode6:$addr), !strconcat(OpcodeStr, "\t${dst:dregsingle}, $addr"), - [(set DPR:$dst, (Ty (IntOp addrmode6:$addr, 1)))]>; + [(set DPR:$dst, (Ty (IntOp addrmode6:$addr)))]>; class VLD1Q : NLdSt<(outs QPR:$dst), (ins addrmode6:$addr), !strconcat(OpcodeStr, "\t${dst:dregpair}, $addr"), - [(set QPR:$dst, (Ty (IntOp addrmode6:$addr, 1)))]>; + [(set QPR:$dst, (Ty (IntOp addrmode6:$addr)))]>; -def VLD1d8 : VLD1D<"vld1.8", v8i8, int_arm_neon_vldi>; -def VLD1d16 : VLD1D<"vld1.16", v4i16, int_arm_neon_vldi>; -def VLD1d32 : VLD1D<"vld1.32", v2i32, int_arm_neon_vldi>; -def VLD1df : VLD1D<"vld1.32", v2f32, int_arm_neon_vldf>; -def VLD1d64 : VLD1D<"vld1.64", v1i64, int_arm_neon_vldi>; - -def VLD1q8 : VLD1Q<"vld1.8", v16i8, int_arm_neon_vldi>; -def VLD1q16 : VLD1Q<"vld1.16", v8i16, int_arm_neon_vldi>; -def VLD1q32 : VLD1Q<"vld1.32", v4i32, int_arm_neon_vldi>; -def VLD1qf : VLD1Q<"vld1.32", v4f32, int_arm_neon_vldf>; -def VLD1q64 : VLD1Q<"vld1.64", v2i64, int_arm_neon_vldi>; +def VLD1d8 : VLD1D<"vld1.8", v8i8, int_arm_neon_vld1i>; +def VLD1d16 : VLD1D<"vld1.16", v4i16, int_arm_neon_vld1i>; +def VLD1d32 : VLD1D<"vld1.32", v2i32, int_arm_neon_vld1i>; +def VLD1df : VLD1D<"vld1.32", v2f32, int_arm_neon_vld1f>; +def VLD1d64 : VLD1D<"vld1.64", v1i64, int_arm_neon_vld1i>; + +def VLD1q8 : VLD1Q<"vld1.8", v16i8, int_arm_neon_vld1i>; +def VLD1q16 : VLD1Q<"vld1.16", v8i16, int_arm_neon_vld1i>; +def VLD1q32 : VLD1Q<"vld1.32", v4i32, int_arm_neon_vld1i>; +def VLD1qf : VLD1Q<"vld1.32", v4f32, int_arm_neon_vld1f>; +def VLD1q64 : VLD1Q<"vld1.64", v2i64, int_arm_neon_vld1i>; // VST1 : Vector Store (multiple single elements) class VST1D : NLdSt<(outs), (ins addrmode6:$addr, DPR:$src), !strconcat(OpcodeStr, "\t${src:dregsingle}, $addr"), - [(IntOp addrmode6:$addr, (Ty DPR:$src), 1)]>; + [(IntOp addrmode6:$addr, (Ty DPR:$src))]>; class VST1Q : NLdSt<(outs), (ins addrmode6:$addr, QPR:$src), !strconcat(OpcodeStr, "\t${src:dregpair}, $addr"), - [(IntOp addrmode6:$addr, (Ty QPR:$src), 1)]>; + [(IntOp addrmode6:$addr, (Ty QPR:$src))]>; -def VST1d8 : VST1D<"vst1.8", v8i8, int_arm_neon_vsti>; -def VST1d16 : VST1D<"vst1.16", v4i16, int_arm_neon_vsti>; -def VST1d32 : VST1D<"vst1.32", v2i32, int_arm_neon_vsti>; -def VST1df : VST1D<"vst1.32", v2f32, int_arm_neon_vstf>; -def VST1d64 : VST1D<"vst1.64", v1i64, int_arm_neon_vsti>; - -def VST1q8 : VST1Q<"vst1.8", v16i8, int_arm_neon_vsti>; -def VST1q16 : VST1Q<"vst1.16", v8i16, int_arm_neon_vsti>; -def VST1q32 : VST1Q<"vst1.32", v4i32, int_arm_neon_vsti>; -def VST1qf : VST1Q<"vst1.32", v4f32, int_arm_neon_vstf>; -def VST1q64 : VST1Q<"vst1.64", v2i64, int_arm_neon_vsti>; +def VST1d8 : VST1D<"vst1.8", v8i8, int_arm_neon_vst1i>; +def VST1d16 : VST1D<"vst1.16", v4i16, int_arm_neon_vst1i>; +def VST1d32 : VST1D<"vst1.32", v2i32, int_arm_neon_vst1i>; +def VST1df : VST1D<"vst1.32", v2f32, int_arm_neon_vst1f>; +def VST1d64 : VST1D<"vst1.64", v1i64, int_arm_neon_vst1i>; + +def VST1q8 : VST1Q<"vst1.8", v16i8, int_arm_neon_vst1i>; +def VST1q16 : VST1Q<"vst1.16", v8i16, int_arm_neon_vst1i>; +def VST1q32 : VST1Q<"vst1.32", v4i32, int_arm_neon_vst1i>; +def VST1qf : VST1Q<"vst1.32", v4f32, int_arm_neon_vst1f>; +def VST1q64 : VST1Q<"vst1.64", v2i64, int_arm_neon_vst1i>; //===----------------------------------------------------------------------===// Modified: llvm/trunk/test/CodeGen/ARM/vld1.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/ARM/vld1.ll?rev=77468&r1=77467&r2=77468&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/ARM/vld1.ll (original) +++ llvm/trunk/test/CodeGen/ARM/vld1.ll Wed Jul 29 11:39:22 2009 @@ -5,63 +5,63 @@ ; RUN: grep {vld1\\.64} %t | count 2 define <8 x i8> @vld1i8(i8* %A) nounwind { - %tmp1 = call <8 x i8> @llvm.arm.neon.vldi.v8i8(i8* %A, i32 1) + %tmp1 = call <8 x i8> @llvm.arm.neon.vld1i.v8i8(i8* %A) ret <8 x i8> %tmp1 } define <4 x i16> @vld1i16(i16* %A) nounwind { - %tmp1 = call <4 x i16> @llvm.arm.neon.vldi.v4i16(i16* %A, i32 1) + %tmp1 = call <4 x i16> @llvm.arm.neon.vld1i.v4i16(i16* %A) ret <4 x i16> %tmp1 } define <2 x i32> @vld1i32(i32* %A) nounwind { - %tmp1 = call <2 x i32> @llvm.arm.neon.vldi.v2i32(i32* %A, i32 1) + %tmp1 = call <2 x i32> @llvm.arm.neon.vld1i.v2i32(i32* %A) ret <2 x i32> %tmp1 } define <2 x float> @vld1f(float* %A) nounwind { - %tmp1 = call <2 x float> @llvm.arm.neon.vldf.v2f32(float* %A, i32 1) + %tmp1 = call <2 x float> @llvm.arm.neon.vld1f.v2f32(float* %A) ret <2 x float> %tmp1 } define <1 x i64> @vld1i64(i64* %A) nounwind { - %tmp1 = call <1 x i64> @llvm.arm.neon.vldi.v1i64(i64* %A, i32 1) + %tmp1 = call <1 x i64> @llvm.arm.neon.vld1i.v1i64(i64* %A) ret <1 x i64> %tmp1 } define <16 x i8> @vld1Qi8(i8* %A) nounwind { - %tmp1 = call <16 x i8> @llvm.arm.neon.vldi.v16i8(i8* %A, i32 1) + %tmp1 = call <16 x i8> @llvm.arm.neon.vld1i.v16i8(i8* %A) ret <16 x i8> %tmp1 } define <8 x i16> @vld1Qi16(i16* %A) nounwind { - %tmp1 = call <8 x i16> @llvm.arm.neon.vldi.v8i16(i16* %A, i32 1) + %tmp1 = call <8 x i16> @llvm.arm.neon.vld1i.v8i16(i16* %A) ret <8 x i16> %tmp1 } define <4 x i32> @vld1Qi32(i32* %A) nounwind { - %tmp1 = call <4 x i32> @llvm.arm.neon.vldi.v4i32(i32* %A, i32 1) + %tmp1 = call <4 x i32> @llvm.arm.neon.vld1i.v4i32(i32* %A) ret <4 x i32> %tmp1 } define <4 x float> @vld1Qf(float* %A) nounwind { - %tmp1 = call <4 x float> @llvm.arm.neon.vldf.v4f32(float* %A, i32 1) + %tmp1 = call <4 x float> @llvm.arm.neon.vld1f.v4f32(float* %A) ret <4 x float> %tmp1 } define <2 x i64> @vld1Qi64(i64* %A) nounwind { - %tmp1 = call <2 x i64> @llvm.arm.neon.vldi.v2i64(i64* %A, i32 1) + %tmp1 = call <2 x i64> @llvm.arm.neon.vld1i.v2i64(i64* %A) ret <2 x i64> %tmp1 } -declare <8 x i8> @llvm.arm.neon.vldi.v8i8(i8*, i32) nounwind readnone -declare <4 x i16> @llvm.arm.neon.vldi.v4i16(i16*, i32) nounwind readnone -declare <2 x i32> @llvm.arm.neon.vldi.v2i32(i32*, i32) nounwind readnone -declare <2 x float> @llvm.arm.neon.vldf.v2f32(float*, i32) nounwind readnone -declare <1 x i64> @llvm.arm.neon.vldi.v1i64(i64*, i32) nounwind readnone - -declare <16 x i8> @llvm.arm.neon.vldi.v16i8(i8*, i32) nounwind readnone -declare <8 x i16> @llvm.arm.neon.vldi.v8i16(i16*, i32) nounwind readnone -declare <4 x i32> @llvm.arm.neon.vldi.v4i32(i32*, i32) nounwind readnone -declare <4 x float> @llvm.arm.neon.vldf.v4f32(float*, i32) nounwind readnone -declare <2 x i64> @llvm.arm.neon.vldi.v2i64(i64*, i32) nounwind readnone +declare <8 x i8> @llvm.arm.neon.vld1i.v8i8(i8*) nounwind readnone +declare <4 x i16> @llvm.arm.neon.vld1i.v4i16(i16*) nounwind readnone +declare <2 x i32> @llvm.arm.neon.vld1i.v2i32(i32*) nounwind readnone +declare <2 x float> @llvm.arm.neon.vld1f.v2f32(float*) nounwind readnone +declare <1 x i64> @llvm.arm.neon.vld1i.v1i64(i64*) nounwind readnone + +declare <16 x i8> @llvm.arm.neon.vld1i.v16i8(i8*) nounwind readnone +declare <8 x i16> @llvm.arm.neon.vld1i.v8i16(i16*) nounwind readnone +declare <4 x i32> @llvm.arm.neon.vld1i.v4i32(i32*) nounwind readnone +declare <4 x float> @llvm.arm.neon.vld1f.v4f32(float*) nounwind readnone +declare <2 x i64> @llvm.arm.neon.vld1i.v2i64(i64*) nounwind readnone Modified: llvm/trunk/test/CodeGen/ARM/vst1.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/ARM/vst1.ll?rev=77468&r1=77467&r2=77468&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/ARM/vst1.ll (original) +++ llvm/trunk/test/CodeGen/ARM/vst1.ll Wed Jul 29 11:39:22 2009 @@ -6,72 +6,72 @@ define void @vst1i8(i8* %A, <8 x i8>* %B) nounwind { %tmp1 = load <8 x i8>* %B - call void @llvm.arm.neon.vsti.v8i8(i8* %A, <8 x i8> %tmp1, i32 1) + call void @llvm.arm.neon.vst1i.v8i8(i8* %A, <8 x i8> %tmp1) ret void } define void @vst1i16(i16* %A, <4 x i16>* %B) nounwind { %tmp1 = load <4 x i16>* %B - call void @llvm.arm.neon.vsti.v4i16(i16* %A, <4 x i16> %tmp1, i32 1) + call void @llvm.arm.neon.vst1i.v4i16(i16* %A, <4 x i16> %tmp1) ret void } define void @vst1i32(i32* %A, <2 x i32>* %B) nounwind { %tmp1 = load <2 x i32>* %B - call void @llvm.arm.neon.vsti.v2i32(i32* %A, <2 x i32> %tmp1, i32 1) + call void @llvm.arm.neon.vst1i.v2i32(i32* %A, <2 x i32> %tmp1) ret void } define void @vst1f(float* %A, <2 x float>* %B) nounwind { %tmp1 = load <2 x float>* %B - call void @llvm.arm.neon.vstf.v2f32(float* %A, <2 x float> %tmp1, i32 1) + call void @llvm.arm.neon.vst1f.v2f32(float* %A, <2 x float> %tmp1) ret void } define void @vst1i64(i64* %A, <1 x i64>* %B) nounwind { %tmp1 = load <1 x i64>* %B - call void @llvm.arm.neon.vsti.v1i64(i64* %A, <1 x i64> %tmp1, i32 1) + call void @llvm.arm.neon.vst1i.v1i64(i64* %A, <1 x i64> %tmp1) ret void } define void @vst1Qi8(i8* %A, <16 x i8>* %B) nounwind { %tmp1 = load <16 x i8>* %B - call void @llvm.arm.neon.vsti.v16i8(i8* %A, <16 x i8> %tmp1, i32 1) + call void @llvm.arm.neon.vst1i.v16i8(i8* %A, <16 x i8> %tmp1) ret void } define void @vst1Qi16(i16* %A, <8 x i16>* %B) nounwind { %tmp1 = load <8 x i16>* %B - call void @llvm.arm.neon.vsti.v8i16(i16* %A, <8 x i16> %tmp1, i32 1) + call void @llvm.arm.neon.vst1i.v8i16(i16* %A, <8 x i16> %tmp1) ret void } define void @vst1Qi32(i32* %A, <4 x i32>* %B) nounwind { %tmp1 = load <4 x i32>* %B - call void @llvm.arm.neon.vsti.v4i32(i32* %A, <4 x i32> %tmp1, i32 1) + call void @llvm.arm.neon.vst1i.v4i32(i32* %A, <4 x i32> %tmp1) ret void } define void @vst1Qf(float* %A, <4 x float>* %B) nounwind { %tmp1 = load <4 x float>* %B - call void @llvm.arm.neon.vstf.v4f32(float* %A, <4 x float> %tmp1, i32 1) + call void @llvm.arm.neon.vst1f.v4f32(float* %A, <4 x float> %tmp1) ret void } define void @vst1Qi64(i64* %A, <2 x i64>* %B) nounwind { %tmp1 = load <2 x i64>* %B - call void @llvm.arm.neon.vsti.v2i64(i64* %A, <2 x i64> %tmp1, i32 1) + call void @llvm.arm.neon.vst1i.v2i64(i64* %A, <2 x i64> %tmp1) ret void } -declare void @llvm.arm.neon.vsti.v8i8(i8*, <8 x i8>, i32) nounwind readnone -declare void @llvm.arm.neon.vsti.v4i16(i16*, <4 x i16>, i32) nounwind readnone -declare void @llvm.arm.neon.vsti.v2i32(i32*, <2 x i32>, i32) nounwind readnone -declare void @llvm.arm.neon.vstf.v2f32(float*, <2 x float>, i32) nounwind readnone -declare void @llvm.arm.neon.vsti.v1i64(i64*, <1 x i64>, i32) nounwind readnone +declare void @llvm.arm.neon.vst1i.v8i8(i8*, <8 x i8>) nounwind readnone +declare void @llvm.arm.neon.vst1i.v4i16(i16*, <4 x i16>) nounwind readnone +declare void @llvm.arm.neon.vst1i.v2i32(i32*, <2 x i32>) nounwind readnone +declare void @llvm.arm.neon.vst1f.v2f32(float*, <2 x float>) nounwind readnone +declare void @llvm.arm.neon.vst1i.v1i64(i64*, <1 x i64>) nounwind readnone -declare void @llvm.arm.neon.vsti.v16i8(i8*, <16 x i8>, i32) nounwind readnone -declare void @llvm.arm.neon.vsti.v8i16(i16*, <8 x i16>, i32) nounwind readnone -declare void @llvm.arm.neon.vsti.v4i32(i32*, <4 x i32>, i32) nounwind readnone -declare void @llvm.arm.neon.vstf.v4f32(float*, <4 x float>, i32) nounwind readnone -declare void @llvm.arm.neon.vsti.v2i64(i64*, <2 x i64>, i32) nounwind readnone +declare void @llvm.arm.neon.vst1i.v16i8(i8*, <16 x i8>) nounwind readnone +declare void @llvm.arm.neon.vst1i.v8i16(i16*, <8 x i16>) nounwind readnone +declare void @llvm.arm.neon.vst1i.v4i32(i32*, <4 x i32>) nounwind readnone +declare void @llvm.arm.neon.vst1f.v4f32(float*, <4 x float>) nounwind readnone +declare void @llvm.arm.neon.vst1i.v2i64(i64*, <2 x i64>) nounwind readnone From bob.wilson at apple.com Wed Jul 29 11:42:28 2009 From: bob.wilson at apple.com (Bob Wilson) Date: Wed, 29 Jul 2009 16:42:28 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r77469 - /llvm-gcc-4.2/trunk/gcc/config/arm/llvm-arm.cpp Message-ID: <200907291642.n6TGgSxr031505@zion.cs.uiuc.edu> Author: bwilson Date: Wed Jul 29 11:42:27 2009 New Revision: 77469 URL: http://llvm.org/viewvc/llvm-project?rev=77469&view=rev Log: Change handling of VLDn/VSTn to match changes to the corresponding LLVM intrinsics. Modified: llvm-gcc-4.2/trunk/gcc/config/arm/llvm-arm.cpp Modified: llvm-gcc-4.2/trunk/gcc/config/arm/llvm-arm.cpp URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/arm/llvm-arm.cpp?rev=77469&r1=77468&r2=77469&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/config/arm/llvm-arm.cpp (original) +++ llvm-gcc-4.2/trunk/gcc/config/arm/llvm-arm.cpp Wed Jul 29 11:42:27 2009 @@ -1964,32 +1964,45 @@ Result = Builder.CreateBitCast(Ops[0], ResultType); break; - case NEON_BUILTIN_vld1: - case NEON_BUILTIN_vld2: - case NEON_BUILTIN_vld3: - case NEON_BUILTIN_vld4: { - const VectorType *VTy = - GetVldstType(exp, insn_data[icode].operand[0].mode); + case NEON_BUILTIN_vld1: { + const VectorType *VTy = dyn_cast(ResultType); + assert(VTy && "expected a vector type"); if (VTy->getElementType()->isFloatingPoint()) - intID = Intrinsic::arm_neon_vldf; + intID = Intrinsic::arm_neon_vld1f; else - intID = Intrinsic::arm_neon_vldi; + intID = Intrinsic::arm_neon_vld1i; intFn = Intrinsic::getDeclaration(TheModule, intID, (const Type **)&VTy, 1); + Type *VPTy = Context.getPointerTypeUnqual(Type::Int8Ty); + Result = Builder.CreateCall(intFn, BitCastToType(Ops[0], VPTy)); + break; + } - unsigned N = 0; - switch (neon_code) { - case NEON_BUILTIN_vld1: N = 1; break; - case NEON_BUILTIN_vld2: N = 2; break; - case NEON_BUILTIN_vld3: N = 3; break; - case NEON_BUILTIN_vld4: N = 4; break; - default: assert(false); + case NEON_BUILTIN_vld2: + case NEON_BUILTIN_vld3: + case NEON_BUILTIN_vld4: { + const StructType *STy = dyn_cast(ResultType); + assert(STy && "expected a struct type"); + const VectorType *VTy = dyn_cast(STy->getElementType(0)); + assert(VTy && "expected a vector type"); + if (VTy->getElementType()->isFloatingPoint()) { + switch (neon_code) { + case NEON_BUILTIN_vld2: intID = Intrinsic::arm_neon_vld2f; break; + case NEON_BUILTIN_vld3: intID = Intrinsic::arm_neon_vld3f; break; + case NEON_BUILTIN_vld4: intID = Intrinsic::arm_neon_vld4f; break; + default: assert(false); + } + } else { + switch (neon_code) { + case NEON_BUILTIN_vld2: intID = Intrinsic::arm_neon_vld2i; break; + case NEON_BUILTIN_vld3: intID = Intrinsic::arm_neon_vld3i; break; + case NEON_BUILTIN_vld4: intID = Intrinsic::arm_neon_vld4i; break; + default: assert(false); + } } - + intFn = Intrinsic::getDeclaration(TheModule, intID, (const Type **)&VTy, 1); Type *VPTy = Context.getPointerTypeUnqual(Type::Int8Ty); - Result = Builder.CreateCall2(intFn, BitCastToType(Ops[0], VPTy), - ConstantInt::get(Type::Int32Ty, N)); - Type *PtrToWideVec = Context.getPointerTypeUnqual(Result->getType()); - Builder.CreateStore(Result, BitCastToType(DestLoc->Ptr, PtrToWideVec)); + Result = Builder.CreateCall(intFn, BitCastToType(Ops[0], VPTy)); + Builder.CreateStore(Result, DestLoc->Ptr); Result = 0; break; } @@ -2066,34 +2079,57 @@ break; } - case NEON_BUILTIN_vst1: - case NEON_BUILTIN_vst2: - case NEON_BUILTIN_vst3: - case NEON_BUILTIN_vst4: { - const VectorType *VTy = - GetVldstType(exp, insn_data[icode].operand[1].mode); + case NEON_BUILTIN_vst1: { + const VectorType *VTy = dyn_cast(Ops[1]->getType()); + assert(VTy && "expected a vector type"); if (VTy->getElementType()->isFloatingPoint()) - intID = Intrinsic::arm_neon_vstf; + intID = Intrinsic::arm_neon_vst1f; else - intID = Intrinsic::arm_neon_vsti; + intID = Intrinsic::arm_neon_vst1i; intFn = Intrinsic::getDeclaration(TheModule, intID, (const Type **)&VTy, 1); + Type *VPTy = Context.getPointerTypeUnqual(Type::Int8Ty); + Builder.CreateCall2(intFn, BitCastToType(Ops[0], VPTy), Ops[1]); + Result = 0; + break; + } - unsigned N = 0; + case NEON_BUILTIN_vst2: + case NEON_BUILTIN_vst3: + case NEON_BUILTIN_vst4: { + const StructType *STy = dyn_cast(Ops[1]->getType()); + assert(STy && "expected a struct type"); + const VectorType *VTy = dyn_cast(STy->getElementType(0)); + assert(VTy && "expected a vector type"); + if (VTy->getElementType()->isFloatingPoint()) { + switch (neon_code) { + case NEON_BUILTIN_vst2: intID = Intrinsic::arm_neon_vst2f; break; + case NEON_BUILTIN_vst3: intID = Intrinsic::arm_neon_vst3f; break; + case NEON_BUILTIN_vst4: intID = Intrinsic::arm_neon_vst4f; break; + default: assert(false); + } + } else { + switch (neon_code) { + case NEON_BUILTIN_vst2: intID = Intrinsic::arm_neon_vst2i; break; + case NEON_BUILTIN_vst3: intID = Intrinsic::arm_neon_vst3i; break; + case NEON_BUILTIN_vst4: intID = Intrinsic::arm_neon_vst4i; break; + default: assert(false); + } + } + intFn = Intrinsic::getDeclaration(TheModule, intID, (const Type **)&VTy, 1); + unsigned NumVecs = 0; switch (neon_code) { - case NEON_BUILTIN_vst1: N = 1; break; - case NEON_BUILTIN_vst2: N = 2; break; - case NEON_BUILTIN_vst3: N = 3; break; - case NEON_BUILTIN_vst4: N = 4; break; + case NEON_BUILTIN_vst2: NumVecs = 2; break; + case NEON_BUILTIN_vst3: NumVecs = 3; break; + case NEON_BUILTIN_vst4: NumVecs = 4; break; default: assert(false); } - + std::vector Args; Type *VPTy = Context.getPointerTypeUnqual(Type::Int8Ty); - Value *Tmp = CreateTemporary(VTy); - Type *PtrToStruct = Context.getPointerTypeUnqual(Ops[1]->getType()); - Builder.CreateStore(Ops[1], BitCastToType(Tmp, PtrToStruct)); - Value *Vec = Builder.CreateLoad(Tmp); - Builder.CreateCall3(intFn, BitCastToType(Ops[0], VPTy), Vec, - ConstantInt::get(Type::Int32Ty, N)); + Args.push_back(BitCastToType(Ops[0], VPTy)); + for (unsigned n = 0; n < NumVecs; ++n) { + Args.push_back(Builder.CreateExtractValue(Ops[1], n)); + } + Builder.CreateCall(intFn, Args.begin(), Args.end()); Result = 0; break; } From daniel at zuster.org Wed Jul 29 11:43:24 2009 From: daniel at zuster.org (Daniel Dunbar) Date: Wed, 29 Jul 2009 09:43:24 -0700 Subject: [llvm-commits] [llvm] r77397 - in /llvm/trunk: include/llvm/Support/FormattedStream.h lib/Support/FormattedStream.cpp In-Reply-To: <200907291103.01091.dag@cray.com> References: <200907282326.n6SNQYms018777@zion.cs.uiuc.edu> <2C88990A-2D3A-4310-B116-5634F1B181DA@apple.com> <750B4DE6-E485-4D9A-9CE2-E07B72844532@apple.com> <200907291103.01091.dag@cray.com> Message-ID: <6a8523d60907290943h4ddaee0dk9f5e4f5547803d72@mail.gmail.com> On Wed, Jul 29, 2009 at 9:03 AM, David Greene wrote: > On Tuesday 28 July 2009 23:48, Evan Cheng wrote: >> Ok. David, I'm going to revert AsmWriterEmitter.cpp back to 74742 for >> now. Please re-commit as you have fixed the efficiency problem. > > As you know, I can't SEE the efficiency problem. ?I'm flying blind. I don't understand this, what times do you see for the example I gave (or something similar)? I can't see why they wouldn't reproduce elsewhere. - Daniel From edwintorok at gmail.com Wed Jul 29 11:44:02 2009 From: edwintorok at gmail.com (=?ISO-8859-1?Q?T=F6r=F6k_Edwin?=) Date: Wed, 29 Jul 2009 19:44:02 +0300 Subject: [llvm-commits] [llvm] r77259 - in /llvm/trunk: docs/LangRef.html include/llvm/Bitcode/LLVMBitCodes.h include/llvm/Operator.h lib/AsmParser/LLLexer.cpp lib/AsmParser/LLParser.cpp lib/AsmParser/LLToken.h lib/Bitcode/Reader/BitcodeReader.cpp lib/Bitcode/Writer/BitcodeWriter.cpp lib/VMCore/AsmWriter.cpp test/Assembler/flags-plain.ll test/Assembler/flags.ll In-Reply-To: References: <200907272153.n6RLrkuk023065@zion.cs.uiuc.edu> <597EA260-27B6-4545-B4B6-F84554804A0D@apple.com> Message-ID: <4A707C52.6070801@gmail.com> On 2009-07-29 19:26, Dan Gohman wrote: > On Jul 28, 2009, at 11:48 PM, Chris Lattner wrote: > > >> On Jul 27, 2009, at 2:53 PM, Dan Gohman wrote: >> >>> URL: http://llvm.org/viewvc/llvm-project?rev=77259&view=rev >>> Log: >>> Add a new keyword 'inbounds' for use with getelementptr. See the >>> LangRef.html changes for details. >>> >> The langref changes look nice. The choice of "inbounds" is a little >> strange to me, isn't this flag mostly about wrapping behavior when >> overflow happens? >> > > It turns out that avoiding wrapping and staying in bounds are basically > the same thing, since LLVM doesn't specify where in the address space > it will allocate an object. > > >> Will "inbounds" be the default generated by the llvm-gcc/clang front- >> ends? If so, it would be nice to invert the sense of the bit so it >> doesn't show up in all the .ll files making them really noisy. >> > > > I'm planning for it to be the default behavior. I'm open to discussion; > there are pros and cons either way. Hi Dan, Some optimization (I think LICM) moves getelementptr out of the basicblock where a predicate guarantees the inbounds property, thus you may get a getelementptr that computes an out of bounds value, but when the value is dereferenced it will always be in bounds (due to that predicate). Requiring a getelementptr to be inbounds is rather strong, since there are optimizations that can create GEPs that are not inbounds (as shown above). Either those optimizations should then clear the flag (any optimization that moves GEPs out of a BB, or over a call), or inbounds should only mean that it is 'inbounds' when dereferenced. Best regards, --Edwin From daniel at zuster.org Wed Jul 29 11:45:41 2009 From: daniel at zuster.org (Daniel Dunbar) Date: Wed, 29 Jul 2009 16:45:41 -0000 Subject: [llvm-commits] [llvm] r77470 - /llvm/trunk/include/llvm/MC/MCAsmLexer.h Message-ID: <200907291645.n6TGjfCe031629@zion.cs.uiuc.edu> Author: ddunbar Date: Wed Jul 29 11:45:40 2009 New Revision: 77470 URL: http://llvm.org/viewvc/llvm-project?rev=77470&view=rev Log: Add missing include. Modified: llvm/trunk/include/llvm/MC/MCAsmLexer.h Modified: llvm/trunk/include/llvm/MC/MCAsmLexer.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCAsmLexer.h?rev=77470&r1=77469&r2=77470&view=diff ============================================================================== --- llvm/trunk/include/llvm/MC/MCAsmLexer.h (original) +++ llvm/trunk/include/llvm/MC/MCAsmLexer.h Wed Jul 29 11:45:40 2009 @@ -11,6 +11,7 @@ #define LLVM_MC_MCASMLEXER_H #include "llvm/ADT/StringRef.h" +#include "llvm/Support/DataTypes.h" namespace llvm { class MCAsmLexer; From benny.kra at googlemail.com Wed Jul 29 11:48:33 2009 From: benny.kra at googlemail.com (Benjamin Kramer) Date: Wed, 29 Jul 2009 16:48:33 -0000 Subject: [llvm-commits] [llvm] r77471 - /llvm/trunk/unittests/ADT/TwineTest.cpp Message-ID: <200907291648.n6TGmXO6031733@zion.cs.uiuc.edu> Author: d0k Date: Wed Jul 29 11:48:32 2009 New Revision: 77471 URL: http://llvm.org/viewvc/llvm-project?rev=77471&view=rev Log: fix unittest on platforms with unsigned chars (e.g. linux-ppc) Modified: llvm/trunk/unittests/ADT/TwineTest.cpp Modified: llvm/trunk/unittests/ADT/TwineTest.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/ADT/TwineTest.cpp?rev=77471&r1=77470&r2=77471&view=diff ============================================================================== --- llvm/trunk/unittests/ADT/TwineTest.cpp (original) +++ llvm/trunk/unittests/ADT/TwineTest.cpp Wed Jul 29 11:48:32 2009 @@ -36,7 +36,7 @@ EXPECT_EQ("123", Twine::utostr(123).str()); EXPECT_EQ("-123", Twine::itostr(-123).str()); EXPECT_EQ("123", Twine::utostr((char) 123).str()); - EXPECT_EQ("-123", Twine::itostr((char) -123).str()); + EXPECT_EQ("-123", Twine::itostr((signed char) -123).str()); EXPECT_EQ("7B", Twine::utohexstr(123).str()); EXPECT_EQ("FFFFFFFFFFFFFF85", Twine::itohexstr(-123).str()); From andreas.bolka at gmx.net Wed Jul 29 11:48:36 2009 From: andreas.bolka at gmx.net (Andreas Bolka) Date: Wed, 29 Jul 2009 18:48:36 +0200 Subject: [llvm-commits] [llvm] r77461 - in /llvm/trunk: include/llvm/Support/FormattedStream.h lib/Support/FormattedStream.cpp In-Reply-To: <200907291608.n6TG8bIU030437@zion.cs.uiuc.edu> References: <200907291608.n6TG8bIU030437@zion.cs.uiuc.edu> Message-ID: <1248885375-sup-9569@strider> Hi David, On Wed Jul 29 16:08:35 UTC 2009, David Greene wrote: > Author: greened > Date: Wed Jul 29 11:08:27 2009 > New Revision: 77461 > > URL: http://llvm.org/viewvc/llvm-project?rev=77461&view=rev > Log: > > Re-apply previous changes and improve column padding performance some more. [..] > + while (Scanned != end()) { Please move the `end()` out of the loop or add a comment if it's really needed there (cf. http://llvm.org/docs/CodingStandards.html#ll_end). -- Andreas From dag at cray.com Wed Jul 29 11:52:41 2009 From: dag at cray.com (David Greene) Date: Wed, 29 Jul 2009 11:52:41 -0500 Subject: [llvm-commits] [llvm] r77397 - in /llvm/trunk: include/llvm/Support/FormattedStream.h lib/Support/FormattedStream.cpp In-Reply-To: <6a8523d60907290943h4ddaee0dk9f5e4f5547803d72@mail.gmail.com> References: <200907282326.n6SNQYms018777@zion.cs.uiuc.edu> <200907291103.01091.dag@cray.com> <6a8523d60907290943h4ddaee0dk9f5e4f5547803d72@mail.gmail.com> Message-ID: <200907291152.41862.dag@cray.com> On Wednesday 29 July 2009 11:43, Daniel Dunbar wrote: > On Wed, Jul 29, 2009 at 9:03 AM, David Greene wrote: > > On Tuesday 28 July 2009 23:48, Evan Cheng wrote: > >> Ok. David, I'm going to revert AsmWriterEmitter.cpp back to 74742 for > >> now. Please re-commit as you have fixed the efficiency problem. > > > > As you know, I can't SEE the efficiency problem. ?I'm flying blind. > > I don't understand this, what times do you see for the example I gave > (or something similar)? I can't see why they wouldn't reproduce > elsewhere. We knew the N^2 algorithm would be a problem but Chris asked me to commit anyway. I reverted your revert and applied a fix to make the algorithm linear again. But due to Evan's revert this doesn't get called yet. That's fine. I am not able to see the original compile time regression caused by excessive flushing. That's what I was referring to. I'm trying to get us back to where we were. I think I have it and am running tests now. I will be reverting Evan's revert after making sure I don't see a problem. But as I said, that's no guarantee there won't be some kind of problem I can't see. -Dave From rnk at mit.edu Wed Jul 29 11:56:27 2009 From: rnk at mit.edu (Reid Kleckner) Date: Wed, 29 Jul 2009 09:56:27 -0700 Subject: [llvm-commits] [llvm] r77444 - /llvm/trunk/lib/Support/raw_ostream.cpp In-Reply-To: <200907290645.n6T6jF5Z032406@zion.cs.uiuc.edu> References: <200907290645.n6T6jF5Z032406@zion.cs.uiuc.edu> Message-ID: <9a9942200907290956t5e0afe9ela1bb216e1c126182@mail.gmail.com> On Tue, Jul 28, 2009 at 11:45 PM, Daniel Dunbar wrote: > Author: ddunbar > Date: Wed Jul 29 01:45:14 2009 > New Revision: 77444 > > URL: http://llvm.org/viewvc/llvm-project?rev=77444&view=rev > Log: > raw_ostream: Follow the 32-bit path when printing "small" decimal numbers. > > Modified: > ? ?llvm/trunk/lib/Support/raw_ostream.cpp > > Modified: llvm/trunk/lib/Support/raw_ostream.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/raw_ostream.cpp?rev=77444&r1=77443&r2=77444&view=diff > > ============================================================================== > --- llvm/trunk/lib/Support/raw_ostream.cpp (original) > +++ llvm/trunk/lib/Support/raw_ostream.cpp Wed Jul 29 01:45:14 2009 > @@ -89,6 +89,10 @@ > ?} > > ?raw_ostream &raw_ostream::operator<<(unsigned long long N) { > + ?// Output using 32-bit div/mod when possible. > + ?if (N == static_cast(N)) > + ? ?return this->operator<<(static_cast(N)); > + > ? // Zero is a special case. > ? if (N == 0) > ? ? return *this << '0'; Doesn't the 'if (N == 0)' become dead code with this change? Reid From dpatel at apple.com Wed Jul 29 12:16:18 2009 From: dpatel at apple.com (Devang Patel) Date: Wed, 29 Jul 2009 17:16:18 -0000 Subject: [llvm-commits] [llvm] r77476 - in /llvm/trunk: include/llvm/Metadata.h include/llvm/Module.h include/llvm/ValueSymbolTable.h lib/VMCore/Metadata.cpp lib/VMCore/Module.cpp lib/VMCore/Value.cpp Message-ID: <200907291716.n6THGIeg032688@zion.cs.uiuc.edu> Author: dpatel Date: Wed Jul 29 12:16:17 2009 New Revision: 77476 URL: http://llvm.org/viewvc/llvm-project?rev=77476&view=rev Log: Keep track of named mdnodes in a Module using an ilist. Modified: llvm/trunk/include/llvm/Metadata.h llvm/trunk/include/llvm/Module.h llvm/trunk/include/llvm/ValueSymbolTable.h llvm/trunk/lib/VMCore/Metadata.cpp llvm/trunk/lib/VMCore/Module.cpp llvm/trunk/lib/VMCore/Value.cpp Modified: llvm/trunk/include/llvm/Metadata.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Metadata.h?rev=77476&r1=77475&r2=77476&view=diff ============================================================================== --- llvm/trunk/include/llvm/Metadata.h (original) +++ llvm/trunk/include/llvm/Metadata.h Wed Jul 29 12:16:17 2009 @@ -18,8 +18,10 @@ #include "llvm/Value.h" #include "llvm/Type.h" +#include "llvm/OperandTraits.h" #include "llvm/ADT/FoldingSet.h" #include "llvm/ADT/SmallVector.h" +#include "llvm/ADT/ilist_node.h" #include "llvm/Support/ErrorHandling.h" #include "llvm/Support/ValueHandle.h" @@ -173,7 +175,11 @@ //===----------------------------------------------------------------------===// /// NamedMDNode - a tuple of other metadata. /// NamedMDNode is always named. All NamedMDNode element has a type of metadata. -class NamedMDNode : public MetadataBase { +template + class SymbolTableListTraits; + +class NamedMDNode : public MetadataBase, public ilist_node { + friend class SymbolTableListTraits; NamedMDNode(const NamedMDNode &); // DO NOT IMPLEMENT friend class LLVMContextImpl; @@ -201,6 +207,7 @@ /// getParent - Get the module that holds this named metadata collection. inline Module *getParent() { return Parent; } inline const Module *getParent() const { return Parent; } + void setParent(Module *M) { Parent = M; } Value *getElement(unsigned i) const { return Node[i]; Modified: llvm/trunk/include/llvm/Module.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Module.h?rev=77476&r1=77475&r2=77476&view=diff ============================================================================== --- llvm/trunk/include/llvm/Module.h (original) +++ llvm/trunk/include/llvm/Module.h Wed Jul 29 12:16:17 2009 @@ -18,6 +18,7 @@ #include "llvm/Function.h" #include "llvm/GlobalVariable.h" #include "llvm/GlobalAlias.h" +#include "llvm/Metadata.h" #include "llvm/Support/DataTypes.h" #include @@ -56,6 +57,21 @@ static GlobalAlias *createSentinel(); static void destroySentinel(GlobalAlias *GA) { delete GA; } }; +template<> struct ilist_traits + : public SymbolTableListTraits { + // createSentinel is used to get hold of a node that marks the end of + // the list... + NamedMDNode *createSentinel() const { + return static_cast(&Sentinel); + } + static void destroySentinel(NamedMDNode*) {} + + NamedMDNode *provideInitialHead() const { return createSentinel(); } + NamedMDNode *ensureHead(NamedMDNode*) const { return createSentinel(); } + static void noteHead(NamedMDNode*, NamedMDNode*) {} +private: + mutable ilist_node Sentinel; +}; /// A Module instance is used to store all the information related to an /// LLVM module. Modules are the top level container of all other LLVM @@ -78,25 +94,31 @@ typedef iplist FunctionListType; /// The type for the list of aliases. typedef iplist AliasListType; + /// The type for the list of named metadata. + typedef iplist NamedMDListType; /// The type for the list of dependent libraries. typedef std::vector LibraryListType; /// The Global Variable iterator. - typedef GlobalListType::iterator global_iterator; + typedef GlobalListType::iterator global_iterator; /// The Global Variable constant iterator. - typedef GlobalListType::const_iterator const_global_iterator; + typedef GlobalListType::const_iterator const_global_iterator; /// The Function iterators. - typedef FunctionListType::iterator iterator; + typedef FunctionListType::iterator iterator; /// The Function constant iterator - typedef FunctionListType::const_iterator const_iterator; + typedef FunctionListType::const_iterator const_iterator; /// The Global Alias iterators. - typedef AliasListType::iterator alias_iterator; + typedef AliasListType::iterator alias_iterator; /// The Global Alias constant iterator - typedef AliasListType::const_iterator const_alias_iterator; + typedef AliasListType::const_iterator const_alias_iterator; + /// The named metadata iterators. + typedef NamedMDListType::iterator named_metadata_iterator; + /// The named metadata constant interators. + typedef NamedMDListType::const_iterator const_named_metadata_iterator; /// The Library list iterator. typedef LibraryListType::const_iterator lib_iterator; @@ -116,6 +138,7 @@ FunctionListType FunctionList; ///< The Functions in the module AliasListType AliasList; ///< The Aliases in the module LibraryListType LibraryList; ///< The Libraries needed by the module + NamedMDListType NamedMDList; ///< The named metadata in the module std::string GlobalScopeAsm; ///< Inline Asm at global scope. ValueSymbolTable *ValSymTab; ///< Symbol table for values TypeSymbolTable *TypeSymTab; ///< Symbol table for types @@ -277,6 +300,15 @@ GlobalAlias *getNamedAlias(const StringRef &Name) const; /// @} +/// @name Named Metadata Accessors +/// @{ +public: + /// getNamedMetadata - Return the first named MDNode in the module with the + /// specified name. This method returns null if a MDNode with the specified + /// name is not found. + NamedMDNode *getNamedMetadata(const StringRef &Name) const; + +/// @} /// @name Type Accessors /// @{ public: @@ -318,6 +350,13 @@ static iplist Module::*getSublistAccess(GlobalAlias*) { return &Module::AliasList; } + /// Get the Module's list of named metadata (constant). + const NamedMDListType &getNamedMDList() const { return NamedMDList; } + /// Get the Module's list of named metadata. + NamedMDListType &getNamedMDList() { return NamedMDList; } + static iplist Module::*getSublistAccess(NamedMDNode *) { + return &Module::NamedMDList; + } /// Get the symbol table of global variable and function identifiers const ValueSymbolTable &getValueSymbolTable() const { return *ValSymTab; } /// Get the Module's symbol table of global variable and function identifiers. @@ -393,6 +432,31 @@ /// Determine if the list of aliases is empty. bool alias_empty() const { return AliasList.empty(); } + +/// @} +/// @name Named Metadata Iteration +/// @{ +public: + /// Get an iterator to the first named metadata. + named_metadata_iterator named_metadata_begin() + { return NamedMDList.begin(); } + /// Get a constant iterator to the first named metadata. + const_named_metadata_iterator named_metadata_begin() const + { return NamedMDList.begin(); } + /// Get an iterator to the last named metadata. + named_metadata_iterator named_metadata_end () + { return NamedMDList.end(); } + /// Get a constant iterator to the last named metadata. + const_named_metadata_iterator named_metadata_end () const + { return NamedMDList.end(); } + /// Determine how many NamedMDNodes are in the Module's list of named metadata. + size_t named_metadata_size () const + { return NamedMDList.size(); } + /// Determine if the list of named metadata is empty. + bool named_metadata_empty() const + { return NamedMDList.empty(); } + + /// @} /// @name Utility functions for printing and dumping Module objects /// @{ Modified: llvm/trunk/include/llvm/ValueSymbolTable.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ValueSymbolTable.h?rev=77476&r1=77475&r2=77476&view=diff ============================================================================== --- llvm/trunk/include/llvm/ValueSymbolTable.h (original) +++ llvm/trunk/include/llvm/ValueSymbolTable.h Wed Jul 29 12:16:17 2009 @@ -23,6 +23,7 @@ class SymbolTableListTraits; class BasicBlock; class Function; + class NamedMDNode; class Module; class StringRef; @@ -38,6 +39,7 @@ friend class SymbolTableListTraits; friend class SymbolTableListTraits; friend class SymbolTableListTraits; + friend class SymbolTableListTraits; /// @name Types /// @{ public: Modified: llvm/trunk/lib/VMCore/Metadata.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Metadata.cpp?rev=77476&r1=77475&r2=77476&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/Metadata.cpp (original) +++ llvm/trunk/lib/VMCore/Metadata.cpp Wed Jul 29 12:16:17 2009 @@ -13,6 +13,7 @@ #include "llvm/Metadata.h" #include "llvm/Module.h" +#include "SymbolTableListTraitsImpl.h" using namespace llvm; //===----------------------------------------------------------------------===// @@ -36,9 +37,11 @@ MetadataBase*const* MDs, unsigned NumMDs, Module *M) : MetadataBase(Type::MetadataTy, Value::NamedMDNodeVal), - Parent(M), Name(N, NameLength) { + Name(N, NameLength) { + setName(N); for (unsigned i = 0; i != NumMDs; ++i) Node.push_back(WeakMetadataVH(MDs[i])); - // FIXME : Add into the parent module. + if (M) + M->getNamedMDList().push_back(this); } Modified: llvm/trunk/lib/VMCore/Module.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Module.cpp?rev=77476&r1=77475&r2=77476&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/Module.cpp (original) +++ llvm/trunk/lib/VMCore/Module.cpp Wed Jul 29 12:16:17 2009 @@ -67,6 +67,7 @@ FunctionList.clear(); AliasList.clear(); LibraryList.clear(); + NamedMDList.clear(); delete ValSymTab; delete TypeSymTab; } @@ -288,6 +289,13 @@ return dyn_cast_or_null(getNamedValue(Name)); } +/// getNamedMetadata - Return the first named MDNode in the module with the +/// specified name. This method returns null if a MDNode with the specified +/// name is not found. +NamedMDNode *Module::getNamedMetadata(const StringRef &Name) const { + return dyn_cast_or_null(getNamedValue(Name)); +} + //===----------------------------------------------------------------------===// // Methods for easy access to the types in the module. // Modified: llvm/trunk/lib/VMCore/Value.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Value.cpp?rev=77476&r1=77475&r2=77476&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/Value.cpp (original) +++ llvm/trunk/lib/VMCore/Value.cpp Wed Jul 29 12:16:17 2009 @@ -142,6 +142,10 @@ } else if (Argument *A = dyn_cast(V)) { if (Function *P = A->getParent()) ST = &P->getValueSymbolTable(); + } else if (NamedMDNode *N = dyn_cast(V)) { + if (Module *P = N->getParent()) { + ST = &P->getValueSymbolTable(); + } } else if (isa(V)) return true; else { From daniel at zuster.org Wed Jul 29 12:29:38 2009 From: daniel at zuster.org (Daniel Dunbar) Date: Wed, 29 Jul 2009 17:29:38 -0000 Subject: [llvm-commits] [llvm] r77477 - /llvm/trunk/lib/Support/raw_ostream.cpp Message-ID: <200907291729.n6THTeQ3000623@zion.cs.uiuc.edu> Author: ddunbar Date: Wed Jul 29 12:29:36 2009 New Revision: 77477 URL: http://llvm.org/viewvc/llvm-project?rev=77477&view=rev Log: Perform simplification noticed by Reid. Modified: llvm/trunk/lib/Support/raw_ostream.cpp Modified: llvm/trunk/lib/Support/raw_ostream.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/raw_ostream.cpp?rev=77477&r1=77476&r2=77477&view=diff ============================================================================== --- llvm/trunk/lib/Support/raw_ostream.cpp (original) +++ llvm/trunk/lib/Support/raw_ostream.cpp Wed Jul 29 12:29:36 2009 @@ -93,10 +93,6 @@ if (N == static_cast(N)) return this->operator<<(static_cast(N)); - // Zero is a special case. - if (N == 0) - return *this << '0'; - char NumberBuffer[20]; char *EndPtr = NumberBuffer+sizeof(NumberBuffer); char *CurPtr = EndPtr; From daniel at zuster.org Wed Jul 29 12:24:43 2009 From: daniel at zuster.org (Daniel Dunbar) Date: Wed, 29 Jul 2009 10:24:43 -0700 Subject: [llvm-commits] [llvm] r77444 - /llvm/trunk/lib/Support/raw_ostream.cpp In-Reply-To: <9a9942200907290956t5e0afe9ela1bb216e1c126182@mail.gmail.com> References: <200907290645.n6T6jF5Z032406@zion.cs.uiuc.edu> <9a9942200907290956t5e0afe9ela1bb216e1c126182@mail.gmail.com> Message-ID: <6a8523d60907291024q792e4392oed08cfe75cdd19ce@mail.gmail.com> Yup, will fix, thanks! - Daniel On Wed, Jul 29, 2009 at 9:56 AM, Reid Kleckner wrote: > On Tue, Jul 28, 2009 at 11:45 PM, Daniel Dunbar wrote: >> Author: ddunbar >> Date: Wed Jul 29 01:45:14 2009 >> New Revision: 77444 >> >> URL: http://llvm.org/viewvc/llvm-project?rev=77444&view=rev >> Log: >> raw_ostream: Follow the 32-bit path when printing "small" decimal numbers. >> >> Modified: >> ? ?llvm/trunk/lib/Support/raw_ostream.cpp >> >> Modified: llvm/trunk/lib/Support/raw_ostream.cpp >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/raw_ostream.cpp?rev=77444&r1=77443&r2=77444&view=diff >> >> ============================================================================== >> --- llvm/trunk/lib/Support/raw_ostream.cpp (original) >> +++ llvm/trunk/lib/Support/raw_ostream.cpp Wed Jul 29 01:45:14 2009 >> @@ -89,6 +89,10 @@ >> ?} >> >> ?raw_ostream &raw_ostream::operator<<(unsigned long long N) { >> + ?// Output using 32-bit div/mod when possible. >> + ?if (N == static_cast(N)) >> + ? ?return this->operator<<(static_cast(N)); >> + >> ? // Zero is a special case. >> ? if (N == 0) >> ? ? return *this << '0'; > > Doesn't the 'if (N == 0)' become dead code with this change? > > Reid > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits > From evan.cheng at apple.com Wed Jul 29 12:40:29 2009 From: evan.cheng at apple.com (Evan Cheng) Date: Wed, 29 Jul 2009 17:40:29 -0000 Subject: [llvm-commits] [llvm] r77478 - /llvm/trunk/test/FrontendC++/2009-07-15-LineNumbers.cpp Message-ID: <200907291740.n6THeUfa001107@zion.cs.uiuc.edu> Author: evancheng Date: Wed Jul 29 12:40:28 2009 New Revision: 77478 URL: http://llvm.org/viewvc/llvm-project?rev=77478&view=rev Log: xfail for now. Modified: llvm/trunk/test/FrontendC++/2009-07-15-LineNumbers.cpp Modified: llvm/trunk/test/FrontendC++/2009-07-15-LineNumbers.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/FrontendC%2B%2B/2009-07-15-LineNumbers.cpp?rev=77478&r1=77477&r2=77478&view=diff ============================================================================== --- llvm/trunk/test/FrontendC++/2009-07-15-LineNumbers.cpp (original) +++ llvm/trunk/test/FrontendC++/2009-07-15-LineNumbers.cpp Wed Jul 29 12:40:28 2009 @@ -2,6 +2,7 @@ // print line numbers in asm. // RUN: %llvmgcc -S -O0 -g %s -o - | llvm-as | \ // RUN: llc --disable-fp-elim -f -O0 -relocation-model=pic | grep {# SrcLine 25} +// XFAIL: * #include From evan.cheng at apple.com Wed Jul 29 12:43:04 2009 From: evan.cheng at apple.com (Evan Cheng) Date: Wed, 29 Jul 2009 10:43:04 -0700 Subject: [llvm-commits] [llvm] r77397 - in /llvm/trunk: include/llvm/Support/FormattedStream.h lib/Support/FormattedStream.cpp In-Reply-To: <200907291103.01091.dag@cray.com> References: <200907282326.n6SNQYms018777@zion.cs.uiuc.edu> <2C88990A-2D3A-4310-B116-5634F1B181DA@apple.com> <750B4DE6-E485-4D9A-9CE2-E07B72844532@apple.com> <200907291103.01091.dag@cray.com> Message-ID: On Jul 29, 2009, at 9:03 AM, David Greene wrote: > On Tuesday 28 July 2009 23:48, Evan Cheng wrote: >> Ok. David, I'm going to revert AsmWriterEmitter.cpp back to 74742 for >> now. Please re-commit as you have fixed the efficiency problem. > > As you know, I can't SEE the efficiency problem. I'm flying blind. > > And I was following Chris' suggestion to commit the patch I had with > the > understanding that more fixes were coming. > > Honestly, this is getting very frustrating. Aren't we in development > right now? Regressions are going to happen. This kind of compile > time > regression shouldn't be a huge problem especially when we have a > solution. David, This is a significant regression that hurts everyone. It slows down nightly testing significantly. Dan was able to reproduce the regression on a Linux box. Folks do try to use other platforms to identify problems. Please do so. Evan > > Oh well, guess I have to spend more time re-doing what I've already > done. > > -Dave > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From echristo at apple.com Wed Jul 29 12:53:21 2009 From: echristo at apple.com (Eric Christopher) Date: Wed, 29 Jul 2009 10:53:21 -0700 Subject: [llvm-commits] [llvm] r77407 - in /llvm/trunk: include/llvm/IntrinsicsX86.td lib/Target/X86/X86ISelLowering.cpp lib/Target/X86/X86ISelLowering.h lib/Target/X86/X86InstrSSE.td test/CodeGen/X86/sse41.ll In-Reply-To: <94249837-D0CD-467E-B36E-4B4B6A6271BC@apple.com> References: <200907290028.n6T0S6VU020655@zion.cs.uiuc.edu> <677CE0D7-9423-444B-82A5-78F234F9012D@apple.com> <94249837-D0CD-467E-B36E-4B4B6A6271BC@apple.com> Message-ID: On Jul 28, 2009, at 10:49 PM, Chris Lattner wrote: > > On Jul 28, 2009, at 10:44 PM, Evan Cheng wrote: > >>> Ok, that's what I feared. This means that we need conditional flag >>> liveness stuff? Is there a way to know (e.g. in regalloc, when >>> doing >>> a spill) that only one flag is used? Do we have flag subregs? >> >> Not yet. >> >> If we care about this, the solution is to lower ptestz and ptestc, >> ptestnzc to different x86isd nodes. > > Yes, that would work for commuting at isel time to match the load. > This wouldn't work for commuting to fold a reload. Yeah, I originally had it this way (multiple isd nodes) but combined them as unnecessarily complicated - shouldn't be a problem to separate them back out. -eric From daniel at zuster.org Wed Jul 29 12:58:00 2009 From: daniel at zuster.org (Daniel Dunbar) Date: Wed, 29 Jul 2009 10:58:00 -0700 Subject: [llvm-commits] [llvm] r77397 - in /llvm/trunk: include/llvm/Support/FormattedStream.h lib/Support/FormattedStream.cpp In-Reply-To: <200907291152.41862.dag@cray.com> References: <200907282326.n6SNQYms018777@zion.cs.uiuc.edu> <200907291103.01091.dag@cray.com> <6a8523d60907290943h4ddaee0dk9f5e4f5547803d72@mail.gmail.com> <200907291152.41862.dag@cray.com> Message-ID: <6a8523d60907291058i34488d6bmc2f5ebfd4195ac94@mail.gmail.com> On Wed, Jul 29, 2009 at 9:52 AM, David Greene wrote: > I'm trying to get us back to where we were. ?I think I have it and am > running tests now. ?I will be reverting Evan's revert after making sure > I don't see a problem. ?But as I said, that's no guarantee there won't > be some kind of problem I can't see. Ok. When reenabling the formatted ostream for the asm printer, please do some timing of llc on some reasonable file to verify that it doesn't hurt the (non-verbose?) performance and provide that in the commit. I don't think it is onerous to expect changes not to cause performance regressions. From a testing and quality control stand point, this is just like wanting the test suite to be free of failures. The problem is that once regressions are allowed to stand, they compound and become much harder to analyze. - Daniel > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?-Dave > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits > From eli.friedman at gmail.com Wed Jul 29 13:11:09 2009 From: eli.friedman at gmail.com (Eli Friedman) Date: Wed, 29 Jul 2009 11:11:09 -0700 Subject: [llvm-commits] [llvm] r77259 - in /llvm/trunk: docs/LangRef.html include/llvm/Bitcode/LLVMBitCodes.h include/llvm/Operator.h lib/AsmParser/LLLexer.cpp lib/AsmParser/LLParser.cpp lib/AsmParser/LLToken.h lib/Bitcode/Reader/BitcodeReader.cpp lib/Bit Message-ID: 2009/7/29 T?r?k Edwin : > Some optimization (I think LICM) moves getelementptr out of the > basicblock where a predicate guarantees the inbounds property, thus you > may get > a getelementptr that computes an out of bounds value, but when the value > is dereferenced it will always be in bounds (due to that predicate). That's fine; an invalid getelementptr has an undefined result, but it's not undefined behavior by itself. It's sort of like an undefined shift. -Eli From echristo at apple.com Wed Jul 29 13:14:04 2009 From: echristo at apple.com (Eric Christopher) Date: Wed, 29 Jul 2009 18:14:04 -0000 Subject: [llvm-commits] [llvm] r77480 - /llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Message-ID: <200907291814.n6TIE5Q8002418@zion.cs.uiuc.edu> Author: echristo Date: Wed Jul 29 13:14:04 2009 New Revision: 77480 URL: http://llvm.org/viewvc/llvm-project?rev=77480&view=rev Log: Add llvm_unreachable for ... unreachable code! 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=77480&r1=77479&r2=77480&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original) +++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Wed Jul 29 13:14:04 2009 @@ -6207,7 +6207,7 @@ case Intrinsic::x86_sse41_ptestnzc:{ unsigned X86CC = 0; switch (IntNo) { - default: break; + default: llvm_unreachable("Bad fallthrough in Intrinsic lowering."); case Intrinsic::x86_sse41_ptestz: // ZF = 1 X86CC = X86::COND_E; From dpatel at apple.com Wed Jul 29 13:15:02 2009 From: dpatel at apple.com (Devang Patel) Date: Wed, 29 Jul 2009 18:15:02 -0000 Subject: [llvm-commits] [llvm] r77482 - /llvm/trunk/lib/Bitcode/Writer/BitcodeWriter.cpp Message-ID: <200907291815.n6TIF3SK002481@zion.cs.uiuc.edu> Author: dpatel Date: Wed Jul 29 13:15:02 2009 New Revision: 77482 URL: http://llvm.org/viewvc/llvm-project?rev=77482&view=rev Log: Refactor. Fix indentation. Modified: llvm/trunk/lib/Bitcode/Writer/BitcodeWriter.cpp Modified: llvm/trunk/lib/Bitcode/Writer/BitcodeWriter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Bitcode/Writer/BitcodeWriter.cpp?rev=77482&r1=77481&r2=77482&view=diff ============================================================================== --- llvm/trunk/lib/Bitcode/Writer/BitcodeWriter.cpp (original) +++ llvm/trunk/lib/Bitcode/Writer/BitcodeWriter.cpp Wed Jul 29 13:15:02 2009 @@ -473,34 +473,41 @@ return Flags; } - static void WriteModuleMetadata(const ValueEnumerator &VE, - BitstreamWriter &Stream) { - const ValueEnumerator::ValueList &Vals = VE.getValues(); - bool StartedMetadataBlock = false; - unsigned MDSAbbrev = 0; - SmallVector Record; - for (unsigned i = 0, e = Vals.size(); i != e; ++i) { - - if (const MDNode *N = dyn_cast(Vals[i].first)) { - if (!StartedMetadataBlock) { - Stream.EnterSubblock(bitc::METADATA_BLOCK_ID, 3); - StartedMetadataBlock = true; - } - for (unsigned i = 0, e = N->getNumElements(); i != e; ++i) { - if (N->getElement(i)) { - Record.push_back(VE.getTypeID(N->getElement(i)->getType())); - Record.push_back(VE.getValueID(N->getElement(i))); - } else { - Record.push_back(VE.getTypeID(Type::VoidTy)); - Record.push_back(0); - } +static void WriteMDNode(const MDNode *N, + const ValueEnumerator &VE, + BitstreamWriter &Stream, + SmallVector &Record) { + for (unsigned i = 0, e = N->getNumElements(); i != e; ++i) { + if (N->getElement(i)) { + Record.push_back(VE.getTypeID(N->getElement(i)->getType())); + Record.push_back(VE.getValueID(N->getElement(i))); + } else { + Record.push_back(VE.getTypeID(Type::VoidTy)); + Record.push_back(0); + } + } + Stream.EmitRecord(bitc::METADATA_NODE, Record, 0); + Record.clear(); +} + +static void WriteModuleMetadata(const ValueEnumerator &VE, + BitstreamWriter &Stream) { + const ValueEnumerator::ValueList &Vals = VE.getValues(); + bool StartedMetadataBlock = false; + unsigned MDSAbbrev = 0; + SmallVector Record; + for (unsigned i = 0, e = Vals.size(); i != e; ++i) { + + if (const MDNode *N = dyn_cast(Vals[i].first)) { + if (!StartedMetadataBlock) { + Stream.EnterSubblock(bitc::METADATA_BLOCK_ID, 3); + StartedMetadataBlock = true; } - Stream.EmitRecord(bitc::METADATA_NODE, Record, 0); - Record.clear(); - } else if (const MDString *MDS = dyn_cast(Vals[i].first)) { - if (!StartedMetadataBlock) { + WriteMDNode(N, VE, Stream, Record); + } else if (const MDString *MDS = dyn_cast(Vals[i].first)) { + if (!StartedMetadataBlock) { Stream.EnterSubblock(bitc::METADATA_BLOCK_ID, 3); - + // Abbrev for METADATA_STRING. BitCodeAbbrev *Abbv = new BitCodeAbbrev(); Abbv->Add(BitCodeAbbrevOp(bitc::METADATA_STRING)); @@ -508,24 +515,23 @@ Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 8)); MDSAbbrev = Stream.EmitAbbrev(Abbv); StartedMetadataBlock = true; - } - - // Code: [strchar x N] - const char *StrBegin = MDS->begin(); - for (unsigned i = 0, e = MDS->length(); i != e; ++i) + } + + // Code: [strchar x N] + const char *StrBegin = MDS->begin(); + for (unsigned i = 0, e = MDS->length(); i != e; ++i) Record.push_back(StrBegin[i]); - - // Emit the finished record. + + // Emit the finished record. Stream.EmitRecord(bitc::METADATA_STRING, Record, MDSAbbrev); Record.clear(); - } - } - - if (StartedMetadataBlock) - Stream.ExitBlock(); + } + } + + if (StartedMetadataBlock) + Stream.ExitBlock(); } - static void WriteConstants(unsigned FirstVal, unsigned LastVal, const ValueEnumerator &VE, BitstreamWriter &Stream, bool isGlobal) { From dgregor at apple.com Wed Jul 29 13:19:47 2009 From: dgregor at apple.com (Douglas Gregor) Date: Wed, 29 Jul 2009 18:19:47 -0000 Subject: [llvm-commits] [llvm] r77487 - /llvm/trunk/include/llvm/ADT/PointerUnion.h Message-ID: <200907291819.n6TIJlUL002697@zion.cs.uiuc.edu> Author: dgregor Date: Wed Jul 29 13:19:47 2009 New Revision: 77487 URL: http://llvm.org/viewvc/llvm-project?rev=77487&view=rev Log: Implement PointerUnion4. Modified: llvm/trunk/include/llvm/ADT/PointerUnion.h Modified: llvm/trunk/include/llvm/ADT/PointerUnion.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/PointerUnion.h?rev=77487&r1=77486&r2=77487&view=diff ============================================================================== --- llvm/trunk/include/llvm/ADT/PointerUnion.h (original) +++ llvm/trunk/include/llvm/ADT/PointerUnion.h Wed Jul 29 13:19:47 2009 @@ -254,6 +254,115 @@ ::NumLowBitsAvailable }; }; + + /// PointerUnion4 - This is a pointer union of four pointer types. See + /// documentation for PointerUnion for usage. + template + class PointerUnion4 { + public: + typedef PointerUnion InnerUnion1; + typedef PointerUnion InnerUnion2; + typedef PointerUnion ValTy; + private: + ValTy Val; + public: + PointerUnion4() {} + + PointerUnion4(PT1 V) { + Val = InnerUnion1(V); + } + PointerUnion4(PT2 V) { + Val = InnerUnion1(V); + } + PointerUnion4(PT3 V) { + Val = InnerUnion2(V); + } + PointerUnion4(PT4 V) { + Val = InnerUnion2(V); + } + + /// isNull - Return true if the pointer help in the union is null, + /// regardless of which type it is. + bool isNull() const { return Val.isNull(); } + operator bool() const { return !isNull(); } + + /// is() return true if the Union currently holds the type matching T. + template + int is() const { + // Is it PT1/PT2? + if (::llvm::getPointerUnionTypeNum((T*)0) != -1) + return Val.is() && Val.get().is(); + return Val.is() && Val.get().is(); + } + + /// get() - Return the value of the specified pointer type. If the + /// specified pointer type is incorrect, assert. + template + T get() const { + assert(is() && "Invalid accessor called"); + // Is it PT1/PT2? + if (::llvm::getPointerUnionTypeNum((T*)0) != -1) + return Val.get().get(); + + return Val.get().get(); + } + + /// dyn_cast() - If the current value is of the specified pointer type, + /// return it, otherwise return null. + template + T dyn_cast() const { + if (is()) return get(); + return T(); + } + + /// Assignment operators - Allow assigning into this union from either + /// pointer type, setting the discriminator to remember what it came from. + const PointerUnion4 &operator=(const PT1 &RHS) { + Val = InnerUnion1(RHS); + return *this; + } + const PointerUnion4 &operator=(const PT2 &RHS) { + Val = InnerUnion1(RHS); + return *this; + } + const PointerUnion4 &operator=(const PT3 &RHS) { + Val = InnerUnion2(RHS); + return *this; + } + const PointerUnion4 &operator=(const PT4 &RHS) { + Val = InnerUnion2(RHS); + return *this; + } + + void *getOpaqueValue() const { return Val.getOpaqueValue(); } + static PointerUnion4 getFromOpaqueValue(void *VP) { + PointerUnion4 V; + V.Val = ValTy::getFromOpaqueValue(VP); + return V; + } + }; + + // Teach SmallPtrSet that PointerUnion4 is "basically a pointer", that has + // # low bits available = min(PT1bits,PT2bits,PT2bits)-2. + template + class PointerLikeTypeTraits > { + public: + static inline void * + getAsVoidPointer(const PointerUnion4 &P) { + return P.getOpaqueValue(); + } + static inline PointerUnion4 + getFromVoidPointer(void *P) { + return PointerUnion4::getFromOpaqueValue(P); + } + + // The number of bits available are the min of the two pointer types. + enum { + NumLowBitsAvailable = + PointerLikeTypeTraits::ValTy> + ::NumLowBitsAvailable + }; + }; } #endif From edwintorok at gmail.com Wed Jul 29 13:22:03 2009 From: edwintorok at gmail.com (=?ISO-8859-1?Q?T=F6r=F6k_Edwin?=) Date: Wed, 29 Jul 2009 21:22:03 +0300 Subject: [llvm-commits] [llvm] r77259 - in /llvm/trunk: docs/LangRef.html include/llvm/Bitcode/LLVMBitCodes.h include/llvm/Operator.h lib/AsmParser/LLLexer.cpp lib/AsmParser/LLParser.cpp lib/AsmParser/LLToken.h lib/Bitcode/Reader/BitcodeReader.cpp lib/Bit In-Reply-To: References: Message-ID: <4A70934B.3090409@gmail.com> On 2009-07-29 21:11, Eli Friedman wrote: > 2009/7/29 T?r?k Edwin : > >> Some optimization (I think LICM) moves getelementptr out of the >> basicblock where a predicate guarantees the inbounds property, thus you >> may get >> a getelementptr that computes an out of bounds value, but when the value >> is dereferenced it will always be in bounds (due to that predicate). >> > > That's fine; an invalid getelementptr has an undefined result, but > it's not undefined behavior by itself. It's sort of like an undefined > shift. > > What happens when you load from it? Previously the code had no undefined result/undefined behaviour, if LICM moves it out of the BB you'll load from an undefined address. Or am I missing something? Best regards, --Edwin From nlewycky at google.com Wed Jul 29 13:23:00 2009 From: nlewycky at google.com (Nick Lewycky) Date: Wed, 29 Jul 2009 11:23:00 -0700 Subject: [llvm-commits] [llvm] r77487 - /llvm/trunk/include/llvm/ADT/PointerUnion.h In-Reply-To: <200907291819.n6TIJlUL002697@zion.cs.uiuc.edu> References: <200907291819.n6TIJlUL002697@zion.cs.uiuc.edu> Message-ID: 2009/7/29 Douglas Gregor > Author: dgregor > Date: Wed Jul 29 13:19:47 2009 > New Revision: 77487 > > URL: http://llvm.org/viewvc/llvm-project?rev=77487&view=rev > Log: > Implement PointerUnion4. > > Modified: > llvm/trunk/include/llvm/ADT/PointerUnion.h > > Modified: llvm/trunk/include/llvm/ADT/PointerUnion.h > URL: > http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/PointerUnion.h?rev=77487&r1=77486&r2=77487&view=diff > > > ============================================================================== > --- llvm/trunk/include/llvm/ADT/PointerUnion.h (original) > +++ llvm/trunk/include/llvm/ADT/PointerUnion.h Wed Jul 29 13:19:47 2009 > @@ -254,6 +254,115 @@ > ::NumLowBitsAvailable > }; > }; > + > + /// PointerUnion4 - This is a pointer union of four pointer types. See > + /// documentation for PointerUnion for usage. > + template > + class PointerUnion4 { > + public: > + typedef PointerUnion InnerUnion1; > + typedef PointerUnion InnerUnion2; > + typedef PointerUnion ValTy; > + private: > + ValTy Val; > + public: > + PointerUnion4() {} > + > + PointerUnion4(PT1 V) { > + Val = InnerUnion1(V); > + } > + PointerUnion4(PT2 V) { > + Val = InnerUnion1(V); > + } > + PointerUnion4(PT3 V) { > + Val = InnerUnion2(V); > + } > + PointerUnion4(PT4 V) { > + Val = InnerUnion2(V); > + } > + > + /// isNull - Return true if the pointer help in the union is null, pointer help? Perhaps it should read "held"? Nick > + /// regardless of which type it is. > + bool isNull() const { return Val.isNull(); } > + operator bool() const { return !isNull(); } > + > + /// is() return true if the Union currently holds the type matching > T. > + template > + int is() const { > + // Is it PT1/PT2? > + if (::llvm::getPointerUnionTypeNum((T*)0) != -1) > + return Val.is() && Val.get().is(); > + return Val.is() && Val.get().is(); > + } > + > + /// get() - Return the value of the specified pointer type. If the > + /// specified pointer type is incorrect, assert. > + template > + T get() const { > + assert(is() && "Invalid accessor called"); > + // Is it PT1/PT2? > + if (::llvm::getPointerUnionTypeNum((T*)0) != -1) > + return Val.get().get(); > + > + return Val.get().get(); > + } > + > + /// dyn_cast() - If the current value is of the specified pointer > type, > + /// return it, otherwise return null. > + template > + T dyn_cast() const { > + if (is()) return get(); > + return T(); > + } > + > + /// Assignment operators - Allow assigning into this union from either > + /// pointer type, setting the discriminator to remember what it came > from. > + const PointerUnion4 &operator=(const PT1 &RHS) { > + Val = InnerUnion1(RHS); > + return *this; > + } > + const PointerUnion4 &operator=(const PT2 &RHS) { > + Val = InnerUnion1(RHS); > + return *this; > + } > + const PointerUnion4 &operator=(const PT3 &RHS) { > + Val = InnerUnion2(RHS); > + return *this; > + } > + const PointerUnion4 &operator=(const PT4 &RHS) { > + Val = InnerUnion2(RHS); > + return *this; > + } > + > + void *getOpaqueValue() const { return Val.getOpaqueValue(); } > + static PointerUnion4 getFromOpaqueValue(void *VP) { > + PointerUnion4 V; > + V.Val = ValTy::getFromOpaqueValue(VP); > + return V; > + } > + }; > + > + // Teach SmallPtrSet that PointerUnion4 is "basically a pointer", that > has > + // # low bits available = min(PT1bits,PT2bits,PT2bits)-2. > + template > + class PointerLikeTypeTraits > { > + public: > + static inline void * > + getAsVoidPointer(const PointerUnion4 &P) { > + return P.getOpaqueValue(); > + } > + static inline PointerUnion4 > + getFromVoidPointer(void *P) { > + return PointerUnion4::getFromOpaqueValue(P); > + } > + > + // The number of bits available are the min of the two pointer types. > + enum { > + NumLowBitsAvailable = > + PointerLikeTypeTraits PT4>::ValTy> > + ::NumLowBitsAvailable > + }; > + }; > } > > #endif > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20090729/d05a16ba/attachment.html From dgregor at apple.com Wed Jul 29 13:27:22 2009 From: dgregor at apple.com (Douglas Gregor) Date: Wed, 29 Jul 2009 18:27:22 -0000 Subject: [llvm-commits] [llvm] r77489 - /llvm/trunk/include/llvm/ADT/PointerUnion.h Message-ID: <200907291827.n6TIRM3k003000@zion.cs.uiuc.edu> Author: dgregor Date: Wed Jul 29 13:27:22 2009 New Revision: 77489 URL: http://llvm.org/viewvc/llvm-project?rev=77489&view=rev Log: Fix a typo, and all of its copies Modified: llvm/trunk/include/llvm/ADT/PointerUnion.h Modified: llvm/trunk/include/llvm/ADT/PointerUnion.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/PointerUnion.h?rev=77489&r1=77488&r2=77489&view=diff ============================================================================== --- llvm/trunk/include/llvm/ADT/PointerUnion.h (original) +++ llvm/trunk/include/llvm/ADT/PointerUnion.h Wed Jul 29 13:27:22 2009 @@ -79,7 +79,7 @@ Val.setInt(1); } - /// isNull - Return true if the pointer help in the union is null, + /// isNull - Return true if the pointer held in the union is null, /// regardless of which type it is. bool isNull() const { return Val.getPointer() == 0; } operator bool() const { return !isNull(); } @@ -176,7 +176,7 @@ Val = V; } - /// isNull - Return true if the pointer help in the union is null, + /// isNull - Return true if the pointer held in the union is null, /// regardless of which type it is. bool isNull() const { return Val.isNull(); } operator bool() const { return !isNull(); } @@ -281,7 +281,7 @@ Val = InnerUnion2(V); } - /// isNull - Return true if the pointer help in the union is null, + /// isNull - Return true if the pointer held in the union is null, /// regardless of which type it is. bool isNull() const { return Val.isNull(); } operator bool() const { return !isNull(); } From dgregor at apple.com Wed Jul 29 13:27:52 2009 From: dgregor at apple.com (Douglas Gregor) Date: Wed, 29 Jul 2009 11:27:52 -0700 Subject: [llvm-commits] [llvm] r77487 - /llvm/trunk/include/llvm/ADT/PointerUnion.h In-Reply-To: References: <200907291819.n6TIJlUL002697@zion.cs.uiuc.edu> Message-ID: On Jul 29, 2009, at 11:23 AM, Nick Lewycky wrote: > 2009/7/29 Douglas Gregor > Author: dgregor > Date: Wed Jul 29 13:19:47 2009 > New Revision: 77487 > > URL: http://llvm.org/viewvc/llvm-project?rev=77487&view=rev > Log: > Implement PointerUnion4. > > + /// isNull - Return true if the pointer help in the union is > null, > > pointer help? Perhaps it should read "held"? Oops, thanks. Fixed this, and the two places it was copied from :) - Doug -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20090729/563e4fdc/attachment.html From eli.friedman at gmail.com Wed Jul 29 13:33:48 2009 From: eli.friedman at gmail.com (Eli Friedman) Date: Wed, 29 Jul 2009 11:33:48 -0700 Subject: [llvm-commits] [llvm] r77259 - in /llvm/trunk: docs/LangRef.html include/llvm/Bitcode/LLVMBitCodes.h include/llvm/Operator.h lib/AsmParser/LLLexer.cpp lib/AsmParser/LLParser.cpp lib/AsmParser/LLToken.h lib/Bitcode/Reader/BitcodeReader.cpp lib/Bit In-Reply-To: <4A70934B.3090409@gmail.com> References: <4A70934B.3090409@gmail.com> Message-ID: 2009/7/29 T?r?k Edwin : > On 2009-07-29 21:11, Eli Friedman wrote: >> 2009/7/29 T?r?k Edwin : >> >>> Some optimization (I think LICM) moves getelementptr out of the >>> basicblock where a predicate guarantees the inbounds property, thus you >>> may get >>> a getelementptr that computes an out of bounds value, but when the value >>> is dereferenced it will always be in bounds (due to that predicate). >>> >> >> That's fine; an invalid getelementptr has an undefined result, but >> it's not undefined behavior by itself. ?It's sort of like an undefined >> shift. >> >> > > What happens when you load from it? > Previously the code had no undefined result/undefined behaviour, if LICM > moves it out of the BB > you'll load from an undefined address. Or am I missing something? I'm not following; if there's a load from a GEP with an undefined result, that's undefined behavior regardless of whether the GEP moves. -Eli From eli.friedman at gmail.com Wed Jul 29 13:35:56 2009 From: eli.friedman at gmail.com (Eli Friedman) Date: Wed, 29 Jul 2009 11:35:56 -0700 Subject: [llvm-commits] [llvm] r77259 - in /llvm/trunk: docs/LangRef.html include/llvm/Bitcode/LLVMBitCodes.h include/llvm/Operator.h lib/AsmParser/LLLexer.cpp lib/AsmParser/LLParser.cpp lib/AsmParser/LLToken.h lib/Bitcode/Reader/BitcodeReader.cpp lib/Bit In-Reply-To: References: <4A70934B.3090409@gmail.com> Message-ID: On Wed, Jul 29, 2009 at 11:33 AM, Eli Friedman wrote: > 2009/7/29 T?r?k Edwin : >> On 2009-07-29 21:11, Eli Friedman wrote: >>> 2009/7/29 T?r?k Edwin : >>> >>>> Some optimization (I think LICM) moves getelementptr out of the >>>> basicblock where a predicate guarantees the inbounds property, thus you >>>> may get >>>> a getelementptr that computes an out of bounds value, but when the value >>>> is dereferenced it will always be in bounds (due to that predicate). >>>> >>> >>> That's fine; an invalid getelementptr has an undefined result, but >>> it's not undefined behavior by itself. ?It's sort of like an undefined >>> shift. >>> >>> >> >> What happens when you load from it? >> Previously the code had no undefined result/undefined behaviour, if LICM >> moves it out of the BB >> you'll load from an undefined address. Or am I missing something? > > I'm not following; if there's a load from a GEP with an undefined > result, that's undefined behavior regardless of whether the GEP moves. Oh, wait, I think I see what you mean. The inbounds property does not guarantee it is safe to load from the pointer in question. -Eli From gohman at apple.com Wed Jul 29 13:55:02 2009 From: gohman at apple.com (Dan Gohman) Date: Wed, 29 Jul 2009 11:55:02 -0700 Subject: [llvm-commits] [llvm] r77259 - in /llvm/trunk: docs/LangRef.html include/llvm/Bitcode/LLVMBitCodes.h include/llvm/Operator.h lib/AsmParser/LLLexer.cpp lib/AsmParser/LLParser.cpp lib/AsmParser/LLToken.h lib/Bitcode/Reader/BitcodeReader.cpp lib/Bitcode/Writer/BitcodeWriter.cpp lib/VMCore/AsmWriter.cpp test/Assembler/flags-plain.ll test/Assembler/flags.ll In-Reply-To: <4A707C52.6070801@gmail.com> References: <200907272153.n6RLrkuk023065@zion.cs.uiuc.edu> <597EA260-27B6-4545-B4B6-F84554804A0D@apple.com> <4A707C52.6070801@gmail.com> Message-ID: <37EC2983-55CB-47A5-A927-4B0AA5CBA036@apple.com> On Jul 29, 2009, at 9:44 AM, T?r?k Edwin wrote: > On 2009-07-29 19:26, Dan Gohman wrote: > >> On Jul 28, 2009, at 11:48 PM, Chris Lattner wrote: >> >> >> >> >> >>> On Jul 27, 2009, at 2:53 PM, Dan Gohman wrote: >>> >>> >>> >>>> URL: http://llvm.org/viewvc/llvm-project?rev=77259&view=rev >>>> >>>> Log: >>>> >>>> Add a new keyword 'inbounds' for use with getelementptr. See the >>>> >>>> LangRef.html changes for details. >>>> >>>> >>>> >>> The langref changes look nice. The choice of "inbounds" is a little >>> >>> strange to me, isn't this flag mostly about wrapping behavior when >>> >>> overflow happens? >>> >>> >>> >> >> >> It turns out that avoiding wrapping and staying in bounds are >> basically >> >> the same thing, since LLVM doesn't specify where in the address space >> >> it will allocate an object. >> >> >> >> >> >>> Will "inbounds" be the default generated by the llvm-gcc/clang >>> front- >>> >>> ends? If so, it would be nice to invert the sense of the bit so it >>> >>> doesn't show up in all the .ll files making them really noisy. >>> >>> >>> >> >> >> >> >> I'm planning for it to be the default behavior. I'm open to >> discussion; >> >> there are pros and cons either way. >> > > Hi Dan, > > Some optimization (I think LICM) moves getelementptr out of the > basicblock where a predicate guarantees the inbounds property, thus > you > may get > a getelementptr that computes an out of bounds value, but when the > value > is dereferenced it will always be in bounds (due to that predicate). > > Requiring a getelementptr to be inbounds is rather strong, since there > are optimizations that can create GEPs that are not inbounds (as shown > above). > Either those optimizations should then clear the flag (any > optimization > that moves GEPs out of a BB, or over a call), or inbounds should only > mean that it is 'inbounds' > when dereferenced. The strong meaning of inbounds is what I intend here. It represents properties guaranteed by the C standard, among other things. Yes, LICM, if-conversion, and other passes will need to clear the flags when they move instructions, unless they can prove that they don't need to. Moving instructions past calls is a case that I hadn't considered. I assume you mean that a call could resize the allocation, or could deallocate and reallocate at the same address. I think the way to handle this is to observe that LLVM IR allocation mechanisms don't permit resizing, and don't provide a way to force a reallocation to happen at the same address. A library allocator could do either of these, but LLVM doesn't know when or where library allocators allocate their storage, so I don't see any cases where this could cause an actual problem. I guess this is an argument in favor of defining inbounds in terms of integer overflow rather than in terms of allocated objects. I'll think about it. Dan From resistor at mac.com Wed Jul 29 13:55:23 2009 From: resistor at mac.com (Owen Anderson) Date: Wed, 29 Jul 2009 18:55:23 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r77493 - in /llvm-gcc-4.2/trunk/gcc: config/rs6000/llvm-rs6000.cpp llvm-backend.cpp Message-ID: <200907291855.n6TItNbv004125@zion.cs.uiuc.edu> Author: resistor Date: Wed Jul 29 13:55:23 2009 New Revision: 77493 URL: http://llvm.org/viewvc/llvm-project?rev=77493&view=rev Log: Update for LLVM API change. Modified: llvm-gcc-4.2/trunk/gcc/config/rs6000/llvm-rs6000.cpp llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp Modified: llvm-gcc-4.2/trunk/gcc/config/rs6000/llvm-rs6000.cpp URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/rs6000/llvm-rs6000.cpp?rev=77493&r1=77492&r2=77493&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/config/rs6000/llvm-rs6000.cpp (original) +++ llvm-gcc-4.2/trunk/gcc/config/rs6000/llvm-rs6000.cpp Wed Jul 29 13:55:23 2009 @@ -177,7 +177,7 @@ return true; case ALTIVEC_BUILTIN_VSPLTISB: if (Constant *Elt = dyn_cast(Ops[0])) { - Elt = Context.getConstantExprIntegerCast(Elt, Type::Int8Ty, true); + Elt = ConstantExpr::getIntegerCast(Elt, Type::Int8Ty, true); Result = BuildVector(Elt, Elt, Elt, Elt, Elt, Elt, Elt, Elt, Elt, Elt, Elt, Elt, Elt, Elt, Elt, Elt, NULL); } else { @@ -187,7 +187,7 @@ return true; case ALTIVEC_BUILTIN_VSPLTISH: if (Constant *Elt = dyn_cast(Ops[0])) { - Elt = Context.getConstantExprIntegerCast(Elt, Type::Int16Ty, true); + Elt = ConstantExpr::getIntegerCast(Elt, Type::Int16Ty, true); Result = BuildVector(Elt, Elt, Elt, Elt, Elt, Elt, Elt, Elt, NULL); } else { error("%Helement must be an immediate", &EXPR_LOCATION(exp)); @@ -196,7 +196,7 @@ return true; case ALTIVEC_BUILTIN_VSPLTISW: if (Constant *Elt = dyn_cast(Ops[0])) { - Elt = Context.getConstantExprIntegerCast(Elt, Type::Int32Ty, true); + Elt = ConstantExpr::getIntegerCast(Elt, Type::Int32Ty, true); Result = BuildVector(Elt, Elt, Elt, Elt, NULL); } else { error("%Hmask must be an immediate", &EXPR_LOCATION(exp)); Modified: llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp?rev=77493&r1=77492&r2=77493&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp (original) +++ llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp Wed Jul 29 13:55:23 2009 @@ -1065,7 +1065,7 @@ handleVisibility(decl, GA); if (GA->getType()->canLosslesslyBitCastTo(V->getType())) - V->replaceAllUsesWith(Context.getConstantExprBitCast(GA, V->getType())); + V->replaceAllUsesWith(ConstantExpr::getBitCast(GA, V->getType())); else if (!V->use_empty()) { error ("%J Alias %qD used with invalid type!", decl, decl); timevar_pop(TV_LLVM_GLOBALS); From resistor at mac.com Wed Jul 29 13:55:55 2009 From: resistor at mac.com (Owen Anderson) Date: Wed, 29 Jul 2009 18:55:55 -0000 Subject: [llvm-commits] [llvm] r77494 - in /llvm/trunk: include/llvm/ include/llvm/Support/ lib/Analysis/ lib/AsmParser/ lib/Bitcode/Reader/ lib/CodeGen/ lib/CodeGen/SelectionDAG/ lib/ExecutionEngine/JIT/ lib/Linker/ lib/Transforms/IPO/ lib/Transforms/Instrumentation/ lib/Transforms/Scalar/ lib/Transforms/Utils/ lib/VMCore/ tools/bugpoint/ Message-ID: <200907291855.n6TItw9j004196@zion.cs.uiuc.edu> Author: resistor Date: Wed Jul 29 13:55:55 2009 New Revision: 77494 URL: http://llvm.org/viewvc/llvm-project?rev=77494&view=rev Log: Move ConstantExpr to 2.5 API. Modified: llvm/trunk/include/llvm/Constants.h llvm/trunk/include/llvm/LLVMContext.h llvm/trunk/include/llvm/Support/ConstantFolder.h llvm/trunk/include/llvm/Support/IRBuilder.h llvm/trunk/include/llvm/Support/NoFolder.h llvm/trunk/include/llvm/Support/PatternMatch.h llvm/trunk/include/llvm/Support/TargetFolder.h llvm/trunk/lib/Analysis/BasicAliasAnalysis.cpp llvm/trunk/lib/Analysis/ConstantFolding.cpp llvm/trunk/lib/Analysis/DebugInfo.cpp llvm/trunk/lib/Analysis/ScalarEvolution.cpp llvm/trunk/lib/Analysis/ScalarEvolutionExpander.cpp llvm/trunk/lib/AsmParser/LLParser.cpp llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp llvm/trunk/lib/CodeGen/ShadowStackGC.cpp llvm/trunk/lib/ExecutionEngine/JIT/JIT.cpp llvm/trunk/lib/Linker/LinkModules.cpp llvm/trunk/lib/Transforms/IPO/ExtractGV.cpp llvm/trunk/lib/Transforms/IPO/GlobalOpt.cpp llvm/trunk/lib/Transforms/IPO/MergeFunctions.cpp llvm/trunk/lib/Transforms/Instrumentation/ProfilingUtils.cpp llvm/trunk/lib/Transforms/Instrumentation/RSProfiling.cpp llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp llvm/trunk/lib/Transforms/Scalar/JumpThreading.cpp llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp llvm/trunk/lib/Transforms/Scalar/MemCpyOptimizer.cpp llvm/trunk/lib/Transforms/Scalar/PredicateSimplifier.cpp llvm/trunk/lib/Transforms/Scalar/Reassociate.cpp llvm/trunk/lib/Transforms/Scalar/SCCP.cpp llvm/trunk/lib/Transforms/Scalar/ScalarReplAggregates.cpp llvm/trunk/lib/Transforms/Scalar/SimplifyLibCalls.cpp llvm/trunk/lib/Transforms/Utils/InlineFunction.cpp llvm/trunk/lib/Transforms/Utils/LowerAllocations.cpp llvm/trunk/lib/Transforms/Utils/LowerInvoke.cpp llvm/trunk/lib/Transforms/Utils/LowerSwitch.cpp llvm/trunk/lib/VMCore/ConstantFold.cpp llvm/trunk/lib/VMCore/Constants.cpp llvm/trunk/lib/VMCore/Core.cpp llvm/trunk/lib/VMCore/LLVMContext.cpp llvm/trunk/lib/VMCore/LLVMContextImpl.h llvm/trunk/lib/VMCore/Module.cpp llvm/trunk/tools/bugpoint/Miscompilation.cpp Modified: llvm/trunk/include/llvm/Constants.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Constants.h?rev=77494&r1=77493&r2=77494&view=diff ============================================================================== --- llvm/trunk/include/llvm/Constants.h (original) +++ llvm/trunk/include/llvm/Constants.h Wed Jul 29 13:55:55 2009 @@ -584,6 +584,38 @@ /// Cast constant expr /// + + /// getAlignOf constant expr - computes the alignment of a type in a target + /// independent way (Note: the return type is an i32; Note: assumes that i8 + /// is byte aligned). + static Constant* getAlignOf(const Type* Ty); + + /// getSizeOf constant expr - computes the size of a type in a target + /// independent way (Note: the return type is an i64). + /// + static Constant* getSizeOf(const Type* Ty); + + static Constant* getNeg(Constant* C); + static Constant* getFNeg(Constant* C); + static Constant* getNot(Constant* C); + static Constant* getAdd(Constant* C1, Constant* C2); + static Constant* getFAdd(Constant* C1, Constant* C2); + static Constant* getSub(Constant* C1, Constant* C2); + static Constant* getFSub(Constant* C1, Constant* C2); + static Constant* getMul(Constant* C1, Constant* C2); + static Constant* getFMul(Constant* C1, Constant* C2); + static Constant* getUDiv(Constant* C1, Constant* C2); + static Constant* getSDiv(Constant* C1, Constant* C2); + static Constant* getFDiv(Constant* C1, Constant* C2); + static Constant* getURem(Constant* C1, Constant* C2); + static Constant* getSRem(Constant* C1, Constant* C2); + static Constant* getFRem(Constant* C1, Constant* C2); + static Constant* getAnd(Constant* C1, Constant* C2); + static Constant* getOr(Constant* C1, Constant* C2); + static Constant* getXor(Constant* C1, Constant* C2); + static Constant* getShl(Constant* C1, Constant* C2); + static Constant* getLShr(Constant* C1, Constant* C2); + static Constant* getAShr(Constant* C1, Constant* C2); static Constant *getTrunc (Constant *C, const Type *Ty); static Constant *getSExt (Constant *C, const Type *Ty); static Constant *getZExt (Constant *C, const Type *Ty); @@ -661,7 +693,7 @@ return getSelectTy(V1->getType(), C, V1, V2); } - /// ConstantExpr::get - Return a binary or shift operator constant expression, + /// get - Return a binary or shift operator constant expression, /// folding if possible. /// static Constant *get(unsigned Opcode, Constant *C1, Constant *C2); @@ -669,7 +701,7 @@ /// @brief Return an ICmp or FCmp comparison operator constant expression. static Constant *getCompare(unsigned short pred, Constant *C1, Constant *C2); - /// ConstantExpr::get* - Return some common constants without having to + /// get* - Return some common constants without having to /// specify the full Instruction::OPCODE identifier. /// static Constant *getICmp(unsigned short pred, Constant *LHS, Constant *RHS); Modified: llvm/trunk/include/llvm/LLVMContext.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/LLVMContext.h?rev=77494&r1=77493&r2=77494&view=diff ============================================================================== --- llvm/trunk/include/llvm/LLVMContext.h (original) +++ llvm/trunk/include/llvm/LLVMContext.h Wed Jul 29 13:55:55 2009 @@ -85,82 +85,6 @@ // ConstantAggregateZero accessors ConstantAggregateZero* getConstantAggregateZero(const Type* Ty); - // ConstantExpr accessors - Constant* getConstantExpr(unsigned Opcode, Constant* C1, Constant* C2); - Constant* getConstantExprTrunc(Constant* C, const Type* Ty); - Constant* getConstantExprSExt(Constant* C, const Type* Ty); - Constant* getConstantExprZExt(Constant* C, const Type* Ty); - Constant* getConstantExprFPTrunc(Constant* C, const Type* Ty); - Constant* getConstantExprFPExtend(Constant* C, const Type* Ty); - Constant* getConstantExprUIToFP(Constant* C, const Type* Ty); - Constant* getConstantExprSIToFP(Constant* C, const Type* Ty); - Constant* getConstantExprFPToUI(Constant* C, const Type* Ty); - Constant* getConstantExprFPToSI(Constant* C, const Type* Ty); - Constant* getConstantExprPtrToInt(Constant* C, const Type* Ty); - Constant* getConstantExprIntToPtr(Constant* C, const Type* Ty); - Constant* getConstantExprBitCast(Constant* C, const Type* Ty); - Constant* getConstantExprCast(unsigned ops, Constant* C, const Type* Ty); - Constant* getConstantExprZExtOrBitCast(Constant* C, const Type* Ty); - Constant* getConstantExprSExtOrBitCast(Constant* C, const Type* Ty); - Constant* getConstantExprTruncOrBitCast(Constant* C, const Type* Ty); - Constant* getConstantExprPointerCast(Constant* C, const Type* Ty); - Constant* getConstantExprIntegerCast(Constant* C, const Type* Ty, - bool isSigned); - Constant* getConstantExprFPCast(Constant* C, const Type* Ty); - Constant* getConstantExprSelect(Constant* C, Constant* V1, Constant* V2); - - /// getAlignOf constant expr - computes the alignment of a type in a target - /// independent way (Note: the return type is an i32; Note: assumes that i8 - /// is byte aligned). - /// - Constant* getConstantExprAlignOf(const Type* Ty); - Constant* getConstantExprCompare(unsigned short pred, - Constant* C1, Constant* C2); - Constant* getConstantExprNeg(Constant* C); - Constant* getConstantExprFNeg(Constant* C); - Constant* getConstantExprNot(Constant* C); - Constant* getConstantExprAdd(Constant* C1, Constant* C2); - Constant* getConstantExprFAdd(Constant* C1, Constant* C2); - Constant* getConstantExprSub(Constant* C1, Constant* C2); - Constant* getConstantExprFSub(Constant* C1, Constant* C2); - Constant* getConstantExprMul(Constant* C1, Constant* C2); - Constant* getConstantExprFMul(Constant* C1, Constant* C2); - Constant* getConstantExprUDiv(Constant* C1, Constant* C2); - Constant* getConstantExprSDiv(Constant* C1, Constant* C2); - Constant* getConstantExprFDiv(Constant* C1, Constant* C2); - Constant* getConstantExprURem(Constant* C1, Constant* C2); - Constant* getConstantExprSRem(Constant* C1, Constant* C2); - Constant* getConstantExprFRem(Constant* C1, Constant* C2); - Constant* getConstantExprAnd(Constant* C1, Constant* C2); - Constant* getConstantExprOr(Constant* C1, Constant* C2); - Constant* getConstantExprXor(Constant* C1, Constant* C2); - Constant* getConstantExprICmp(unsigned short pred, Constant* LHS, - Constant* RHS); - Constant* getConstantExprFCmp(unsigned short pred, Constant* LHS, - Constant* RHS); - Constant* getConstantExprShl(Constant* C1, Constant* C2); - Constant* getConstantExprLShr(Constant* C1, Constant* C2); - Constant* getConstantExprAShr(Constant* C1, Constant* C2); - Constant* getConstantExprGetElementPtr(Constant* C, Constant* const* IdxList, - unsigned NumIdx); - Constant* getConstantExprGetElementPtr(Constant* C, Value* const* IdxList, - unsigned NumIdx); - Constant* getConstantExprExtractElement(Constant* Vec, Constant* Idx); - Constant* getConstantExprInsertElement(Constant* Vec, Constant* Elt, - Constant* Idx); - Constant* getConstantExprShuffleVector(Constant* V1, Constant* V2, - Constant* Mask); - Constant* getConstantExprExtractValue(Constant* Agg, const unsigned* IdxList, - unsigned NumIdx); - Constant* getConstantExprInsertValue(Constant* Agg, Constant* Val, - const unsigned* IdxList, - unsigned NumIdx); - - /// getSizeOf constant expr - computes the size of a type in a target - /// independent way (Note: the return type is an i64). - /// - Constant* getConstantExprSizeOf(const Type* Ty); - // MDNode accessors MDNode* getMDNode(Value* const* Vals, unsigned NumVals); Modified: llvm/trunk/include/llvm/Support/ConstantFolder.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/ConstantFolder.h?rev=77494&r1=77493&r2=77494&view=diff ============================================================================== --- llvm/trunk/include/llvm/Support/ConstantFolder.h (original) +++ llvm/trunk/include/llvm/Support/ConstantFolder.h Wed Jul 29 13:55:55 2009 @@ -34,63 +34,63 @@ //===--------------------------------------------------------------------===// Constant *CreateAdd(Constant *LHS, Constant *RHS) const { - return Context.getConstantExprAdd(LHS, RHS); + return ConstantExpr::getAdd(LHS, RHS); } Constant *CreateFAdd(Constant *LHS, Constant *RHS) const { - return Context.getConstantExprFAdd(LHS, RHS); + return ConstantExpr::getFAdd(LHS, RHS); } Constant *CreateSub(Constant *LHS, Constant *RHS) const { - return Context.getConstantExprSub(LHS, RHS); + return ConstantExpr::getSub(LHS, RHS); } Constant *CreateFSub(Constant *LHS, Constant *RHS) const { - return Context.getConstantExprFSub(LHS, RHS); + return ConstantExpr::getFSub(LHS, RHS); } Constant *CreateMul(Constant *LHS, Constant *RHS) const { - return Context.getConstantExprMul(LHS, RHS); + return ConstantExpr::getMul(LHS, RHS); } Constant *CreateFMul(Constant *LHS, Constant *RHS) const { - return Context.getConstantExprFMul(LHS, RHS); + return ConstantExpr::getFMul(LHS, RHS); } Constant *CreateUDiv(Constant *LHS, Constant *RHS) const { - return Context.getConstantExprUDiv(LHS, RHS); + return ConstantExpr::getUDiv(LHS, RHS); } Constant *CreateSDiv(Constant *LHS, Constant *RHS) const { - return Context.getConstantExprSDiv(LHS, RHS); + return ConstantExpr::getSDiv(LHS, RHS); } Constant *CreateFDiv(Constant *LHS, Constant *RHS) const { - return Context.getConstantExprFDiv(LHS, RHS); + return ConstantExpr::getFDiv(LHS, RHS); } Constant *CreateURem(Constant *LHS, Constant *RHS) const { - return Context.getConstantExprURem(LHS, RHS); + return ConstantExpr::getURem(LHS, RHS); } Constant *CreateSRem(Constant *LHS, Constant *RHS) const { - return Context.getConstantExprSRem(LHS, RHS); + return ConstantExpr::getSRem(LHS, RHS); } Constant *CreateFRem(Constant *LHS, Constant *RHS) const { - return Context.getConstantExprFRem(LHS, RHS); + return ConstantExpr::getFRem(LHS, RHS); } Constant *CreateShl(Constant *LHS, Constant *RHS) const { - return Context.getConstantExprShl(LHS, RHS); + return ConstantExpr::getShl(LHS, RHS); } Constant *CreateLShr(Constant *LHS, Constant *RHS) const { - return Context.getConstantExprLShr(LHS, RHS); + return ConstantExpr::getLShr(LHS, RHS); } Constant *CreateAShr(Constant *LHS, Constant *RHS) const { - return Context.getConstantExprAShr(LHS, RHS); + return ConstantExpr::getAShr(LHS, RHS); } Constant *CreateAnd(Constant *LHS, Constant *RHS) const { - return Context.getConstantExprAnd(LHS, RHS); + return ConstantExpr::getAnd(LHS, RHS); } Constant *CreateOr(Constant *LHS, Constant *RHS) const { - return Context.getConstantExprOr(LHS, RHS); + return ConstantExpr::getOr(LHS, RHS); } Constant *CreateXor(Constant *LHS, Constant *RHS) const { - return Context.getConstantExprXor(LHS, RHS); + return ConstantExpr::getXor(LHS, RHS); } Constant *CreateBinOp(Instruction::BinaryOps Opc, Constant *LHS, Constant *RHS) const { - return Context.getConstantExpr(Opc, LHS, RHS); + return ConstantExpr::get(Opc, LHS, RHS); } //===--------------------------------------------------------------------===// @@ -98,13 +98,13 @@ //===--------------------------------------------------------------------===// Constant *CreateNeg(Constant *C) const { - return Context.getConstantExprNeg(C); + return ConstantExpr::getNeg(C); } Constant *CreateFNeg(Constant *C) const { - return Context.getConstantExprFNeg(C); + return ConstantExpr::getFNeg(C); } Constant *CreateNot(Constant *C) const { - return Context.getConstantExprNot(C); + return ConstantExpr::getNot(C); } //===--------------------------------------------------------------------===// @@ -113,11 +113,11 @@ Constant *CreateGetElementPtr(Constant *C, Constant* const *IdxList, unsigned NumIdx) const { - return Context.getConstantExprGetElementPtr(C, IdxList, NumIdx); + return ConstantExpr::getGetElementPtr(C, IdxList, NumIdx); } Constant *CreateGetElementPtr(Constant *C, Value* const *IdxList, unsigned NumIdx) const { - return Context.getConstantExprGetElementPtr(C, IdxList, NumIdx); + return ConstantExpr::getGetElementPtr(C, IdxList, NumIdx); } //===--------------------------------------------------------------------===// @@ -126,11 +126,11 @@ Constant *CreateCast(Instruction::CastOps Op, Constant *C, const Type *DestTy) const { - return Context.getConstantExprCast(Op, C, DestTy); + return ConstantExpr::getCast(Op, C, DestTy); } Constant *CreateIntCast(Constant *C, const Type *DestTy, bool isSigned) const { - return Context.getConstantExprIntegerCast(C, DestTy, isSigned); + return ConstantExpr::getIntegerCast(C, DestTy, isSigned); } Constant *CreateBitCast(Constant *C, const Type *DestTy) const { @@ -143,7 +143,7 @@ return CreateCast(Instruction::PtrToInt, C, DestTy); } Constant *CreateTruncOrBitCast(Constant *C, const Type *DestTy) const { - return Context.getConstantExprTruncOrBitCast(C, DestTy); + return ConstantExpr::getTruncOrBitCast(C, DestTy); } //===--------------------------------------------------------------------===// @@ -152,11 +152,11 @@ Constant *CreateICmp(CmpInst::Predicate P, Constant *LHS, Constant *RHS) const { - return Context.getConstantExprCompare(P, LHS, RHS); + return ConstantExpr::getCompare(P, LHS, RHS); } Constant *CreateFCmp(CmpInst::Predicate P, Constant *LHS, Constant *RHS) const { - return Context.getConstantExprCompare(P, LHS, RHS); + return ConstantExpr::getCompare(P, LHS, RHS); } //===--------------------------------------------------------------------===// @@ -164,31 +164,31 @@ //===--------------------------------------------------------------------===// Constant *CreateSelect(Constant *C, Constant *True, Constant *False) const { - return Context.getConstantExprSelect(C, True, False); + return ConstantExpr::getSelect(C, True, False); } Constant *CreateExtractElement(Constant *Vec, Constant *Idx) const { - return Context.getConstantExprExtractElement(Vec, Idx); + return ConstantExpr::getExtractElement(Vec, Idx); } Constant *CreateInsertElement(Constant *Vec, Constant *NewElt, Constant *Idx) const { - return Context.getConstantExprInsertElement(Vec, NewElt, Idx); + return ConstantExpr::getInsertElement(Vec, NewElt, Idx); } Constant *CreateShuffleVector(Constant *V1, Constant *V2, Constant *Mask) const { - return Context.getConstantExprShuffleVector(V1, V2, Mask); + return ConstantExpr::getShuffleVector(V1, V2, Mask); } Constant *CreateExtractValue(Constant *Agg, const unsigned *IdxList, unsigned NumIdx) const { - return Context.getConstantExprExtractValue(Agg, IdxList, NumIdx); + return ConstantExpr::getExtractValue(Agg, IdxList, NumIdx); } Constant *CreateInsertValue(Constant *Agg, Constant *Val, const unsigned *IdxList, unsigned NumIdx) const { - return Context.getConstantExprInsertValue(Agg, Val, IdxList, NumIdx); + return ConstantExpr::getInsertValue(Agg, Val, IdxList, NumIdx); } }; Modified: llvm/trunk/include/llvm/Support/IRBuilder.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/IRBuilder.h?rev=77494&r1=77493&r2=77494&view=diff ============================================================================== --- llvm/trunk/include/llvm/Support/IRBuilder.h (original) +++ llvm/trunk/include/llvm/Support/IRBuilder.h Wed Jul 29 13:55:55 2009 @@ -726,7 +726,7 @@ Value *RHS_int = CreatePtrToInt(RHS, Type::Int64Ty); Value *Difference = CreateSub(LHS_int, RHS_int); return CreateSDiv(Difference, - Context.getConstantExprSizeOf(ArgType->getElementType()), + ConstantExpr::getSizeOf(ArgType->getElementType()), Name); } }; Modified: llvm/trunk/include/llvm/Support/NoFolder.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/NoFolder.h?rev=77494&r1=77493&r2=77494&view=diff ============================================================================== --- llvm/trunk/include/llvm/Support/NoFolder.h (original) +++ llvm/trunk/include/llvm/Support/NoFolder.h Wed Jul 29 13:55:55 2009 @@ -116,7 +116,7 @@ Constant *CreateGetElementPtr(Constant *C, Constant* const *IdxList, unsigned NumIdx) const { - return Context.getConstantExprGetElementPtr(C, IdxList, NumIdx); + return ConstantExpr::getGetElementPtr(C, IdxList, NumIdx); } Value *CreateGetElementPtr(Constant *C, Value* const *IdxList, unsigned NumIdx) const { Modified: llvm/trunk/include/llvm/Support/PatternMatch.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/PatternMatch.h?rev=77494&r1=77493&r2=77494&view=diff ============================================================================== --- llvm/trunk/include/llvm/Support/PatternMatch.h (original) +++ llvm/trunk/include/llvm/Support/PatternMatch.h Wed Jul 29 13:55:55 2009 @@ -465,7 +465,7 @@ if (CE->getOpcode() == Instruction::Xor) return matchIfNot(CE->getOperand(0), CE->getOperand(1), Context); if (ConstantInt *CI = dyn_cast(V)) - return L.match(Context.getConstantExprNot(CI), Context); + return L.match(ConstantExpr::getNot(CI), Context); return false; } private: @@ -501,7 +501,7 @@ if (CE->getOpcode() == Instruction::Sub) return matchIfNeg(CE->getOperand(0), CE->getOperand(1), Context); if (ConstantInt *CI = dyn_cast(V)) - return L.match(Context.getConstantExprNeg(CI), Context); + return L.match(ConstantExpr::getNeg(CI), Context); return false; } private: @@ -530,7 +530,7 @@ if (CE->getOpcode() == Instruction::FSub) return matchIfFNeg(CE->getOperand(0), CE->getOperand(1), Context); if (ConstantFP *CF = dyn_cast(V)) - return L.match(Context.getConstantExprFNeg(CF), Context); + return L.match(ConstantExpr::getFNeg(CF), Context); return false; } private: Modified: llvm/trunk/include/llvm/Support/TargetFolder.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/TargetFolder.h?rev=77494&r1=77493&r2=77494&view=diff ============================================================================== --- llvm/trunk/include/llvm/Support/TargetFolder.h (original) +++ llvm/trunk/include/llvm/Support/TargetFolder.h Wed Jul 29 13:55:55 2009 @@ -49,63 +49,63 @@ //===--------------------------------------------------------------------===// Constant *CreateAdd(Constant *LHS, Constant *RHS) const { - return Fold(Context.getConstantExprAdd(LHS, RHS)); + return Fold(ConstantExpr::getAdd(LHS, RHS)); } Constant *CreateFAdd(Constant *LHS, Constant *RHS) const { - return Fold(Context.getConstantExprFAdd(LHS, RHS)); + return Fold(ConstantExpr::getFAdd(LHS, RHS)); } Constant *CreateSub(Constant *LHS, Constant *RHS) const { - return Fold(Context.getConstantExprSub(LHS, RHS)); + return Fold(ConstantExpr::getSub(LHS, RHS)); } Constant *CreateFSub(Constant *LHS, Constant *RHS) const { - return Fold(Context.getConstantExprFSub(LHS, RHS)); + return Fold(ConstantExpr::getFSub(LHS, RHS)); } Constant *CreateMul(Constant *LHS, Constant *RHS) const { - return Fold(Context.getConstantExprMul(LHS, RHS)); + return Fold(ConstantExpr::getMul(LHS, RHS)); } Constant *CreateFMul(Constant *LHS, Constant *RHS) const { - return Fold(Context.getConstantExprFMul(LHS, RHS)); + return Fold(ConstantExpr::getFMul(LHS, RHS)); } Constant *CreateUDiv(Constant *LHS, Constant *RHS) const { - return Fold(Context.getConstantExprUDiv(LHS, RHS)); + return Fold(ConstantExpr::getUDiv(LHS, RHS)); } Constant *CreateSDiv(Constant *LHS, Constant *RHS) const { - return Fold(Context.getConstantExprSDiv(LHS, RHS)); + return Fold(ConstantExpr::getSDiv(LHS, RHS)); } Constant *CreateFDiv(Constant *LHS, Constant *RHS) const { - return Fold(Context.getConstantExprFDiv(LHS, RHS)); + return Fold(ConstantExpr::getFDiv(LHS, RHS)); } Constant *CreateURem(Constant *LHS, Constant *RHS) const { - return Fold(Context.getConstantExprURem(LHS, RHS)); + return Fold(ConstantExpr::getURem(LHS, RHS)); } Constant *CreateSRem(Constant *LHS, Constant *RHS) const { - return Fold(Context.getConstantExprSRem(LHS, RHS)); + return Fold(ConstantExpr::getSRem(LHS, RHS)); } Constant *CreateFRem(Constant *LHS, Constant *RHS) const { - return Fold(Context.getConstantExprFRem(LHS, RHS)); + return Fold(ConstantExpr::getFRem(LHS, RHS)); } Constant *CreateShl(Constant *LHS, Constant *RHS) const { - return Fold(Context.getConstantExprShl(LHS, RHS)); + return Fold(ConstantExpr::getShl(LHS, RHS)); } Constant *CreateLShr(Constant *LHS, Constant *RHS) const { - return Fold(Context.getConstantExprLShr(LHS, RHS)); + return Fold(ConstantExpr::getLShr(LHS, RHS)); } Constant *CreateAShr(Constant *LHS, Constant *RHS) const { - return Fold(Context.getConstantExprAShr(LHS, RHS)); + return Fold(ConstantExpr::getAShr(LHS, RHS)); } Constant *CreateAnd(Constant *LHS, Constant *RHS) const { - return Fold(Context.getConstantExprAnd(LHS, RHS)); + return Fold(ConstantExpr::getAnd(LHS, RHS)); } Constant *CreateOr(Constant *LHS, Constant *RHS) const { - return Fold(Context.getConstantExprOr(LHS, RHS)); + return Fold(ConstantExpr::getOr(LHS, RHS)); } Constant *CreateXor(Constant *LHS, Constant *RHS) const { - return Fold(Context.getConstantExprXor(LHS, RHS)); + return Fold(ConstantExpr::getXor(LHS, RHS)); } Constant *CreateBinOp(Instruction::BinaryOps Opc, Constant *LHS, Constant *RHS) const { - return Fold(Context.getConstantExpr(Opc, LHS, RHS)); + return Fold(ConstantExpr::get(Opc, LHS, RHS)); } //===--------------------------------------------------------------------===// @@ -113,13 +113,13 @@ //===--------------------------------------------------------------------===// Constant *CreateNeg(Constant *C) const { - return Fold(Context.getConstantExprNeg(C)); + return Fold(ConstantExpr::getNeg(C)); } Constant *CreateFNeg(Constant *C) const { - return Fold(Context.getConstantExprFNeg(C)); + return Fold(ConstantExpr::getFNeg(C)); } Constant *CreateNot(Constant *C) const { - return Fold(Context.getConstantExprNot(C)); + return Fold(ConstantExpr::getNot(C)); } //===--------------------------------------------------------------------===// @@ -128,11 +128,11 @@ Constant *CreateGetElementPtr(Constant *C, Constant* const *IdxList, unsigned NumIdx) const { - return Fold(Context.getConstantExprGetElementPtr(C, IdxList, NumIdx)); + return Fold(ConstantExpr::getGetElementPtr(C, IdxList, NumIdx)); } Constant *CreateGetElementPtr(Constant *C, Value* const *IdxList, unsigned NumIdx) const { - return Fold(Context.getConstantExprGetElementPtr(C, IdxList, NumIdx)); + return Fold(ConstantExpr::getGetElementPtr(C, IdxList, NumIdx)); } //===--------------------------------------------------------------------===// @@ -143,13 +143,13 @@ const Type *DestTy) const { if (C->getType() == DestTy) return C; // avoid calling Fold - return Fold(Context.getConstantExprCast(Op, C, DestTy)); + return Fold(ConstantExpr::getCast(Op, C, DestTy)); } Constant *CreateIntCast(Constant *C, const Type *DestTy, bool isSigned) const { if (C->getType() == DestTy) return C; // avoid calling Fold - return Fold(Context.getConstantExprIntegerCast(C, DestTy, isSigned)); + return Fold(ConstantExpr::getIntegerCast(C, DestTy, isSigned)); } Constant *CreateBitCast(Constant *C, const Type *DestTy) const { @@ -164,7 +164,7 @@ Constant *CreateTruncOrBitCast(Constant *C, const Type *DestTy) const { if (C->getType() == DestTy) return C; // avoid calling Fold - return Fold(Context.getConstantExprTruncOrBitCast(C, DestTy)); + return Fold(ConstantExpr::getTruncOrBitCast(C, DestTy)); } //===--------------------------------------------------------------------===// @@ -173,11 +173,11 @@ Constant *CreateICmp(CmpInst::Predicate P, Constant *LHS, Constant *RHS) const { - return Fold(Context.getConstantExprCompare(P, LHS, RHS)); + return Fold(ConstantExpr::getCompare(P, LHS, RHS)); } Constant *CreateFCmp(CmpInst::Predicate P, Constant *LHS, Constant *RHS) const { - return Fold(Context.getConstantExprCompare(P, LHS, RHS)); + return Fold(ConstantExpr::getCompare(P, LHS, RHS)); } //===--------------------------------------------------------------------===// @@ -185,31 +185,31 @@ //===--------------------------------------------------------------------===// Constant *CreateSelect(Constant *C, Constant *True, Constant *False) const { - return Fold(Context.getConstantExprSelect(C, True, False)); + return Fold(ConstantExpr::getSelect(C, True, False)); } Constant *CreateExtractElement(Constant *Vec, Constant *Idx) const { - return Fold(Context.getConstantExprExtractElement(Vec, Idx)); + return Fold(ConstantExpr::getExtractElement(Vec, Idx)); } Constant *CreateInsertElement(Constant *Vec, Constant *NewElt, Constant *Idx) const { - return Fold(Context.getConstantExprInsertElement(Vec, NewElt, Idx)); + return Fold(ConstantExpr::getInsertElement(Vec, NewElt, Idx)); } Constant *CreateShuffleVector(Constant *V1, Constant *V2, Constant *Mask) const { - return Fold(Context.getConstantExprShuffleVector(V1, V2, Mask)); + return Fold(ConstantExpr::getShuffleVector(V1, V2, Mask)); } Constant *CreateExtractValue(Constant *Agg, const unsigned *IdxList, unsigned NumIdx) const { - return Fold(Context.getConstantExprExtractValue(Agg, IdxList, NumIdx)); + return Fold(ConstantExpr::getExtractValue(Agg, IdxList, NumIdx)); } Constant *CreateInsertValue(Constant *Agg, Constant *Val, const unsigned *IdxList, unsigned NumIdx) const { - return Fold(Context.getConstantExprInsertValue(Agg, Val, IdxList, NumIdx)); + return Fold(ConstantExpr::getInsertValue(Agg, Val, IdxList, NumIdx)); } }; Modified: llvm/trunk/lib/Analysis/BasicAliasAnalysis.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/BasicAliasAnalysis.cpp?rev=77494&r1=77493&r2=77494&view=diff ============================================================================== --- llvm/trunk/lib/Analysis/BasicAliasAnalysis.cpp (original) +++ llvm/trunk/lib/Analysis/BasicAliasAnalysis.cpp Wed Jul 29 13:55:55 2009 @@ -505,9 +505,9 @@ if (Constant *C2 = dyn_cast(V2)) { // Sign extend the constants to long types, if necessary if (C1->getType() != Type::Int64Ty) - C1 = Context.getConstantExprSExt(C1, Type::Int64Ty); + C1 = ConstantExpr::getSExt(C1, Type::Int64Ty); if (C2->getType() != Type::Int64Ty) - C2 = Context.getConstantExprSExt(C2, Type::Int64Ty); + C2 = ConstantExpr::getSExt(C2, Type::Int64Ty); return C1 == C2; } return false; @@ -603,9 +603,9 @@ if (G1OC->getType() != G2OC->getType()) { // Sign extend both operands to long. if (G1OC->getType() != Type::Int64Ty) - G1OC = Context.getConstantExprSExt(G1OC, Type::Int64Ty); + G1OC = ConstantExpr::getSExt(G1OC, Type::Int64Ty); if (G2OC->getType() != Type::Int64Ty) - G2OC = Context.getConstantExprSExt(G2OC, Type::Int64Ty); + G2OC = ConstantExpr::getSExt(G2OC, Type::Int64Ty); GEP1Ops[FirstConstantOper] = G1OC; GEP2Ops[FirstConstantOper] = G2OC; } Modified: llvm/trunk/lib/Analysis/ConstantFolding.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/ConstantFolding.cpp?rev=77494&r1=77493&r2=77494&view=diff ============================================================================== --- llvm/trunk/lib/Analysis/ConstantFolding.cpp (original) +++ llvm/trunk/lib/Analysis/ConstantFolding.cpp Wed Jul 29 13:55:55 2009 @@ -152,7 +152,7 @@ uint64_t Offset = TD->getIndexedOffset(Ptr->getType(), (Value**)Ops+1, NumOps-1); Constant *C = ConstantInt::get(TD->getIntPtrType(), Offset+BasePtr); - return Context.getConstantExprIntToPtr(C, ResultTy); + return ConstantExpr::getIntToPtr(C, ResultTy); } /// FoldBitCast - Constant fold bitcast, symbolically evaluating it with @@ -191,7 +191,7 @@ if (!C) return 0; // Finally, VMCore can handle this now that #elts line up. - return Context.getConstantExprBitCast(C, DestTy); + return ConstantExpr::getBitCast(C, DestTy); } // Okay, we know the destination is integer, if the input is FP, convert @@ -201,7 +201,7 @@ const Type *SrcIVTy = Context.getVectorType( Context.getIntegerType(FPWidth), NumSrcElt); // Ask VMCore to do the conversion now that #elts line up. - C = Context.getConstantExprBitCast(C, SrcIVTy); + C = ConstantExpr::getBitCast(C, SrcIVTy); CV = dyn_cast(C); if (!CV) return 0; // If VMCore wasn't able to fold it, bail out. } @@ -228,15 +228,15 @@ if (!Src) return 0; // Reject constantexpr elements. // Zero extend the element to the right size. - Src = Context.getConstantExprZExt(Src, Elt->getType()); + Src = ConstantExpr::getZExt(Src, Elt->getType()); // Shift it to the right place, depending on endianness. - Src = Context.getConstantExprShl(Src, + Src = ConstantExpr::getShl(Src, ConstantInt::get(Src->getType(), ShiftAmt)); ShiftAmt += isLittleEndian ? SrcBitSize : -SrcBitSize; // Mix it in. - Elt = Context.getConstantExprOr(Elt, Src); + Elt = ConstantExpr::getOr(Elt, Src); } Result.push_back(Elt); } @@ -254,12 +254,12 @@ for (unsigned j = 0; j != Ratio; ++j) { // Shift the piece of the value into the right place, depending on // endianness. - Constant *Elt = Context.getConstantExprLShr(Src, + Constant *Elt = ConstantExpr::getLShr(Src, ConstantInt::get(Src->getType(), ShiftAmt)); ShiftAmt += isLittleEndian ? DstBitSize : -DstBitSize; // Truncate and remember this piece. - Result.push_back(Context.getConstantExprTrunc(Elt, DstEltTy)); + Result.push_back(ConstantExpr::getTrunc(Elt, DstEltTy)); } } } @@ -354,7 +354,7 @@ Context)) return C; - return Context.getConstantExpr(Opcode, Ops[0], Ops[1]); + return ConstantExpr::get(Opcode, Ops[0], Ops[1]); } switch (Opcode) { @@ -378,13 +378,13 @@ Constant *Mask = ConstantInt::get(Context, APInt::getLowBitsSet(InWidth, TD->getPointerSizeInBits())); - Input = Context.getConstantExprAnd(Input, Mask); + Input = ConstantExpr::getAnd(Input, Mask); } // Do a zext or trunc to get to the dest size. - return Context.getConstantExprIntegerCast(Input, DestTy, false); + return ConstantExpr::getIntegerCast(Input, DestTy, false); } } - return Context.getConstantExprCast(Opcode, Ops[0], DestTy); + return ConstantExpr::getCast(Opcode, Ops[0], DestTy); case Instruction::IntToPtr: // If the input is a ptrtoint, turn the pair into a ptr to ptr bitcast if // the int size is >= the ptr size. This requires knowing the width of a @@ -396,7 +396,7 @@ if (CE->getOpcode() == Instruction::PtrToInt) { Constant *Input = CE->getOperand(0); Constant *C = FoldBitCast(Input, DestTy, *TD, Context); - return C ? C : Context.getConstantExprBitCast(Input, DestTy); + return C ? C : ConstantExpr::getBitCast(Input, DestTy); } // If there's a constant offset added to the integer value before // it is casted back to a pointer, see if the expression can be @@ -423,14 +423,14 @@ ConstantInt::get(Context, ElemIdx) }; return - Context.getConstantExprGetElementPtr(GV, &Index[0], 2); + ConstantExpr::getGetElementPtr(GV, &Index[0], 2); } } } } } } - return Context.getConstantExprCast(Opcode, Ops[0], DestTy); + return ConstantExpr::getCast(Opcode, Ops[0], DestTy); case Instruction::Trunc: case Instruction::ZExt: case Instruction::SExt: @@ -440,25 +440,25 @@ case Instruction::SIToFP: case Instruction::FPToUI: case Instruction::FPToSI: - return Context.getConstantExprCast(Opcode, Ops[0], DestTy); + return ConstantExpr::getCast(Opcode, Ops[0], DestTy); case Instruction::BitCast: if (TD) if (Constant *C = FoldBitCast(Ops[0], DestTy, *TD, Context)) return C; - return Context.getConstantExprBitCast(Ops[0], DestTy); + return ConstantExpr::getBitCast(Ops[0], DestTy); case Instruction::Select: - return Context.getConstantExprSelect(Ops[0], Ops[1], Ops[2]); + return ConstantExpr::getSelect(Ops[0], Ops[1], Ops[2]); case Instruction::ExtractElement: - return Context.getConstantExprExtractElement(Ops[0], Ops[1]); + return ConstantExpr::getExtractElement(Ops[0], Ops[1]); case Instruction::InsertElement: - return Context.getConstantExprInsertElement(Ops[0], Ops[1], Ops[2]); + return ConstantExpr::getInsertElement(Ops[0], Ops[1], Ops[2]); case Instruction::ShuffleVector: - return Context.getConstantExprShuffleVector(Ops[0], Ops[1], Ops[2]); + return ConstantExpr::getShuffleVector(Ops[0], Ops[1], Ops[2]); case Instruction::GetElementPtr: if (Constant *C = SymbolicallyEvaluateGEP(Ops, NumOps, DestTy, Context, TD)) return C; - return Context.getConstantExprGetElementPtr(Ops[0], Ops+1, NumOps-1); + return ConstantExpr::getGetElementPtr(Ops[0], Ops+1, NumOps-1); } } @@ -484,7 +484,7 @@ if (CE0->getOpcode() == Instruction::IntToPtr) { // Convert the integer value to the right size to ensure we get the // proper extension or truncation. - Constant *C = Context.getConstantExprIntegerCast(CE0->getOperand(0), + Constant *C = ConstantExpr::getIntegerCast(CE0->getOperand(0), IntPtrTy, false); Constant *NewOps[] = { C, Context.getNullValue(C->getType()) }; return ConstantFoldCompareInstOperands(Predicate, NewOps, 2, @@ -510,9 +510,9 @@ if (CE0->getOpcode() == Instruction::IntToPtr) { // Convert the integer value to the right size to ensure we get the // proper extension or truncation. - Constant *C0 = Context.getConstantExprIntegerCast(CE0->getOperand(0), + Constant *C0 = ConstantExpr::getIntegerCast(CE0->getOperand(0), IntPtrTy, false); - Constant *C1 = Context.getConstantExprIntegerCast(CE1->getOperand(0), + Constant *C1 = ConstantExpr::getIntegerCast(CE1->getOperand(0), IntPtrTy, false); Constant *NewOps[] = { C0, C1 }; return ConstantFoldCompareInstOperands(Predicate, NewOps, 2, @@ -533,7 +533,7 @@ } } } - return Context.getConstantExprCompare(Predicate, Ops[0], Ops[1]); + return ConstantExpr::getCompare(Predicate, Ops[0], Ops[1]); } Modified: llvm/trunk/lib/Analysis/DebugInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/DebugInfo.cpp?rev=77494&r1=77493&r2=77494&view=diff ============================================================================== --- llvm/trunk/lib/Analysis/DebugInfo.cpp (original) +++ llvm/trunk/lib/Analysis/DebugInfo.cpp Wed Jul 29 13:55:55 2009 @@ -477,7 +477,7 @@ /// This is only valid when the descriptor is non-null. Constant *DIFactory::getCastToEmpty(DIDescriptor D) { if (D.isNull()) return VMContext.getNullValue(EmptyStructPtr); - return VMContext.getConstantExprBitCast(D.getGV(), EmptyStructPtr); + return ConstantExpr::getBitCast(D.getGV(), EmptyStructPtr); } Constant *DIFactory::GetTagConstant(unsigned TAG) { @@ -507,7 +507,7 @@ GlobalVariable::InternalLinkage, ConstStr, ".str"); StrGV->setSection("llvm.metadata"); - return Slot = VMContext.getConstantExprBitCast(StrGV, DestTy); + return Slot = ConstantExpr::getBitCast(StrGV, DestTy); } //===----------------------------------------------------------------------===// @@ -779,7 +779,7 @@ getCastToEmpty(Type), ConstantInt::get(Type::Int1Ty, isLocalToUnit), ConstantInt::get(Type::Int1Ty, isDefinition), - VMContext.getConstantExprBitCast(Val, EmptyStructPtr) + ConstantExpr::getBitCast(Val, EmptyStructPtr) }; Constant *Init = ConstantStruct::get(Elts, sizeof(Elts)/sizeof(Elts[0])); Modified: llvm/trunk/lib/Analysis/ScalarEvolution.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/ScalarEvolution.cpp?rev=77494&r1=77493&r2=77494&view=diff ============================================================================== --- llvm/trunk/lib/Analysis/ScalarEvolution.cpp (original) +++ llvm/trunk/lib/Analysis/ScalarEvolution.cpp Wed Jul 29 13:55:55 2009 @@ -1694,7 +1694,7 @@ if (const SCEVConstant *LHSC = dyn_cast(LHS)) { Constant *LHSCV = LHSC->getValue(); Constant *RHSCV = RHSC->getValue(); - return getConstant(cast(getContext().getConstantExprUDiv(LHSCV, + return getConstant(cast(ConstantExpr::getUDiv(LHSCV, RHSCV))); } } @@ -2095,7 +2095,7 @@ const SCEV *ScalarEvolution::getNegativeSCEV(const SCEV *V) { if (const SCEVConstant *VC = dyn_cast(V)) return getConstant( - cast(getContext().getConstantExprNeg(VC->getValue()))); + cast(ConstantExpr::getNeg(VC->getValue()))); const Type *Ty = V->getType(); Ty = getEffectiveSCEVType(Ty); @@ -2107,7 +2107,7 @@ const SCEV *ScalarEvolution::getNotSCEV(const SCEV *V) { if (const SCEVConstant *VC = dyn_cast(V)) return getConstant( - cast(getContext().getConstantExprNot(VC->getValue()))); + cast(ConstantExpr::getNot(VC->getValue()))); const Type *Ty = V->getType(); Ty = getEffectiveSCEVType(Ty); @@ -4130,7 +4130,7 @@ #endif // Pick the smallest positive root value. if (ConstantInt *CB = - dyn_cast(getContext().getConstantExprICmp(ICmpInst::ICMP_ULT, + dyn_cast(ConstantExpr::getICmp(ICmpInst::ICMP_ULT, R1->getValue(), R2->getValue()))) { if (CB->getZExtValue() == false) std::swap(R1, R2); // R1 is the minimum root now. @@ -4856,8 +4856,7 @@ if (R1) { // Pick the smallest positive root value. if (ConstantInt *CB = - dyn_cast( - SE.getContext().getConstantExprICmp(ICmpInst::ICMP_ULT, + dyn_cast(ConstantExpr::getICmp(ICmpInst::ICMP_ULT, R1->getValue(), R2->getValue()))) { if (CB->getZExtValue() == false) std::swap(R1, R2); // R1 is the minimum root now. Modified: llvm/trunk/lib/Analysis/ScalarEvolutionExpander.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/ScalarEvolutionExpander.cpp?rev=77494&r1=77493&r2=77494&view=diff ============================================================================== --- llvm/trunk/lib/Analysis/ScalarEvolutionExpander.cpp (original) +++ llvm/trunk/lib/Analysis/ScalarEvolutionExpander.cpp Wed Jul 29 13:55:55 2009 @@ -55,7 +55,7 @@ // FIXME: keep track of the cast instruction. if (Constant *C = dyn_cast(V)) - return getContext().getConstantExprCast(Op, C, Ty); + return ConstantExpr::getCast(Op, C, Ty); if (Argument *A = dyn_cast(V)) { // Check to see if there is already a cast! @@ -126,7 +126,7 @@ // Fold a binop with constant operands. if (Constant *CLHS = dyn_cast(LHS)) if (Constant *CRHS = dyn_cast(RHS)) - return getContext().getConstantExpr(Opcode, CLHS, CRHS); + return ConstantExpr::get(Opcode, CLHS, CRHS); // Do a quick scan to see if we have this binop nearby. If so, reuse it. unsigned ScanLimit = 6; @@ -327,7 +327,7 @@ // Fold a GEP with constant operands. if (Constant *CLHS = dyn_cast(V)) if (Constant *CRHS = dyn_cast(Idx)) - return getContext().getConstantExprGetElementPtr(CLHS, &CRHS, 1); + return ConstantExpr::getGetElementPtr(CLHS, &CRHS, 1); // Do a quick scan to see if we have this GEP nearby. If so, reuse it. unsigned ScanLimit = 6; Modified: llvm/trunk/lib/AsmParser/LLParser.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/AsmParser/LLParser.cpp?rev=77494&r1=77493&r2=77494&view=diff ============================================================================== --- llvm/trunk/lib/AsmParser/LLParser.cpp (original) +++ llvm/trunk/lib/AsmParser/LLParser.cpp Wed Jul 29 13:55:55 2009 @@ -1899,7 +1899,7 @@ return Error(ID.Loc, "invalid cast opcode for cast from '" + SrcVal->getType()->getDescription() + "' to '" + DestTy->getDescription() + "'"); - ID.ConstantVal = Context.getConstantExprCast((Instruction::CastOps)Opc, + ID.ConstantVal = ConstantExpr::getCast((Instruction::CastOps)Opc, SrcVal, DestTy); ID.Kind = ValID::t_Constant; return false; @@ -1919,7 +1919,7 @@ Indices.end())) return Error(ID.Loc, "invalid indices for extractvalue"); ID.ConstantVal = - Context.getConstantExprExtractValue(Val, Indices.data(), Indices.size()); + ConstantExpr::getExtractValue(Val, Indices.data(), Indices.size()); ID.Kind = ValID::t_Constant; return false; } @@ -1939,7 +1939,7 @@ if (!ExtractValueInst::getIndexedType(Val0->getType(), Indices.begin(), Indices.end())) return Error(ID.Loc, "invalid indices for insertvalue"); - ID.ConstantVal = Context.getConstantExprInsertValue(Val0, Val1, + ID.ConstantVal = ConstantExpr::getInsertValue(Val0, Val1, Indices.data(), Indices.size()); ID.Kind = ValID::t_Constant; return false; @@ -1965,13 +1965,13 @@ if (Opc == Instruction::FCmp) { if (!Val0->getType()->isFPOrFPVector()) return Error(ID.Loc, "fcmp requires floating point operands"); - ID.ConstantVal = Context.getConstantExprFCmp(Pred, Val0, Val1); + ID.ConstantVal = ConstantExpr::getFCmp(Pred, Val0, Val1); } else { assert(Opc == Instruction::ICmp && "Unexpected opcode for CmpInst!"); if (!Val0->getType()->isIntOrIntVector() && !isa(Val0->getType())) return Error(ID.Loc, "icmp requires pointer or integer operands"); - ID.ConstantVal = Context.getConstantExprICmp(Pred, Val0, Val1); + ID.ConstantVal = ConstantExpr::getICmp(Pred, Val0, Val1); } ID.Kind = ValID::t_Constant; return false; @@ -2030,7 +2030,7 @@ if (!Val0->getType()->isIntOrIntVector() && !Val0->getType()->isFPOrFPVector()) return Error(ID.Loc,"constexpr requires integer, fp, or vector operands"); - Constant *C = Context.getConstantExpr(Opc, Val0, Val1); + Constant *C = ConstantExpr::get(Opc, Val0, Val1); if (NUW) cast(C)->setHasNoUnsignedOverflow(true); if (NSW) @@ -2063,7 +2063,7 @@ if (!Val0->getType()->isIntOrIntVector()) return Error(ID.Loc, "constexpr requires integer or integer vector operands"); - ID.ConstantVal = Context.getConstantExpr(Opc, Val0, Val1); + ID.ConstantVal = ConstantExpr::get(Opc, Val0, Val1); ID.Kind = ValID::t_Constant; return false; } @@ -2092,7 +2092,7 @@ (Value**)(Elts.data() + 1), Elts.size() - 1)) return Error(ID.Loc, "invalid indices for getelementptr"); - ID.ConstantVal = Context.getConstantExprGetElementPtr(Elts[0], + ID.ConstantVal = ConstantExpr::getGetElementPtr(Elts[0], Elts.data() + 1, Elts.size() - 1); if (InBounds) cast(ID.ConstantVal)->setIsInBounds(true); @@ -2102,20 +2102,20 @@ if (const char *Reason = SelectInst::areInvalidOperands(Elts[0], Elts[1], Elts[2])) return Error(ID.Loc, Reason); - ID.ConstantVal = Context.getConstantExprSelect(Elts[0], Elts[1], Elts[2]); + ID.ConstantVal = ConstantExpr::getSelect(Elts[0], Elts[1], Elts[2]); } else if (Opc == Instruction::ShuffleVector) { if (Elts.size() != 3) return Error(ID.Loc, "expected three operands to shufflevector"); if (!ShuffleVectorInst::isValidOperands(Elts[0], Elts[1], Elts[2])) return Error(ID.Loc, "invalid operands to shufflevector"); ID.ConstantVal = - Context.getConstantExprShuffleVector(Elts[0], Elts[1],Elts[2]); + ConstantExpr::getShuffleVector(Elts[0], Elts[1],Elts[2]); } else if (Opc == Instruction::ExtractElement) { if (Elts.size() != 2) return Error(ID.Loc, "expected two operands to extractelement"); if (!ExtractElementInst::isValidOperands(Elts[0], Elts[1])) return Error(ID.Loc, "invalid extractelement operands"); - ID.ConstantVal = Context.getConstantExprExtractElement(Elts[0], Elts[1]); + ID.ConstantVal = ConstantExpr::getExtractElement(Elts[0], Elts[1]); } else { assert(Opc == Instruction::InsertElement && "Unknown opcode"); if (Elts.size() != 3) @@ -2123,7 +2123,7 @@ if (!InsertElementInst::isValidOperands(Elts[0], Elts[1], Elts[2])) return Error(ID.Loc, "invalid insertelement operands"); ID.ConstantVal = - Context.getConstantExprInsertElement(Elts[0], Elts[1],Elts[2]); + ConstantExpr::getInsertElement(Elts[0], Elts[1],Elts[2]); } ID.Kind = ValID::t_Constant; Modified: llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp?rev=77494&r1=77493&r2=77494&view=diff ============================================================================== --- llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp (original) +++ llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp Wed Jul 29 13:55:55 2009 @@ -978,7 +978,7 @@ } else { Constant *LHS = ValueList.getConstantFwdRef(Record[1], CurTy); Constant *RHS = ValueList.getConstantFwdRef(Record[2], CurTy); - V = Context.getConstantExpr(Opc, LHS, RHS); + V = ConstantExpr::get(Opc, LHS, RHS); } if (Record.size() >= 4) SetOptimizationFlags(V, Record[3]); @@ -993,7 +993,7 @@ const Type *OpTy = getTypeByID(Record[1]); if (!OpTy) return Error("Invalid CE_CAST record"); Constant *Op = ValueList.getConstantFwdRef(Record[2], OpTy); - V = Context.getConstantExprCast(Opc, Op, CurTy); + V = ConstantExpr::getCast(Opc, Op, CurTy); } break; } @@ -1006,7 +1006,7 @@ if (!ElTy) return Error("Invalid CE_GEP record"); Elts.push_back(ValueList.getConstantFwdRef(Record[i+1], ElTy)); } - V = Context.getConstantExprGetElementPtr(Elts[0], &Elts[1], + V = ConstantExpr::getGetElementPtr(Elts[0], &Elts[1], Elts.size()-1); if (BitCode == bitc::CST_CODE_CE_INBOUNDS_GEP) cast(V)->setIsInBounds(true); @@ -1014,7 +1014,7 @@ } case bitc::CST_CODE_CE_SELECT: // CE_SELECT: [opval#, opval#, opval#] if (Record.size() < 3) return Error("Invalid CE_SELECT record"); - V = Context.getConstantExprSelect(ValueList.getConstantFwdRef(Record[0], + V = ConstantExpr::getSelect(ValueList.getConstantFwdRef(Record[0], Type::Int1Ty), ValueList.getConstantFwdRef(Record[1],CurTy), ValueList.getConstantFwdRef(Record[2],CurTy)); @@ -1026,7 +1026,7 @@ if (OpTy == 0) return Error("Invalid CE_EXTRACTELT record"); Constant *Op0 = ValueList.getConstantFwdRef(Record[1], OpTy); Constant *Op1 = ValueList.getConstantFwdRef(Record[2], Type::Int32Ty); - V = Context.getConstantExprExtractElement(Op0, Op1); + V = ConstantExpr::getExtractElement(Op0, Op1); break; } case bitc::CST_CODE_CE_INSERTELT: { // CE_INSERTELT: [opval, opval, opval] @@ -1037,7 +1037,7 @@ Constant *Op1 = ValueList.getConstantFwdRef(Record[1], OpTy->getElementType()); Constant *Op2 = ValueList.getConstantFwdRef(Record[2], Type::Int32Ty); - V = Context.getConstantExprInsertElement(Op0, Op1, Op2); + V = ConstantExpr::getInsertElement(Op0, Op1, Op2); break; } case bitc::CST_CODE_CE_SHUFFLEVEC: { // CE_SHUFFLEVEC: [opval, opval, opval] @@ -1049,7 +1049,7 @@ const Type *ShufTy = Context.getVectorType(Type::Int32Ty, OpTy->getNumElements()); Constant *Op2 = ValueList.getConstantFwdRef(Record[2], ShufTy); - V = Context.getConstantExprShuffleVector(Op0, Op1, Op2); + V = ConstantExpr::getShuffleVector(Op0, Op1, Op2); break; } case bitc::CST_CODE_CE_SHUFVEC_EX: { // [opty, opval, opval, opval] @@ -1062,7 +1062,7 @@ const Type *ShufTy = Context.getVectorType(Type::Int32Ty, RTy->getNumElements()); Constant *Op2 = ValueList.getConstantFwdRef(Record[3], ShufTy); - V = Context.getConstantExprShuffleVector(Op0, Op1, Op2); + V = ConstantExpr::getShuffleVector(Op0, Op1, Op2); break; } case bitc::CST_CODE_CE_CMP: { // CE_CMP: [opty, opval, opval, pred] @@ -1073,9 +1073,9 @@ Constant *Op1 = ValueList.getConstantFwdRef(Record[2], OpTy); if (OpTy->isFloatingPoint()) - V = Context.getConstantExprFCmp(Record[3], Op0, Op1); + V = ConstantExpr::getFCmp(Record[3], Op0, Op1); else - V = Context.getConstantExprICmp(Record[3], Op0, Op1); + V = ConstantExpr::getICmp(Record[3], Op0, Op1); break; } case bitc::CST_CODE_INLINEASM: { Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp?rev=77494&r1=77493&r2=77494&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Wed Jul 29 13:55:55 2009 @@ -363,7 +363,7 @@ TLI.isLoadExtLegal(ISD::EXTLOAD, SVT) && TLI.ShouldShrinkFPConstant(OrigVT)) { const Type *SType = SVT.getTypeForMVT(*DAG.getContext()); - LLVMC = cast(Context->getConstantExprFPTrunc(LLVMC, SType)); + LLVMC = cast(ConstantExpr::getFPTrunc(LLVMC, SType)); VT = SVT; Extend = true; } Modified: llvm/trunk/lib/CodeGen/ShadowStackGC.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/ShadowStackGC.cpp?rev=77494&r1=77493&r2=77494&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/ShadowStackGC.cpp (original) +++ llvm/trunk/lib/CodeGen/ShadowStackGC.cpp Wed Jul 29 13:55:55 2009 @@ -238,7 +238,7 @@ Constant *GEPIndices[2] = { ConstantInt::get(Type::Int32Ty, 0), ConstantInt::get(Type::Int32Ty, 0) }; - return Context.getConstantExprGetElementPtr(GV, GEPIndices, 2); + return ConstantExpr::getGetElementPtr(GV, GEPIndices, 2); } const Type* ShadowStackGC::GetConcreteStackEntryType(Function &F) { Modified: llvm/trunk/lib/ExecutionEngine/JIT/JIT.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/JIT/JIT.cpp?rev=77494&r1=77493&r2=77494&view=diff ============================================================================== --- llvm/trunk/lib/ExecutionEngine/JIT/JIT.cpp (original) +++ llvm/trunk/lib/ExecutionEngine/JIT/JIT.cpp Wed Jul 29 13:55:55 2009 @@ -507,7 +507,7 @@ else C = ConstantInt::get(Type::Int64Ty, (intptr_t)ArgPtr); // Cast the integer to pointer - C = Context.getConstantExprIntToPtr(C, ArgTy); + C = ConstantExpr::getIntToPtr(C, ArgTy); break; } Args.push_back(C); Modified: llvm/trunk/lib/Linker/LinkModules.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Linker/LinkModules.cpp?rev=77494&r1=77493&r2=77494&view=diff ============================================================================== --- llvm/trunk/lib/Linker/LinkModules.cpp (original) +++ llvm/trunk/lib/Linker/LinkModules.cpp Wed Jul 29 13:55:55 2009 @@ -641,7 +641,7 @@ // Propagate alignment, section, and visibility info. CopyGVAttributes(NewDGV, SGV); - DGV->replaceAllUsesWith(Context.getConstantExprBitCast(NewDGV, + DGV->replaceAllUsesWith(ConstantExpr::getBitCast(NewDGV, DGV->getType())); // DGV will conflict with NewDGV because they both had the same @@ -688,7 +688,7 @@ DGV->setLinkage(NewLinkage); // Make sure to remember this mapping... - ValueMap[SGV] = Context.getConstantExprBitCast(DGV, SGV->getType()); + ValueMap[SGV] = ConstantExpr::getBitCast(DGV, SGV->getType()); } return false; } @@ -798,7 +798,7 @@ // Any uses of DGV need to change to NewGA, with cast, if needed. if (SGA->getType() != DGVar->getType()) - DGVar->replaceAllUsesWith(Context.getConstantExprBitCast(NewGA, + DGVar->replaceAllUsesWith(ConstantExpr::getBitCast(NewGA, DGVar->getType())); else DGVar->replaceAllUsesWith(NewGA); @@ -827,7 +827,7 @@ // Any uses of DF need to change to NewGA, with cast, if needed. if (SGA->getType() != DF->getType()) - DF->replaceAllUsesWith(Context.getConstantExprBitCast(NewGA, + DF->replaceAllUsesWith(ConstantExpr::getBitCast(NewGA, DF->getType())); else DF->replaceAllUsesWith(NewGA); @@ -996,7 +996,7 @@ CopyGVAttributes(NewDF, SF); // Any uses of DF need to change to NewDF, with cast - DGV->replaceAllUsesWith(Context.getConstantExprBitCast(NewDF, + DGV->replaceAllUsesWith(ConstantExpr::getBitCast(NewDF, DGV->getType())); // DF will conflict with NewDF because they both had the same. We must @@ -1035,7 +1035,7 @@ DGV->setLinkage(NewLinkage); // Make sure to remember this mapping. - ValueMap[SF] = Context.getConstantExprBitCast(DGV, SF->getType()); + ValueMap[SF] = ConstantExpr::getBitCast(DGV, SF->getType()); } return false; } @@ -1194,9 +1194,9 @@ // FIXME: This should rewrite simple/straight-forward uses such as // getelementptr instructions to not use the Cast! - G1->replaceAllUsesWith(Context.getConstantExprBitCast(NG, + G1->replaceAllUsesWith(ConstantExpr::getBitCast(NG, G1->getType())); - G2->replaceAllUsesWith(Context.getConstantExprBitCast(NG, + G2->replaceAllUsesWith(ConstantExpr::getBitCast(NG, G2->getType())); // Remove the two globals from the module now... Modified: llvm/trunk/lib/Transforms/IPO/ExtractGV.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/ExtractGV.cpp?rev=77494&r1=77493&r2=77494&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/IPO/ExtractGV.cpp (original) +++ llvm/trunk/lib/Transforms/IPO/ExtractGV.cpp Wed Jul 29 13:55:55 2009 @@ -107,7 +107,7 @@ for (std::vector::iterator GI = Named.begin(), GE = Named.end(); GI != GE; ++GI) { (*GI)->setLinkage(GlobalValue::ExternalLinkage); - AUGs.push_back(Context.getConstantExprBitCast(*GI, SBP)); + AUGs.push_back(ConstantExpr::getBitCast(*GI, SBP)); } ArrayType *AT = Context.getArrayType(SBP, AUGs.size()); Constant *Init = ConstantArray::get(AT, AUGs); Modified: llvm/trunk/lib/Transforms/IPO/GlobalOpt.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/GlobalOpt.cpp?rev=77494&r1=77493&r2=77494&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/IPO/GlobalOpt.cpp (original) +++ llvm/trunk/lib/Transforms/IPO/GlobalOpt.cpp Wed Jul 29 13:55:55 2009 @@ -576,7 +576,7 @@ Idxs.push_back(NullInt); for (unsigned i = 3, e = CE->getNumOperands(); i != e; ++i) Idxs.push_back(CE->getOperand(i)); - NewPtr = Context.getConstantExprGetElementPtr(cast(NewPtr), + NewPtr = ConstantExpr::getGetElementPtr(cast(NewPtr), &Idxs[0], Idxs.size()); } else { GetElementPtrInst *GEPI = cast(GEP); @@ -708,7 +708,7 @@ } } else if (CastInst *CI = dyn_cast(I)) { Changed |= OptimizeAwayTrappingUsesOfValue(CI, - Context.getConstantExprCast(CI->getOpcode(), + ConstantExpr::getCast(CI->getOpcode(), NewV, CI->getType()), Context); if (CI->use_empty()) { Changed = true; @@ -726,7 +726,7 @@ break; if (Idxs.size() == GEPI->getNumOperands()-1) Changed |= OptimizeAwayTrappingUsesOfValue(GEPI, - Context.getConstantExprGetElementPtr(NewV, &Idxs[0], + ConstantExpr::getGetElementPtr(NewV, &Idxs[0], Idxs.size()), Context); if (GEPI->use_empty()) { Changed = true; @@ -858,7 +858,7 @@ Constant *RepValue = NewGV; if (NewGV->getType() != GV->getType()->getElementType()) - RepValue = Context.getConstantExprBitCast(RepValue, + RepValue = ConstantExpr::getBitCast(RepValue, GV->getType()->getElementType()); // If there is a comparison against null, we will insert a global bool to @@ -1543,7 +1543,7 @@ if (Constant *SOVC = dyn_cast(StoredOnceVal)) { if (GV->getInitializer()->getType() != SOVC->getType()) SOVC = - Context.getConstantExprBitCast(SOVC, GV->getInitializer()->getType()); + ConstantExpr::getBitCast(SOVC, GV->getInitializer()->getType()); // Optimize away any trapping uses of the loaded value. if (OptimizeAwayTrappingUsesOfLoads(GV, SOVC, Context)) @@ -1989,7 +1989,7 @@ if (!GCL->use_empty()) { Constant *V = NGV; if (V->getType() != GCL->getType()) - V = Context.getConstantExprBitCast(V, GCL->getType()); + V = ConstantExpr::getBitCast(V, GCL->getType()); GCL->replaceAllUsesWith(V); } GCL->eraseFromParent(); @@ -2194,20 +2194,20 @@ Constant *Val = getVal(Values, SI->getOperand(0)); MutatedMemory[Ptr] = Val; } else if (BinaryOperator *BO = dyn_cast(CurInst)) { - InstResult = Context.getConstantExpr(BO->getOpcode(), + InstResult = ConstantExpr::get(BO->getOpcode(), getVal(Values, BO->getOperand(0)), getVal(Values, BO->getOperand(1))); } else if (CmpInst *CI = dyn_cast(CurInst)) { - InstResult = Context.getConstantExprCompare(CI->getPredicate(), + InstResult = ConstantExpr::getCompare(CI->getPredicate(), getVal(Values, CI->getOperand(0)), getVal(Values, CI->getOperand(1))); } else if (CastInst *CI = dyn_cast(CurInst)) { - InstResult = Context.getConstantExprCast(CI->getOpcode(), + InstResult = ConstantExpr::getCast(CI->getOpcode(), getVal(Values, CI->getOperand(0)), CI->getType()); } else if (SelectInst *SI = dyn_cast(CurInst)) { InstResult = - Context.getConstantExprSelect(getVal(Values, SI->getOperand(0)), + ConstantExpr::getSelect(getVal(Values, SI->getOperand(0)), getVal(Values, SI->getOperand(1)), getVal(Values, SI->getOperand(2))); } else if (GetElementPtrInst *GEP = dyn_cast(CurInst)) { @@ -2217,7 +2217,7 @@ i != e; ++i) GEPOps.push_back(getVal(Values, *i)); InstResult = - Context.getConstantExprGetElementPtr(P, &GEPOps[0], GEPOps.size()); + ConstantExpr::getGetElementPtr(P, &GEPOps[0], GEPOps.size()); } else if (LoadInst *LI = dyn_cast(CurInst)) { if (LI->isVolatile()) return false; // no volatile accesses. InstResult = ComputeLoadResult(getVal(Values, LI->getOperand(0)), Modified: llvm/trunk/lib/Transforms/IPO/MergeFunctions.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/MergeFunctions.cpp?rev=77494&r1=77493&r2=77494&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/IPO/MergeFunctions.cpp (original) +++ llvm/trunk/lib/Transforms/IPO/MergeFunctions.cpp Wed Jul 29 13:55:55 2009 @@ -521,7 +521,7 @@ GlobalAlias *GA = new GlobalAlias( G->getType(), G->getLinkage(), "", - F->getContext().getConstantExprBitCast(F, G->getType()), G->getParent()); + ConstantExpr::getBitCast(F, G->getType()), G->getParent()); F->setAlignment(std::max(F->getAlignment(), G->getAlignment())); GA->takeName(G); GA->setVisibility(G->getVisibility()); Modified: llvm/trunk/lib/Transforms/Instrumentation/ProfilingUtils.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Instrumentation/ProfilingUtils.cpp?rev=77494&r1=77493&r2=77494&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Instrumentation/ProfilingUtils.cpp (original) +++ llvm/trunk/lib/Transforms/Instrumentation/ProfilingUtils.cpp Wed Jul 29 13:55:55 2009 @@ -46,7 +46,7 @@ std::vector GEPIndices(2, Context.getNullValue(Type::Int32Ty)); unsigned NumElements = 0; if (Array) { - Args[2] = Context.getConstantExprGetElementPtr(Array, &GEPIndices[0], + Args[2] = ConstantExpr::getGetElementPtr(Array, &GEPIndices[0], GEPIndices.size()); NumElements = cast(Array->getType()->getElementType())->getNumElements(); @@ -113,7 +113,7 @@ Indices[0] = Context.getNullValue(Type::Int32Ty); Indices[1] = ConstantInt::get(Type::Int32Ty, CounterNum); Constant *ElementPtr = - Context.getConstantExprGetElementPtr(CounterArray, &Indices[0], + ConstantExpr::getGetElementPtr(CounterArray, &Indices[0], Indices.size()); // Load, increment and store the value back. Modified: llvm/trunk/lib/Transforms/Instrumentation/RSProfiling.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Instrumentation/RSProfiling.cpp?rev=77494&r1=77493&r2=77494&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Instrumentation/RSProfiling.cpp (original) +++ llvm/trunk/lib/Transforms/Instrumentation/RSProfiling.cpp Wed Jul 29 13:55:55 2009 @@ -352,8 +352,7 @@ std::vector Indices(2); Indices[0] = BB->getContext().getNullValue(Type::Int32Ty); Indices[1] = ConstantInt::get(Type::Int32Ty, CounterNum); - Constant *ElementPtr = - BB->getContext().getConstantExprGetElementPtr(CounterArray, + Constant *ElementPtr =ConstantExpr::getGetElementPtr(CounterArray, &Indices[0], 2); // Load, increment and store the value back. Modified: llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp?rev=77494&r1=77493&r2=77494&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp Wed Jul 29 13:55:55 2009 @@ -286,7 +286,7 @@ if (V->getType() == Ty) return V; if (Constant *CV = dyn_cast(V)) - return Context->getConstantExprCast(opc, CV, Ty); + return ConstantExpr::getCast(opc, CV, Ty); Instruction *C = CastInst::Create(opc, V, Ty, V->getName(), &Pos); AddToWorkList(C); @@ -519,7 +519,7 @@ if (BinaryOperator *Op = dyn_cast(I.getOperand(0))) if (Op->getOpcode() == Opcode && isa(Op->getOperand(1))) { if (isa(I.getOperand(1))) { - Constant *Folded = Context->getConstantExpr(I.getOpcode(), + Constant *Folded = ConstantExpr::get(I.getOpcode(), cast(I.getOperand(1)), cast(Op->getOperand(1))); I.setOperand(0, Op->getOperand(0)); @@ -532,7 +532,7 @@ Constant *C2 = cast(Op1->getOperand(1)); // Fold (op (op V1, C1), (op V2, C2)) ==> (op (op V1, V2), (op C1,C2)) - Constant *Folded = Context->getConstantExpr(I.getOpcode(), C1, C2); + Constant *Folded = ConstantExpr::get(I.getOpcode(), C1, C2); Instruction *New = BinaryOperator::Create(Opcode, Op->getOperand(0), Op1->getOperand(0), Op1->getName(), &I); @@ -566,11 +566,11 @@ // Constants can be considered to be negated values if they can be folded. if (ConstantInt *C = dyn_cast(V)) - return Context->getConstantExprNeg(C); + return ConstantExpr::getNeg(C); if (ConstantVector *C = dyn_cast(V)) if (C->getType()->getElementType()->isInteger()) - return Context->getConstantExprNeg(C); + return ConstantExpr::getNeg(C); return 0; } @@ -585,11 +585,11 @@ // Constants can be considered to be negated values if they can be folded. if (ConstantFP *C = dyn_cast(V)) - return Context->getConstantExprFNeg(C); + return ConstantExpr::getFNeg(C); if (ConstantVector *C = dyn_cast(V)) if (C->getType()->getElementType()->isFloatingPoint()) - return Context->getConstantExprFNeg(C); + return ConstantExpr::getFNeg(C); return 0; } @@ -630,12 +630,12 @@ /// AddOne - Add one to a ConstantInt static Constant *AddOne(Constant *C, LLVMContext *Context) { - return Context->getConstantExprAdd(C, + return ConstantExpr::getAdd(C, ConstantInt::get(C->getType(), 1)); } /// SubOne - Subtract one from a ConstantInt static Constant *SubOne(ConstantInt *C, LLVMContext *Context) { - return Context->getConstantExprSub(C, + return ConstantExpr::getSub(C, ConstantInt::get(C->getType(), 1)); } /// MultiplyOverflows - True if the multiply can not be expressed in an int @@ -1409,7 +1409,7 @@ if ((DemandedMask & (RHSKnownZero|RHSKnownOne)) == DemandedMask) { Constant *C = ConstantInt::get(*Context, RHSKnownOne); if (isa(V->getType())) - C = Context->getConstantExprIntToPtr(C, V->getType()); + C = ConstantExpr::getIntToPtr(C, V->getType()); return C; } return false; @@ -1865,7 +1865,7 @@ bool shouldApply(Value *LHS) const { ConstantInt *C1; return match(LHS, m_And(m_Value(), m_ConstantInt(C1)), *Context) && - Context->getConstantExprAnd(C1, C2)->isNullValue(); + ConstantExpr::getAnd(C1, C2)->isNullValue(); } Instruction *apply(BinaryOperator &Add) const { return BinaryOperator::CreateOr(Add.getOperand(0), Add.getOperand(1)); @@ -1888,8 +1888,8 @@ if (Constant *SOC = dyn_cast(SO)) { if (ConstIsRHS) - return Context->getConstantExpr(I.getOpcode(), SOC, ConstOperand); - return Context->getConstantExpr(I.getOpcode(), ConstOperand, SOC); + return ConstantExpr::get(I.getOpcode(), SOC, ConstOperand); + return ConstantExpr::get(I.getOpcode(), ConstOperand, SOC); } Value *Op0 = SO, *Op1 = ConstOperand; @@ -1978,9 +1978,9 @@ Value *InV = 0; if (Constant *InC = dyn_cast(PN->getIncomingValue(i))) { if (CmpInst *CI = dyn_cast(&I)) - InV = Context->getConstantExprCompare(CI->getPredicate(), InC, C); + InV = ConstantExpr::getCompare(CI->getPredicate(), InC, C); else - InV = Context->getConstantExpr(I.getOpcode(), InC, C); + InV = ConstantExpr::get(I.getOpcode(), InC, C); } else { assert(PN->getIncomingBlock(i) == NonConstBB); if (BinaryOperator *BO = dyn_cast(&I)) @@ -2005,7 +2005,7 @@ for (unsigned i = 0; i != NumPHIValues; ++i) { Value *InV; if (Constant *InC = dyn_cast(PN->getIncomingValue(i))) { - InV = Context->getConstantExprCast(CI->getOpcode(), InC, RetTy); + InV = ConstantExpr::getCast(CI->getOpcode(), InC, RetTy); } else { assert(PN->getIncomingBlock(i) == NonConstBB); InV = CastInst::Create(CI->getOpcode(), PN->getIncomingValue(i), @@ -2177,7 +2177,7 @@ // X*C1 + X*C2 --> X * (C1+C2) ConstantInt *C1; if (X == dyn_castFoldableMul(RHS, C1, Context)) - return BinaryOperator::CreateMul(X, Context->getConstantExprAdd(C1, C2)); + return BinaryOperator::CreateMul(X, ConstantExpr::getAdd(C1, C2)); } // X + X*C --> X * (C+1) @@ -2244,7 +2244,7 @@ // (X & FF00) + xx00 -> (X+xx00) & FF00 if (LHS->hasOneUse() && match(LHS, m_And(m_Value(X), m_ConstantInt(C2)), *Context)) { - Constant *Anded = Context->getConstantExprAnd(CRHS, C2); + Constant *Anded = ConstantExpr::getAnd(CRHS, C2); if (Anded == CRHS) { // See if all bits from the first bit set in the Add RHS up are included // in the mask. First, get the rightmost bit. @@ -2303,9 +2303,9 @@ // (add (sext x), cst) --> (sext (add x, cst')) if (ConstantInt *RHSC = dyn_cast(RHS)) { Constant *CI = - Context->getConstantExprTrunc(RHSC, LHSConv->getOperand(0)->getType()); + ConstantExpr::getTrunc(RHSC, LHSConv->getOperand(0)->getType()); if (LHSConv->hasOneUse() && - Context->getConstantExprSExt(CI, I.getType()) == RHSC && + ConstantExpr::getSExt(CI, I.getType()) == RHSC && WillNotOverflowSignedAdd(LHSConv->getOperand(0), CI)) { // Insert the new, smaller add. Instruction *NewAdd = BinaryOperator::CreateAdd(LHSConv->getOperand(0), @@ -2379,9 +2379,9 @@ // instcombined. if (ConstantFP *CFP = dyn_cast(RHS)) { Constant *CI = - Context->getConstantExprFPToSI(CFP, LHSConv->getOperand(0)->getType()); + ConstantExpr::getFPToSI(CFP, LHSConv->getOperand(0)->getType()); if (LHSConv->hasOneUse() && - Context->getConstantExprSIToFP(CI, I.getType()) == CFP && + ConstantExpr::getSIToFP(CI, I.getType()) == CFP && WillNotOverflowSignedAdd(LHSConv->getOperand(0), CI)) { // Insert the new integer add. Instruction *NewAdd = BinaryOperator::CreateAdd(LHSConv->getOperand(0), @@ -2493,7 +2493,7 @@ if (ConstantInt *CI2 = dyn_cast(Op1I->getOperand(1))) // C1-(X+C2) --> (C1-C2)-X return BinaryOperator::CreateSub( - Context->getConstantExprSub(CI1, CI2), Op1I->getOperand(0)); + ConstantExpr::getSub(CI1, CI2), Op1I->getOperand(0)); } } @@ -2529,13 +2529,13 @@ if (CSI->isZero()) if (Constant *DivRHS = dyn_cast(Op1I->getOperand(1))) return BinaryOperator::CreateSDiv(Op1I->getOperand(0), - Context->getConstantExprNeg(DivRHS)); + ConstantExpr::getNeg(DivRHS)); // X - X*C --> X * (1-C) ConstantInt *C2 = 0; if (dyn_castFoldableMul(Op1I, C2, Context) == Op0) { Constant *CP1 = - Context->getConstantExprSub(ConstantInt::get(I.getType(), 1), + ConstantExpr::getSub(ConstantInt::get(I.getType(), 1), C2); return BinaryOperator::CreateMul(Op0, CP1); } @@ -2562,7 +2562,7 @@ ConstantInt *C2; // X*C1 - X*C2 -> X * (C1-C2) if (X == dyn_castFoldableMul(Op1, C2, Context)) - return BinaryOperator::CreateMul(X, Context->getConstantExprSub(C1, C2)); + return BinaryOperator::CreateMul(X, ConstantExpr::getSub(C1, C2)); } return 0; } @@ -2634,7 +2634,7 @@ if (SI->getOpcode() == Instruction::Shl) if (Constant *ShOp = dyn_cast(SI->getOperand(1))) return BinaryOperator::CreateMul(SI->getOperand(0), - Context->getConstantExprShl(CI, ShOp)); + ConstantExpr::getShl(CI, ShOp)); if (CI->isZero()) return ReplaceInstUsesWith(I, Op1); // X * 0 == 0 @@ -2672,7 +2672,7 @@ Instruction *Add = BinaryOperator::CreateMul(Op0I->getOperand(0), Op1, "tmp"); InsertNewInstBefore(Add, I); - Value *C1C2 = Context->getConstantExprMul(Op1, + Value *C1C2 = ConstantExpr::getMul(Op1, cast(Op0I->getOperand(1))); return BinaryOperator::CreateAdd(Add, C1C2); @@ -2955,7 +2955,7 @@ return ReplaceInstUsesWith(I, Context->getNullValue(I.getType())); else return BinaryOperator::Create(I.getOpcode(), LHS->getOperand(0), - Context->getConstantExprMul(RHS, LHSRHS)); + ConstantExpr::getMul(RHS, LHSRHS)); } if (!RHS->isZero()) { // avoid X udiv 0 @@ -3253,7 +3253,7 @@ for (unsigned i = 0; i != VWidth; ++i) { if (ConstantInt *RHS = dyn_cast(RHSV->getOperand(i))) { if (RHS->getValue().isNegative()) - Elts[i] = cast(Context->getConstantExprNeg(RHS)); + Elts[i] = cast(ConstantExpr::getNeg(RHS)); else Elts[i] = RHS; } @@ -3503,7 +3503,7 @@ Value *X = Op->getOperand(0); Constant *Together = 0; if (!Op->isShift()) - Together = Context->getConstantExprAnd(AndRHS, OpRHS); + Together = ConstantExpr::getAnd(AndRHS, OpRHS); switch (Op->getOpcode()) { case Instruction::Xor: @@ -3633,7 +3633,7 @@ Instruction *InstCombiner::InsertRangeTest(Value *V, Constant *Lo, Constant *Hi, bool isSigned, bool Inside, Instruction &IB) { - assert(cast(Context->getConstantExprICmp((isSigned ? + assert(cast(ConstantExpr::getICmp((isSigned ? ICmpInst::ICMP_SLE:ICmpInst::ICMP_ULE), Lo, Hi))->getZExtValue() && "Lo is not <= Hi in range emission code!"); @@ -3649,10 +3649,10 @@ } // Emit V-Lo getConstantExprNeg(Lo); + Constant *NegLo = ConstantExpr::getNeg(Lo); Instruction *Add = BinaryOperator::CreateAdd(V, NegLo, V->getName()+".off"); InsertNewInstBefore(Add, IB); - Constant *UpperBound = Context->getConstantExprAdd(NegLo, Hi); + Constant *UpperBound = ConstantExpr::getAdd(NegLo, Hi); return new ICmpInst(*Context, ICmpInst::ICMP_ULT, Add, UpperBound); } @@ -3669,10 +3669,10 @@ // Emit V-Lo >u Hi-1-Lo // Note that Hi has already had one subtracted from it, above. - ConstantInt *NegLo = cast(Context->getConstantExprNeg(Lo)); + ConstantInt *NegLo = cast(ConstantExpr::getNeg(Lo)); Instruction *Add = BinaryOperator::CreateAdd(V, NegLo, V->getName()+".off"); InsertNewInstBefore(Add, IB); - Constant *LowerBound = Context->getConstantExprAdd(NegLo, Hi); + Constant *LowerBound = ConstantExpr::getAdd(NegLo, Hi); return new ICmpInst(*Context, ICmpInst::ICMP_UGT, Add, LowerBound); } @@ -3714,7 +3714,7 @@ switch (LHSI->getOpcode()) { default: return 0; case Instruction::And: - if (Context->getConstantExprAnd(N, Mask) == Mask) { + if (ConstantExpr::getAnd(N, Mask) == Mask) { // If the AndRHS is a power of two minus one (0+1+), this is simple. if ((Mask->getValue().countLeadingZeros() + Mask->getValue().countPopulation()) == @@ -3738,7 +3738,7 @@ // If the AndRHS is a power of two minus one (0+1+), and N&Mask == 0 if ((Mask->getValue().countLeadingZeros() + Mask->getValue().countPopulation()) == Mask->getValue().getBitWidth() - && Context->getConstantExprAnd(N, Mask)->isNullValue()) + && ConstantExpr::getAnd(N, Mask)->isNullValue()) break; return 0; } @@ -3843,7 +3843,7 @@ return ReplaceInstUsesWith(I, RHS); case ICmpInst::ICMP_NE: if (LHSCst == SubOne(RHSCst, Context)){// (X != 13 & X != 14) -> X-13 >u 1 - Constant *AddCST = Context->getConstantExprNeg(LHSCst); + Constant *AddCST = ConstantExpr::getNeg(LHSCst); Instruction *Add = BinaryOperator::CreateAdd(Val, AddCST, Val->getName()+".off"); InsertNewInstBefore(Add, I); @@ -4130,15 +4130,15 @@ NewCast = InsertNewInstBefore(NewCast, I); // trunc_or_bitcast(C1)&C2 Constant *C3 = - Context->getConstantExprTruncOrBitCast(AndCI,I.getType()); - C3 = Context->getConstantExprAnd(C3, AndRHS); + ConstantExpr::getTruncOrBitCast(AndCI,I.getType()); + C3 = ConstantExpr::getAnd(C3, AndRHS); return BinaryOperator::CreateAnd(NewCast, C3); } else if (CastOp->getOpcode() == Instruction::Or) { // Change: and (cast (or X, C1) to T), C2 // into : trunc(C1)&C2 iff trunc(C1)&C2 == C2 Constant *C3 = - Context->getConstantExprTruncOrBitCast(AndCI,I.getType()); - if (Context->getConstantExprAnd(C3, AndRHS) == AndRHS) + ConstantExpr::getTruncOrBitCast(AndCI,I.getType()); + if (ConstantExpr::getAnd(C3, AndRHS) == AndRHS) // trunc(C1)&C2 return ReplaceInstUsesWith(I, AndRHS); } @@ -4526,11 +4526,11 @@ case ICmpInst::ICMP_EQ: if (LHSCst == SubOne(RHSCst, Context)) { // (X == 13 | X == 14) -> X-13 getConstantExprNeg(LHSCst); + Constant *AddCST = ConstantExpr::getNeg(LHSCst); Instruction *Add = BinaryOperator::CreateAdd(Val, AddCST, Val->getName()+".off"); InsertNewInstBefore(Add, I); - AddCST = Context->getConstantExprSub(AddOne(RHSCst, Context), LHSCst); + AddCST = ConstantExpr::getSub(AddOne(RHSCst, Context), LHSCst); return new ICmpInst(*Context, ICmpInst::ICMP_ULT, Add, AddCST); } break; // (X == 13 | X == 15) -> no change @@ -5078,7 +5078,7 @@ if (CI->hasOneUse() && Op0C->hasOneUse()) { Instruction::CastOps Opcode = Op0C->getOpcode(); if (Opcode == Instruction::ZExt || Opcode == Instruction::SExt) { - if (RHS == Context->getConstantExprCast(Opcode, + if (RHS == ConstantExpr::getCast(Opcode, Context->getTrue(), Op0C->getDestTy())) { Instruction *NewCI = InsertNewInstBefore(CmpInst::Create( @@ -5097,8 +5097,8 @@ // ~(c-X) == X-c-1 == X+(-c-1) if (Op0I->getOpcode() == Instruction::Sub && RHS->isAllOnesValue()) if (Constant *Op0I0C = dyn_cast(Op0I->getOperand(0))) { - Constant *NegOp0I0C = Context->getConstantExprNeg(Op0I0C); - Constant *ConstantRHS = Context->getConstantExprSub(NegOp0I0C, + Constant *NegOp0I0C = ConstantExpr::getNeg(Op0I0C); + Constant *ConstantRHS = ConstantExpr::getSub(NegOp0I0C, ConstantInt::get(I.getType(), 1)); return BinaryOperator::CreateAdd(Op0I->getOperand(1), ConstantRHS); } @@ -5107,9 +5107,9 @@ if (Op0I->getOpcode() == Instruction::Add) { // ~(X-c) --> (-c-1)-X if (RHS->isAllOnesValue()) { - Constant *NegOp0CI = Context->getConstantExprNeg(Op0CI); + Constant *NegOp0CI = ConstantExpr::getNeg(Op0CI); return BinaryOperator::CreateSub( - Context->getConstantExprSub(NegOp0CI, + ConstantExpr::getSub(NegOp0CI, ConstantInt::get(I.getType(), 1)), Op0I->getOperand(0)); } else if (RHS->getValue().isSignBit()) { @@ -5122,12 +5122,12 @@ } else if (Op0I->getOpcode() == Instruction::Or) { // (X|C1)^C2 -> X^(C1|C2) iff X&~C1 == 0 if (MaskedValueIsZero(Op0I->getOperand(0), Op0CI->getValue())) { - Constant *NewRHS = Context->getConstantExprOr(Op0CI, RHS); + Constant *NewRHS = ConstantExpr::getOr(Op0CI, RHS); // Anything in both C1 and C2 is known to be zero, remove it from // NewRHS. - Constant *CommonBits = Context->getConstantExprAnd(Op0CI, RHS); - NewRHS = Context->getConstantExprAnd(NewRHS, - Context->getConstantExprNot(CommonBits)); + Constant *CommonBits = ConstantExpr::getAnd(Op0CI, RHS); + NewRHS = ConstantExpr::getAnd(NewRHS, + ConstantExpr::getNot(CommonBits)); AddToWorkList(Op0I); I.setOperand(0, Op0I->getOperand(0)); I.setOperand(1, NewRHS); @@ -5295,7 +5295,7 @@ static ConstantInt *ExtractElement(Constant *V, Constant *Idx, LLVMContext *Context) { - return cast(Context->getConstantExprExtractElement(V, Idx)); + return cast(ConstantExpr::getExtractElement(V, Idx)); } static bool HasAddOverflow(ConstantInt *Result, @@ -5315,7 +5315,7 @@ static bool AddWithOverflow(Constant *&Result, Constant *In1, Constant *In2, LLVMContext *Context, bool IsSigned = false) { - Result = Context->getConstantExprAdd(In1, In2); + Result = ConstantExpr::getAdd(In1, In2); if (const VectorType *VTy = dyn_cast(In1->getType())) { for (unsigned i = 0, e = VTy->getNumElements(); i != e; ++i) { @@ -5351,7 +5351,7 @@ static bool SubWithOverflow(Constant *&Result, Constant *In1, Constant *In2, LLVMContext *Context, bool IsSigned = false) { - Result = Context->getConstantExprSub(In1, In2); + Result = ConstantExpr::getSub(In1, In2); if (const VectorType *VTy = dyn_cast(In1->getType())) { for (unsigned i = 0, e = VTy->getNumElements(); i != e; ++i) { @@ -5409,10 +5409,10 @@ Constant *Scale = ConstantInt::get(IntPtrTy, Size); Constant *OC = - Context->getConstantExprIntegerCast(OpC, IntPtrTy, true /*SExt*/); - Scale = Context->getConstantExprMul(OC, Scale); + ConstantExpr::getIntegerCast(OpC, IntPtrTy, true /*SExt*/); + Scale = ConstantExpr::getMul(OC, Scale); if (Constant *RC = dyn_cast(Result)) - Result = Context->getConstantExprAdd(RC, Scale); + Result = ConstantExpr::getAdd(RC, Scale); else { // Emit an add instruction. Result = IC.InsertNewInstBefore( @@ -5424,7 +5424,7 @@ // Convert to correct type. if (Op->getType() != IntPtrTy) { if (Constant *OpC = dyn_cast(Op)) - Op = Context->getConstantExprIntegerCast(OpC, IntPtrTy, true); + Op = ConstantExpr::getIntegerCast(OpC, IntPtrTy, true); else Op = IC.InsertNewInstBefore(CastInst::CreateIntegerCast(Op, IntPtrTy, true, @@ -5433,7 +5433,7 @@ if (Size != 1) { Constant *Scale = ConstantInt::get(IntPtrTy, Size); if (Constant *OpC = dyn_cast(Op)) - Op = Context->getConstantExprMul(OpC, Scale); + Op = ConstantExpr::getMul(OpC, Scale); else // We'll let instcombine(mul) convert this to a shl if possible. Op = IC.InsertNewInstBefore(BinaryOperator::CreateMul(Op, Scale, GEP->getName()+".idx"), I); @@ -5441,7 +5441,7 @@ // Emit an add instruction. if (isa(Op) && isa(Result)) - Result = Context->getConstantExprAdd(cast(Op), + Result = ConstantExpr::getAdd(cast(Op), cast(Result)); else Result = IC.InsertNewInstBefore(BinaryOperator::CreateAdd(Op, Result, @@ -5788,12 +5788,12 @@ // casting the FP value to the integer value and back, checking for equality. // Don't do this for zero, because -0.0 is not fractional. Constant *RHSInt = LHSUnsigned - ? Context->getConstantExprFPToUI(RHSC, IntTy) - : Context->getConstantExprFPToSI(RHSC, IntTy); + ? ConstantExpr::getFPToUI(RHSC, IntTy) + : ConstantExpr::getFPToSI(RHSC, IntTy); if (!RHS.isZero()) { bool Equal = LHSUnsigned - ? Context->getConstantExprUIToFP(RHSInt, RHSC->getType()) == RHSC - : Context->getConstantExprSIToFP(RHSInt, RHSC->getType()) == RHSC; + ? ConstantExpr::getUIToFP(RHSInt, RHSC->getType()) == RHSC + : ConstantExpr::getSIToFP(RHSInt, RHSC->getType()) == RHSC; if (!Equal) { // If we had a comparison against a fractional value, we have to adjust // the compare predicate and sometimes the value. RHSC is rounded towards @@ -5946,14 +5946,14 @@ if (LHSI->hasOneUse()) { if (Constant *C = dyn_cast(LHSI->getOperand(1))) { // Fold the known value into the constant operand. - Op1 = Context->getConstantExprCompare(I.getPredicate(), C, RHSC); + Op1 = ConstantExpr::getCompare(I.getPredicate(), C, RHSC); // Insert a new FCmp of the other select operand. Op2 = InsertNewInstBefore(new FCmpInst(*Context, I.getPredicate(), LHSI->getOperand(2), RHSC, I.getName()), I); } else if (Constant *C = dyn_cast(LHSI->getOperand(2))) { // Fold the known value into the constant operand. - Op2 = Context->getConstantExprCompare(I.getPredicate(), C, RHSC); + Op2 = ConstantExpr::getCompare(I.getPredicate(), C, RHSC); // Insert a new FCmp of the other select operand. Op1 = InsertNewInstBefore(new FCmpInst(*Context, I.getPredicate(), LHSI->getOperand(1), RHSC, @@ -6312,14 +6312,14 @@ if (LHSI->hasOneUse()) { if (Constant *C = dyn_cast(LHSI->getOperand(1))) { // Fold the known value into the constant operand. - Op1 = Context->getConstantExprICmp(I.getPredicate(), C, RHSC); + Op1 = ConstantExpr::getICmp(I.getPredicate(), C, RHSC); // Insert a new ICmp of the other select operand. Op2 = InsertNewInstBefore(new ICmpInst(*Context, I.getPredicate(), LHSI->getOperand(2), RHSC, I.getName()), I); } else if (Constant *C = dyn_cast(LHSI->getOperand(2))) { // Fold the known value into the constant operand. - Op2 = Context->getConstantExprICmp(I.getPredicate(), C, RHSC); + Op2 = ConstantExpr::getICmp(I.getPredicate(), C, RHSC); // Insert a new ICmp of the other select operand. Op1 = InsertNewInstBefore(new ICmpInst(*Context, I.getPredicate(), LHSI->getOperand(1), RHSC, @@ -6370,7 +6370,7 @@ // If Op1 is a constant, we can fold the cast into the constant. if (Op0->getType() != Op1->getType()) { if (Constant *Op1C = dyn_cast(Op1)) { - Op1 = Context->getConstantExprBitCast(Op1C, Op0->getType()); + Op1 = ConstantExpr::getBitCast(Op1C, Op0->getType()); } else { // Otherwise, cast the RHS right before the icmp Op1 = InsertBitCastBefore(Op1, Op0->getType(), I); @@ -6572,13 +6572,13 @@ // of form X/C1=C2. We solve for X by multiplying C1 (DivRHS) and // C2 (CI). By solving for X we can turn this into a range check // instead of computing a divide. - Constant *Prod = Context->getConstantExprMul(CmpRHS, DivRHS); + Constant *Prod = ConstantExpr::getMul(CmpRHS, DivRHS); // Determine if the product overflows by seeing if the product is // not equal to the divide. Make sure we do the same kind of divide // as in the LHS instruction that we're folding. - bool ProdOV = (DivIsSigned ? Context->getConstantExprSDiv(Prod, DivRHS) : - Context->getConstantExprUDiv(Prod, DivRHS)) != CmpRHS; + bool ProdOV = (DivIsSigned ? ConstantExpr::getSDiv(Prod, DivRHS) : + ConstantExpr::getUDiv(Prod, DivRHS)) != CmpRHS; // Get the ICmp opcode ICmpInst::Predicate Pred = ICI.getPredicate(); @@ -6602,7 +6602,7 @@ } else if (DivRHS->getValue().isStrictlyPositive()) { // Divisor is > 0. if (CmpRHSV == 0) { // (X / pos) op 0 // Can't overflow. e.g. X/2 op 0 --> [-1, 2) - LoBound = cast(Context->getConstantExprNeg(SubOne(DivRHS, + LoBound = cast(ConstantExpr::getNeg(SubOne(DivRHS, Context))); HiBound = DivRHS; } else if (CmpRHSV.isStrictlyPositive()) { // (X / pos) op pos @@ -6616,7 +6616,7 @@ LoOverflow = HiOverflow = ProdOV ? -1 : 0; if (!LoOverflow) { ConstantInt* DivNeg = - cast(Context->getConstantExprNeg(DivRHS)); + cast(ConstantExpr::getNeg(DivRHS)); LoOverflow = AddWithOverflow(LoBound, HiBound, DivNeg, Context, true) ? -1 : 0; } @@ -6625,7 +6625,7 @@ if (CmpRHSV == 0) { // (X / neg) op 0 // e.g. X/-5 op 0 --> [-4, 5) LoBound = AddOne(DivRHS, Context); - HiBound = cast(Context->getConstantExprNeg(DivRHS)); + HiBound = cast(ConstantExpr::getNeg(DivRHS)); if (HiBound == DivRHS) { // -INTMIN = INTMIN HiOverflow = 1; // [INTMIN+1, overflow) HiBound = 0; // e.g. X/INTMIN = 0 --> X > INTMIN @@ -6842,13 +6842,13 @@ if (CanFold) { Constant *NewCst; if (Shift->getOpcode() == Instruction::Shl) - NewCst = Context->getConstantExprLShr(RHS, ShAmt); + NewCst = ConstantExpr::getLShr(RHS, ShAmt); else - NewCst = Context->getConstantExprShl(RHS, ShAmt); + NewCst = ConstantExpr::getShl(RHS, ShAmt); // Check to see if we are shifting out any of the bits being // compared. - if (Context->getConstantExpr(Shift->getOpcode(), + if (ConstantExpr::get(Shift->getOpcode(), NewCst, ShAmt) != RHS) { // If we shifted bits out, the fold is not going to work out. // As a special case, check to see if this means that the @@ -6861,9 +6861,9 @@ ICI.setOperand(1, NewCst); Constant *NewAndCST; if (Shift->getOpcode() == Instruction::Shl) - NewAndCST = Context->getConstantExprLShr(AndCST, ShAmt); + NewAndCST = ConstantExpr::getLShr(AndCST, ShAmt); else - NewAndCST = Context->getConstantExprShl(AndCST, ShAmt); + NewAndCST = ConstantExpr::getShl(AndCST, ShAmt); LHSI->setOperand(1, NewAndCST); LHSI->setOperand(0, Shift->getOperand(0)); AddToWorkList(Shift); // Shift is dead. @@ -6918,7 +6918,7 @@ // If we are comparing against bits always shifted out, the // comparison cannot succeed. Constant *Comp = - Context->getConstantExprShl(Context->getConstantExprLShr(RHS, ShAmt), + ConstantExpr::getShl(ConstantExpr::getLShr(RHS, ShAmt), ShAmt); if (Comp != RHS) {// Comparing against a bit that we know is zero. bool IsICMP_NE = ICI.getPredicate() == ICmpInst::ICMP_NE; @@ -6997,7 +6997,7 @@ MaskedValueIsZero(LHSI->getOperand(0), APInt::getLowBitsSet(Comp.getBitWidth(), ShAmtVal))) { return new ICmpInst(*Context, ICI.getPredicate(), LHSI->getOperand(0), - Context->getConstantExprShl(RHS, ShAmt)); + ConstantExpr::getShl(RHS, ShAmt)); } if (LHSI->hasOneUse()) { @@ -7010,7 +7010,7 @@ Mask, LHSI->getName()+".mask"); Value *And = InsertNewInstBefore(AndI, ICI); return new ICmpInst(*Context, ICI.getPredicate(), And, - Context->getConstantExprShl(RHS, ShAmt)); + ConstantExpr::getShl(RHS, ShAmt)); } break; } @@ -7088,7 +7088,7 @@ if (ConstantInt *BOp1C = dyn_cast(BO->getOperand(1))) { if (BO->hasOneUse()) return new ICmpInst(*Context, ICI.getPredicate(), BO->getOperand(0), - Context->getConstantExprSub(RHS, BOp1C)); + ConstantExpr::getSub(RHS, BOp1C)); } else if (RHSV == 0) { // Replace ((add A, B) != 0) with (A != -B) if A or B is // efficiently invertible, or if the add has just this one use. @@ -7111,7 +7111,7 @@ // the explicit xor. if (Constant *BOC = dyn_cast(BO->getOperand(1))) return new ICmpInst(*Context, ICI.getPredicate(), BO->getOperand(0), - Context->getConstantExprXor(RHS, BOC)); + ConstantExpr::getXor(RHS, BOC)); // FALLTHROUGH case Instruction::Sub: @@ -7125,8 +7125,8 @@ // If bits are being or'd in that are not present in the constant we // are comparing against, then the comparison could never succeed! if (Constant *BOC = dyn_cast(BO->getOperand(1))) { - Constant *NotCI = Context->getConstantExprNot(RHS); - if (!Context->getConstantExprAnd(BOC, NotCI)->isNullValue()) + Constant *NotCI = ConstantExpr::getNot(RHS); + if (!ConstantExpr::getAnd(BOC, NotCI)->isNullValue()) return ReplaceInstUsesWith(ICI, ConstantInt::get(Type::Int1Ty, isICMP_NE)); @@ -7160,7 +7160,7 @@ // ((X & ~7) == 0) --> X < 8 if (RHSV == 0 && isHighOnes(BOC)) { Value *X = BO->getOperand(0); - Constant *NegX = Context->getConstantExprNeg(BOC); + Constant *NegX = ConstantExpr::getNeg(BOC); ICmpInst::Predicate pred = isICMP_NE ? ICmpInst::ICMP_UGE : ICmpInst::ICMP_ULT; return new ICmpInst(*Context, pred, X, NegX); @@ -7198,7 +7198,7 @@ cast(DestTy)->getBitWidth()) { Value *RHSOp = 0; if (Constant *RHSC = dyn_cast(ICI.getOperand(1))) { - RHSOp = Context->getConstantExprIntToPtr(RHSC, SrcTy); + RHSOp = ConstantExpr::getIntToPtr(RHSC, SrcTy); } else if (PtrToIntInst *RHSC = dyn_cast(ICI.getOperand(1))) { RHSOp = RHSC->getOperand(0); // If the pointer types don't match, insert a bitcast. @@ -7250,8 +7250,8 @@ // Compute the constant that would happen if we truncated to SrcTy then // reextended to DestTy. - Constant *Res1 = Context->getConstantExprTrunc(CI, SrcTy); - Constant *Res2 = Context->getConstantExprCast(LHSCI->getOpcode(), + Constant *Res1 = ConstantExpr::getTrunc(CI, SrcTy); + Constant *Res2 = ConstantExpr::getCast(LHSCI->getOpcode(), Res1, DestTy); // If the re-extended constant didn't change... @@ -7313,7 +7313,7 @@ ICI.getPredicate()==ICmpInst::ICMP_SGT) && "ICmp should be folded!"); if (Constant *CI = dyn_cast(Result)) - return ReplaceInstUsesWith(ICI, Context->getConstantExprNot(CI)); + return ReplaceInstUsesWith(ICI, ConstantExpr::getNot(CI)); return BinaryOperator::CreateNot(*Context, Result); } @@ -7413,7 +7413,7 @@ if (BO->getOpcode() == Instruction::Mul && isLeftShift) if (Constant *BOOp = dyn_cast(BO->getOperand(1))) return BinaryOperator::CreateMul(BO->getOperand(0), - Context->getConstantExprShl(BOOp, Op1)); + ConstantExpr::getShl(BOOp, Op1)); // Try to fold constant and into select arguments. if (SelectInst *SI = dyn_cast(Op0)) @@ -7434,7 +7434,7 @@ if (TrOp && I.isLogicalShift() && TrOp->isShift() && isa(TrOp->getOperand(1))) { // Okay, we'll do this xform. Make the shift of shift. - Constant *ShAmt = Context->getConstantExprZExt(Op1, TrOp->getType()); + Constant *ShAmt = ConstantExpr::getZExt(Op1, TrOp->getType()); Instruction *NSh = BinaryOperator::Create(I.getOpcode(), TrOp, ShAmt, I.getName()); InsertNewInstBefore(NSh, I); // (shift2 (shift1 & 0x00FF), c2) @@ -7510,7 +7510,7 @@ InsertNewInstBefore(YS, I); // (Y << C) Instruction *XM = BinaryOperator::CreateAnd(V1, - Context->getConstantExprShl(CC, Op1), + ConstantExpr::getShl(CC, Op1), V1->getName()+".mask"); InsertNewInstBefore(XM, I); // X & (CC << C) @@ -7550,7 +7550,7 @@ InsertNewInstBefore(YS, I); // (Y << C) Instruction *XM = BinaryOperator::CreateAnd(V1, - Context->getConstantExprShl(CC, Op1), + ConstantExpr::getShl(CC, Op1), V1->getName()+".mask"); InsertNewInstBefore(XM, I); // X & (CC << C) @@ -7592,7 +7592,7 @@ isValid = Op0C->getValue()[TypeBits-1] == highBitSet; if (isValid) { - Constant *NewRHS = Context->getConstantExpr(I.getOpcode(), Op0C, Op1); + Constant *NewRHS = ConstantExpr::get(I.getOpcode(), Op0C, Op1); Instruction *NewShift = BinaryOperator::Create(I.getOpcode(), Op0BO->getOperand(0), Op1); @@ -7866,7 +7866,7 @@ // If the allocation size is constant, form a constant mul expression Amt = ConstantInt::get(Type::Int32Ty, Scale); if (isa(NumElements)) - Amt = Context->getConstantExprMul(cast(NumElements), + Amt = ConstantExpr::getMul(cast(NumElements), cast(Amt)); // otherwise multiply the amount and the number of elements else { @@ -8057,7 +8057,7 @@ Value *InstCombiner::EvaluateInDifferentType(Value *V, const Type *Ty, bool isSigned) { if (Constant *C = dyn_cast(V)) - return Context->getConstantExprIntegerCast(C, Ty, + return ConstantExpr::getIntegerCast(C, Ty, isSigned /*Sext or ZExt*/); // Otherwise, it must be an instruction. @@ -8497,7 +8497,7 @@ // Okay, we can shrink this. Truncate the input, then return a new // shift. Value *V1 = InsertCastBefore(Instruction::Trunc, ShiftOp, Ty, CI); - Value *V2 = Context->getConstantExprTrunc(ShAmtV, Ty); + Value *V2 = ConstantExpr::getTrunc(ShAmtV, Ty); return BinaryOperator::CreateLShr(V1, V2); } } @@ -8569,7 +8569,7 @@ // (X&4) == 2 --> false // (X&4) != 2 --> true Constant *Res = ConstantInt::get(Type::Int1Ty, isNE); - Res = Context->getConstantExprZExt(Res, CI.getType()); + Res = ConstantExpr::getZExt(Res, CI.getType()); return ReplaceInstUsesWith(CI, Res); } @@ -8668,7 +8668,7 @@ if (TI0->getType() == CI.getType()) return BinaryOperator::CreateAnd(TI0, - Context->getConstantExprZExt(C, CI.getType())); + ConstantExpr::getZExt(C, CI.getType())); } // zext((trunc(t) & C) ^ C) -> ((t & zext(C)) ^ zext(C)). @@ -8680,7 +8680,7 @@ if (TruncInst *TI = dyn_cast(And->getOperand(0))) { Value *TI0 = TI->getOperand(0); if (TI0->getType() == CI.getType()) { - Constant *ZC = Context->getConstantExprZExt(C, CI.getType()); + Constant *ZC = ConstantExpr::getZExt(C, CI.getType()); Instruction *NewAnd = BinaryOperator::CreateAnd(TI0, ZC, "tmp"); InsertNewInstBefore(NewAnd, *And); return BinaryOperator::CreateXor(NewAnd, ZC); @@ -9548,7 +9548,7 @@ // select C, (add X, Y), (sub X, Z) Value *NegVal; // Compute -Z if (Constant *C = dyn_cast(SubOp->getOperand(1))) { - NegVal = Context->getConstantExprNeg(C); + NegVal = ConstantExpr::getNeg(C); } else { NegVal = InsertNewInstBefore( BinaryOperator::CreateNeg(*Context, SubOp->getOperand(1), @@ -10462,7 +10462,7 @@ FTy->isVarArg()); Constant *NewCallee = NestF->getType() == Context->getPointerTypeUnqual(NewFTy) ? - NestF : Context->getConstantExprBitCast(NestF, + NestF : ConstantExpr::getBitCast(NestF, Context->getPointerTypeUnqual(NewFTy)); const AttrListPtr &NewPAL = AttrListPtr::get(NewAttrs.begin(), NewAttrs.end()); @@ -10497,7 +10497,7 @@ // code sort out any function type mismatches. Constant *NewCallee = NestF->getType() == PTy ? NestF : - Context->getConstantExprBitCast(NestF, PTy); + ConstantExpr::getBitCast(NestF, PTy); CS.setCalledFunction(NewCallee); return CS.getInstruction(); } @@ -11034,7 +11034,7 @@ Value *Op = *i; if (TD->getTypeSizeInBits(Op->getType()) > TD->getPointerSizeInBits()) { if (Constant *C = dyn_cast(Op)) { - *i = Context->getConstantExprTrunc(C, TD->getIntPtrType()); + *i = ConstantExpr::getTrunc(C, TD->getIntPtrType()); MadeChange = true; } else { Op = InsertCastBefore(Instruction::Trunc, Op, TD->getIntPtrType(), @@ -11045,7 +11045,7 @@ } else if (TD->getTypeSizeInBits(Op->getType()) < TD->getPointerSizeInBits()) { if (Constant *C = dyn_cast(Op)) { - *i = Context->getConstantExprSExt(C, TD->getIntPtrType()); + *i = ConstantExpr::getSExt(C, TD->getIntPtrType()); MadeChange = true; } else { Op = InsertCastBefore(Instruction::SExt, Op, TD->getIntPtrType(), @@ -11103,10 +11103,10 @@ if (SO1->getType() != GO1->getType()) { if (Constant *SO1C = dyn_cast(SO1)) { SO1 = - Context->getConstantExprIntegerCast(SO1C, GO1->getType(), true); + ConstantExpr::getIntegerCast(SO1C, GO1->getType(), true); } else if (Constant *GO1C = dyn_cast(GO1)) { GO1 = - Context->getConstantExprIntegerCast(GO1C, SO1->getType(), true); + ConstantExpr::getIntegerCast(GO1C, SO1->getType(), true); } else if (TD) { unsigned PS = TD->getPointerSizeInBits(); if (TD->getTypeSizeInBits(SO1->getType()) == PS) { @@ -11124,7 +11124,7 @@ } } if (isa(SO1) && isa(GO1)) - Sum = Context->getConstantExprAdd(cast(SO1), + Sum = ConstantExpr::getAdd(cast(SO1), cast(GO1)); else { Sum = BinaryOperator::CreateAdd(SO1, GO1, PtrOp->getName()+".sum"); @@ -11173,7 +11173,7 @@ Indices.push_back(cast(*I)); if (I == E) { // If they are all constants... - Constant *CE = Context->getConstantExprGetElementPtr(GV, + Constant *CE = ConstantExpr::getGetElementPtr(GV, &Indices[0],Indices.size()); // Replace all uses of the GEP with the new constexpr... @@ -11284,7 +11284,7 @@ Scale->getZExtValue() / ArrayEltSize); if (Scale->getZExtValue() != 1) { Constant *C = - Context->getConstantExprIntegerCast(Scale, NewIdx->getType(), + ConstantExpr::getIntegerCast(Scale, NewIdx->getType(), false /*ZExt*/); Instruction *Sc = BinaryOperator::CreateMul(NewIdx, C, "idxscale"); NewIdx = InsertNewInstBefore(Sc, GEP); @@ -11523,7 +11523,7 @@ if (ASrcTy->getNumElements() != 0) { Value *Idxs[2]; Idxs[0] = Idxs[1] = Context->getNullValue(Type::Int32Ty); - CastOp = Context->getConstantExprGetElementPtr(CSrc, Idxs, 2); + CastOp = ConstantExpr::getGetElementPtr(CSrc, Idxs, 2); SrcTy = cast(CastOp->getType()); SrcPTy = SrcTy->getElementType(); } @@ -11769,7 +11769,7 @@ // emit a GEP to index into its first field. if (!NewGEPIndices.empty()) { if (Constant *C = dyn_cast(CastOp)) - CastOp = Context->getConstantExprGetElementPtr(C, &NewGEPIndices[0], + CastOp = ConstantExpr::getGetElementPtr(C, &NewGEPIndices[0], NewGEPIndices.size()); else CastOp = IC.InsertNewInstBefore( @@ -11779,7 +11779,7 @@ } if (Constant *C = dyn_cast(SIOp0)) - NewCast = Context->getConstantExprCast(opcode, C, CastDstTy); + NewCast = ConstantExpr::getCast(opcode, C, CastDstTy); else NewCast = IC.InsertNewInstBefore( CastInst::Create(opcode, SIOp0, CastDstTy, SIOp0->getName()+".c"), @@ -12170,7 +12170,7 @@ // change 'switch (X+4) case 1:' into 'switch (X) case -3' for (unsigned i = 2, e = SI.getNumOperands(); i != e; i += 2) SI.setOperand(i, - Context->getConstantExprSub(cast(SI.getOperand(i)), + ConstantExpr::getSub(cast(SI.getOperand(i)), AddRHS)); SI.setOperand(0, I->getOperand(0)); AddToWorkList(I); Modified: llvm/trunk/lib/Transforms/Scalar/JumpThreading.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/JumpThreading.cpp?rev=77494&r1=77493&r2=77494&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/JumpThreading.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/JumpThreading.cpp Wed Jul 29 13:55:55 2009 @@ -799,7 +799,7 @@ LLVMContext &Context) { if (Constant *CLHS = dyn_cast(LHS)) if (Constant *CRHS = dyn_cast(RHS)) - return Context.getConstantExprCompare(pred, CLHS, CRHS); + return ConstantExpr::getCompare(pred, CLHS, CRHS); if (LHS == RHS) if (isa(LHS->getType()) || isa(LHS->getType())) Modified: llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp?rev=77494&r1=77493&r2=77494&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp Wed Jul 29 13:55:55 2009 @@ -1995,7 +1995,7 @@ NewCmpRHS = ConstantInt::get(NewCmpTy, NewCmpVal); else { Constant *CI = ConstantInt::get(NewCmpIntTy, NewCmpVal); - NewCmpRHS = Context.getConstantExprIntToPtr(CI, NewCmpTy); + NewCmpRHS = ConstantExpr::getIntToPtr(CI, NewCmpTy); } NewOffset = TyBits == NewTyBits ? SE->getMulExpr(CondUse->getOffset(), Modified: llvm/trunk/lib/Transforms/Scalar/MemCpyOptimizer.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/MemCpyOptimizer.cpp?rev=77494&r1=77493&r2=77494&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/MemCpyOptimizer.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/MemCpyOptimizer.cpp Wed Jul 29 13:55:55 2009 @@ -44,9 +44,9 @@ // corresponding integer value is "byteable". An important case is 0.0. if (ConstantFP *CFP = dyn_cast(V)) { if (CFP->getType() == Type::FloatTy) - V = Context.getConstantExprBitCast(CFP, Type::Int32Ty); + V = ConstantExpr::getBitCast(CFP, Type::Int32Ty); if (CFP->getType() == Type::DoubleTy) - V = Context.getConstantExprBitCast(CFP, Type::Int64Ty); + V = ConstantExpr::getBitCast(CFP, Type::Int64Ty); // Don't handle long double formats, which have strange constraints. } Modified: llvm/trunk/lib/Transforms/Scalar/PredicateSimplifier.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/PredicateSimplifier.cpp?rev=77494&r1=77493&r2=77494&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/PredicateSimplifier.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/PredicateSimplifier.cpp Wed Jul 29 13:55:55 2009 @@ -1694,7 +1694,7 @@ bool isRelatedBy(Value *V1, Value *V2, ICmpInst::Predicate Pred) const { if (Constant *C1 = dyn_cast(V1)) if (Constant *C2 = dyn_cast(V2)) - return Context->getConstantExprCompare(Pred, C1, C2) == + return ConstantExpr::getCompare(Pred, C1, C2) == Context->getTrue(); unsigned n1 = VN.valueNumber(V1, Top); @@ -2161,7 +2161,7 @@ // the BB as unreachable if so. if (Constant *CI_L = dyn_cast(O.LHS)) { if (Constant *CI_R = dyn_cast(O.RHS)) { - if (Context->getConstantExprCompare(O.Op, CI_L, CI_R) == + if (ConstantExpr::getCompare(O.Op, CI_L, CI_R) == Context->getFalse()) UB.mark(TopBB); Modified: llvm/trunk/lib/Transforms/Scalar/Reassociate.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/Reassociate.cpp?rev=77494&r1=77493&r2=77494&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/Reassociate.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/Reassociate.cpp Wed Jul 29 13:55:55 2009 @@ -468,7 +468,7 @@ isReassociableOp(Shl->use_back(), Instruction::Add)))) { Constant *MulCst = ConstantInt::get(Shl->getType(), 1); MulCst = - Context.getConstantExprShl(MulCst, cast(Shl->getOperand(1))); + ConstantExpr::getShl(MulCst, cast(Shl->getOperand(1))); Instruction *Mul = BinaryOperator::CreateMul(Shl->getOperand(0), MulCst, "", Shl); @@ -570,7 +570,7 @@ if (Constant *V1 = dyn_cast(Ops[Ops.size()-2].Op)) if (Constant *V2 = dyn_cast(Ops.back().Op)) { Ops.pop_back(); - Ops.back().Op = Context.getConstantExpr(Opcode, V1, V2); + Ops.back().Op = ConstantExpr::get(Opcode, V1, V2); return OptimizeExpression(I, Ops); } Modified: llvm/trunk/lib/Transforms/Scalar/SCCP.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/SCCP.cpp?rev=77494&r1=77493&r2=77494&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/SCCP.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/SCCP.cpp Wed Jul 29 13:55:55 2009 @@ -670,7 +670,7 @@ if (VState.isOverdefined()) // Inherit overdefinedness of operand markOverdefined(&I); else if (VState.isConstant()) // Propagate constant value - markConstant(&I, Context->getConstantExprCast(I.getOpcode(), + markConstant(&I, ConstantExpr::getCast(I.getOpcode(), VState.getConstant(), I.getType())); } @@ -863,7 +863,7 @@ break; // Cannot fold this operation over the PHI nodes! } else if (In1.isConstant() && In2.isConstant()) { Constant *V = - Context->getConstantExpr(I.getOpcode(), In1.getConstant(), + ConstantExpr::get(I.getOpcode(), In1.getConstant(), In2.getConstant()); if (Result.isUndefined()) Result.markConstant(V); @@ -912,7 +912,7 @@ markOverdefined(IV, &I); } else if (V1State.isConstant() && V2State.isConstant()) { markConstant(IV, &I, - Context->getConstantExpr(I.getOpcode(), V1State.getConstant(), + ConstantExpr::get(I.getOpcode(), V1State.getConstant(), V2State.getConstant())); } } @@ -949,7 +949,7 @@ Result.markOverdefined(); break; // Cannot fold this operation over the PHI nodes! } else if (In1.isConstant() && In2.isConstant()) { - Constant *V = Context->getConstantExprCompare(I.getPredicate(), + Constant *V = ConstantExpr::getCompare(I.getPredicate(), In1.getConstant(), In2.getConstant()); if (Result.isUndefined()) @@ -998,7 +998,7 @@ markOverdefined(IV, &I); } else if (V1State.isConstant() && V2State.isConstant()) { - markConstant(IV, &I, Context->getConstantExprCompare(I.getPredicate(), + markConstant(IV, &I, ConstantExpr::getCompare(I.getPredicate(), V1State.getConstant(), V2State.getConstant())); } @@ -1100,7 +1100,7 @@ Constant *Ptr = Operands[0]; Operands.erase(Operands.begin()); // Erase the pointer from idx list... - markConstant(IV, &I, Context->getConstantExprGetElementPtr(Ptr, &Operands[0], + markConstant(IV, &I, ConstantExpr::getGetElementPtr(Ptr, &Operands[0], Operands.size())); } Modified: llvm/trunk/lib/Transforms/Scalar/ScalarReplAggregates.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/ScalarReplAggregates.cpp?rev=77494&r1=77493&r2=77494&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/ScalarReplAggregates.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/ScalarReplAggregates.cpp Wed Jul 29 13:55:55 2009 @@ -242,8 +242,7 @@ DOUT << "Found alloca equal to global: " << *AI; DOUT << " memcpy = " << *TheCopy; Constant *TheSrc = cast(TheCopy->getOperand(2)); - AI->replaceAllUsesWith( - F.getContext().getConstantExprBitCast(TheSrc, AI->getType())); + AI->replaceAllUsesWith(ConstantExpr::getBitCast(TheSrc, AI->getType())); TheCopy->eraseFromParent(); // Don't mutate the global. AI->eraseFromParent(); ++NumGlobals; @@ -841,9 +840,9 @@ // Convert the integer value to the appropriate type. StoreVal = ConstantInt::get(Context, TotalVal); if (isa(ValTy)) - StoreVal = Context.getConstantExprIntToPtr(StoreVal, ValTy); + StoreVal = ConstantExpr::getIntToPtr(StoreVal, ValTy); else if (ValTy->isFloatingPoint()) - StoreVal = Context.getConstantExprBitCast(StoreVal, ValTy); + StoreVal = ConstantExpr::getBitCast(StoreVal, ValTy); assert(StoreVal->getType() == ValTy && "Type mismatch!"); // If the requested value was a vector constant, create it. Modified: llvm/trunk/lib/Transforms/Scalar/SimplifyLibCalls.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/SimplifyLibCalls.cpp?rev=77494&r1=77493&r2=77494&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/SimplifyLibCalls.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/SimplifyLibCalls.cpp Wed Jul 29 13:55:55 2009 @@ -1098,7 +1098,7 @@ Constant *One = ConstantFP::get(*Context, APFloat(1.0f)); if (Op->getType() != Type::FloatTy) - One = Context->getConstantExprFPExtend(One, Op->getType()); + One = ConstantExpr::getFPExtend(One, Op->getType()); Module *M = Caller->getParent(); Value *Callee = M->getOrInsertFunction(Name, Op->getType(), Modified: llvm/trunk/lib/Transforms/Utils/InlineFunction.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/InlineFunction.cpp?rev=77494&r1=77493&r2=77494&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Utils/InlineFunction.cpp (original) +++ llvm/trunk/lib/Transforms/Utils/InlineFunction.cpp Wed Jul 29 13:55:55 2009 @@ -322,7 +322,7 @@ Value *Size; if (TD == 0) - Size = Context.getConstantExprSizeOf(AggTy); + Size = ConstantExpr::getSizeOf(AggTy); else Size = ConstantInt::get(Type::Int64Ty, TD->getTypeStoreSize(AggTy)); Modified: llvm/trunk/lib/Transforms/Utils/LowerAllocations.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/LowerAllocations.cpp?rev=77494&r1=77493&r2=77494&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Utils/LowerAllocations.cpp (original) +++ llvm/trunk/lib/Transforms/Utils/LowerAllocations.cpp Wed Jul 29 13:55:55 2009 @@ -121,9 +121,9 @@ MallocArg = ConstantInt::get(Type::Int64Ty, TD.getTypeAllocSize(AllocTy)); else - MallocArg = Context.getConstantExprSizeOf(AllocTy); + MallocArg = ConstantExpr::getSizeOf(AllocTy); MallocArg = - Context.getConstantExprTruncOrBitCast(cast(MallocArg), + ConstantExpr::getTruncOrBitCast(cast(MallocArg), IntPtrTy); if (MI->isArrayAllocation()) { @@ -132,8 +132,8 @@ MallocArg = MI->getOperand(0); // Operand * 1 = Operand } else if (Constant *CO = dyn_cast(MI->getOperand(0))) { CO = - Context.getConstantExprIntegerCast(CO, IntPtrTy, false /*ZExt*/); - MallocArg = Context.getConstantExprMul(CO, + ConstantExpr::getIntegerCast(CO, IntPtrTy, false /*ZExt*/); + MallocArg = ConstantExpr::getMul(CO, cast(MallocArg)); } else { Value *Scale = MI->getOperand(0); Modified: llvm/trunk/lib/Transforms/Utils/LowerInvoke.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/LowerInvoke.cpp?rev=77494&r1=77493&r2=77494&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Utils/LowerInvoke.cpp (original) +++ llvm/trunk/lib/Transforms/Utils/LowerInvoke.cpp Wed Jul 29 13:55:55 2009 @@ -190,7 +190,7 @@ GlobalValue::InternalLin

    MediaWhoDescription