diff options
author | Derek Schuff <dschuff@chromium.org> | 2013-01-09 16:55:43 -0800 |
---|---|---|
committer | Derek Schuff <dschuff@chromium.org> | 2013-01-11 13:47:37 -0800 |
commit | b770d0e0636a4b5ad61b1ca661caee67576c05fc (patch) | |
tree | c486ce032d41f97313c50629bd5b879f53e6ccbf /include/llvm/Support | |
parent | b835840cf112a6178506d834b58aa625f59a8994 (diff) | |
parent | 1ad9253c9d34ccbce3e7e4ea5d87c266cbf93410 (diff) |
Merge commit '1ad9253c9d34ccbce3e7e4ea5d87c266cbf93410'
deplib features commented out due to removal upstream;
will add back as a localmod
Conflicts:
include/llvm/ADT/Triple.h
include/llvm/MC/MCAssembler.h
include/llvm/Target/TargetFrameLowering.h
lib/CodeGen/AsmPrinter/DwarfDebug.cpp
lib/CodeGen/AsmPrinter/DwarfDebug.h
lib/CodeGen/BranchFolding.cpp
lib/LLVMBuild.txt
lib/Linker/LinkArchives.cpp
lib/MC/MCAssembler.cpp
lib/MC/MCELFStreamer.cpp
lib/Makefile
lib/Target/ARM/ARMExpandPseudoInsts.cpp
lib/Target/ARM/ARMFrameLowering.cpp
lib/Target/ARM/ARMISelLowering.cpp
lib/Target/ARM/ARMSubtarget.h
lib/Target/ARM/ARMTargetObjectFile.cpp
lib/Target/ARM/MCTargetDesc/ARMAsmBackend.cpp
lib/Target/Mips/MipsInstrFPU.td
lib/Target/Mips/MipsInstrInfo.td
lib/Target/X86/X86CodeEmitter.cpp
lib/Target/X86/X86Subtarget.h
lib/VMCore/Module.cpp
test/MC/MachO/ARM/nop-armv4-padding.s
tools/Makefile
tools/llc/llc.cpp
tools/lto/LTOModule.cpp
tools/lto/lto.cpp
Diffstat (limited to 'include/llvm/Support')
27 files changed, 177 insertions, 406 deletions
diff --git a/include/llvm/Support/Allocator.h b/include/llvm/Support/Allocator.h index a644b13366..3243fd9cea 100644 --- a/include/llvm/Support/Allocator.h +++ b/include/llvm/Support/Allocator.h @@ -15,12 +15,12 @@ #define LLVM_SUPPORT_ALLOCATOR_H #include "llvm/Support/AlignOf.h" -#include "llvm/Support/MathExtras.h" #include "llvm/Support/DataTypes.h" +#include "llvm/Support/MathExtras.h" #include <algorithm> #include <cassert> -#include <cstdlib> #include <cstddef> +#include <cstdlib> namespace llvm { template <typename T> struct ReferenceAdder { typedef T& result; }; diff --git a/include/llvm/Support/CallSite.h b/include/llvm/Support/CallSite.h index ad8d6d41fc..7a0b8db9bb 100644 --- a/include/llvm/Support/CallSite.h +++ b/include/llvm/Support/CallSite.h @@ -26,8 +26,8 @@ #ifndef LLVM_SUPPORT_CALLSITE_H #define LLVM_SUPPORT_CALLSITE_H -#include "llvm/Attributes.h" #include "llvm/ADT/PointerIntPair.h" +#include "llvm/Attributes.h" #include "llvm/BasicBlock.h" #include "llvm/CallingConv.h" #include "llvm/Instructions.h" @@ -177,10 +177,10 @@ public: /// getAttributes/setAttributes - get or set the parameter attributes of /// the call. - const AttrListPtr &getAttributes() const { + const AttributeSet &getAttributes() const { CALLSITE_DELEGATE_GETTER(getAttributes()); } - void setAttributes(const AttrListPtr &PAL) { + void setAttributes(const AttributeSet &PAL) { CALLSITE_DELEGATE_SETTER(setAttributes(PAL)); } diff --git a/include/llvm/Support/CommandLine.h b/include/llvm/Support/CommandLine.h index 872c57998c..0ab39fca38 100644 --- a/include/llvm/Support/CommandLine.h +++ b/include/llvm/Support/CommandLine.h @@ -20,10 +20,10 @@ #ifndef LLVM_SUPPORT_COMMANDLINE_H #define LLVM_SUPPORT_COMMANDLINE_H -#include "llvm/Support/type_traits.h" -#include "llvm/Support/Compiler.h" #include "llvm/ADT/SmallVector.h" #include "llvm/ADT/Twine.h" +#include "llvm/Support/Compiler.h" +#include "llvm/Support/type_traits.h" #include <cassert> #include <climits> #include <cstdarg> diff --git a/include/llvm/Support/Compiler.h b/include/llvm/Support/Compiler.h index 5acc7160ab..fce30e8b7d 100644 --- a/include/llvm/Support/Compiler.h +++ b/include/llvm/Support/Compiler.h @@ -19,25 +19,47 @@ # define __has_feature(x) 0 #endif -/// LLVM_HAS_RVALUE_REFERENCES - Does the compiler provide r-value references? +/// \brief Does the compiler support r-value references? /// This implies that <utility> provides the one-argument std::move; it /// does not imply the existence of any other C++ library features. #if (__has_feature(cxx_rvalue_references) \ || defined(__GXX_EXPERIMENTAL_CXX0X__) \ || (defined(_MSC_VER) && _MSC_VER >= 1600)) -#define LLVM_USE_RVALUE_REFERENCES 1 +#define LLVM_HAS_RVALUE_REFERENCES 1 #else -#define LLVM_USE_RVALUE_REFERENCES 0 +#define LLVM_HAS_RVALUE_REFERENCES 0 +#endif + +/// \brief Does the compiler support r-value reference *this? +/// +/// Sadly, this is separate from just r-value reference support because GCC +/// implemented everything but this thus far. No release of GCC yet has support +/// for this feature so it is enabled with Clang only. +/// FIXME: This should change to a version check when GCC grows support for it. +#if __has_feature(cxx_rvalue_references) +#define LLVM_HAS_RVALUE_REFERENCE_THIS 1 +#else +#define LLVM_HAS_RVALUE_REFERENCE_THIS 0 #endif /// llvm_move - Expands to ::std::move if the compiler supports /// r-value references; otherwise, expands to the argument. -#if LLVM_USE_RVALUE_REFERENCES +#if LLVM_HAS_RVALUE_REFERENCES #define llvm_move(value) (::std::move(value)) #else #define llvm_move(value) (value) #endif +/// Expands to '&' if r-value references are supported. +/// +/// This can be used to provide l-value/r-value overrides of member functions. +/// The r-value override should be guarded by LLVM_HAS_RVALUE_REFERENCE_THIS +#if LLVM_HAS_RVALUE_REFERENCE_THIS +#define LLVM_LVALUE_FUNCTION & +#else +#define LLVM_LVALUE_FUNCTION +#endif + /// LLVM_DELETED_FUNCTION - Expands to = delete if the compiler supports it. /// Use to mark functions as uncallable. Member functions with this should /// be declared private so that some behavior is kept in C++03 mode. diff --git a/include/llvm/Support/DataFlow.h b/include/llvm/Support/DataFlow.h index 355c402f54..cc3ff0da5c 100644 --- a/include/llvm/Support/DataFlow.h +++ b/include/llvm/Support/DataFlow.h @@ -14,8 +14,8 @@ #ifndef LLVM_SUPPORT_DATAFLOW_H #define LLVM_SUPPORT_DATAFLOW_H -#include "llvm/User.h" #include "llvm/ADT/GraphTraits.h" +#include "llvm/User.h" namespace llvm { diff --git a/include/llvm/Support/ELF.h b/include/llvm/Support/ELF.h index 0b60150168..54df4ebabc 100644 --- a/include/llvm/Support/ELF.h +++ b/include/llvm/Support/ELF.h @@ -473,8 +473,13 @@ enum { R_PPC64_ADDR16_HIGHER = 39, R_PPC64_ADDR16_HIGHEST = 41, R_PPC64_TOC16 = 47, + R_PPC64_TOC16_LO = 48, + R_PPC64_TOC16_HA = 50, R_PPC64_TOC = 51, - R_PPC64_TOC16_DS = 63 + R_PPC64_TOC16_DS = 63, + R_PPC64_TOC16_LO_DS = 64, + R_PPC64_TLS = 67, + R_PPC64_GOT_TPREL16_DS = 87 }; // ARM Specific e_flags diff --git a/include/llvm/Support/ErrorHandling.h b/include/llvm/Support/ErrorHandling.h index 95b01095c1..ca5dec0173 100644 --- a/include/llvm/Support/ErrorHandling.h +++ b/include/llvm/Support/ErrorHandling.h @@ -15,8 +15,8 @@ #ifndef LLVM_SUPPORT_ERRORHANDLING_H #define LLVM_SUPPORT_ERRORHANDLING_H -#include "llvm/Support/Compiler.h" #include "llvm/ADT/StringRef.h" +#include "llvm/Support/Compiler.h" #include <string> namespace llvm { diff --git a/include/llvm/Support/FileOutputBuffer.h b/include/llvm/Support/FileOutputBuffer.h index bcd35e3c1e..cbc9c467d2 100644 --- a/include/llvm/Support/FileOutputBuffer.h +++ b/include/llvm/Support/FileOutputBuffer.h @@ -14,85 +14,79 @@ #ifndef LLVM_SUPPORT_FILEOUTPUTBUFFER_H #define LLVM_SUPPORT_FILEOUTPUTBUFFER_H +#include "llvm/ADT/OwningPtr.h" #include "llvm/ADT/SmallString.h" #include "llvm/ADT/StringRef.h" #include "llvm/Support/DataTypes.h" +#include "llvm/Support/FileSystem.h" namespace llvm { - class error_code; -template<class T> class OwningPtr; /// FileOutputBuffer - This interface provides simple way to create an in-memory -/// buffer which will be written to a file. During the lifetime of these +/// buffer which will be written to a file. During the lifetime of these /// objects, the content or existence of the specified file is undefined. That /// is, creating an OutputBuffer for a file may immediately remove the file. -/// If the FileOutputBuffer is committed, the target file's content will become -/// the buffer content at the time of the commit. If the FileOutputBuffer is +/// If the FileOutputBuffer is committed, the target file's content will become +/// the buffer content at the time of the commit. If the FileOutputBuffer is /// not committed, the file will be deleted in the FileOutputBuffer destructor. class FileOutputBuffer { public: enum { F_executable = 1 /// set the 'x' bit on the resulting file - }; + }; /// Factory method to create an OutputBuffer object which manages a read/write /// buffer of the specified size. When committed, the buffer will be written - /// to the file at the specified path. - static error_code create(StringRef FilePath, size_t Size, - OwningPtr<FileOutputBuffer> &Result, - unsigned Flags=0); - + /// to the file at the specified path. + static error_code create(StringRef FilePath, size_t Size, + OwningPtr<FileOutputBuffer> &Result, + unsigned Flags = 0); /// Returns a pointer to the start of the buffer. - uint8_t *getBufferStart() const { - return BufferStart; + uint8_t *getBufferStart() { + return (uint8_t*)Region->data(); } - + /// Returns a pointer to the end of the buffer. - uint8_t *getBufferEnd() const { - return BufferEnd; + uint8_t *getBufferEnd() { + return (uint8_t*)Region->data() + Region->size(); } - + /// Returns size of the buffer. size_t getBufferSize() const { - return BufferEnd - BufferStart; + return Region->size(); } - + /// Returns path where file will show up if buffer is committed. StringRef getPath() const { return FinalPath; } - - /// Flushes the content of the buffer to its file and deallocates the + + /// Flushes the content of the buffer to its file and deallocates the /// buffer. If commit() is not called before this object's destructor /// is called, the file is deleted in the destructor. The optional parameter /// is used if it turns out you want the file size to be smaller than /// initially requested. error_code commit(int64_t NewSmallerSize = -1); - + /// If this object was previously committed, the destructor just deletes /// this object. If this object was not committed, the destructor /// deallocates the buffer and the target file is never written. ~FileOutputBuffer(); - private: FileOutputBuffer(const FileOutputBuffer &) LLVM_DELETED_FUNCTION; FileOutputBuffer &operator=(const FileOutputBuffer &) LLVM_DELETED_FUNCTION; -protected: - FileOutputBuffer(uint8_t *Start, uint8_t *End, - StringRef Path, StringRef TempPath); - - uint8_t *BufferStart; - uint8_t *BufferEnd; + + FileOutputBuffer(llvm::sys::fs::mapped_file_region *R, + StringRef Path, StringRef TempPath); + + OwningPtr<llvm::sys::fs::mapped_file_region> Region; SmallString<128> FinalPath; SmallString<128> TempPath; }; - - - } // end namespace llvm #endif diff --git a/include/llvm/Support/FileSystem.h b/include/llvm/Support/FileSystem.h index b455b28b81..f1cbe978c1 100644 --- a/include/llvm/Support/FileSystem.h +++ b/include/llvm/Support/FileSystem.h @@ -607,7 +607,7 @@ private: public: typedef char char_type; -#if LLVM_USE_RVALUE_REFERENCES +#if LLVM_HAS_RVALUE_REFERENCES mapped_file_region(mapped_file_region&&); mapped_file_region &operator =(mapped_file_region&&); #endif diff --git a/include/llvm/Support/GetElementPtrTypeIterator.h b/include/llvm/Support/GetElementPtrTypeIterator.h index 93dc41fbdc..d1519e479d 100644 --- a/include/llvm/Support/GetElementPtrTypeIterator.h +++ b/include/llvm/Support/GetElementPtrTypeIterator.h @@ -15,8 +15,8 @@ #ifndef LLVM_SUPPORT_GETELEMENTPTRTYPE_H #define LLVM_SUPPORT_GETELEMENTPTRTYPE_H -#include "llvm/User.h" #include "llvm/DerivedTypes.h" +#include "llvm/User.h" namespace llvm { template<typename ItTy = User::const_op_iterator> diff --git a/include/llvm/Support/GraphWriter.h b/include/llvm/Support/GraphWriter.h index f178b0caa8..30cfe6124b 100644 --- a/include/llvm/Support/GraphWriter.h +++ b/include/llvm/Support/GraphWriter.h @@ -23,12 +23,12 @@ #ifndef LLVM_SUPPORT_GRAPHWRITER_H #define LLVM_SUPPORT_GRAPHWRITER_H -#include "llvm/Support/DOTGraphTraits.h" -#include "llvm/Support/raw_ostream.h" #include "llvm/ADT/GraphTraits.h" +#include "llvm/Support/DOTGraphTraits.h" #include "llvm/Support/Path.h" -#include <vector> +#include "llvm/Support/raw_ostream.h" #include <cassert> +#include <vector> namespace llvm { diff --git a/include/llvm/Support/InstVisitor.h b/include/llvm/Support/InstVisitor.h deleted file mode 100644 index 6dfb4dec0e..0000000000 --- a/include/llvm/Support/InstVisitor.h +++ /dev/null @@ -1,288 +0,0 @@ -//===- llvm/Support/InstVisitor.h - Define instruction visitors -*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - - -#ifndef LLVM_SUPPORT_INSTVISITOR_H -#define LLVM_SUPPORT_INSTVISITOR_H - -#include "llvm/Function.h" -#include "llvm/Instructions.h" -#include "llvm/Intrinsics.h" -#include "llvm/IntrinsicInst.h" -#include "llvm/Module.h" -#include "llvm/Support/CallSite.h" -#include "llvm/Support/ErrorHandling.h" - -namespace llvm { - -// We operate on opaque instruction classes, so forward declare all instruction -// types now... -// -#define HANDLE_INST(NUM, OPCODE, CLASS) class CLASS; -#include "llvm/Instruction.def" - -#define DELEGATE(CLASS_TO_VISIT) \ - return static_cast<SubClass*>(this)-> \ - visit##CLASS_TO_VISIT(static_cast<CLASS_TO_VISIT&>(I)) - - -/// @brief Base class for instruction visitors -/// -/// Instruction visitors are used when you want to perform different actions -/// for different kinds of instructions without having to use lots of casts -/// and a big switch statement (in your code, that is). -/// -/// To define your own visitor, inherit from this class, specifying your -/// new type for the 'SubClass' template parameter, and "override" visitXXX -/// functions in your class. I say "override" because this class is defined -/// in terms of statically resolved overloading, not virtual functions. -/// -/// For example, here is a visitor that counts the number of malloc -/// instructions processed: -/// -/// /// Declare the class. Note that we derive from InstVisitor instantiated -/// /// with _our new subclasses_ type. -/// /// -/// struct CountAllocaVisitor : public InstVisitor<CountAllocaVisitor> { -/// unsigned Count; -/// CountAllocaVisitor() : Count(0) {} -/// -/// void visitAllocaInst(AllocaInst &AI) { ++Count; } -/// }; -/// -/// And this class would be used like this: -/// CountAllocaVisitor CAV; -/// CAV.visit(function); -/// NumAllocas = CAV.Count; -/// -/// The defined has 'visit' methods for Instruction, and also for BasicBlock, -/// Function, and Module, which recursively process all contained instructions. -/// -/// Note that if you don't implement visitXXX for some instruction type, -/// the visitXXX method for instruction superclass will be invoked. So -/// if instructions are added in the future, they will be automatically -/// supported, if you handle one of their superclasses. -/// -/// The optional second template argument specifies the type that instruction -/// visitation functions should return. If you specify this, you *MUST* provide -/// an implementation of visitInstruction though!. -/// -/// Note that this class is specifically designed as a template to avoid -/// virtual function call overhead. Defining and using an InstVisitor is just -/// as efficient as having your own switch statement over the instruction -/// opcode. -template<typename SubClass, typename RetTy=void> -class InstVisitor { - //===--------------------------------------------------------------------===// - // Interface code - This is the public interface of the InstVisitor that you - // use to visit instructions... - // - -public: - // Generic visit method - Allow visitation to all instructions in a range - template<class Iterator> - void visit(Iterator Start, Iterator End) { - while (Start != End) - static_cast<SubClass*>(this)->visit(*Start++); - } - - // Define visitors for functions and basic blocks... - // - void visit(Module &M) { - static_cast<SubClass*>(this)->visitModule(M); - visit(M.begin(), M.end()); - } - void visit(Function &F) { - static_cast<SubClass*>(this)->visitFunction(F); - visit(F.begin(), F.end()); - } - void visit(BasicBlock &BB) { - static_cast<SubClass*>(this)->visitBasicBlock(BB); - visit(BB.begin(), BB.end()); - } - - // Forwarding functions so that the user can visit with pointers AND refs. - void visit(Module *M) { visit(*M); } - void visit(Function *F) { visit(*F); } - void visit(BasicBlock *BB) { visit(*BB); } - RetTy visit(Instruction *I) { return visit(*I); } - - // visit - Finally, code to visit an instruction... - // - RetTy visit(Instruction &I) { - switch (I.getOpcode()) { - default: llvm_unreachable("Unknown instruction type encountered!"); - // Build the switch statement using the Instruction.def file... -#define HANDLE_INST(NUM, OPCODE, CLASS) \ - case Instruction::OPCODE: return \ - static_cast<SubClass*>(this)-> \ - visit##OPCODE(static_cast<CLASS&>(I)); -#include "llvm/Instruction.def" - } - } - - //===--------------------------------------------------------------------===// - // Visitation functions... these functions provide default fallbacks in case - // the user does not specify what to do for a particular instruction type. - // The default behavior is to generalize the instruction type to its subtype - // and try visiting the subtype. All of this should be inlined perfectly, - // because there are no virtual functions to get in the way. - // - - // When visiting a module, function or basic block directly, these methods get - // called to indicate when transitioning into a new unit. - // - void visitModule (Module &M) {} - void visitFunction (Function &F) {} - void visitBasicBlock(BasicBlock &BB) {} - - // Define instruction specific visitor functions that can be overridden to - // handle SPECIFIC instructions. These functions automatically define - // visitMul to proxy to visitBinaryOperator for instance in case the user does - // not need this generality. - // - // These functions can also implement fan-out, when a single opcode and - // instruction have multiple more specific Instruction subclasses. The Call - // instruction currently supports this. We implement that by redirecting that - // instruction to a special delegation helper. -#define HANDLE_INST(NUM, OPCODE, CLASS) \ - RetTy visit##OPCODE(CLASS &I) { \ - if (NUM == Instruction::Call) \ - return delegateCallInst(I); \ - else \ - DELEGATE(CLASS); \ - } -#include "llvm/Instruction.def" - - // Specific Instruction type classes... note that all of the casts are - // necessary because we use the instruction classes as opaque types... - // - RetTy visitReturnInst(ReturnInst &I) { DELEGATE(TerminatorInst);} - RetTy visitBranchInst(BranchInst &I) { DELEGATE(TerminatorInst);} - RetTy visitSwitchInst(SwitchInst &I) { DELEGATE(TerminatorInst);} - RetTy visitIndirectBrInst(IndirectBrInst &I) { DELEGATE(TerminatorInst);} - RetTy visitResumeInst(ResumeInst &I) { DELEGATE(TerminatorInst);} - RetTy visitUnreachableInst(UnreachableInst &I) { DELEGATE(TerminatorInst);} - RetTy visitICmpInst(ICmpInst &I) { DELEGATE(CmpInst);} - RetTy visitFCmpInst(FCmpInst &I) { DELEGATE(CmpInst);} - RetTy visitAllocaInst(AllocaInst &I) { DELEGATE(UnaryInstruction);} - RetTy visitLoadInst(LoadInst &I) { DELEGATE(UnaryInstruction);} - RetTy visitStoreInst(StoreInst &I) { DELEGATE(Instruction);} - RetTy visitAtomicCmpXchgInst(AtomicCmpXchgInst &I) { DELEGATE(Instruction);} - RetTy visitAtomicRMWInst(AtomicRMWInst &I) { DELEGATE(Instruction);} - RetTy visitFenceInst(FenceInst &I) { DELEGATE(Instruction);} - RetTy visitGetElementPtrInst(GetElementPtrInst &I){ DELEGATE(Instruction);} - RetTy visitPHINode(PHINode &I) { DELEGATE(Instruction);} - RetTy visitTruncInst(TruncInst &I) { DELEGATE(CastInst);} - RetTy visitZExtInst(ZExtInst &I) { DELEGATE(CastInst);} - RetTy visitSExtInst(SExtInst &I) { DELEGATE(CastInst);} - RetTy visitFPTruncInst(FPTruncInst &I) { DELEGATE(CastInst);} - RetTy visitFPExtInst(FPExtInst &I) { DELEGATE(CastInst);} - RetTy visitFPToUIInst(FPToUIInst &I) { DELEGATE(CastInst);} - RetTy visitFPToSIInst(FPToSIInst &I) { DELEGATE(CastInst);} - RetTy visitUIToFPInst(UIToFPInst &I) { DELEGATE(CastInst);} - RetTy visitSIToFPInst(SIToFPInst &I) { DELEGATE(CastInst);} - RetTy visitPtrToIntInst(PtrToIntInst &I) { DELEGATE(CastInst);} - RetTy visitIntToPtrInst(IntToPtrInst &I) { DELEGATE(CastInst);} - RetTy visitBitCastInst(BitCastInst &I) { DELEGATE(CastInst);} - RetTy visitSelectInst(SelectInst &I) { DELEGATE(Instruction);} - RetTy visitVAArgInst(VAArgInst &I) { DELEGATE(UnaryInstruction);} - RetTy visitExtractElementInst(ExtractElementInst &I) { DELEGATE(Instruction);} - RetTy visitInsertElementInst(InsertElementInst &I) { DELEGATE(Instruction);} - RetTy visitShuffleVectorInst(ShuffleVectorInst &I) { DELEGATE(Instruction);} - RetTy visitExtractValueInst(ExtractValueInst &I){ DELEGATE(UnaryInstruction);} - RetTy visitInsertValueInst(InsertValueInst &I) { DELEGATE(Instruction); } - RetTy visitLandingPadInst(LandingPadInst &I) { DELEGATE(Instruction); } - - // Handle the special instrinsic instruction classes. - RetTy visitDbgDeclareInst(DbgDeclareInst &I) { DELEGATE(DbgInfoIntrinsic);} - RetTy visitDbgValueInst(DbgValueInst &I) { DELEGATE(DbgInfoIntrinsic);} - RetTy visitDbgInfoIntrinsic(DbgInfoIntrinsic &I) { DELEGATE(IntrinsicInst); } - RetTy visitMemSetInst(MemSetInst &I) { DELEGATE(MemIntrinsic); } - RetTy visitMemCpyInst(MemCpyInst &I) { DELEGATE(MemTransferInst); } - RetTy visitMemMoveInst(MemMoveInst &I) { DELEGATE(MemTransferInst); } - RetTy visitMemTransferInst(MemTransferInst &I) { DELEGATE(MemIntrinsic); } - RetTy visitMemIntrinsic(MemIntrinsic &I) { DELEGATE(IntrinsicInst); } - RetTy visitVAStartInst(VAStartInst &I) { DELEGATE(IntrinsicInst); } - RetTy visitVAEndInst(VAEndInst &I) { DELEGATE(IntrinsicInst); } - RetTy visitVACopyInst(VACopyInst &I) { DELEGATE(IntrinsicInst); } - RetTy visitIntrinsicInst(IntrinsicInst &I) { DELEGATE(CallInst); } - - // Call and Invoke are slightly different as they delegate first through - // a generic CallSite visitor. - RetTy visitCallInst(CallInst &I) { - return static_cast<SubClass*>(this)->visitCallSite(&I); - } - RetTy visitInvokeInst(InvokeInst &I) { - return static_cast<SubClass*>(this)->visitCallSite(&I); - } - - // Next level propagators: If the user does not overload a specific - // instruction type, they can overload one of these to get the whole class - // of instructions... - // - RetTy visitCastInst(CastInst &I) { DELEGATE(UnaryInstruction);} - RetTy visitBinaryOperator(BinaryOperator &I) { DELEGATE(Instruction);} - RetTy visitCmpInst(CmpInst &I) { DELEGATE(Instruction);} - RetTy visitTerminatorInst(TerminatorInst &I) { DELEGATE(Instruction);} - RetTy visitUnaryInstruction(UnaryInstruction &I){ DELEGATE(Instruction);} - - // Provide a special visitor for a 'callsite' that visits both calls and - // invokes. When unimplemented, properly delegates to either the terminator or - // regular instruction visitor. - RetTy visitCallSite(CallSite CS) { - assert(CS); - Instruction &I = *CS.getInstruction(); - if (CS.isCall()) - DELEGATE(Instruction); - - assert(CS.isInvoke()); - DELEGATE(TerminatorInst); - } - - // If the user wants a 'default' case, they can choose to override this - // function. If this function is not overloaded in the user's subclass, then - // this instruction just gets ignored. - // - // Note that you MUST override this function if your return type is not void. - // - void visitInstruction(Instruction &I) {} // Ignore unhandled instructions - -private: - // Special helper function to delegate to CallInst subclass visitors. - RetTy delegateCallInst(CallInst &I) { - if (const Function *F = I.getCalledFunction()) { - switch ((Intrinsic::ID)F->getIntrinsicID()) { - default: DELEGATE(IntrinsicInst); - case Intrinsic::dbg_declare: DELEGATE(DbgDeclareInst); - case Intrinsic::dbg_value: DELEGATE(DbgValueInst); - case Intrinsic::memcpy: DELEGATE(MemCpyInst); - case Intrinsic::memmove: DELEGATE(MemMoveInst); - case Intrinsic::memset: DELEGATE(MemSetInst); - case Intrinsic::vastart: DELEGATE(VAStartInst); - case Intrinsic::vaend: DELEGATE(VAEndInst); - case Intrinsic::vacopy: DELEGATE(VACopyInst); - case Intrinsic::not_intrinsic: break; - } - } - DELEGATE(CallInst); - } - - // An overload that will never actually be called, it is used only from dead - // code in the dispatching from opcodes to instruction subclasses. - RetTy delegateCallInst(Instruction &I) { - llvm_unreachable("delegateCallInst called for non-CallInst"); - } -}; - -#undef DELEGATE - -} // End llvm namespace - -#endif diff --git a/include/llvm/Support/IntegersSubset.h b/include/llvm/Support/IntegersSubset.h index 03039fd645..d6a3b2f541 100644 --- a/include/llvm/Support/IntegersSubset.h +++ b/include/llvm/Support/IntegersSubset.h @@ -18,11 +18,10 @@ #ifndef CONSTANTRANGESSET_H_ #define CONSTANTRANGESSET_H_ -#include <list> - #include "llvm/Constants.h" #include "llvm/DerivedTypes.h" #include "llvm/LLVMContext.h" +#include <list> namespace llvm { diff --git a/include/llvm/Support/PassNameParser.h b/include/llvm/Support/PassNameParser.h index a24a6f0c5e..bdfab390b3 100644 --- a/include/llvm/Support/PassNameParser.h +++ b/include/llvm/Support/PassNameParser.h @@ -23,8 +23,8 @@ #ifndef LLVM_SUPPORT_PASS_NAME_PARSER_H #define LLVM_SUPPORT_PASS_NAME_PARSER_H -#include "llvm/Pass.h" #include "llvm/ADT/STLExtras.h" +#include "llvm/Pass.h" #include "llvm/Support/CommandLine.h" #include "llvm/Support/ErrorHandling.h" #include "llvm/Support/raw_ostream.h" diff --git a/include/llvm/Support/PatternMatch.h b/include/llvm/Support/PatternMatch.h index 221fa8b3eb..36b6db7a72 100644 --- a/include/llvm/Support/PatternMatch.h +++ b/include/llvm/Support/PatternMatch.h @@ -41,13 +41,13 @@ bool match(Val *V, const Pattern &P) { return const_cast<Pattern&>(P).match(V); } - + template<typename SubPattern_t> struct OneUse_match { SubPattern_t SubPattern; - + OneUse_match(const SubPattern_t &SP) : SubPattern(SP) {} - + template<typename OpTy> bool match(OpTy *V) { return V->hasOneUse() && SubPattern.match(V); @@ -56,8 +56,8 @@ struct OneUse_match { template<typename T> inline OneUse_match<T> m_OneUse(const T &SubPattern) { return SubPattern; } - - + + template<typename Class> struct class_match { template<typename ITy> @@ -74,7 +74,7 @@ inline class_match<ConstantInt> m_ConstantInt() { inline class_match<UndefValu |