diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/llvm/ADT/HashExtras.h | 40 | ||||
-rw-r--r-- | include/llvm/ADT/Tree.h | 62 | ||||
-rw-r--r-- | include/llvm/Analysis/LoopVR.h | 90 | ||||
-rw-r--r-- | include/llvm/CodeGen/LazyLiveness.h | 63 | ||||
-rw-r--r-- | include/llvm/Config/alloca.h | 49 | ||||
-rw-r--r-- | include/llvm/Debugger/Debugger.h | 176 | ||||
-rw-r--r-- | include/llvm/Debugger/InferiorProcess.h | 137 | ||||
-rw-r--r-- | include/llvm/Debugger/ProgramInfo.h | 246 | ||||
-rw-r--r-- | include/llvm/Debugger/RuntimeInfo.h | 142 | ||||
-rw-r--r-- | include/llvm/Debugger/SourceFile.h | 87 | ||||
-rw-r--r-- | include/llvm/Debugger/SourceLanguage.h | 99 | ||||
-rw-r--r-- | include/llvm/MDNode.h | 135 | ||||
-rw-r--r-- | include/llvm/Support/Annotation.h | 216 | ||||
-rw-r--r-- | include/llvm/Support/Streams.h | 91 | ||||
-rw-r--r-- | include/llvm/Target/DarwinTargetAsmInfo.h | 50 | ||||
-rw-r--r-- | include/llvm/Target/ELFTargetAsmInfo.h | 45 | ||||
-rw-r--r-- | include/llvm/Target/TargetAsmInfo.h | 930 | ||||
-rw-r--r-- | include/llvm/Target/TargetMachineRegistry.h | 97 | ||||
-rw-r--r-- | include/llvm/Transforms/Utils/InlineCost.h | 155 |
19 files changed, 0 insertions, 2910 deletions
diff --git a/include/llvm/ADT/HashExtras.h b/include/llvm/ADT/HashExtras.h deleted file mode 100644 index 20c4fd3..0000000 --- a/include/llvm/ADT/HashExtras.h +++ /dev/null @@ -1,40 +0,0 @@ -//===-- llvm/ADT/HashExtras.h - Useful functions for STL hash ---*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// -// This file contains some templates that are useful if you are working with the -// STL Hashed containers. -// -// No library is required when using these functions. -// -//===----------------------------------------------------------------------===// - -#ifndef LLVM_ADT_HASHEXTRAS_H -#define LLVM_ADT_HASHEXTRAS_H - -#include <string> - -// Cannot specialize hash template from outside of the std namespace. -namespace HASH_NAMESPACE { - -// Provide a hash function for arbitrary pointers... -template <class T> struct hash<T *> { - inline size_t operator()(const T *Val) const { - return reinterpret_cast<size_t>(Val); - } -}; - -template <> struct hash<std::string> { - size_t operator()(std::string const &str) const { - return hash<char const *>()(str.c_str()); - } -}; - -} // End namespace std - -#endif diff --git a/include/llvm/ADT/Tree.h b/include/llvm/ADT/Tree.h deleted file mode 100644 index 78f5b4f..0000000 --- a/include/llvm/ADT/Tree.h +++ /dev/null @@ -1,62 +0,0 @@ -//===- llvm/ADT/Tree.h - Generic n-way tree structure -----------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// -// This class defines a generic N-way tree node structure. The tree structure -// is immutable after creation, but the payload contained within it is not. -// -//===----------------------------------------------------------------------===// - -#ifndef LLVM_ADT_TREE_H -#define LLVM_ADT_TREE_H - -#include <vector> - -namespace llvm { - -template<class ConcreteTreeNode, class Payload> -class Tree { - std::vector<ConcreteTreeNode*> Children; // This node's children, if any. - ConcreteTreeNode *Parent; // Parent of this node. - Payload Data; // Data held in this node. - -protected: - void setChildren(const std::vector<ConcreteTreeNode*> &children) { - Children = children; - } -public: - inline Tree(ConcreteTreeNode *parent) : Parent(parent) {} - inline Tree(const std::vector<ConcreteTreeNode*> &children, - ConcreteTreeNode *par) : Children(children), Parent(par) {} - - inline Tree(const std::vector<ConcreteTreeNode*> &children, - ConcreteTreeNode *par, const Payload &data) - : Children(children), Parent(par), Data(data) {} - - // Tree dtor - Free all children - inline ~Tree() { - for (unsigned i = Children.size(); i > 0; --i) - delete Children[i-1]; - } - - // Tree manipulation/walking routines... - inline ConcreteTreeNode *getParent() const { return Parent; } - inline unsigned getNumChildren() const { return Children.size(); } - inline ConcreteTreeNode *getChild(unsigned i) const { - assert(i < Children.size() && "Tree::getChild with index out of range!"); - return Children[i]; - } - - // Payload access... - inline Payload &getTreeData() { return Data; } - inline const Payload &getTreeData() const { return Data; } -}; - -} // End llvm namespace - -#endif diff --git a/include/llvm/Analysis/LoopVR.h b/include/llvm/Analysis/LoopVR.h deleted file mode 100644 index 36b6215..0000000 --- a/include/llvm/Analysis/LoopVR.h +++ /dev/null @@ -1,90 +0,0 @@ -//===- LoopVR.cpp - Value Range analysis driven by loop information -------===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// -// This file defines the interface for the loop-driven value range pass. -// -//===----------------------------------------------------------------------===// - -#ifndef LLVM_ANALYSIS_LOOPVR_H -#define LLVM_ANALYSIS_LOOPVR_H - -#include "llvm/Pass.h" -#include "llvm/Analysis/ScalarEvolution.h" -#include "llvm/Support/ConstantRange.h" -#include <iosfwd> -#include <map> - -namespace llvm { - -/// LoopVR - This class maintains a mapping of Values to ConstantRanges. -/// There are interfaces to look up and update ranges by value, and for -/// accessing all values with range information. -/// -class LoopVR : public FunctionPass { -public: - static char ID; // Class identification, replacement for typeinfo - - LoopVR() : FunctionPass(&ID) {} - - bool runOnFunction(Function &F); - virtual void print(std::ostream &os, const Module *) const; - void releaseMemory(); - - void getAnalysisUsage(AnalysisUsage &AU) const { - AU.addRequiredTransitive<LoopInfo>(); - AU.addRequiredTransitive<ScalarEvolution>(); - AU.setPreservesAll(); - } - - //===--------------------------------------------------------------------- - // Methods that are used to look up and update particular values. - - /// get - return the ConstantRange for a given Value of IntegerType. - ConstantRange get(Value *V); - - /// remove - remove a value from this analysis. - void remove(Value *V); - - /// narrow - improve our unterstanding of a Value by pointing out that it - /// must fall within ConstantRange. To replace a range, remove it first. - void narrow(Value *V, const ConstantRange &CR); - - //===--------------------------------------------------------------------- - // Methods that are used to iterate across all values with information. - - /// size - returns the number of Values with information - unsigned size() const { return Map.size(); } - - typedef std::map<Value *, ConstantRange *>::iterator iterator; - - /// begin - return an iterator to the first Value, ConstantRange pair - iterator begin() { return Map.begin(); } - - /// end - return an iterator one past the last Value, ConstantRange pair - iterator end() { return Map.end(); } - - /// getValue - return the Value referenced by an iterator - Value *getValue(iterator I) { return I->first; } - - /// getConstantRange - return the ConstantRange referenced by an iterator - ConstantRange getConstantRange(iterator I) { return *I->second; } - -private: - ConstantRange compute(Value *V); - - ConstantRange getRange(const SCEV* S, Loop *L, ScalarEvolution &SE); - - ConstantRange getRange(const SCEV* S, const SCEV* T, ScalarEvolution &SE); - - std::map<Value *, ConstantRange *> Map; -}; - -} // end llvm namespace - -#endif diff --git a/include/llvm/CodeGen/LazyLiveness.h b/include/llvm/CodeGen/LazyLiveness.h deleted file mode 100644 index 82e4a15..0000000 --- a/include/llvm/CodeGen/LazyLiveness.h +++ /dev/null @@ -1,63 +0,0 @@ -//===- LazyLiveness.h - Lazy, CFG-invariant liveness information ----------===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// -// This pass implements a lazy liveness analysis as per "Fast Liveness Checking -// for SSA-form Programs," by Boissinot, et al. -// -//===----------------------------------------------------------------------===// - -#ifndef LLVM_CODEGEN_LAZYLIVENESS_H -#define LLVM_CODEGEN_LAZYLIVENESS_H - -#include "llvm/CodeGen/MachineFunctionPass.h" -#include "llvm/CodeGen/MachineDominators.h" -#include "llvm/ADT/DenseMap.h" -#include "llvm/ADT/DenseSet.h" -#include "llvm/ADT/SparseBitVector.h" -#include <vector> - -namespace llvm { - -class MachineRegisterInfo; - -class LazyLiveness : public MachineFunctionPass { -public: - static char ID; // Pass identification, replacement for typeid - LazyLiveness() : MachineFunctionPass(&ID) { } - - void getAnalysisUsage(AnalysisUsage &AU) const { - AU.setPreservesAll(); - AU.addRequired<MachineDominatorTree>(); - } - - bool runOnMachineFunction(MachineFunction &mf); - - bool vregLiveIntoMBB(unsigned vreg, MachineBasicBlock* MBB); - -private: - void computeBackedgeChain(MachineFunction& mf, MachineBasicBlock* MBB); - - typedef std::pair<MachineBasicBlock*, MachineBasicBlock*> edge_t; - - MachineRegisterInfo* MRI; - - DenseMap<MachineBasicBlock*, unsigned> preorder; - std::vector<MachineBasicBlock*> rev_preorder; - DenseMap<MachineBasicBlock*, SparseBitVector<128> > rv; - DenseMap<MachineBasicBlock*, SparseBitVector<128> > tv; - DenseSet<edge_t> backedges; - SparseBitVector<128> backedge_source; - SparseBitVector<128> backedge_target; - SparseBitVector<128> calculated; -}; - -} - -#endif - diff --git a/include/llvm/Config/alloca.h b/include/llvm/Config/alloca.h deleted file mode 100644 index 9990507..0000000 --- a/include/llvm/Config/alloca.h +++ /dev/null @@ -1,49 +0,0 @@ -/* - * The LLVM Compiler Infrastructure - * - * This file is distributed under the University of Illinois Open Source - * License. See LICENSE.TXT for details. - * - ****************************************************************************** - * - * Description: - * This header file includes the infamous alloc.h header file if the - * autoconf system has found it. It hides all of the autoconf details - * from the rest of the application source code. - */ - -#ifndef _CONFIG_ALLOC_H -#define _CONFIG_ALLOC_H - -#include "llvm/Config/config.h" - -/* - * This is a modified version of that suggested by the Autoconf manual. - * 1) The #pragma is indented so that pre-ANSI C compilers ignore it. - * 2) If alloca.h cannot be found, then try stdlib.h. Some platforms - * (notably FreeBSD) defined alloca() there. - */ -#ifdef _MSC_VER -#include <malloc.h> -#define alloca _alloca -#elif defined(HAVE_ALLOCA_H) -#include <alloca.h> -#elif defined(__MINGW32__) && defined(HAVE_MALLOC_H) -#include <malloc.h> -#elif !defined(__GNUC__) -# ifdef _AIX -# pragma alloca -# else -# ifndef alloca - char * alloca (); -# endif -# endif -#else -# ifdef HAVE_STDLIB_H -# include <stdlib.h> -# else -# error "The function alloca() is required but not found!" -# endif -#endif - -#endif diff --git a/include/llvm/Debugger/Debugger.h b/include/llvm/Debugger/Debugger.h deleted file mode 100644 index 42de356..0000000 --- a/include/llvm/Debugger/Debugger.h +++ /dev/null @@ -1,176 +0,0 @@ -//===- Debugger.h - LLVM debugger library interface -------------*- 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 the LLVM source-level debugger library interface. -// -//===----------------------------------------------------------------------===// - -#ifndef LLVM_DEBUGGER_DEBUGGER_H -#define LLVM_DEBUGGER_DEBUGGER_H - -#include <string> -#include <vector> - -namespace llvm { - class Module; - class InferiorProcess; - class LLVMContext; - - /// Debugger class - This class implements the LLVM source-level debugger. - /// This allows clients to handle the user IO processing without having to - /// worry about how the debugger itself works. - /// - class Debugger { - // State the debugger needs when starting and stopping the program. - std::vector<std::string> ProgramArguments; - - // The environment to run the program with. This should eventually be - // changed to vector of strings when we allow the user to edit the - // environment. - const char * const *Environment; - - // Program - The currently loaded program, or null if none is loaded. - Module *Program; - - // Process - The currently executing inferior process. - InferiorProcess *Process; - - Debugger(const Debugger &); // DO NOT IMPLEMENT - void operator=(const Debugger &); // DO NOT IMPLEMENT - public: - Debugger(); - ~Debugger(); - - //===------------------------------------------------------------------===// - // Methods for manipulating and inspecting the execution environment. - // - - /// initializeEnvironment - Specify the environment the program should run - /// with. This is used to initialize the environment of the program to the - /// environment of the debugger. - void initializeEnvironment(const char *const *envp) { - Environment = envp; - } - - /// setWorkingDirectory - Specify the working directory for the program to - /// be started from. - void setWorkingDirectory(const std::string &Dir) { - // FIXME: implement - } - - template<typename It> - void setProgramArguments(It I, It E) { - ProgramArguments.assign(I, E); - } - unsigned getNumProgramArguments() const { - return static_cast<unsigned>(ProgramArguments.size()); - } - const std::string &getProgramArgument(unsigned i) const { - return ProgramArguments[i]; - } - - - //===------------------------------------------------------------------===// - // Methods for manipulating and inspecting the program currently loaded. - // - - /// isProgramLoaded - Return true if there is a program currently loaded. - /// - bool isProgramLoaded() const { return Program != 0; } - - /// getProgram - Return the LLVM module corresponding to the program. - /// - Module *getProgram() const { return Program; } - - /// getProgramPath - Get the path of the currently loaded program, or an - /// empty string if none is loaded. - std::string getProgramPath() const; - - /// loadProgram - If a program is currently loaded, unload it. Then search - /// the PATH for the specified program, loading it when found. If the - /// specified program cannot be found, an exception is thrown to indicate - /// the error. - void loadProgram(const std::string &Path, LLVMContext& Context); - - /// unloadProgram - If a program is running, kill it, then unload all traces - /// of the current program. If no program is loaded, this method silently - /// succeeds. - void unloadProgram(); - - //===------------------------------------------------------------------===// - // Methods for manipulating and inspecting the program currently running. - // - // If the program is running, and the debugger is active, then we know that - // the program has stopped. This being the case, we can inspect the - // program, ask it for its source location, set breakpoints, etc. - // - - /// isProgramRunning - Return true if a program is loaded and has a - /// currently active instance. - bool isProgramRunning() const { return Process != 0; } - - /// getRunningProcess - If there is no program running, throw an exception. - /// Otherwise return the running process so that it can be inspected by the - /// debugger. - const InferiorProcess &getRunningProcess() const { - if (Process == 0) throw "No process running."; - return *Process; - } - - /// createProgram - Create an instance of the currently loaded program, - /// killing off any existing one. This creates the program and stops it at - /// the first possible moment. If there is no program loaded or if there is - /// a problem starting the program, this method throws an exception. - void createProgram(); - - /// killProgram - If the program is currently executing, kill off the - /// process and free up any state related to the currently running program. - /// If there is no program currently running, this just silently succeeds. - /// If something horrible happens when killing the program, an exception - /// gets thrown. - void killProgram(); - - - //===------------------------------------------------------------------===// - // Methods for continuing execution. These methods continue the execution - // of the program by some amount. If the program is successfully stopped, - // execution returns, otherwise an exception is thrown. - // - // NOTE: These methods should always be used in preference to directly - // accessing the Dbg object, because these will delete the Process object if - // the process unexpectedly dies. - // - - /// stepProgram - Implement the 'step' command, continuing execution until - /// the next possible stop point. - void stepProgram(); - - /// nextProgram - Implement the 'next' command, continuing execution until - /// the next possible stop point that is in the current function. - void nextProgram(); - - /// finishProgram - Implement the 'finish' command, continuing execution - /// until the specified frame ID returns. - void finishProgram(void *Frame); - - /// contProgram - Implement the 'cont' command, continuing execution until - /// the next breakpoint is encountered. - void contProgram(); - }; - - class NonErrorException { - std::string Message; - public: - NonErrorException(const std::string &M) : Message(M) {} - const std::string &getMessage() const { return Message; } - }; - -} // end namespace llvm - -#endif diff --git a/include/llvm/Debugger/InferiorProcess.h b/include/llvm/Debugger/InferiorProcess.h deleted file mode 100644 index 71d138b..0000000 --- a/include/llvm/Debugger/InferiorProcess.h +++ /dev/null @@ -1,137 +0,0 @@ -//===- InferiorProcess.h - Represent the program being debugged -*- 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 the InferiorProcess class, which is used to represent, -// inspect, and manipulate a process under the control of the LLVM debugger. -// -// This is an abstract class which should allow various different types of -// implementations. Initially we implement a unix specific debugger backend -// that does not require code generator support, but we could eventually use -// code generator support with ptrace, support windows based targets, supported -// remote targets, etc. -// -// If the inferior process unexpectedly dies, an attempt to communicate with it -// will cause an InferiorProcessDead exception to be thrown, indicating the exit -// code of the process. When this occurs, no methods on the InferiorProcess -// class should be called except for the destructor. -// -//===----------------------------------------------------------------------===// - -#ifndef LLVM_DEBUGGER_INFERIORPROCESS_H -#define LLVM_DEBUGGER_INFERIORPROCESS_H - -#include <string> -#include <vector> - -namespace llvm { - class Module; - class GlobalVariable; - - /// InferiorProcessDead exception - This class is thrown by methods that - /// communicate with the interior process if the process unexpectedly exits or - /// dies. The instance variable indicates what the exit code of the process - /// was, or -1 if unknown. - class InferiorProcessDead { - int ExitCode; - public: - InferiorProcessDead(int EC) : ExitCode(EC) {} - int getExitCode() const { return ExitCode; } - }; - - /// InferiorProcess class - This class represents the process being debugged - /// by the debugger. Objects of this class should not be stack allocated, - /// because the destructor can throw exceptions. - /// - class InferiorProcess { - Module *M; - protected: - InferiorProcess(Module *m) : M(m) {} - public: - /// create - Create an inferior process of the specified module, and - /// stop it at the first opportunity. If there is a problem starting the - /// program (for example, it has no main), throw an exception. - static InferiorProcess *create(Module *M, - const std::vector<std::string> &Arguments, - const char * const *envp); - - // InferiorProcess destructor - Kill the current process. If something - // terrible happens, we throw an exception from the destructor. - virtual ~InferiorProcess() {} - - //===------------------------------------------------------------------===// - // Status methods - These methods return information about the currently - // stopped process. - // - - /// getStatus - Return a status message that is specific to the current type - /// of inferior process that is created. This can return things like the - /// PID of the inferior or other potentially interesting things. - virtual std::string getStatus() const { - return ""; - } - - //===------------------------------------------------------------------===// - // Methods for inspecting the call stack. - // - - /// getPreviousFrame - Given the descriptor for the current stack frame, - /// return the descriptor for the caller frame. This returns null when it - /// runs out of frames. If Frame is null, the initial frame should be - /// returned. - virtual void *getPreviousFrame(void *Frame) const = 0; - - /// getSubprogramDesc - Return the subprogram descriptor for the current - /// stack frame. - virtual const GlobalVariable *getSubprogramDesc(void *Frame) const = 0; - - /// getFrameLocation - This method returns the source location where each - /// stack frame is stopped. - virtual void getFrameLocation(void *Frame, unsigned &LineNo, - unsigned &ColNo, - const GlobalVariable *&SourceDesc) const = 0; - - //===------------------------------------------------------------------===// - // Methods for manipulating breakpoints. - // - - /// addBreakpoint - This method adds a breakpoint at the specified line, - /// column, and source file, and returns a unique identifier for it. - /// - /// It is up to the debugger to determine whether or not there is actually a - /// stop-point that corresponds with the specified location. - virtual unsigned addBreakpoint(unsigned LineNo, unsigned ColNo, - const GlobalVariable *SourceDesc) = 0; - - /// removeBreakpoint - This deletes the breakpoint with the specified ID - /// number. - virtual void removeBreakpoint(unsigned ID) = 0; - - - //===------------------------------------------------------------------===// - // Execution methods - These methods cause the program to continue execution - // by some amount. If the program successfully stops, this returns. - // Otherwise, if the program unexpectedly terminates, an InferiorProcessDead - // exception is thrown. - // - - /// stepProgram - Implement the 'step' command, continuing execution until - /// the next possible stop point. - virtual void stepProgram() = 0; - - /// finishProgram - Implement the 'finish' command, continuing execution - /// until the current function returns. - virtual void finishProgram(void *Frame) = 0; - - /// contProgram - Implement the 'cont' command, continuing execution until - /// a breakpoint is encountered. - virtual void contProgram() = 0; - }; -} // end namespace llvm - -#endif diff --git a/include/llvm/Debugger/ProgramInfo.h b/include/llvm/Debugger/ProgramInfo.h deleted file mode 100644 index 5c07c86..0000000 --- a/include/llvm/Debugger/ProgramInfo.h +++ /dev/null @@ -1,246 +0,0 @@ -//===- ProgramInfo.h - Information about the loaded program -----*- 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 various pieces of information about the currently loaded -// program. One instance of this object is created every time a program is -// loaded, and destroyed every time it is unloaded. -// -// The various pieces of information gathered about the source program are all -// designed to be extended by various SourceLanguage implementations. This -// allows source languages to keep any extended information that they support in -// the derived class portions of the class. -// -//===----------------------------------------------------------------------===// - -#ifndef LLVM_DEBUGGER_PROGRAMINFO_H -#define LLVM_DEBUGGER_PROGRAMINFO_H - -#include "llvm/System/TimeValue.h" -#include <string> -#include <map> -#include <vector> - -namespace llvm { - class GlobalVariable; - class Module; - class SourceFile; - class SourceLanguage; - class ProgramInfo; - - /// SourceLanguageCache - SourceLanguage implementations are allowed to cache - /// stuff in the ProgramInfo object. The only requirement we have on these - /// instances is that they are destroyable. - struct SourceLanguageCache { - virtual ~SourceLanguageCache() {} - }; - - /// SourceFileInfo - One instance of this structure is created for each - /// source file in the program. - /// - class SourceFileInfo { - /// BaseName - The filename of the source file. - std::string BaseName; - - /// Directory - The working directory of this source file when it was - /// compiled. - std::string Directory; - - /// Version - The version of the LLVM debug information that this file was - /// compiled with. - unsigned Version; - - /// Language - The source language that the file was compiled with. This - /// pointer is never null. - /// - const SourceLanguage *Language; - - /// Descriptor - The LLVM Global Variable which describes the source file. - /// - const GlobalVariable *Descriptor; - - /// SourceText - The body of this source file, or null if it has not yet - /// been loaded. - mutable SourceFile *SourceText; - public: - SourceFileInfo(const GlobalVariable *Desc, const SourceLanguage &Lang); - ~SourceFileInfo(); - - const std::string &getBaseName() const { return BaseName; } - const std::string &getDirectory() const { return Directory; } - unsigned getDebugVersion() const { return Version; } - const GlobalVariable *getDescriptor() const { return Descriptor; } - SourceFile &getSourceText() const; - - const SourceLanguage &getLanguage() const { return *Language; } - }; - - - /// SourceFunctionInfo - An instance of this class is used to represent each - /// source function in the program. - /// - class SourceFunctionInfo { - /// Name - This contains an abstract name that is potentially useful to the - /// end-user. If there is no explicit support for the current language, - /// then this string is used to identify the function. - std::string Name; - - /// Descriptor - The descriptor for this function. - /// - const GlobalVariable *Descriptor; - - /// SourceFile - The file that this function is defined in. - /// - const SourceFileInfo *SourceFile; - - /// LineNo, ColNo - The location of the first stop-point in the function. - /// These are computed on demand. - mutable unsigned LineNo, ColNo; - - public: - SourceFunctionInfo(ProgramInfo &PI, const GlobalVariable *Desc); - virtual ~SourceFunctionInfo() {} - - /// getSymbolicName - Return a human-readable symbolic name to identify the - /// function (for example, in stack traces). - virtual std::string getSymbolicName() const { return Name; } - - /// getDescriptor - This returns the descriptor for the function. - /// - const GlobalVariable *getDescriptor() const { return Descriptor; } - - /// getSourceFile - This returns the source file that defines the function. - /// - const SourceFileInfo &getSourceFile() const { return *SourceFile; } - - /// getSourceLocation - This method returns the location of the first - /// stopping point in the function. If the body of the function cannot be - /// found, this returns zeros for both values. - void getSourceLocation(unsigned &LineNo, unsigned &ColNo) const; - }; - - - /// ProgramInfo - This object contains information about the loaded program. - /// When a new program is loaded, an instance of this class is created. When - /// the program is unloaded, the instance is destroyed. This object basically - /// manages the lazy computation of information useful for the debugger. - class ProgramInfo { - Module *M; - - /// ProgramTimeStamp - This is the timestamp of the executable file that we - /// currently have loaded into the debugger. - sys::TimeValue ProgramTimeStamp; - - /// SourceFiles - This map is used to transform source file descriptors into - /// their corresponding SourceFileInfo objects. This mapping owns the - /// memory for the SourceFileInfo objects. - /// - bool SourceFilesIsComplete; - std::map<const GlobalVariable*, SourceFileInfo*> SourceFiles; - - /// SourceFileIndex - Mapping from source file basenames to the information - /// about the file. Note that there can be filename collisions, so this is - /// a multimap. This map is populated incrementally as the user interacts - /// with the program, through the getSourceFileFromDesc method. If ALL of - /// the source files are needed, the getSourceFiles() method scans the - /// entire program looking for them. - /// - std::multimap<std::string, SourceFileInfo*> SourceFileIndex; - - /// SourceFunctions - This map contains entries functions in the source - /// program. If SourceFunctionsIsComplete is true, then this is ALL of the - /// functions in the program are in this map. - bool SourceFunctionsIsComplete; - std::map<const GlobalVariable*, SourceFunctionInfo*> SourceFunctions; - - /// LanguageCaches - Each source language is permitted to keep a per-program - /// cache of information specific to whatever it needs. This vector is - /// effectively a small map from the languages that are active in the - /// program to their caches. This can be accessed by the language by the - /// "getLanguageCache" method. - std::vector<std::pair<const SourceLanguage*, - SourceLanguageCache*> > LanguageCaches; - public: - ProgramInfo(Module *m); - ~ProgramInfo(); - - /// getProgramTimeStamp - Return the time-stamp of the program when it was - /// loaded. - sys::TimeValue getProgramTimeStamp() const { return ProgramTimeStamp; } - - //===------------------------------------------------------------------===// - // Interfaces to the source code files that make up the program. - // - - /// getSourceFile - Return source file information for the specified source - /// file descriptor object, adding it to the collection as needed. This - /// method always succeeds (is unambiguous), and is always efficient. - /// - const SourceFileInfo &getSourceFile(const GlobalVariable *Desc); - - /// getSourceFile - Look up the file with the specified name. If there is - /// more than one match for the specified filename, prompt the user to pick - /// one. If there is no source file that matches the specified name, throw - /// an exception indicating that we can't find the file. Otherwise, return - /// the file information for that file. - /// - /// If the source file hasn't been discovered yet in the program, this - /// method might have to index the whole program by calling the - /// getSourceFiles() method. - /// - const SourceFileInfo &getSourceFile(const std::string &Filename); - - /// getSourceFiles - Index all of the source files in the program and return - /// them. This information is lazily computed the first time that it is - /// requested. Since this information can take a long time to compute, the - /// user is given a chance to cancel it. If this occurs, an exception is - /// thrown. - const std::map<const GlobalVariable*, SourceFileInfo*> & - getSourceFiles(bool RequiresCompleteMap = true); - - //===------------------------------------------------------------------===// - // Interfaces to the functions that make up the program. - // - - /// getFunction - Return source function information for the specified - /// function descriptor object, adding it to the collection as needed. This - /// method always succeeds (is unambiguous), and is always efficient. - /// - const SourceFunctionInfo &getFunction(const GlobalVariable *Desc); - - /// getSourceFunctions - Index all of the functions in the program and - /// return them. This information is lazily computed the first time that it - /// is requested. Since this information can take a long time to compute, - /// the user is given a chance to cancel it. If this occurs, an exception - /// is thrown. - const std::map<const GlobalVariable*, SourceFunctionInfo*> & - getSourceFunctions(bool RequiresCompleteMap = true); - - /// addSourceFunctionsRead - Return true if the source functions map is - /// complete: that is, all functions in the program have been read in. - bool allSourceFunctionsRead() const { return SourceFunctionsIsComplete; } - - /// getLanguageCache - This method is used to build per-program caches of - /// information, such as the functions or types visible to the program. - /// This can be used by SourceLanguage implementations because it requires - /// an accessible [sl]::CacheType typedef, where [sl] is the C++ type of the - /// source-language subclass. - template<typename SL> - typename SL::CacheType &getLanguageCache(const SL *L) { - for (unsigned i = 0, e = LanguageCaches.size(); i != e; ++i) - if (LanguageCaches[i].first == L) - return *(typename SL::CacheType*)LanguageCaches[i].second; - typename SL::CacheType *NewCache = L->createSourceLanguageCache(*this); - LanguageCaches.push_back(std::make_pair(L, NewCache)); - return *NewCache; - } - }; - -} // end namespace llvm - -#endif diff --git a/include/llvm/Debugger/RuntimeInfo.h b/include/llvm/Debugger/RuntimeInfo.h deleted file mode 100644 index c537651..0000000 --- a/include/llvm/Debugger/RuntimeInfo.h +++ /dev/null @@ -1,142 +0,0 @@ -//===- RuntimeInfo.h - Information about running program --------*- 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 classes that capture various pieces of information about -// the currently executing, but stopped, program. One instance of this object -// is created every time a program is stopped, and destroyed every time it -// starts running again. This object's main goal is to make access to runtime -// information easy and efficient, by caching information as requested. -// -//===----------------------------------------------------------------------===// - -#ifndef LLVM_DEBUGGER_RUNTIMEINFO_H -#define LLVM_DEBUGGER_RUNTIMEINFO_H - -#include <vector> -#include <cassert> - -namespace llvm { - class ProgramInfo; - class RuntimeInfo; - class InferiorProcess; - class GlobalVariable; - class SourceFileInfo; - - /// StackFrame - One instance of this structure is created for each stack - /// frame that is active in the program. - /// - class StackFrame { - RuntimeInfo &RI; - void *FrameID; - const GlobalVariable *FunctionDesc; - - /// LineNo, ColNo, FileInfo - This information indicates WHERE in the source - /// code for the program the stack frame is located. - unsigned LineNo, ColNo; - const SourceFileInfo *SourceInfo; - public: - StackFrame(RuntimeInfo &RI, void *ParentFrameID); - - StackFrame &operator=(const StackFrame &RHS) { - FrameID = RHS.FrameID; - FunctionDesc = RHS.FunctionDesc; - return *this; - } - - /// getFrameID - return the low-level opaque frame ID of this stack frame. - /// - void *getFrameID() const { return FrameID; } - - /// getFunctionDesc - Return the descriptor for the function that contains - /// this stack frame, or null if it is unknown. - /// - const GlobalVariable *getFunctionDesc(); - - /// getSourceLocation - Return the source location that this stack frame is - /// sitting at. - void getSourceLocation(unsigned &LineNo, unsigned &ColNo, - const SourceFileInfo *&SourceInfo); - }; - - - /// RuntimeInfo - This class collects information about the currently running - /// process. It is created whenever the program stops execution for the - /// debugger, and destroyed whenver execution continues. - class RuntimeInfo { - /// ProgInfo - This object contains static information about the program. - /// - ProgramInfo *ProgInfo; - - /// IP - This object contains information about the actual inferior process - /// that we are communicating with and aggregating information from. - const InferiorProcess &IP; - - /// CallStack - This caches information about the current stack trace of the - /// program. This is lazily computed as needed. - std::vector<StackFrame> CallStack; - - /// CurrentFrame - The user can traverse the stack frame with the - /// up/down/frame family of commands. This index indicates the current - /// stack frame. - unsigned CurrentFrame; - - public: - RuntimeInfo(ProgramInfo *PI, const InferiorProcess &ip) - : ProgInfo(PI), IP(ip), CurrentFrame(0) { - // Make sure that the top of stack has been materialized. If this throws - // an exception, something is seriously wrong and the RuntimeInfo object - // would be unusable anyway. - getStackFrame(0); - } - - ProgramInfo &getProgramInfo() { return *ProgInfo; } - const InferiorProcess &getInferiorProcess() const { return IP; } - - //===------------------------------------------------------------------===// - // Methods for inspecting the call stack of the program. - // - - /// getStackFrame - Materialize the specified stack frame and return it. If - /// the specified ID is off of the bottom of the stack, throw an exception - /// indicating the problem. - StackFrame &getStackFrame(unsigned ID) { - if (ID >= CallStack.size()) - materializeFrame(ID); - return CallStack[ID]; - } - - /// getCurrentFrame - Return the current stack frame object that the user is - /// inspecting. - StackFrame &getCurrentFrame() { - assert(CallStack.size() > CurrentFrame && - "Must have materialized frame before making it current!"); - return CallStack[CurrentFrame]; - } - - /// getCurrentFrameIdx - Return the current frame the user is inspecting. - /// - unsigned getCurrentFrameIdx() const { return CurrentFrame; } - - /// setCurrentFrameIdx - Set the current frame index to the specified value. - /// Note that the specified frame must have been materialized with - /// getStackFrame before it can be made current. - void setCurrentFrameIdx(unsigned Idx) { - assert(Idx < CallStack.size() && - "Must materialize frame before making it current!"); - CurrentFrame = Idx; - } - private: - /// materializeFrame - Create and process all frames up to and including the - /// specified frame number. This throws an exception if the specified frame - /// ID is nonexistant. - void materializeFrame(unsigned ID); - }; -} - -#endif diff --git a/include/llvm/Debugger/SourceFile.h b/include/llvm/Debugger/SourceFile.h deleted file mode 100644 index 249435a..0000000 --- a/include/llvm/Debugger/SourceFile.h +++ /dev/null @@ -1,87 +0,0 @@ -//===- SourceFile.h - Class to represent a source code file -----*- 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 the SourceFile class which is used to represent a single -// file of source code in the program, caching data from the file to make access -// efficient. -// -//===----------------------------------------------------------------------===// - -#ifndef LLVM_DEBUGGER_SOURCEFILE_H -#define LLVM_DEBUGGER_SOURCEFILE_H - -#include "llvm/System/Path.h" -#include "llvm/ADT/OwningPtr.h" -#include <vector> - -namespace llvm { - class GlobalVariable; - class MemoryBuffer; - - class SourceFile { - /// Filename - This is the full path of the file that is loaded. - /// - sys::Path Filename; - - /// Descriptor - The debugging descriptor for this source file. If there - /// are multiple descriptors for the same file, this is just the first one - /// encountered. - /// - const GlobalVariable *Descriptor; - - /// This is the memory mapping for the file so we can gain access to it. - OwningPtr<MemoryBuffer> File; - - /// LineOffset - This vector contains a mapping from source line numbers to - /// their offsets in the file. This data is computed lazily, the first time - /// it is asked for. If there are zero elements allocated in this vector, - /// then it has not yet been computed. - mutable std::vector<unsigned> LineOffset; - - public: - /// SourceFile constructor - Read in the specified source file if it exists, - /// but do not build the LineOffsets table until it is requested. This will - /// NOT throw an exception if the file is not found, if there is an error - /// reading it, or if the user cancels the operation. Instead, it will just - /// be an empty source file. - SourceFile(const std::string &fn, const GlobalVariable *Desc); - - ~SourceFile(); - - /// getDescriptor - Return the debugging decriptor for this source file. - /// - const GlobalVariable *getDescriptor() const { return Descriptor; } - - /// getFilename - Return the fully resolved path that this file was loaded - /// from. - const std::string &getFilename() const { return Filename.toString(); } - - /// getSourceLine - Given a line number, return the start and end of the - /// line in the file. If the line number is invalid, or if the file could - /// not be loaded, null pointers are returned for the start and end of the - /// file. Note that line numbers start with 0, not 1. This also strips off - /// any newlines from the end of the line, to ease formatting of the text. - void getSourceLine(unsigned LineNo, const char *&LineStart, - const char *&LineEnd) const; - - /// getNumLines - Return the number of lines the source file contains. - /// - unsigned getNumLines() const { - if (LineOffset.empty()) calculateLineOffsets(); - return static_cast<unsigned>(LineOffset.size()); - } - - private: - /// calculateLineOffsets - Compute the LineOffset vector for the current - /// file. - void calculateLineOffsets() const; - }; -} // end namespace llvm - -#endif diff --git a/include/llvm/Debugger/SourceLanguage.h b/include/llvm/Debugger/SourceLanguage.h deleted file mode 100644 index a07dd97..0000000 --- a/include/llvm/Debugger/SourceLanguage.h +++ /dev/null @@ -1,99 +0,0 @@ -//===- SourceLanguage.h - Interact with source languages --------*- 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 the abstract SourceLanguage interface, which is used by the -// LLVM debugger to parse source-language expressions and render program objects -// into a human readable string. In general, these classes perform all of the -// analysis and interpretation of the language-specific debugger information. -// -// This interface is designed to be completely stateless, so all methods are -// const. -// -//===----------------------------------------------------------------------===// - -#ifndef LLVM_DEBUGGER_SOURCELANGUAGE_H -#define LLVM_DEBUGGER_SOURCELANGUAGE_H - -#include <string> - -namespace llvm { - class GlobalVariable; - class SourceFileInfo; - class SourceFunctionInfo; - class ProgramInfo; - class RuntimeInfo; - - struct SourceLanguage { - virtual ~SourceLanguage() {} - - /// getSourceLanguageName - This method is used to implement the 'show - /// language' command in the debugger. - virtual const char *getSourceLanguageName() const = 0; - - //===------------------------------------------------------------------===// - // Methods used to implement debugger hooks. - // - - /// printInfo - Implementing this method allows the debugger to use - /// language-specific 'info' extensions, e.g., 'info selectors' for objc. - /// This method should return true if the specified string is recognized. - /// - virtual bool printInfo(const std::string &What) const { - return false; - } - - /// lookupFunction - Given a textual function name, return the - /// SourceFunctionInfo descriptor for that function, or null if it cannot be - /// found. If the program is currently running, the RuntimeInfo object - /// provides information about the current evaluation context, otherwise it - /// will be null. - /// - virtual SourceFunctionInfo *lookupFunction(const std::string &FunctionName, - ProgramInfo &PI, - RuntimeInfo *RI = 0) const { - return 0; - } - - - //===------------------------------------------------------------------===// - // Methods used to parse various pieces of program information. - // - - /// createSourceFileInfo - This method can be implemented by the front-end - /// if it needs to keep track of information beyond what the debugger - /// requires. - virtual SourceFileInfo * - createSourceFileInfo(const GlobalVariable *Desc, ProgramInfo &PI) const; - - /// createSourceFunctionInfo - This method can be implemented by the derived - /// SourceLanguage if it needs to keep track of more information than the - /// SourceFunctionInfo has. - virtual SourceFunctionInfo * - createSourceFunctionInfo(const GlobalVariable *Desc, ProgramInfo &PI) const; - - - //===------------------------------------------------------------------===// - // Static methods used to get instances of various source languages. - // - - /// get - This method returns a source-language instance for the specified - /// Dwarf 3 language identifier. If the language is unknown, an object is - /// returned that can support some minimal operations, but is not terribly - /// bright. - static const SourceLanguage &get(unsigned ID); - - /// get*Instance() - These methods return specific instances of languages. - /// - static const SourceLanguage &getCFamilyInstance(); - static const SourceLanguage &getCPlusPlusInstance(); - static const SourceLanguage &getUnknownLanguageInstance(); - }; -} - -#endif diff --git a/include/llvm/MDNode.h b/include/llvm/MDNode.h deleted file mode 100644 index d632e4e..0000000 --- a/include/llvm/MDNode.h +++ /dev/null @@ -1,135 +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/ValueHandle.h" - -namespace llvm { - -//===----------------------------------------------------------------------===// -/// MDNode - a tuple of other values. -/// These contain a list of the Constants that represent the metadata. The -/// operand list is always empty, query the element list instead. -/// -/// This class will attempt to keep track of values as they are modified. When -/// a value is replaced the element will be replaced with it, and when the -/// value is deleted the element is set to a null pointer. In order to preserve -/// structural equivalence while the elements mutate, the MDNode may call -/// replaceAllUsesWith on itself. Because of this, users of MDNode must use a -/// WeakVH or CallbackVH to hold the node pointer if there is a chance that one -/// of the elements held by the node may change. -/// -class MDNode : public Constant, public FoldingSetNode { - MDNode(const MDNode &); // DO NOT IMPLEMENT - - friend class ElementVH; - struct ElementVH : public CallbackVH { - MDNode *OwningNode; - - ElementVH(Value *V, MDNode *Parent) - : CallbackVH(V), OwningNode(Parent) {} - - ~ElementVH() {} - - /// deleted - Set this entry in the MDNode to 'null'. This will reallocate - /// the MDNode. - virtual void deleted() { - OwningNode->replaceElement(this->operator Value*(), 0); - } - - /// allUsesReplacedWith - Modify the MDNode by replacing this entry with - /// new_value. This will reallocate the MDNode. - virtual void allUsesReplacedWith(Value *new_value) { - OwningNode->replaceElement(this->operator Value*(), new_value); - } - }; - - void replaceElement(Value *From, Value *To); - - SmallVector<ElementVH, 4> Node; - typedef SmallVectorImpl<ElementVH>::iterator elem_iterator; -protected: - explicit MDNode(Value*const* Vals, unsigned NumVals); -public: - typedef SmallVectorImpl<ElementVH>::const_iterator const_elem_iterator; - - /// get() - Static factory methods - Return objects of the specified value. - /// - static MDNode *get(Value*const* Vals, unsigned NumVals); - - 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 destroyConstant(); - virtual void replaceUsesOfWithOnConstant(Value *From, Value *To, Use *U) { - assert(0 && "This should never be called because MDNodes have no ops"); - abort(); - } - - /// 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 diff --git a/include/llvm/Support/Annotation.h b/include/llvm/Support/Annotation.h deleted file mode 100644 index ffc9296..0000000 --- a/include/llvm/Support/Annotation.h +++ /dev/null @@ -1,216 +0,0 @@ -//===-- llvm/Support/Annotation.h - Annotation classes ----------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// -// This file contains the declarations for two classes: Annotation & Annotable. -// Using these two simple classes, anything that derives from Annotable can have -// Annotation subclasses attached to them, ready for easy retrieval. -// -// Annotations are designed to be easily attachable to various classes. -// -// The AnnotationManager class is essential for using these classes. It is -// responsible for turning Annotation name strings into tokens [unique id #'s] -// that may be used to search for and create annotations. -// -//===----------------------------------------------------------------------===// - -#ifndef LLVM_SUPPORT_ANNOTATION_H -#define LLVM_SUPPORT_ANNOTATION_H - -#include <cassert> - -namespace llvm { - -class AnnotationID; -class Annotation; -class Annotable; -struct AnnotationManager; - -//===----------------------------------------------------------------------===// -// -// AnnotationID - This class is a thin wrapper around an unsigned integer that -// is used to hopefully prevent errors using AnnotationID's. They may be copied -// freely around and passed byvalue with little or no overhead. -// -class AnnotationID { - friend struct AnnotationManager; - unsigned ID; - - AnnotationID(); // Default ctor is disabled - - // AnnotationID is only creatable from AnnMgr. - explicit inline AnnotationID(unsigned i) : ID(i) {} -public: - inline AnnotationID(const AnnotationID &A) : ID(A.ID) {} - - inline bool operator==(const AnnotationID &A) const { - return A.ID == ID; - } - inline bool operator<(const AnnotationID &A) const { - return ID < A.ID; - } -}; - - -//===----------------------------------------------------------------------===// -// -// Annotation Class - This class serves as a base class for any specific -// annotations that you might need. Simply subclass this to add extra -// information to the annotations. -// -class Annotation { - friend class Annotable; // Annotable manipulates Next list - AnnotationID ID; // ID number, as obtained from AnnotationManager - Annotation *Next; // The next annotation in the linked list -public: - explicit inline Annotation(AnnotationID id) : ID(id), Next(0) {} - virtual ~Annotation(); // Designed to be subclassed - - // getID - Return the unique ID# of this annotation - inline AnnotationID getID() const { return ID; } - - // getNext - Return the next annotation in the list... - inline Annotation *getNext() const { return Next; } -}; - - -//===----------------------------------------------------------------------===// -// -// Annotable - This class is used as a base class for all objects that would -// like to have annotation capability. -// -// Annotable objects keep their annotation list sorted as annotations are -// inserted and deleted. This is used to ensure that annotations with identical -// ID#'s are stored sequentially. -// -class Annotable { - mutable Annotation *AnnotationList; - - Annotable(const Annotable &); // Do not implement - void operator=(const Annotable &); // Do not implement -public: - Annotable() : AnnotationList(0) {} - ~Annotable(); - - // getAnnotation - Search the list for annotations of the specified ID. The - // pointer returned is either null (if no annotations of the specified ID - // exist), or it points to the first element of a potentially list of elements - // with identical ID #'s. - // - Annotation *getAnnotation(AnnotationID ID) const { - for (Annotation *A = AnnotationList; A; A = A->getNext()) - if (A->getID() == ID) return A; - return 0; - } - - // getOrCreateAnnotation - Search through the annotation list, if there is - // no annotation with the specified ID, then use the AnnotationManager to - // create one. - // - inline Annotation *getOrCreateAnnotation(AnnotationID ID) const; - - // addAnnotation - Insert the annotation into the list in a sorted location. - // - void addAnnotation(Annotation *A) const { - assert(A->Next == 0 && "Annotation already in list?!?"); - - Annotation **AL = &AnnotationList; - while (*AL && (*AL)->ID < A->getID()) // Find where to insert annotation - AL = &((*AL)->Next); - A->Next = *AL; // Link the annotation in - *AL = A; - } - - // unlinkAnnotation - Remove the first annotation of the specified ID... and - // then return the unlinked annotation. The annotation object is not deleted. - // - inline Annotation *unlinkAnnotation(AnnotationID ID) const { - for (Annotation **A = &AnnotationList; *A; A = &((*A)->Next)) - if ((*A)->getID() == ID) { - Annotation *Ret = *A; - *A = Ret->Next; - Ret->Next = 0; - return Ret; - } - return 0; - } - - // deleteAnnotation - Delete the first annotation of the specified ID in the - // list. Unlink unlinkAnnotation, this actually deletes the annotation object - // - bool deleteAnnotation(AnnotationID ID) const { - Annotation *A = unlinkAnnotation(ID); - delete A; - return A != 0; - } -}; - - -//===----------------------------------------------------------------------===// -// -// AnnotationManager - This class is primarily responsible for maintaining a -// one-to-one mapping between string Annotation names and Annotation ID numbers. -// -// Compared to the rest of the Annotation system, these mapping methods are -// relatively slow, so they should be avoided by locally caching Annotation -// ID #'s. These methods are safe to call at any time, even by static ctors, so -// they should be used by static ctors most of the time. -// -// This class also provides support for annotations that are created on demand -// by the Annotable::getOrCreateAnnotation method. To get this to work, simply -// register an annotation handler -// -struct AnnotationManager { - typedef Annotation *(*Factory)(AnnotationID, const Annotable *, void*); - - //===--------------------------------------------------------------------===// - // Basic ID <-> Name map functionality - - static AnnotationID getID(const char *Name); // Name -> ID - static const char *getName(AnnotationID ID); // ID -> Name - - // getID - Name -> ID + registration of a factory function for demand driven - // annotation support. - static AnnotationID getID(const char *Name, Factory Fact, void *Data = 0); - - //===--------------------------------------------------------------------===// - // Annotation creation on demand support... - - // registerAnnotationFactory - This method is used to register a callback - // function used to create an annotation on demand if it is needed by the - // Annotable::getOrCreateAnnotation method. - // - static void registerAnnotationFactory(AnnotationID ID, Factory Func, - void *ExtraData = 0); - - // createAnnotation - Create an annotation of the specified ID for the - // specified object, using a register annotation creation function. - // - static Annotation *createAnnotation(AnnotationID ID, const Annotable *Obj); -}; - - - -// getOrCreateAnnotation - Search through the annotation list, if there is -// no annotation with the specified ID, then use the AnnotationManager to -// create one. -// -inline Annotation *Annotable::getOrCreateAnnotation(AnnotationID ID) const { - Annotation *A = getAnnotation(ID); // Fast path, check for preexisting ann - if (A) return A; - - // No annotation found, ask the annotation manager to create an annotation... - A = AnnotationManager::createAnnotation(ID, this); - assert(A && "AnnotationManager could not create annotation!"); - addAnnotation(A); - return A; -} - -} // End namespace llvm - -#endif diff --git a/include/llvm/Support/Streams.h b/include/llvm/Support/Streams.h deleted file mode 100644 index 445ab98..0000000 --- a/include/llvm/Support/Streams.h +++ /dev/null @@ -1,91 +0,0 @@ -//===- llvm/Support/Streams.h - Wrappers for iostreams ----------*- 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 a wrapper for the STL I/O streams. It prevents the need -// to include <iostream> in a file just to get I/O. -// -//===----------------------------------------------------------------------===// - -#ifndef LLVM_SUPPORT_STREAMS_H -#define LLVM_SUPPORT_STREAMS_H - -#include <iosfwd> - -namespace llvm { - - /// FlushStream - Function called by BaseStream to flush an ostream. - void FlushStream(std::ostream &S); - - /// BaseStream - Acts like the STL streams. It's a wrapper for the std::cerr, - /// std::cout, std::cin, etc. streams. However, it doesn't require #including - /// @verbatim <iostream> @endverbatm in every file (doing so increases static - /// c'tors & d'tors in the object code). - /// - template <typename StreamTy> - class BaseStream { - StreamTy *Stream; - public: - BaseStream() : Stream(0) {} - BaseStream(StreamTy &S) : Stream(&S) {} - BaseStream(StreamTy *S) : Stream(S) {} - - StreamTy *stream() const { return Stream; } - - inline BaseStream &operator << (std::ios_base &(*Func)(std::ios_base&)) { - if (Stream) *Stream << Func; - return *this; - } - - inline BaseStream &operator << (StreamTy &(*Func)(StreamTy&)) { - if (Stream) *Stream << Func; - return *this; - } - - void flush() { - if (Stream) - FlushStream(*Stream); - } - - template <typename Ty> - BaseStream &operator << (const Ty &Thing) { - if (Stream) *Stream << Thing; - return *this; - } - - template <typename Ty> - BaseStream &operator >> (Ty &Thing) { - if (Stream) *Stream >> Thing; - return *this; - } - - template <typename Ty> - BaseStream &write(const Ty &A, unsigned N) { - if (Stream) Stream->write(A, N); - return *this; - } - - operator StreamTy* () { return Stream; } - - bool operator == (const StreamTy &S) { return &S == Stream; } - bool operator != (const StreamTy &S) { return !(*this == S); } - bool operator == (const BaseStream &S) { return S.Stream == Stream; } - bool operator != (const BaseStream &S) { return !(*this == S); } - }; - - typedef BaseStream<std::ostream> OStream; - typedef BaseStream<std::istream> IStream; - typedef BaseStream<std::stringstream> StringStream; - - extern OStream cout; - extern OStream cerr; - extern IStream cin; - -} // End llvm namespace - -#endif diff --git a/include/llvm/Target/DarwinTargetAsmInfo.h b/include/llvm/Target/DarwinTargetAsmInfo.h deleted file mode 100644 index 171a6b3..0000000 --- a/include/llvm/Target/DarwinTargetAsmInfo.h +++ /dev/null @@ -1,50 +0,0 @@ -//===---- DarwinTargetAsmInfo.h - Darwin 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 Darwin-based targets -// -//===----------------------------------------------------------------------===// - -#ifndef LLVM_DARWIN_TARGET_ASM_INFO_H -#define LLVM_DARWIN_TARGET_ASM_INFO_H - -#include "llvm/Target/TargetAsmInfo.h" - -namespace llvm { - class GlobalValue; - class GlobalVariable; - class Type; - 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) const; - virtual std::string UniqueSectionForGlobal(const GlobalValue* GV, - SectionKind::Kind kind) const; - virtual bool emitUsedDirectiveFor(const GlobalValue *GV, - Mangler *Mang) const; - const Section* MergeableConstSection(const GlobalVariable *GV) const; - const Section* MergeableConstSection(const Type *Ty) const; - const Section* MergeableStringSection(const GlobalVariable *GV) const; - const Section* SelectSectionForMachineConst(const Type *Ty) const; - }; -} - - -#endif // LLVM_DARWIN_TARGET_ASM_INFO_H diff --git a/include/llvm/Target/ELFTargetAsmInfo.h b/include/llvm/Target/ELFTargetAsmInfo.h deleted file mode 100644 index 6181e59..0000000 --- a/include/llvm/Target/ELFTargetAsmInfo.h +++ /dev/null @@ -1,45 +0,0 @@ -//===---- ELFTargetAsmInfo.h - ELF 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 ELF-based targets -// -//===----------------------------------------------------------------------===// - -#ifndef LLVM_ELF_TARGET_ASM_INFO_H -#define LLVM_ELF_TARGET_ASM_INFO_H - -#include "llvm/Target/TargetAsmInfo.h" - -namespace llvm { - class GlobalValue; - class GlobalVariable; - class Type; - - struct ELFTargetAsmInfo: public TargetAsmInfo { - explicit ELFTargetAsmInfo(const TargetMachine &TM); - - SectionKind::Kind SectionKindForGlobal(const GlobalValue *GV) const; - virtual const Section* SelectSectionForGlobal(const GlobalValue *GV) const; - virtual std::string printSectionFlags(unsigned flags) const; - const Section* MergeableConstSection(const GlobalVariable *GV) const; - inline const Section* MergeableConstSection(const Type *Ty) const; - const Section* MergeableStringSection(const GlobalVariable *GV) const; - virtual const Section* - SelectSectionForMachineConst(const Type *Ty) const; - - const Section* DataRelSection; - const Section* DataRelLocalSection; - const Section* DataRelROSection; - const Section* DataRelROLocalSection; - }; -} - - -#endif // LLVM_ELF_TARGET_ASM_INFO_H diff --git a/include/llvm/Target/TargetAsmInfo.h b/include/llvm/Target/TargetAsmInfo.h deleted file mode 100644 index 670b099..0000000 --- a/include/llvm/Target/TargetAsmInfo.h +++ /dev/null @@ -1,930 +0,0 @@ -//===-- llvm/Target/TargetAsmInfo.h - Asm 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 contains a class to be used as the basis for target specific -// asm writers. This class primarily takes care of global printing constants, -// which are used in very similar ways across all targets. -// -//===----------------------------------------------------------------------===// - -#ifndef LLVM_TARGET_ASM_INFO_H -#define LLVM_TARGET_ASM_INFO_H - -#include "llvm/ADT/DenseMap.h" -#include "llvm/ADT/StringMap.h" -#include "llvm/Support/DataTypes.h" -#include <string> - -namespace llvm { - // DWARF encoding query type - namespace DwarfEncoding { - enum Target { - Data = 0, - CodeLabels = 1, - Functions = 2 - }; - } - - namespace SectionKind { - enum Kind { - Unknown = 0, ///< Custom section - Text, ///< Text section - Data, ///< Data section - DataRel, ///< Contains data that has relocations - DataRelLocal, ///< Contains data that has only local relocations - BSS, ///< BSS section - ROData, ///< Readonly data section - DataRelRO, ///< Contains data that is otherwise readonly - DataRelROLocal, ///< Contains r/o data with only local relocations - RODataMergeStr, ///< Readonly data section (mergeable strings) - RODataMergeConst, ///< Readonly data section (mergeable constants) - SmallData, ///< Small data section - SmallBSS, ///< Small bss section - SmallROData, ///< Small readonly section - ThreadData, ///< Initialized TLS data objects - ThreadBSS ///< Uninitialized TLS data objects - }; - - static inline bool isReadOnly(Kind K) { - return (K == SectionKind::ROData || - K == SectionKind::RODataMergeConst || - K == SectionKind::RODataMergeStr || - K == SectionKind::SmallROData); - } - - static inline bool isBSS(Kind K) { - return (K == SectionKind::BSS || - K == SectionKind::SmallBSS); - } - } - - namespace SectionFlags { - const unsigned Invalid = -1U; - const unsigned None = 0; - const unsigned Code = 1 << 0; ///< Section contains code - const unsigned Writeable = 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 Small = 1 << 8; ///< Section is small - const unsigned TypeFlags = 0xFF; - // Some gap for future flags - 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; - } - - 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; } - }; - - typedef DenseMap<unsigned, std::string, KeyInfo> FlagsStringsMapType; - } - - class TargetMachine; - class CallInst; - class GlobalValue; - class Type; - class Mangler; - - class Section { - friend class TargetAsmInfo; - friend class StringMapEntry<Section>; - friend class StringMap<Section>; - - std::string Name; - unsigned Flags; - explicit Section(unsigned F = SectionFlags::Invalid):Flags(F) { } - - public: - - bool isNamed() const { return Flags & SectionFlags::Named; } - unsigned getEntitySize() const { return (Flags >> 24) & 0xFF; } - - const std::string& getName() const { return Name; } - unsigned getFlags() const { return Flags; } - }; - - /// 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<Section> Sections; - mutable SectionFlags::FlagsStringsMapType FlagsStrings; - protected: - /// TM - The current TargetMachine. - const TargetMachine &TM; - - //===------------------------------------------------------------------===// - // 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. - /// - 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 - - /// SmallDataSection - This is the directive that is emitted to switch to a - /// small data section. - /// - const Section *SmallDataSection; // Defaults to NULL - - /// SmallBSSSection - This is the directive that is emitted to switch to a - /// small bss section. - /// - const Section *SmallBSSSection; // Defaults to NULL - - /// SmallRODataSection - This is the directive that is emitted to switch to - /// a small read-only data section. - /// - const Section *SmallRODataSection; // 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. - const char *ZeroFillDirective; // Default is null. - - /// NonexecutableStackDirective - Directive for declaring to the - /// linker and beyond that the emitted code does not require stack - /// memory to be executable. - const char *NonexecutableStackDirective; // Default is null. - - /// NeedsSet - True if target asm treats expressions in data directives - /// as linktime-relocatable. For assembly-time computation, we need to - /// use a .set. Thus: - /// .set w, x-y - /// .long w - /// is computed at assembly time, while - /// .long x-y - /// is relocated if the relative locations of x and y change at linktime. - /// We want both these things in different places. - bool NeedsSet; // Defaults to false. - - /// MaxInstLength - This is the maximum possible length of an instruction, - /// which is needed to compute the size of an inline asm. - unsigned MaxInstLength; // Defaults to 4. - - /// PCSymbol - The symbol used to represent the current PC. Used in PC - /// relative expressions. - const char *PCSymbol; // Defaults to "$". - - /// SeparatorChar - This character, if specified, is used to separate - /// instructions from each other when on the same line. This is used to - /// measure inline asm instructions. - char SeparatorChar; // Defaults to ';' - - /// CommentString - This indicates the comment character used by the - /// assembler. - const char *CommentString; // Defaults to "#" - - /// GlobalPrefix - If this is set to a non-empty string, it is prepended - /// onto all global symbols. This is often used for "_" or ".". - const char *GlobalPrefix; // Defaults to "" - - /// PrivateGlobalPrefix - This prefix is used for globals like constant - /// pool entries that are completely private to the .s file and should not - /// have names in the .o file. This is often "." or "L". - const char *PrivateGlobalPrefix; // Defaults to "." - - /// LessPrivateGlobalPrefix - This prefix is used for symbols that should - /// be passed through the assembler but be removed by the linker. This - /// is "l" on Darwin, currently used for some ObjC metadata. - const char *LessPrivateGlobalPrefix; // Defaults to "" - - /// JumpTableSpecialLabelPrefix - If not null, a extra (dead) label is - /// emitted before jump tables with the specified prefix. - const char *JumpTableSpecialLabelPrefix; // Default to null. - - /// GlobalVarAddrPrefix/Suffix - If these are nonempty, these strings - /// will enclose any GlobalVariable (that isn't a function) - /// - const char *GlobalVarAddrPrefix; // Defaults to "" - const char *GlobalVarAddrSuffix; // Defaults to "" - - /// FunctionAddrPrefix/Suffix - If these are nonempty, these strings - /// will enclose any GlobalVariable that points to a function. - /// For example, this is used by the IA64 backend to materialize - /// function descriptors, by decorating the ".data8" object with the - /// @verbatim @fptr( ) @endverbatim - /// link-relocation operator. - /// - const char *FunctionAddrPrefix; // Defaults to "" - const char *FunctionAddrSuffix; // Defaults to "" - - /// PersonalityPrefix/Suffix - If these are nonempty, these strings will - /// enclose any personality function in the common frame section. - /// - const char *PersonalityPrefix; // Defaults to "" - const char *PersonalitySuffix; // Defaults to "" - - /// NeedsIndirectEncoding - If set, we need to set the indirect encoding bit - /// for EH in Dwarf. - /// - bool NeedsIndirectEncoding; // Defaults to false - - /// InlineAsmStart/End - If these are nonempty, they contain a directive to - /// emit before and after an inline assembly statement. - const char *InlineAsmStart; // Defaults to "#APP\n" - const char *InlineAsmEnd; // Defaults to "#NO_APP\n" - - /// AssemblerDialect - Which dialect of an assembler variant to use. - unsigned AssemblerDialect; // Defaults to 0 - - /// StringConstantPrefix - Prefix for FEs to use when generating unnamed - /// constant strings. These names get run through the Mangler later; if - /// you want the Mangler not to add the GlobalPrefix as well, - /// use '\1' as the first character. - const char *StringConstantPrefix; // Defaults to ".str" - - /// AllowQuotesInName - This is true if the assembler allows for complex - /// symbol names to be surrounded in quotes. This defaults to false. - bool AllowQuotesInName; - - //===--- Data Emission Directives -------------------------------------===// - - /// ZeroDirective - this should be set to the directive used to get some - /// number of zero bytes emitted to the current section. Common cases are - /// "\t.zero\t" and "\t.space\t". If this is set to null, the - /// Data*bitsDirective's will be used to emit zero bytes. - const char *ZeroDirective; // Defaults to "\t.zero\t" - const char *ZeroDirectiveSuffix; // Defaults to "" - - /// AsciiDirective - This directive allows emission of an ascii string with - /// the standard C escape characters embedded into it. - const char *AsciiDirective; // Defaults to "\t.ascii\t" - - /// AscizDirective - If not null, this allows for special handling of - /// zero terminated strings on this target. This is commonly supported as - /// ".asciz". If a target doesn't support this, it can be set to null. - const char *AscizDirective; // Defaults to "\t.asciz\t" - - /// DataDirectives - These directives are used to output some unit of - /// integer data to the current section. If a data directive is set to - /// null, smaller data directives will be used to emit the large sizes. - const char *Data8bitsDirective; // Defaults to "\t.byte\t" - const char *Data16bitsDirective; // Defaults to "\t.short\t" - const char *Data32bitsDirective; // Defaults to "\t.long\t" - const char *Data64bitsDirective; // Defaults to "\t.quad\t" - - /// getASDirective - Targets can override it to provide different data - /// directives for various sizes and non-default address spaces. - virtual const char *getASDirective(unsigned size, - unsigned AS) const { - assert(AS > 0 && "Dont know the directives for default addr space"); - return NULL; - } - - //===--- Alignment Information ----------------------------------------===// - - /// AlignDirective - The directive used to emit round up to an alignment - /// boundary. - /// - const char *AlignDirective; // Defaults to "\t.align\t" - - /// AlignmentIsInBytes - If this is true (the default) then the asmprinter - /// emits ".align N" directives, where N is the number of bytes to align to. - /// Otherwise, it emits ".align log2(N)", e.g. 3 to align to an 8 byte - /// boundary. - bool AlignmentIsInBytes; // Defaults to true - - /// TextAlignFillValue - If non-zero, this is used to fill the executable - /// space created as the result of a alignment directive. - unsigned TextAlignFillValue; - - //===--- Section Switching Directives ---------------------------------===// - - /// SwitchToSectionDirective - This is the directive used when we want to - /// emit a global to an arbitrary section. The section name is emited after - /// this. - const char *SwitchToSectionDirective; // Defaults to "\t.section\t" - - /// TextSectionStartSuffix - This is printed after each start of section - /// directive for text sections. - const char *TextSectionStartSuffix; // Defaults to "". - - /// DataSectionStartSuffix - This is printed after each start of section - /// directive for data sections. - const char *DataSectionStartSuffix; // Defaults to "". - - /// SectionEndDirectiveSuffix - If non-null, the asm printer will close each - /// section with the section name and this suffix printed. - const char *SectionEndDirectiveSuffix;// Defaults to null. - - /// ConstantPoolSection - This is the section that we SwitchToSection right - /// before emitting the constant pool for a function. - const char *ConstantPoolSection; // Defaults to "\t.section .rodata" - - /// JumpTableDataSection - This is the section that we SwitchToSection right - /// before emitting the jump tables for a function when the relocation model - /// is not PIC. - const char *JumpTableDataSection; // Defaults to "\t.section .rodata" - - /// JumpTableDirective - if non-null, the directive to emit before a jump - /// table. - const char *JumpTableDirective; - - /// CStringSection - If not null, this allows for special handling of - /// cstring constants (null terminated string that does not contain any - /// other null bytes) on this target. This is commonly supported as - /// ".cstring". - 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. - /// Defaults to "\t.section .ctors,\"aw\",@progbits". - const char *StaticCtorsSection; - - /// StaticDtorsSection - This is the directive that is emitted to switch to - /// a section to emit the static destructor list. - /// Defaults to "\t.section .dtors,\"aw\",@progbits". - const char *StaticDtorsSection; - - //===--- Global Variable Emission Directives --------------------------===// - - /// GlobalDirective - This is the directive used to declare a global entity. - /// - const char *GlobalDirective; // Defaults to NULL. - - /// ExternDirective - This is the directive used to declare external - /// globals. - /// - const char *ExternDirective; // Defaults to NULL. - - /// SetDirective - This is the name of a directive that can be used to tell - /// the assembler to set the value of a variable to some expression. - const char *SetDirective; // Defaults to null. - - /// LCOMMDirective - This is the name of a directive (if supported) that can - /// be used to efficiently declare a local (internal) block of zero - /// initialized data in the .bss/.data section. The syntax expected is: - /// @verbatim <LCOMMDirective> SYMBOLNAME LENGTHINBYTES, ALIGNMENT - /// @endverbatim - const char *LCOMMDirective; // Defaults to null. - - const char *COMMDirective; // Defaults to "\t.comm\t". - - /// COMMDirectiveTakesAlignment - True if COMMDirective take a third - /// argument that specifies the alignment of the declaration. - bool COMMDirectiveTakesAlignment; // Defaults to true. - - /// HasDotTypeDotSizeDirective - True if the target has .type and .size - /// directives, this is true for most ELF targets. - bool HasDotTypeDotSizeDirective; // Defaults to true. - - /// HasSingleParameterDotFile - True if the target has a single parameter - /// .file directive, this is true for ELF targets. - bool HasSingleParameterDotFile; // Defaults to true. - - /// UsedDirective - This directive, if non-null, is used to declare a global - /// as being used somehow that the assembler can't see. This prevents dead - /// code elimination on some targets. - const char *UsedDirective; // Defaults to null. - - /// WeakRefDirective - This directive, if non-null, is used to declare a - /// global as being a weak undefined symbol. - const char *WeakRefDirective; // Defaults to null. - - /// WeakDefDirective - This directive, if non-null, is used to declare a - /// global as being a weak defined symbol. - const char *WeakDefDirective; // Defaults to null. - - /// HiddenDirective - This directive, if non-null, is used to declare a - /// global or function as having hidden visibility. - const char *HiddenDirective; // Defaults to "\t.hidden\t". - - /// ProtectedDirective - This directive, if non-null, is used to declare a - /// global or function as having protected visibility. - const char *ProtectedDirective; // Defaults to "\t.protected\t". - - //===--- Dwarf Emission Directives -----------------------------------===// - - /// AbsoluteDebugSectionOffsets - True if we should emit abolute section - /// offsets for debug information. Defaults to false. - bool AbsoluteDebugSectionOffsets; - - /// AbsoluteEHSectionOffsets - True if we should emit abolute section - /// offsets for EH information. Defaults to false. - bool AbsoluteEHSectionOffsets; - - /// HasLEB128 - True if target asm supports leb128 directives. - /// - bool HasLEB128; // Defaults to false. - - /// hasDotLocAndDotFile - True if target asm supports .loc and .file - /// directives for emitting debugging information. - /// - bool HasDotLocAndDotFile; // Defaults to false. - - /// SupportsDebugInformation - True if target supports emission of debugging - /// information. - bool SupportsDebugInformation; - - /// SupportsExceptionHandling - True if target supports - /// exception handling. - /// - bool SupportsExceptionHandling; // Defaults to false. - - /// RequiresFrameSection - true if the Dwarf2 output needs a frame section - /// - bool DwarfRequiresFrameSection; // Defaults to true. - - /// DwarfUsesInlineInfoSection - True if DwarfDebugInlineSection is used to - /// encode inline subroutine information. - bool DwarfUsesInlineInfoSection; // Defaults to false. - - /// NonLocalEHFrameLabel - If set, the EH_frame label needs to be non-local. - /// - bool NonLocalEHFrameLabel; // Defaults to false. - - /// GlobalEHDirective - This is the directive used to make exception frame - /// tables globally visible. - /// - const char *GlobalEHDirective; // Defaults to NULL. - - /// SupportsWeakEmptyEHFrame - True if target assembler and linker will - /// handle a weak_definition of constant 0 for an omitted EH frame. - bool SupportsWeakOmittedEHFrame; // Defaults to true. - - /// DwarfSectionOffsetDirective - Special section offset directive. - const char* DwarfSectionOffsetDirective; // Defaults to NULL - - /// DwarfAbbrevSection - Section directive for Dwarf abbrev. - /// - const char *DwarfAbbrevSection; // Defaults to ".debug_abbrev". - - /// DwarfInfoSection - Section directive for Dwarf info. - /// - const char *DwarfInfoSection; // Defaults to ".debug_info". - - /// DwarfLineSection - Section directive for Dwarf info. - /// - const char *DwarfLineSection; // Defaults to ".debug_line". - - /// DwarfFrameSection - Section directive for Dwarf info. - /// - const char *DwarfFrameSection; // Defaults to ".debug_frame". - - /// DwarfPubNamesSection - Section directive for Dwarf info. - /// - const char *DwarfPubNamesSection; // Defaults to ".debug_pubnames". - - /// DwarfPubTypesSection - Section directive for Dwarf info. - /// - const char *DwarfPubTypesSection; // Defaults to ".debug_pubtypes". - - /// DwarfDebugInlineSection - Section directive for inline info. - /// - const char *DwarfDebugInlineSection; // Defaults to ".debug_inlined" - - /// DwarfStrSection - Section directive for Dwarf info. - /// - const char *DwarfStrSection; // Defaults to ".debug_str". - - /// DwarfLocSection - Section directive for Dwarf info. - /// - const char *DwarfLocSection; // Defaults to ".debug_loc". - - /// DwarfARangesSection - Section directive for Dwarf info. - /// - const char *DwarfARangesSection; // Defaults to ".debug_aranges". - - /// DwarfRangesSection - Section directive for Dwarf info. - /// - const char *DwarfRangesSection; // Defaults to ".debug_ranges". - - /// DwarfMacroInfoSection - Section directive for DWARF macro info. - /// - const char *DwarfMacroInfoSection; // Defaults to ".debug_macinfo". - - /// DwarfEHFrameSection - Section directive for Exception frames. - /// - const char *DwarfEHFrameSection; // Defaults to ".eh_frame". - - /// DwarfExceptionSection - Section directive for Exception table. - /// - const char *DwarfExceptionSection; // Defaults to ".gcc_except_table". - - //===--- CBE Asm Translation Table -----------------------------------===// - - const char *const *AsmTransCBE; // Defaults to empty - - public: - explicit TargetAsmInfo(const TargetMachine &TM); - virtual ~TargetAsmInfo(); - - const Section* getNamedSection(const char *Name, - unsigned Flags = SectionFlags::None, - bool Override = false) const; - const Section* getUnnamedSection(const char *Directive, - unsigned Flags = SectionFlags::None, - bool Override = false) const; - - /// Measure the specified inline asm to determine an approximation of its - /// length. - virtual unsigned getInlineAsmLength(const char *Str) const; - - /// ExpandInlineAsm - This hook allows the target to expand an inline asm - /// call to be explicit llvm code if it wants to. This is useful for - /// turning simple inline asms into LLVM intrinsics, which gives the - /// compiler more information about the behavior of the code. - virtual bool ExpandInlineAsm(CallInst *CI) const { - return false; - } - - /// emitUsedDirectiveFor - This hook allows targets to selectively decide - /// not to emit the UsedDirective for some symbols in llvm.used. - virtual bool emitUsedDirectiveFor(const GlobalValue *GV, - Mangler *Mang) const { - return (GV!=0); - } - - /// PreferredEHDataFormat - This hook allows the target to select data - /// format used for encoding pointers in exception handling data. Reason is - /// 0 for data, 1 for code labels, 2 for function pointers. Global is true - /// if the symbol can be relocated. - virtual unsigned PreferredEHDataFormat(DwarfEncoding::Target Reason, - bool Global) const; - - /// SectionKindForGlobal - This hook allows the target to select proper - /// section kind used for global emission. - virtual SectionKind::Kind - SectionKindForGlobal(const GlobalValue *GV) const; - - /// RelocBehaviour - Describes how relocations should be treated when - /// selecting sections. Reloc::Global bit should be set if global - /// relocations should force object to be placed in read-write - /// sections. Reloc::Local bit should be set if local relocations should - /// force object to be placed in read-write sections. - virtual unsigned RelocBehaviour() const; - - /// SectionFlagsForGlobal - This hook allows the target to select proper - /// section flags either for given global or for section. - virtual unsigned - SectionFlagsForGlobal(const GlobalValue *GV = NULL, - const char* name = NULL) const; - - /// SectionForGlobal - This hooks returns proper section name for given - /// global with all necessary flags and marks. - virtual const Section* SectionForGlobal(const GlobalValue *GV) const; - - // Helper methods for SectionForGlobal - virtual std::string UniqueSectionForGlobal(const GlobalValue* GV, - SectionKind::Kind kind) const; - - const std::string& getSectionFlags(unsigned Flags) const; - virtual std::string printSectionFlags(unsigned flags) const { return ""; } - - virtual const Section* SelectSectionForGlobal(const GlobalValue *GV) const; - - virtual const Section* SelectSectionForMachineConst(const Type *Ty) const; - - /// getSLEB128Size - Compute the number of bytes required for a signed - /// leb128 value. - - static unsigned getSLEB128Size(int Value); - - /// getULEB128Size - Compute the number of bytes required for an unsigned - /// leb128 value. - - static unsigned getULEB128Size(unsigned Value); - - // Data directive accessors - // - const char *getData8bitsDirective(unsigned AS = 0) const { - return AS == 0 ? Data8bitsDirective : getASDirective(8, AS); - } - const char *getData16bitsDirective(unsigned AS = 0) const { - return AS == 0 ? Data16bitsDirective : getASDirective(16, AS); - } - const char *getData32bitsDirective(unsigned AS = 0) const { - return AS == 0 ? Data32bitsDirective : getASDirective(32, AS); - } - const char *getData64bitsDirective(unsigned AS = 0) const { - return AS == 0 ? Data64bitsDirective : getASDirective(64, AS); - } - - - // 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 *getSmallDataSection() const { - return SmallDataSection; - } - const Section *getSmallBSSSection() const { - return SmallBSSSection; - } - const Section *getSmallRODataSection() const { - return SmallRODataSection; - } - const Section *getTLSDataSection() const { - return TLSDataSection; - } - const Section *getTLSBSSSection() const { - return TLSBSSSection; - } - const char *getZeroFillDirective() const { - return ZeroFillDirective; - } - const char *getNonexecutableStackDirective() const { - return NonexecutableStackDirective; - } - bool needsSet() const { - return NeedsSet; - } - const char *getPCSymbol() const { - return PCSymbol; - } - char getSeparatorChar() const { - return SeparatorChar; - } - const char *getCommentString() const { - return CommentString; - } - const char *getGlobalPrefix() const { - return GlobalPrefix; - } - const char *getPrivateGlobalPrefix() const { - return PrivateGlobalPrefix; - } - /// EHGlobalPrefix - Prefix for EH_frame and the .eh symbols. - /// This is normally PrivateGlobalPrefix, but some targets want - /// these symbols to be visible. - virtual const char *getEHGlobalPrefix() const { - return PrivateGlobalPrefix; - } - const char *getLessPrivateGlobalPrefix() const { - return LessPrivateGlobalPrefix; - } - const char *getJumpTableSpecialLabelPrefix() const { - return JumpTableSpecialLabelPrefix; - } - const char *getGlobalVarAddrPrefix() const { - return GlobalVarAddrPrefix; - } - const char *getGlobalVarAddrSuffix() const { - return GlobalVarAddrSuffix; - } - const char *getFunctionAddrPrefix() const { - return FunctionAddrPrefix; - } - const char *getFunctionAddrSuffix() const { - return FunctionAddrSuffix; - } - const char *getPersonalityPrefix() const { - return PersonalityPrefix; - } - const char *getPersonalitySuffix() const { - return PersonalitySuffix; - } - bool getNeedsIndirectEncoding() const { - return NeedsIndirectEncoding; - } - const char *getInlineAsmStart() const { - return InlineAsmStart; - } - const char *getInlineAsmEnd() const { - return InlineAsmEnd; - } - unsigned getAssemblerDialect() const { - return AssemblerDialect; - } - const char *getStringConstantPrefix() const { - return StringConstantPrefix; - } - bool doesAllowQuotesInName() const { - return AllowQuotesInName; - } - const char *getZeroDirective() const { - return ZeroDirective; - } - const char *getZeroDirectiveSuffix() const { - return ZeroDirectiveSuffix; - } - const char *getAsciiDirective() const { - return AsciiDirective; - } - const char *getAscizDirective() const { - return AscizDirective; - } - const char *getJumpTableDirective() const { - return JumpTableDirective; - } - const char *getAlignDirective() const { - return AlignDirective; - } - bool getAlignmentIsInBytes() const { - return AlignmentIsInBytes; - } - unsigned getTextAlignFillValue() const { - return TextAlignFillValue; - } - const char *getSwitchToSectionDirective() const { - return SwitchToSectionDirective; - } - const char *getTextSectionStartSuffix() const { - return TextSectionStartSuffix; - } - const char *getDataSectionStartSuffix() const { - return DataSectionStartSuffix; - } - const char *getSectionEndDirectiveSuffix() const { - return SectionEndDirectiveSuffix; - } - const char *getConstantPoolSection() const { - return ConstantPoolSection; - } - const char *getJumpTableDataSection() const { - return JumpTableDataSection; - } - const char *getCStringSection() const { - return CStringSection; - } - const Section *getCStringSection_() const { - return CStringSection_; - } - const char *getStaticCtorsSection() const { - return StaticCtorsSection; - } - const char *getStaticDtorsSection() const { - return StaticDtorsSection; - } - const char *getGlobalDirective() const { - return GlobalDirective; - } - const char *getExternDirective() const { - return ExternDirective; - } - const char *getSetDirective() const { - return SetDirective; - } - const char *getLCOMMDirective() const { - return LCOMMDirective; - } - const char *getCOMMDirective() const { - return COMMDirective; - } - bool getCOMMDirectiveTakesAlignment() const { - return COMMDirectiveTakesAlignment; - } - bool hasDotTypeDotSizeDirective() const { - return HasDotTypeDotSizeDirective; - } - bool hasSingleParameterDotFile() const { - return HasSingleParameterDotFile; - } - const char *getUsedDirective() const { - return UsedDirective; - } - const char *getWeakRefDirective() const { - return WeakRefDirective; - } - const char *getWeakDefDirective() const { - return WeakDefDirective; - } - const char *getHiddenDirective() const { - return HiddenDirective; - } - const char *getProtectedDirective() const { - return ProtectedDirective; - } - bool isAbsoluteDebugSectionOffsets() const { - return AbsoluteDebugSectionOffsets; - } - bool isAbsoluteEHSectionOffsets() const { - return AbsoluteEHSectionOffsets; - } - bool hasLEB128() const { - return HasLEB128; - } - bool hasDotLocAndDotFile() const { - return HasDotLocAndDotFile; - } - bool doesSupportDebugInformation() const { - return SupportsDebugInformation; - } - bool doesSupportExceptionHandling() const { - return SupportsExceptionHandling; - } - bool doesDwarfRequireFrameSection() const { - return DwarfRequiresFrameSection; - } - bool doesDwarfUsesInlineInfoSection() const { - return DwarfUsesInlineInfoSection; - } - bool doesRequireNonLocalEHFrameLabel() const { - return NonLocalEHFrameLabel; - } - const char *getGlobalEHDirective() const { - return GlobalEHDirective; - } - bool getSupportsWeakOmittedEHFrame() const { - return SupportsWeakOmittedEHFrame; - } - const char *getDwarfSectionOffsetDirective() const { - return DwarfSectionOffsetDirective; - } - const char *getDwarfAbbrevSection() const { - return DwarfAbbrevSection; - } - const char *getDwarfInfoSection() const { - return DwarfInfoSection; - } - const char *getDwarfLineSection() const { - return DwarfLineSection; - } - const char *getDwarfFrameSection() const { - return DwarfFrameSection; - } - const char *getDwarfPubNamesSection() const { - return DwarfPubNamesSection; - } - const char *getDwarfPubTypesSection() const { - return DwarfPubTypesSection; - } - const char *getDwarfDebugInlineSection() const { - return DwarfDebugInlineSection; - } - const char *getDwarfStrSection() const { - return DwarfStrSection; - } - const char *getDwarfLocSection() const { - return DwarfLocSection; - } - const char *getDwarfARangesSection() const { - return DwarfARangesSection; - } - const char *getDwarfRangesSection() const { - return DwarfRangesSection; - } - const char *getDwarfMacroInfoSection() const { - return DwarfMacroInfoSection; - } - const char *getDwarfEHFrameSection() const { - return DwarfEHFrameSection; - } - const char *getDwarfExceptionSection() const { - return DwarfExceptionSection; - } - const char *const *getAsmCBE() const { - return AsmTransCBE; - } - }; -} - -#endif diff --git a/include/llvm/Target/TargetMachineRegistry.h b/include/llvm/Target/TargetMachineRegistry.h deleted file mode 100644 index b7ea448..0000000 --- a/include/llvm/Target/TargetMachineRegistry.h +++ /dev/null @@ -1,97 +0,0 @@ -//===-- Target/TargetMachineRegistry.h - Target Registration ----*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// -// This file exposes two classes: the TargetMachineRegistry class, which allows -// tools to inspect all of registered targets, and the RegisterTarget class, -// which TargetMachine implementations should use to register themselves with -// the system. -// -//===----------------------------------------------------------------------===// - -#ifndef LLVM_TARGET_TARGETMACHINEREGISTRY_H -#define LLVM_TARGET_TARGETMACHINEREGISTRY_H - -#include "llvm/Module.h" -#include "llvm/Support/Registry.h" - -namespace llvm { - class Module; - class TargetMachine; - - struct TargetMachineRegistryEntry { - const char *Name; - const char *ShortDesc; - TargetMachine *(*CtorFn)(const Module &, const std::string &); - unsigned (*ModuleMatchQualityFn)(const Module &M); - unsigned (*JITMatchQualityFn)(); - - public: - TargetMachineRegistryEntry(const char *N, const char *SD, - TargetMachine *(*CF)(const Module &, const std::string &), - unsigned (*MMF)(const Module &M), - unsigned (*JMF)()) - : Name(N), ShortDesc(SD), CtorFn(CF), ModuleMatchQualityFn(MMF), - JITMatchQualityFn(JMF) {} - }; - - template<> - class RegistryTraits<TargetMachine> { - public: - typedef TargetMachineRegistryEntry entry; - - static const char *nameof(const entry &Entry) { return Entry.Name; } - static const char *descof(const entry &Entry) { return Entry.ShortDesc; } - }; - - struct TargetMachineRegistry : public Registry<TargetMachine> { - /// getClosestStaticTargetForModule - Given an LLVM module, pick the best - /// target that is compatible with the module. If no close target can be - /// found, this returns null and sets the Error string to a reason. - static const entry *getClosestStaticTargetForModule(const Module &M, - std::string &Error); - - /// getClosestTargetForJIT - Pick the best target that is compatible with - /// the current host. If no close target can be found, this returns null - /// and sets the Error string to a reason. - static const entry *getClosestTargetForJIT(std::string &Error); - - }; - - //===--------------------------------------------------------------------===// - /// RegisterTarget - This class is used to make targets automatically register - /// themselves with the tool they are linked. Targets should define an - /// instance of this and implement the static methods described in the - /// TargetMachine comments. - /// The type 'TargetMachineImpl' should provide a constructor with two - /// parameters: - /// - const Module& M: the module that is being compiled: - /// - const std::string& FS: target-specific string describing target - /// flavour. - - template<class TargetMachineImpl> - struct RegisterTarget { - RegisterTarget(const char *Name, const char *ShortDesc) - : Entry(Name, ShortDesc, &Allocator, - &TargetMachineImpl::getModuleMatchQuality, - &TargetMachineImpl::getJITMatchQuality), - Node(Entry) - {} - - private: - TargetMachineRegistry::entry Entry; - TargetMachineRegistry::node Node; - - static TargetMachine *Allocator(const Module &M, const std::string &FS) { - return new TargetMachineImpl(M, FS); - } - }; - -} - -#endif diff --git a/include/llvm/Transforms/Utils/InlineCost.h b/include/llvm/Transforms/Utils/InlineCost.h deleted file mode 100644 index f275b76..0000000 --- a/include/llvm/Transforms/Utils/InlineCost.h +++ /dev/null @@ -1,155 +0,0 @@ -//===- InlineCost.cpp - Cost analysis for inliner ---------------*- 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 heuristics for inlining decisions. -// -//===----------------------------------------------------------------------===// - -#ifndef LLVM_TRANSFORMS_UTILS_INLINECOST_H -#define LLVM_TRANSFORMS_UTILS_INLINECOST_H - -#include "llvm/ADT/SmallPtrSet.h" -#include <cassert> -#include <climits> -#include <map> -#include <vector> - -namespace llvm { - - class Value; - class Function; - class CallSite; - - /// InlineCost - Represent the cost of inlining a function. This - /// supports special values for functions which should "always" or - /// "never" be inlined. Otherwise, the cost represents a unitless - /// amount; smaller values increase the likelyhood of the function - /// being inlined. - class InlineCost { - enum Kind { - Value, - Always, - Never - }; - - // This is a do-it-yourself implementation of - // int Cost : 30; - // unsigned Type : 2; - // We used to use bitfields, but they were sometimes miscompiled (PR3822). - enum { TYPE_BITS = 2 }; - enum { COST_BITS = unsigned(sizeof(unsigned)) * CHAR_BIT - TYPE_BITS }; - unsigned TypedCost; // int Cost : COST_BITS; unsigned Type : TYPE_BITS; - - Kind getType() const { - return Kind(TypedCost >> COST_BITS); - } - - int getCost() const { - // Sign-extend the bottom COST_BITS bits. - return (int(TypedCost << TYPE_BITS)) >> TYPE_BITS; - } - - InlineCost(int C, int T) { - TypedCost = (unsigned(C << TYPE_BITS) >> TYPE_BITS) | (T << COST_BITS); - assert(getCost() == C && "Cost exceeds InlineCost precision"); - } - public: - static InlineCost get(int Cost) { return InlineCost(Cost, Value); } - static InlineCost getAlways() { return InlineCost(0, Always); } - static InlineCost getNever() { return InlineCost(0, Never); } - - bool isVariable() const { return getType() == Value; } - bool isAlways() const { return getType() == Always; } - bool isNever() const { return getType() == Never; } - - /// getValue() - Return a "variable" inline cost's amount. It is - /// an error to call this on an "always" or "never" InlineCost. - int getValue() const { - assert(getType() == Value && "Invalid access of InlineCost"); - return getCost(); - } - }; - - /// InlineCostAnalyzer - Cost analyzer used by inliner. - class InlineCostAnalyzer { - struct ArgInfo { - public: - unsigned ConstantWeight; - unsigned AllocaWeight; - - ArgInfo(unsigned CWeight, unsigned AWeight) - : ConstantWeight(CWeight), AllocaWeight(AWeight) {} - }; - - // FunctionInfo - For each function, calculate the size of it in blocks and - // instructions. - struct FunctionInfo { - /// NeverInline - True if this callee should never be inlined into a - /// caller. - bool NeverInline; - - /// usesDynamicAlloca - True if this function calls alloca (in the C sense). - bool usesDynamicAlloca; - - /// NumInsts, NumBlocks - Keep track of how large each function is, which - /// is used to estimate the code size cost of inlining it. - unsigned NumInsts, NumBlocks; - - /// NumVectorInsts - Keep track of how many instructions produce vector - /// values. The inliner is being more aggressive with inlining vector - /// kernels. - unsigned NumVectorInsts; - - /// ArgumentWeights - Each formal argument of the function is inspected to - /// see if it is used in any contexts where making it a constant or alloca - /// would reduce the code size. If so, we add some value to the argument - /// entry here. - std::vector<ArgInfo> ArgumentWeights; - - FunctionInfo() : NeverInline(false), usesDynamicAlloca(false), NumInsts(0), - NumBlocks(0), NumVectorInsts(0) {} - - /// analyzeFunction - Fill in the current structure with information - /// gleaned from the specified function. - void analyzeFunction(Function *F); - - /// CountCodeReductionForConstant - Figure out an approximation for how - /// many instructions will be constant folded if the specified value is - /// constant. - unsigned CountCodeReductionForConstant(Value *V); - - /// CountCodeReductionForAlloca - Figure out an approximation of how much - /// smaller the function will be if it is inlined into a context where an - /// argument becomes an alloca. - /// - unsigned CountCodeReductionForAlloca(Value *V); - }; - - std::map<const Function *, FunctionInfo> CachedFunctionInfo; - - public: - - /// getInlineCost - The heuristic used to determine if we should inline the - /// function call or not. - /// - InlineCost getInlineCost(CallSite CS, - SmallPtrSet<const Function *, 16> &NeverInline); - - /// getInlineFudgeFactor - Return a > 1.0 factor if the inliner should use a - /// higher threshold to determine if the function call should be inlined. - float getInlineFudgeFactor(CallSite CS); - - /// resetCachedFunctionInfo - erase any cached cost info for this function. - void resetCachedCostInfo(Function* Caller) { - CachedFunctionInfo[Caller].NumBlocks = 0; - } - }; -} - -#endif |