forked from OSchip/llvm-project
parent
5c9ef1ba2d
commit
95aab4ef6d
|
@ -1,10 +1,10 @@
|
|||
//===-- llvm/Support/AIXDataTypesFix.h - Fix datatype defs ------*- C++ -*-===//
|
||||
//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file was developed by the LLVM research group and is distributed under
|
||||
// the University of Illinois Open Source License. See LICENSE.TXT for details.
|
||||
//
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// This file overrides default system-defined types and limits which cannot be
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
//===-- llvm/Support/Annotation.h - Annotation classes ----------*- C++ -*-===//
|
||||
//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file was developed by the LLVM research group and 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.
|
||||
|
@ -81,7 +81,7 @@ public:
|
|||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Annotable - This class is used as a base class for all objects that would
|
||||
// like to have annotation capability. One notable subclass is Value, which
|
||||
// like to have annotation capability. One notable subclass is Value, which
|
||||
// means annotations can be attached to almost everything in LLVM.
|
||||
//
|
||||
// Annotable objects keep their annotation list sorted as annotations are
|
||||
|
@ -157,13 +157,13 @@ public:
|
|||
// 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
|
||||
// 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
|
||||
// register an annotation handler
|
||||
//
|
||||
struct AnnotationManager {
|
||||
typedef Annotation *(*Factory)(AnnotationID, const Annotable *, void*);
|
||||
|
@ -183,7 +183,7 @@ struct AnnotationManager {
|
|||
// 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
|
||||
// function used to create an annotation on demand if it is needed by the
|
||||
// Annotable::getOrCreateAnnotation method.
|
||||
//
|
||||
static void registerAnnotationFactory(AnnotationID ID, Factory Func,
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
//===-- llvm/Support/CFG.h - Process LLVM structures as graphs --*- C++ -*-===//
|
||||
//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file was developed by the LLVM research group and is distributed under
|
||||
// the University of Illinois Open Source License. See LICENSE.TXT for details.
|
||||
//
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// This file defines specializations of GraphTraits that allow Function and
|
||||
|
@ -34,40 +34,40 @@ class PredIterator : public forward_iterator<_Ptr, ptrdiff_t> {
|
|||
public:
|
||||
typedef PredIterator<_Ptr,_USE_iterator> _Self;
|
||||
typedef typename super::pointer pointer;
|
||||
|
||||
|
||||
inline void advancePastNonTerminators() {
|
||||
// Loop to ignore non terminator uses (for example PHI nodes)...
|
||||
while (It != BB->use_end() && !isa<TerminatorInst>(*It))
|
||||
++It;
|
||||
}
|
||||
|
||||
|
||||
inline PredIterator(_Ptr *bb) : BB(bb), It(bb->use_begin()) {
|
||||
advancePastNonTerminators();
|
||||
}
|
||||
inline PredIterator(_Ptr *bb, bool) : BB(bb), It(bb->use_end()) {}
|
||||
|
||||
|
||||
inline bool operator==(const _Self& x) const { return It == x.It; }
|
||||
inline bool operator!=(const _Self& x) const { return !operator==(x); }
|
||||
|
||||
inline pointer operator*() const {
|
||||
|
||||
inline pointer operator*() const {
|
||||
assert(It != BB->use_end() && "pred_iterator out of range!");
|
||||
return cast<TerminatorInst>(*It)->getParent();
|
||||
return cast<TerminatorInst>(*It)->getParent();
|
||||
}
|
||||
inline pointer *operator->() const { return &(operator*()); }
|
||||
|
||||
|
||||
inline _Self& operator++() { // Preincrement
|
||||
assert(It != BB->use_end() && "pred_iterator out of range!");
|
||||
++It; advancePastNonTerminators();
|
||||
return *this;
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
inline _Self operator++(int) { // Postincrement
|
||||
_Self tmp = *this; ++*this; return tmp;
|
||||
_Self tmp = *this; ++*this; return tmp;
|
||||
}
|
||||
};
|
||||
|
||||
typedef PredIterator<BasicBlock, Value::use_iterator> pred_iterator;
|
||||
typedef PredIterator<const BasicBlock,
|
||||
typedef PredIterator<const BasicBlock,
|
||||
Value::use_const_iterator> pred_const_iterator;
|
||||
|
||||
inline pred_iterator pred_begin(BasicBlock *BB) { return pred_iterator(BB); }
|
||||
|
@ -94,7 +94,7 @@ public:
|
|||
typedef SuccIterator<Term_, BB_> _Self;
|
||||
typedef typename super::pointer pointer;
|
||||
// TODO: This can be random access iterator, need operator+ and stuff tho
|
||||
|
||||
|
||||
inline SuccIterator(Term_ T) : Term(T), idx(0) { // begin iterator
|
||||
assert(T && "getTerminator returned null!");
|
||||
}
|
||||
|
@ -112,18 +112,18 @@ public:
|
|||
/// getSuccessorIndex - This is used to interface between code that wants to
|
||||
/// operate on terminator instructions directly.
|
||||
unsigned getSuccessorIndex() const { return idx; }
|
||||
|
||||
|
||||
inline bool operator==(const _Self& x) const { return idx == x.idx; }
|
||||
inline bool operator!=(const _Self& x) const { return !operator==(x); }
|
||||
|
||||
|
||||
inline pointer operator*() const { return Term->getSuccessor(idx); }
|
||||
inline pointer operator->() const { return operator*(); }
|
||||
|
||||
|
||||
inline _Self& operator++() { ++idx; return *this; } // Preincrement
|
||||
inline _Self operator++(int) { // Postincrement
|
||||
_Self tmp = *this; ++*this; return tmp;
|
||||
_Self tmp = *this; ++*this; return tmp;
|
||||
}
|
||||
|
||||
|
||||
inline _Self& operator--() { --idx; return *this; } // Predecrement
|
||||
inline _Self operator--(int) { // Postdecrement
|
||||
_Self tmp = *this; --*this; return tmp;
|
||||
|
@ -153,7 +153,7 @@ inline succ_const_iterator succ_end(const BasicBlock *BB) {
|
|||
// GraphTraits specializations for basic block graphs (CFGs)
|
||||
//===--------------------------------------------------------------------===//
|
||||
|
||||
// Provide specializations of GraphTraits to be able to treat a function as a
|
||||
// Provide specializations of GraphTraits to be able to treat a function as a
|
||||
// graph of basic blocks...
|
||||
|
||||
template <> struct GraphTraits<BasicBlock*> {
|
||||
|
@ -161,10 +161,10 @@ template <> struct GraphTraits<BasicBlock*> {
|
|||
typedef succ_iterator ChildIteratorType;
|
||||
|
||||
static NodeType *getEntryNode(BasicBlock *BB) { return BB; }
|
||||
static inline ChildIteratorType child_begin(NodeType *N) {
|
||||
static inline ChildIteratorType child_begin(NodeType *N) {
|
||||
return succ_begin(N);
|
||||
}
|
||||
static inline ChildIteratorType child_end(NodeType *N) {
|
||||
static inline ChildIteratorType child_end(NodeType *N) {
|
||||
return succ_end(N);
|
||||
}
|
||||
};
|
||||
|
@ -175,15 +175,15 @@ template <> struct GraphTraits<const BasicBlock*> {
|
|||
|
||||
static NodeType *getEntryNode(const BasicBlock *BB) { return BB; }
|
||||
|
||||
static inline ChildIteratorType child_begin(NodeType *N) {
|
||||
static inline ChildIteratorType child_begin(NodeType *N) {
|
||||
return succ_begin(N);
|
||||
}
|
||||
static inline ChildIteratorType child_end(NodeType *N) {
|
||||
static inline ChildIteratorType child_end(NodeType *N) {
|
||||
return succ_end(N);
|
||||
}
|
||||
};
|
||||
|
||||
// Provide specializations of GraphTraits to be able to treat a function as a
|
||||
// Provide specializations of GraphTraits to be able to treat a function as a
|
||||
// graph of basic blocks... and to walk it in inverse order. Inverse order for
|
||||
// a function is considered to be when traversing the predecessor edges of a BB
|
||||
// instead of the successor edges.
|
||||
|
@ -192,10 +192,10 @@ template <> struct GraphTraits<Inverse<BasicBlock*> > {
|
|||
typedef BasicBlock NodeType;
|
||||
typedef pred_iterator ChildIteratorType;
|
||||
static NodeType *getEntryNode(Inverse<BasicBlock *> G) { return G.Graph; }
|
||||
static inline ChildIteratorType child_begin(NodeType *N) {
|
||||
static inline ChildIteratorType child_begin(NodeType *N) {
|
||||
return pred_begin(N);
|
||||
}
|
||||
static inline ChildIteratorType child_end(NodeType *N) {
|
||||
static inline ChildIteratorType child_end(NodeType *N) {
|
||||
return pred_end(N);
|
||||
}
|
||||
};
|
||||
|
@ -204,12 +204,12 @@ template <> struct GraphTraits<Inverse<const BasicBlock*> > {
|
|||
typedef const BasicBlock NodeType;
|
||||
typedef pred_const_iterator ChildIteratorType;
|
||||
static NodeType *getEntryNode(Inverse<const BasicBlock*> G) {
|
||||
return G.Graph;
|
||||
return G.Graph;
|
||||
}
|
||||
static inline ChildIteratorType child_begin(NodeType *N) {
|
||||
static inline ChildIteratorType child_begin(NodeType *N) {
|
||||
return pred_begin(N);
|
||||
}
|
||||
static inline ChildIteratorType child_end(NodeType *N) {
|
||||
static inline ChildIteratorType child_end(NodeType *N) {
|
||||
return pred_end(N);
|
||||
}
|
||||
};
|
||||
|
@ -220,7 +220,7 @@ template <> struct GraphTraits<Inverse<const BasicBlock*> > {
|
|||
// GraphTraits specializations for function basic block graphs (CFGs)
|
||||
//===--------------------------------------------------------------------===//
|
||||
|
||||
// Provide specializations of GraphTraits to be able to treat a function as a
|
||||
// Provide specializations of GraphTraits to be able to treat a function as a
|
||||
// graph of basic blocks... these are the same as the basic block iterators,
|
||||
// except that the root node is implicitly the first node of the function.
|
||||
//
|
||||
|
@ -243,7 +243,7 @@ template <> struct GraphTraits<const Function*> :
|
|||
};
|
||||
|
||||
|
||||
// Provide specializations of GraphTraits to be able to treat a function as a
|
||||
// Provide specializations of GraphTraits to be able to treat a function as a
|
||||
// graph of basic blocks... and to walk it in inverse order. Inverse order for
|
||||
// a function is considered to be when traversing the predecessor edges of a BB
|
||||
// instead of the successor edges.
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
//===-- llvm/Support/CallSite.h - Abstract Call & Invoke instrs -*- C++ -*-===//
|
||||
//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file was developed by the LLVM research group and is distributed under
|
||||
// the University of Illinois Open Source License. See LICENSE.TXT for details.
|
||||
//
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// This file defines the CallSite class, which is a handy wrapper for code that
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
//===-- llvm/Support/Casting.h - Allow flexible, checked, casts -*- C++ -*-===//
|
||||
//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file was developed by the LLVM research group and is distributed under
|
||||
// the University of Illinois Open Source License. See LICENSE.TXT for details.
|
||||
//
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// This file defines the isa<X>(), cast<X>(), dyn_cast<X>(), cast_or_null<X>(),
|
||||
|
@ -48,7 +48,7 @@ template<typename From> struct simplify_type<const From> {
|
|||
// if (isa<Type*>(myVal)) { ... }
|
||||
//
|
||||
template <typename To, typename From>
|
||||
inline bool isa_impl(const From &Val) {
|
||||
inline bool isa_impl(const From &Val) {
|
||||
return To::classof(&Val);
|
||||
}
|
||||
|
||||
|
@ -57,7 +57,7 @@ struct isa_impl_wrap {
|
|||
// When From != SimplifiedType, we can simplify the type some more by using
|
||||
// the simplify_type template.
|
||||
static bool doit(const From &Val) {
|
||||
return isa_impl_cl<const SimpleType>::template
|
||||
return isa_impl_cl<const SimpleType>::template
|
||||
isa<To>(simplify_type<const From>::getSimplifiedValue(Val));
|
||||
}
|
||||
};
|
||||
|
@ -159,7 +159,7 @@ struct cast_retty_wrap<To, FromTy, FromTy> {
|
|||
|
||||
template<class To, class From>
|
||||
struct cast_retty {
|
||||
typedef typename cast_retty_wrap<To, From,
|
||||
typedef typename cast_retty_wrap<To, From,
|
||||
typename simplify_type<From>::SimpleType>::ret_type ret_type;
|
||||
};
|
||||
|
||||
|
@ -248,7 +248,7 @@ struct foo {
|
|||
}*/
|
||||
};
|
||||
|
||||
template <> inline bool isa_impl<foo,bar>(const bar &Val) {
|
||||
template <> inline bool isa_impl<foo,bar>(const bar &Val) {
|
||||
cerr << "Classof: " << &Val << "\n";
|
||||
return true;
|
||||
}
|
||||
|
@ -279,7 +279,7 @@ void test(bar &B1, const bar *B2) {
|
|||
const foo *F12 = cast_or_null<foo>(B2);
|
||||
const foo *F13 = cast_or_null<foo>(B4);
|
||||
const foo *F14 = cast_or_null<foo>(fub()); // Shouldn't print.
|
||||
|
||||
|
||||
// These lines are errors...
|
||||
//foo *F20 = cast<foo>(B2); // Yields const foo*
|
||||
//foo &F21 = cast<foo>(B3); // Yields const foo&
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
//===- llvm/Support/CommandLine.h - Command line handler --------*- C++ -*-===//
|
||||
//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file was developed by the LLVM research group and is distributed under
|
||||
// the University of Illinois Open Source License. See LICENSE.TXT for details.
|
||||
//
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// This class implements a command line argument processor that is useful when
|
||||
|
@ -126,14 +126,14 @@ class Option {
|
|||
// an argument. Should return true if there was an error processing the
|
||||
// argument and the program should exit.
|
||||
//
|
||||
virtual bool handleOccurrence(unsigned pos, const char *ArgName,
|
||||
virtual bool handleOccurrence(unsigned pos, const char *ArgName,
|
||||
const std::string &Arg) = 0;
|
||||
|
||||
virtual enum NumOccurrences getNumOccurrencesFlagDefault() const {
|
||||
virtual enum NumOccurrences getNumOccurrencesFlagDefault() const {
|
||||
return Optional;
|
||||
}
|
||||
virtual enum ValueExpected getValueExpectedFlagDefault() const {
|
||||
return ValueOptional;
|
||||
return ValueOptional;
|
||||
}
|
||||
virtual enum OptionHidden getOptionHiddenFlagDefault() const {
|
||||
return NotHidden;
|
||||
|
@ -216,14 +216,14 @@ public:
|
|||
// Return the width of the option tag for printing...
|
||||
virtual unsigned getOptionWidth() const = 0;
|
||||
|
||||
// printOptionInfo - Print out information about this option. The
|
||||
// printOptionInfo - Print out information about this option. The
|
||||
// to-be-maintained width is specified.
|
||||
//
|
||||
virtual void printOptionInfo(unsigned GlobalWidth) const = 0;
|
||||
|
||||
// addOccurrence - Wrapper around handleOccurrence that enforces Flags
|
||||
//
|
||||
bool addOccurrence(unsigned pos, const char *ArgName,
|
||||
bool addOccurrence(unsigned pos, const char *ArgName,
|
||||
const std::string &Value);
|
||||
|
||||
// Prints option name followed by message. Always returns true.
|
||||
|
@ -311,7 +311,7 @@ class ValuesClass {
|
|||
std::vector<std::pair<const char *, std::pair<int, const char *> > > Values;
|
||||
void processValues(va_list Vals);
|
||||
public:
|
||||
ValuesClass(const char *EnumName, DataType Val, const char *Desc,
|
||||
ValuesClass(const char *EnumName, DataType Val, const char *Desc,
|
||||
va_list ValueArgs) {
|
||||
// Insert the first value, which is required.
|
||||
Values.push_back(std::make_pair(EnumName, std::make_pair(Val, Desc)));
|
||||
|
@ -366,14 +366,14 @@ struct generic_parser_base {
|
|||
|
||||
// getOption - Return option name N.
|
||||
virtual const char *getOption(unsigned N) const = 0;
|
||||
|
||||
|
||||
// getDescription - Return description N
|
||||
virtual const char *getDescription(unsigned N) const = 0;
|
||||
|
||||
// Return the width of the option tag for printing...
|
||||
virtual unsigned getOptionWidth(const Option &O) const;
|
||||
|
||||
// printOptionInfo - Print out information about this option. The
|
||||
// printOptionInfo - Print out information about this option. The
|
||||
// to-be-maintained width is specified.
|
||||
//
|
||||
virtual void printOptionInfo(const Option &O, unsigned GlobalWidth) const;
|
||||
|
@ -442,7 +442,7 @@ public:
|
|||
}
|
||||
|
||||
// parse - Return true on error.
|
||||
bool parse(Option &O, const char *ArgName, const std::string &Arg,
|
||||
bool parse(Option &O, const char *ArgName, const std::string &Arg,
|
||||
DataType &V) {
|
||||
std::string ArgVal;
|
||||
if (hasArgStr)
|
||||
|
@ -485,12 +485,12 @@ struct basic_parser_impl { // non-template implementation of basic_parser<t>
|
|||
enum ValueExpected getValueExpectedFlagDefault() const {
|
||||
return ValueRequired;
|
||||
}
|
||||
|
||||
|
||||
void initialize(Option &O) {}
|
||||
|
||||
|
||||
// Return the width of the option tag for printing...
|
||||
unsigned getOptionWidth(const Option &O) const;
|
||||
|
||||
|
||||
// printOptionInfo - Print out information about this option. The
|
||||
// to-be-maintained width is specified.
|
||||
//
|
||||
|
@ -519,7 +519,7 @@ public:
|
|||
bool parse(Option &O, const char *ArgName, const std::string &Arg, bool &Val);
|
||||
|
||||
enum ValueExpected getValueExpectedFlagDefault() const {
|
||||
return ValueOptional;
|
||||
return ValueOptional;
|
||||
}
|
||||
|
||||
// getValueName - Do not print =<value> at all
|
||||
|
@ -590,7 +590,7 @@ template<>
|
|||
class parser<std::string> : public basic_parser<std::string> {
|
||||
public:
|
||||
// parse - Return true on error.
|
||||
bool parse(Option &O, const char *AN, const std::string &Arg,
|
||||
bool parse(Option &O, const char *AN, const std::string &Arg,
|
||||
std::string &Value) {
|
||||
Value = Arg;
|
||||
return false;
|
||||
|
@ -727,12 +727,12 @@ public:
|
|||
//
|
||||
template <class DataType, bool ExternalStorage = false,
|
||||
class ParserClass = parser<DataType> >
|
||||
class opt : public Option,
|
||||
class opt : public Option,
|
||||
public opt_storage<DataType, ExternalStorage,
|
||||
is_class<DataType>::value> {
|
||||
ParserClass Parser;
|
||||
|
||||
virtual bool handleOccurrence(unsigned pos, const char *ArgName,
|
||||
virtual bool handleOccurrence(unsigned pos, const char *ArgName,
|
||||
const std::string &Arg) {
|
||||
typename ParserClass::parser_data_type Val;
|
||||
if (Parser.parse(*this, ArgName, Arg, Val))
|
||||
|
@ -884,14 +884,14 @@ class list : public Option, public list_storage<DataType, Storage> {
|
|||
std::vector<unsigned> Positions;
|
||||
ParserClass Parser;
|
||||
|
||||
virtual enum NumOccurrences getNumOccurrencesFlagDefault() const {
|
||||
virtual enum NumOccurrences getNumOccurrencesFlagDefault() const {
|
||||
return ZeroOrMore;
|
||||
}
|
||||
virtual enum ValueExpected getValueExpectedFlagDefault() const {
|
||||
return Parser.getValueExpectedFlagDefault();
|
||||
}
|
||||
|
||||
virtual bool handleOccurrence(unsigned pos, const char *ArgName,
|
||||
virtual bool handleOccurrence(unsigned pos, const char *ArgName,
|
||||
const std::string &Arg) {
|
||||
typename ParserClass::parser_data_type Val;
|
||||
if (Parser.parse(*this, ArgName, Arg, Val))
|
||||
|
@ -915,9 +915,9 @@ class list : public Option, public list_storage<DataType, Storage> {
|
|||
public:
|
||||
ParserClass &getParser() { return Parser; }
|
||||
|
||||
unsigned getPosition(unsigned optnum) const {
|
||||
unsigned getPosition(unsigned optnum) const {
|
||||
assert(optnum < this->size() && "Invalid option index");
|
||||
return Positions[optnum];
|
||||
return Positions[optnum];
|
||||
}
|
||||
|
||||
// One option...
|
||||
|
@ -987,7 +987,7 @@ public:
|
|||
|
||||
class alias : public Option {
|
||||
Option *AliasFor;
|
||||
virtual bool handleOccurrence(unsigned pos, const char *ArgName,
|
||||
virtual bool handleOccurrence(unsigned pos, const char *ArgName,
|
||||
const std::string &Arg) {
|
||||
return AliasFor->handleOccurrence(pos, AliasFor->ArgStr, Arg);
|
||||
}
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
//===- llvm/Support/Compressor.h --------------------------------*- C++ -*-===//
|
||||
//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file was developed by Reid Spencer and is distributed under the
|
||||
// This file was developed by Reid Spencer and is distributed under the
|
||||
// University of Illinois Open Source License. See LICENSE.TXT for details.
|
||||
//
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// This file declares the llvm::Compressor class.
|
||||
|
@ -23,15 +23,15 @@ namespace llvm {
|
|||
/// a block of memory. The algorithm used here is currently bzip2 but that
|
||||
/// may change without notice. Should newer algorithms prove to compress
|
||||
/// bytecode better than bzip2, that newer algorithm will be added, but won't
|
||||
/// replace bzip2. This interface allows us to abstract the notion of
|
||||
/// compression and deal with alternate compression schemes over time.
|
||||
/// The type of compression used can be determined by inspecting the
|
||||
/// first byte of the compressed output. Currently value '0' means no
|
||||
/// replace bzip2. This interface allows us to abstract the notion of
|
||||
/// compression and deal with alternate compression schemes over time.
|
||||
/// The type of compression used can be determined by inspecting the
|
||||
/// first byte of the compressed output. Currently value '0' means no
|
||||
/// compression was used (for very small files) and value '2' means bzip2
|
||||
/// compression was used. The Compressor is intended for use with memory
|
||||
/// compression was used. The Compressor is intended for use with memory
|
||||
/// mapped files where the entire data block to be compressed or decompressed
|
||||
/// is available in memory. However, output can be gathered in repeated calls
|
||||
/// to a callback. Utilities for sending compressed or decompressed output
|
||||
/// to a callback. Utilities for sending compressed or decompressed output
|
||||
/// to a stream or directly to a memory block are also provided.
|
||||
/// @since 1.4
|
||||
/// @brief An abstraction for memory to memory data (de)compression
|
||||
|
@ -39,8 +39,8 @@ namespace llvm {
|
|||
/// @name High Level Interface
|
||||
/// @{
|
||||
public:
|
||||
/// This method compresses a block of memory pointed to by \p in with
|
||||
/// size \p size to a block of memory, \p out, that is allocated with
|
||||
/// This method compresses a block of memory pointed to by \p in with
|
||||
/// size \p size to a block of memory, \p out, that is allocated with
|
||||
/// malloc. It is the caller's responsibility to free \p out. The \p hint
|
||||
/// indicates which type of compression the caller would *prefer*.
|
||||
/// @throws std::string explaining error if a compression error occurs
|
||||
|
@ -52,10 +52,10 @@ namespace llvm {
|
|||
char*&out ///< The returned output buffer
|
||||
);
|
||||
|
||||
/// This method compresses a block of memory pointed to by \p in with
|
||||
/// This method compresses a block of memory pointed to by \p in with
|
||||
/// size \p size to a stream. The stream \p out must be open and ready for
|
||||
/// writing when this method is called. The stream will not be closed by
|
||||
/// this method. The \p hint argument indicates which type of
|
||||
/// this method. The \p hint argument indicates which type of
|
||||
/// compression the caller would *prefer*.
|
||||
/// @returns The amount of data written to \p out.
|
||||
/// @brief Compress memory to a file.
|
||||
|
@ -65,9 +65,9 @@ namespace llvm {
|
|||
std::ostream& out ///< The output stream to write data on
|
||||
);
|
||||
|
||||
/// This method decompresses a block of memory pointed to by \p in with
|
||||
/// This method decompresses a block of memory pointed to by \p in with
|
||||
/// size \p size to a new block of memory, \p out, \p that was allocated
|
||||
/// by malloc. It is the caller's responsibility to free \p out.
|
||||
/// by malloc. It is the caller's responsibility to free \p out.
|
||||
/// @returns The size of the output buffer \p out.
|
||||
/// @brief Decompress memory to a new memory buffer.
|
||||
static size_t decompressToNewBuffer(
|
||||
|
@ -76,10 +76,10 @@ namespace llvm {
|
|||
char*&out ///< The returned output buffer
|
||||
);
|
||||
|
||||
/// This method decompresses a block of memory pointed to by \p in with
|
||||
/// This method decompresses a block of memory pointed to by \p in with
|
||||
/// size \p size to a stream. The stream \p out must be open and ready for
|
||||
/// writing when this method is called. The stream will not be closed by
|
||||
/// this method.
|
||||
/// this method.
|
||||
/// @returns The amount of data written to \p out.
|
||||
/// @brief Decompress memory to a stream.
|
||||
static size_t decompressToStream(
|
||||
|
@ -93,10 +93,10 @@ namespace llvm {
|
|||
/// @{
|
||||
public:
|
||||
/// A callback function type used by the Compressor's low level interface
|
||||
/// to get the next chunk of data to which (de)compressed output will be
|
||||
/// written. This callback completely abstracts the notion of how to
|
||||
/// to get the next chunk of data to which (de)compressed output will be
|
||||
/// written. This callback completely abstracts the notion of how to
|
||||
/// handle the output data of compression or decompression. The callback
|
||||
/// is responsible for determining both the storage location and the size
|
||||
/// is responsible for determining both the storage location and the size
|
||||
/// of the output. The callback may also do other things with the data
|
||||
/// such as write it, transmit it, etc. Note that providing very small
|
||||
/// values for \p size will make the compression run very inefficiently.
|
||||
|
@ -138,7 +138,7 @@ namespace llvm {
|
|||
/// Note that the callback function will be called as many times as
|
||||
/// necessary to complete the compression of the \p in block but that the
|
||||
/// total size will generally be greater than \p size. It is a good idea
|
||||
/// to provide as large a value to the callback's \p size parameter as
|
||||
/// to provide as large a value to the callback's \p size parameter as
|
||||
/// possible so that fewer calls to the callback are made.
|
||||
/// @throws std::string if an error occurs
|
||||
/// @returns the total size of the decompressed data
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
//===-- llvm/Support/ConstantRange.h - Represent a range --------*- C++ -*-===//
|
||||
//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file was developed by the LLVM research group and is distributed under
|
||||
// the University of Illinois Open Source License. See LICENSE.TXT for details.
|
||||
//
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Represent a range of possible values that may occur when the program is run
|
||||
|
@ -39,7 +39,7 @@ class ConstantRange {
|
|||
/// Initialize a full (the default) or empty set for the specified type.
|
||||
///
|
||||
ConstantRange(const Type *Ty, bool isFullSet = true);
|
||||
|
||||
|
||||
/// Initialize a range to hold the single specified value.
|
||||
///
|
||||
ConstantRange(Constant *Value);
|
||||
|
@ -49,7 +49,7 @@ class ConstantRange {
|
|||
/// have different types, or if the constant are not integral values.
|
||||
///
|
||||
ConstantRange(Constant *Lower, Constant *Upper);
|
||||
|
||||
|
||||
/// Initialize a set of values that all satisfy the condition with C.
|
||||
///
|
||||
ConstantRange(unsigned SetCCOpcode, ConstantIntegral *C);
|
||||
|
@ -65,12 +65,12 @@ class ConstantRange {
|
|||
/// getType - Return the LLVM data type of this range.
|
||||
///
|
||||
const Type *getType() const;
|
||||
|
||||
|
||||
/// isFullSet - Return true if this set contains all of the elements possible
|
||||
/// for this data-type
|
||||
///
|
||||
bool isFullSet() const;
|
||||
|
||||
|
||||
/// isEmptySet - Return true if this set contains no members.
|
||||
///
|
||||
bool isEmptySet() const;
|
||||
|
@ -83,12 +83,12 @@ class ConstantRange {
|
|||
/// contains - Return true if the specified value is in the set.
|
||||
///
|
||||
bool contains(ConstantInt *Val) const;
|
||||
|
||||
|
||||
/// getSingleElement - If this set contains a single element, return it,
|
||||
/// otherwise return null.
|
||||
///
|
||||
ConstantIntegral *getSingleElement() const;
|
||||
|
||||
|
||||
/// isSingleElement - Return true if this set contains exactly one member.
|
||||
///
|
||||
bool isSingleElement() const { return getSingleElement() != 0; }
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
//===-- llvm/Support/DotGraphTraits.h - Customize .dot output ---*- C++ -*-===//
|
||||
//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file was developed by the LLVM research group and is distributed under
|
||||
// the University of Illinois Open Source License. See LICENSE.TXT for details.
|
||||
//
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// This file defines a template class that can be used to customize dot output
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
//===- llvm/Support/Debug.h - Easy way to add debug output ------*- C++ -*-===//
|
||||
//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file was developed by the LLVM research group and is distributed under
|
||||
// the University of Illinois Open Source License. See LICENSE.TXT for details.
|
||||
//
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// This file implements a handle way of adding debugging information to your
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
//===-- llvm/Support/DynamicLinker.h - Portable Dynamic Linker --*- C++ -*-===//
|
||||
//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file was developed by the LLVM research group and is distributed under
|
||||
// the University of Illinois Open Source License. See LICENSE.TXT for details.
|
||||
//
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Lightweight interface to dynamic library linking and loading, and dynamic
|
||||
|
@ -31,7 +31,7 @@ bool LinkDynamicObject (const char *filename, std::string *ErrorMessage);
|
|||
/// the currently running process, as reported by the dynamic linker,
|
||||
/// or NULL if the symbol does not exist or some other error has
|
||||
/// occurred.
|
||||
///
|
||||
///
|
||||
void *GetAddressOfSymbol (const char *symbolName);
|
||||
void *GetAddressOfSymbol (const std::string &symbolName);
|
||||
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
//===-- llvm/Support/ELF.h - ELF constants and data structures --*- C++ -*-===//
|
||||
//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file was developed by the LLVM research group and is distributed under
|
||||
// the University of Illinois Open Source License. See LICENSE.TXT for details.
|
||||
//
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// This header contains common, non-processor-specific data structures and
|
||||
// constants for the ELF file format.
|
||||
//
|
||||
//
|
||||
// The details of the ELF32 bits in this file are largely based on
|
||||
// the Tool Interface Standard (TIS) Executable and Linking Format
|
||||
// (ELF) Specification Version 1.2, May 1995. The ELF64 stuff is not
|
||||
|
@ -137,7 +137,7 @@ struct Elf32_Shdr {
|
|||
Elf32_Addr sh_addr; // Address where section is to be loaded
|
||||
Elf32_Off sh_offset; // File offset of section data, in bytes
|
||||
Elf32_Word sh_size; // Size of section, in bytes
|
||||
Elf32_Word sh_link; // Section type-specific header table index link
|
||||
Elf32_Word sh_link; // Section type-specific header table index link
|
||||
Elf32_Word sh_info; // Section type-specific extra information
|
||||
Elf32_Word sh_addralign; // Section address alignment
|
||||
Elf32_Word sh_entsize; // Size of records contained within the section
|
||||
|
@ -204,7 +204,7 @@ struct Elf32_Sym {
|
|||
unsigned char st_info; // Symbol's type and binding attributes
|
||||
unsigned char st_other; // Must be zero; reserved
|
||||
Elf32_Half st_shndx; // Which section (header table index) it's defined in
|
||||
|
||||
|
||||
// These accessors and mutators correspond to the ELF32_ST_BIND,
|
||||
// ELF32_ST_TYPE, and ELF32_ST_INFO macros defined in the ELF specification:
|
||||
unsigned char getBinding () const { return st_info >> 4; }
|
||||
|
@ -238,9 +238,9 @@ enum {
|
|||
|
||||
// Relocation entry, without explicit addend.
|
||||
struct Elf32_Rel {
|
||||
Elf32_Addr r_offset; // Location (file byte offset, or program virtual addr)
|
||||
Elf32_Addr r_offset; // Location (file byte offset, or program virtual addr)
|
||||
Elf32_Word r_info; // Symbol table index and type of relocation to apply
|
||||
|
||||
|
||||
// These accessors and mutators correspond to the ELF32_R_SYM, ELF32_R_TYPE,
|
||||
// and ELF32_R_INFO macros defined in the ELF specification:
|
||||
Elf32_Word getSymbol () const { return (r_info >> 8); }
|
||||
|
@ -254,10 +254,10 @@ struct Elf32_Rel {
|
|||
|
||||
// Relocation entry with explicit addend.
|
||||
struct Elf32_Rela {
|
||||
Elf32_Addr r_offset; // Location (file byte offset, or program virtual addr)
|
||||
Elf32_Addr r_offset; // Location (file byte offset, or program virtual addr)
|
||||
Elf32_Word r_info; // Symbol table index and type of relocation to apply
|
||||
Elf32_Sword r_addend; // Compute value for relocatable field by adding this
|
||||
|
||||
|
||||
// These accessors and mutators correspond to the ELF32_R_SYM, ELF32_R_TYPE,
|
||||
// and ELF32_R_INFO macros defined in the ELF specification:
|
||||
Elf32_Word getSymbol () const { return (r_info >> 8); }
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
//===- llvm/Support/FileUtilities.h - File System Utilities -----*- C++ -*-===//
|
||||
//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file was developed by the LLVM research group and is distributed under
|
||||
// the University of Illinois Open Source License. See LICENSE.TXT for details.
|
||||
//
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// This file defines a family of utility functions which are useful for doing
|
||||
|
@ -41,7 +41,7 @@ namespace llvm {
|
|||
public:
|
||||
FileRemover(const sys::Path &filename, bool deleteIt = true)
|
||||
: Filename(filename), DeleteIt(deleteIt) {}
|
||||
|
||||
|
||||
~FileRemover() {
|
||||
if (DeleteIt)
|
||||
try {
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
//===- llvm/Support/GetElementPtrTypeIterator.h -----------------*- C++ -*-===//
|
||||
//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file was developed by the LLVM research group and is distributed under
|
||||
// the University of Illinois Open Source License. See LICENSE.TXT for details.
|
||||
//
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// This file implements an iterator for walking through the types indexed by
|
||||
|
@ -42,14 +42,14 @@ namespace llvm {
|
|||
return I;
|
||||
}
|
||||
|
||||
bool operator==(const generic_gep_type_iterator& x) const {
|
||||
bool operator==(const generic_gep_type_iterator& x) const {
|
||||
return OpIt == x.OpIt;
|
||||
}
|
||||
bool operator!=(const generic_gep_type_iterator& x) const {
|
||||
return !operator==(x);
|
||||
}
|
||||
|
||||
const Type *operator*() const {
|
||||
const Type *operator*() const {
|
||||
return CurTy;
|
||||
}
|
||||
|
||||
|
@ -61,7 +61,7 @@ namespace llvm {
|
|||
// This is a non-standard operator->. It allows you to call methods on the
|
||||
// current type directly.
|
||||
const Type *operator->() const { return operator*(); }
|
||||
|
||||
|
||||
Value *getOperand() const { return *OpIt; }
|
||||
|
||||
generic_gep_type_iterator& operator++() { // Preincrement
|
||||
|
@ -71,11 +71,11 @@ namespace llvm {
|
|||
CurTy = 0;
|
||||
}
|
||||
++OpIt;
|
||||
return *this;
|
||||
return *this;
|
||||
}
|
||||
|
||||
generic_gep_type_iterator operator++(int) { // Postincrement
|
||||
generic_gep_type_iterator tmp = *this; ++*this; return tmp;
|
||||
generic_gep_type_iterator tmp = *this; ++*this; return tmp;
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
//===-- llvm/Support/GraphWriter.h - Write graph to a .dot file -*- C++ -*-===//
|
||||
//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file was developed by the LLVM research group and is distributed under
|
||||
// the University of Illinois Open Source License. See LICENSE.TXT for details.
|
||||
//
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// This file defines a simple interface that can be used to print out generic
|
||||
|
@ -99,33 +99,33 @@ public:
|
|||
I != E; ++I)
|
||||
writeNode(&*I);
|
||||
}
|
||||
|
||||
|
||||
void writeNode(NodeType *const *Node) {
|
||||
writeNode(*Node);
|
||||
}
|
||||
|
||||
|
||||
void writeNode(NodeType *Node) {
|
||||
std::string NodeAttributes = DOTTraits::getNodeAttributes(Node);
|
||||
|
||||
|
||||
O << "\tNode" << reinterpret_cast<const void*>(Node) << " [shape=record,";
|
||||
if (!NodeAttributes.empty()) O << NodeAttributes << ",";
|
||||
O << "label=\"{";
|
||||
|
||||
if (!DOTTraits::renderGraphFromBottomUp())
|
||||
O << DOT::EscapeString(DOTTraits::getNodeLabel(Node, G));
|
||||
|
||||
|
||||
// Print out the fields of the current node...
|
||||
child_iterator EI = GTraits::child_begin(Node);
|
||||
child_iterator EE = GTraits::child_end(Node);
|
||||
if (EI != EE) {
|
||||
if (!DOTTraits::renderGraphFromBottomUp()) O << "|";
|
||||
O << "{";
|
||||
|
||||
|
||||
for (unsigned i = 0; EI != EE && i != 64; ++EI, ++i) {
|
||||
if (i) O << "|";
|
||||
O << "<g" << i << ">" << DOTTraits::getEdgeSourceLabel(Node, EI);
|
||||
}
|
||||
|
||||
|
||||
if (EI != EE)
|
||||
O << "|<g64>truncated...";
|
||||
O << "}";
|
||||
|
@ -133,9 +133,9 @@ public:
|
|||
}
|
||||
if (DOTTraits::renderGraphFromBottomUp())
|
||||
O << DOT::EscapeString(DOTTraits::getNodeLabel(Node, G));
|
||||
|
||||
|
||||
O << "}\"];\n"; // Finish printing the "node" line
|
||||
|
||||
|
||||
// Output all of the edges now
|
||||
EI = GTraits::child_begin(Node);
|
||||
for (unsigned i = 0; EI != EE && i != 64; ++EI, ++i)
|
||||
|
@ -174,7 +174,7 @@ public:
|
|||
O << DOT::EscapeString(Label);
|
||||
if (NumEdgeSources) {
|
||||
O << "|{";
|
||||
|
||||
|
||||
for (unsigned i = 0; i != NumEdgeSources; ++i) {
|
||||
if (i) O << "|";
|
||||
O << "<g" << i << ">";
|
||||
|
@ -197,7 +197,7 @@ public:
|
|||
O << ":g" << SrcNodePort;
|
||||
O << " -> Node" << reinterpret_cast<const void*>(DestNodeID);
|
||||
if (DestNodePort >= 0)
|
||||
O << ":g" << DestNodePort;
|
||||
O << ":g" << DestNodePort;
|
||||
|
||||
if (!Attrs.empty())
|
||||
O << "[" << Attrs << "]";
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
//===- llvm/Support/InstIterator.h - Classes for inst iteration -*- C++ -*-===//
|
||||
//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file was developed by the LLVM research group and is distributed under
|
||||
// the University of Illinois Open Source License. See LICENSE.TXT for details.
|
||||
//
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// This file contains definitions of two iterators for iterating over the
|
||||
|
@ -54,8 +54,8 @@ public:
|
|||
template<typename A, typename B, typename C, typename D>
|
||||
InstIterator(InstIterator<A,B,C,D> &II)
|
||||
: BBs(II.BBs), BB(II.BB), BI(II.BI) {}
|
||||
|
||||
template<class M> InstIterator(M &m)
|
||||
|
||||
template<class M> InstIterator(M &m)
|
||||
: BBs(&m.getBasicBlockList()), BB(BBs->begin()) { // begin ctor
|
||||
if (BB != BBs->end()) {
|
||||
BI = BB->begin();
|
||||
|
@ -63,43 +63,43 @@ public:
|
|||
}
|
||||
}
|
||||
|
||||
template<class M> InstIterator(M &m, bool)
|
||||
template<class M> InstIterator(M &m, bool)
|
||||
: BBs(&m.getBasicBlockList()), BB(BBs->end()) { // end ctor
|
||||
}
|
||||
|
||||
// Accessors to get at the underlying iterators...
|
||||
inline BBIty &getBasicBlockIterator() { return BB; }
|
||||
inline BIty &getInstructionIterator() { return BI; }
|
||||
|
||||
|
||||
inline reference operator*() const { return *BI; }
|
||||
inline pointer operator->() const { return &operator*(); }
|
||||
|
||||
inline bool operator==(const InstIterator &y) const {
|
||||
|
||||
inline bool operator==(const InstIterator &y) const {
|
||||
return BB == y.BB && (BB == BBs->end() || BI == y.BI);
|
||||
}
|
||||
inline bool operator!=(const InstIterator& y) const {
|
||||
inline bool operator!=(const InstIterator& y) const {
|
||||
return !operator==(y);
|
||||
}
|
||||
|
||||
InstIterator& operator++() {
|
||||
InstIterator& operator++() {
|
||||
++BI;
|
||||
advanceToNextBB();
|
||||
return *this;
|
||||
return *this;
|
||||
}
|
||||
inline InstIterator operator++(int) {
|
||||
InstIterator tmp = *this; ++*this; return tmp;
|
||||
inline InstIterator operator++(int) {
|
||||
InstIterator tmp = *this; ++*this; return tmp;
|
||||
}
|
||||
|
||||
InstIterator& operator--() {
|
||||
|
||||
InstIterator& operator--() {
|
||||
while (BB == BBs->end() || BI == BB->begin()) {
|
||||
--BB;
|
||||
BI = BB->end();
|
||||
}
|
||||
--BI;
|
||||
return *this;
|
||||
return *this;
|
||||
}
|
||||
inline InstIterator operator--(int) {
|
||||
InstIterator tmp = *this; --*this; return tmp;
|
||||
inline InstIterator operator--(int) {
|
||||
InstIterator tmp = *this; --*this; return tmp;
|
||||
}
|
||||
|
||||
inline bool atEnd() const { return BB == BBs->end(); }
|
||||
|
@ -121,7 +121,7 @@ typedef InstIterator<iplist<BasicBlock>,
|
|||
Function::iterator, BasicBlock::iterator,
|
||||
Instruction> inst_iterator;
|
||||
typedef InstIterator<const iplist<BasicBlock>,
|
||||
Function::const_iterator,
|
||||
Function::const_iterator,
|
||||
BasicBlock::const_iterator,
|
||||
const Instruction> const_inst_iterator;
|
||||
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
//===- llvm/Support/InstVisitor.h - Define instruction visitors -*- C++ -*-===//
|
||||
//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file was developed by the LLVM research group and is distributed under
|
||||
// the University of Illinois Open Source License. See LICENSE.TXT for details.
|
||||
//
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// This template class is used to define instruction visitors in a typesafe
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
//===-- llvm/Support/LeakDetector.h - Provide leak detection ----*- C++ -*-===//
|
||||
//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file was developed by the LLVM research group and is distributed under
|
||||
// the University of Illinois Open Source License. See LICENSE.TXT for details.
|
||||
//
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// This file defines a class that can be used to provide very simple memory leak
|
||||
|
@ -48,7 +48,7 @@ struct LeakDetector {
|
|||
removeGarbageObjectImpl(Object);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
/// checkForGarbage - Traverse the internal representation of garbage
|
||||
/// pointers. If there are any pointers that have been add'ed, but not
|
||||
/// remove'd, big obnoxious warnings about memory leaks are issued.
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
//===-- llvm/Support/Mangler.h - Self-contained name mangler ----*- C++ -*-===//
|
||||
//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file was developed by the LLVM research group and is distributed under
|
||||
// the University of Illinois Open Source License. See LICENSE.TXT for details.
|
||||
//
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Unified name mangler for various backends.
|
||||
|
@ -63,7 +63,7 @@ public:
|
|||
/// doesn't guarantee unique names for values. getValueName already
|
||||
/// does this for you, so there's no point calling it on the result
|
||||
/// from getValueName.
|
||||
///
|
||||
///
|
||||
static std::string makeNameProper(const std::string &x);
|
||||
};
|
||||
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
//===-- llvm/Support/MathExtras.h - Useful math functions -------*- C++ -*-===//
|
||||
//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file was developed by the LLVM research group and is distributed under
|
||||
// the University of Illinois Open Source License. See LICENSE.TXT for details.
|
||||
//
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// This file contains some functions that are useful for math stuff.
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
//===- llvm/Support/PassNameParser.h ----------------------------*- C++ -*-===//
|
||||
//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file was developed by the LLVM research group and is distributed under
|
||||
// the University of Illinois Open Source License. See LICENSE.TXT for details.
|
||||
//
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// This file the PassNameParser and FilteredPassNameParser<> classes, which are
|
||||
|
@ -34,12 +34,12 @@ namespace llvm {
|
|||
// PassNameParser class - Make use of the pass registration mechanism to
|
||||
// automatically add a command line argument to opt for each pass.
|
||||
//
|
||||
class PassNameParser : public PassRegistrationListener,
|
||||
class PassNameParser : public PassRegistrationListener,
|
||||
public cl::parser<const PassInfo*> {
|
||||
cl::Option *Opt;
|
||||
public:
|
||||
PassNameParser() : Opt(0) {}
|
||||
|
||||
|
||||
void initialize(cl::Option &O) {
|
||||
Opt = &O;
|
||||
cl::parser<const PassInfo*>::initialize(O);
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
//===-- llvm/Support/PatternMatch.h - Match on the LLVM IR ------*- C++ -*-===//
|
||||
//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file was developed by the LLVM research group and is distributed under
|
||||
// the University of Illinois Open Source License. See LICENSE.TXT for details.
|
||||
//
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// This file provides a simple and efficient mechanism for performing general
|
||||
|
@ -33,7 +33,7 @@
|
|||
#include "llvm/Instructions.h"
|
||||
|
||||
namespace llvm {
|
||||
namespace PatternMatch {
|
||||
namespace PatternMatch {
|
||||
|
||||
template<typename Val, typename Pattern>
|
||||
bool match(Val *V, const Pattern &P) {
|
||||
|
@ -88,7 +88,7 @@ struct BinaryOp_match {
|
|||
R.match(CE->getOperand(1));
|
||||
return false;
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
template<typename LHS, typename RHS>
|
||||
inline BinaryOp_match<LHS, RHS, Instruction::Add> m_Add(const LHS &L,
|
||||
|
@ -178,7 +178,7 @@ struct BinaryOpClass_match {
|
|||
#endif
|
||||
return false;
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
template<typename LHS, typename RHS>
|
||||
inline BinaryOpClass_match<LHS, RHS, SetCondInst>
|
||||
|
@ -216,7 +216,7 @@ private:
|
|||
else
|
||||
return LHS == ConstantFP::get(LHS->getType(), -0.0) && L.match(RHS);
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
template<typename LHS>
|
||||
inline neg_match<LHS> m_Neg(const LHS &L) { return L; }
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
//===-- llvm/Support/PluginLoader.h - Plugin Loader for Tools ---*- C++ -*-===//
|
||||
//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file was developed by the LLVM research group and is distributed under
|
||||
// the University of Illinois Open Source License. See LICENSE.TXT for details.
|
||||
//
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// A tool can #include this file to get a -load option that allows the user to
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
//===- llvm/Support/SlowOperationInformer.h - Keep user informed *- C++ -*-===//
|
||||
//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file was developed by the LLVM research group and is distributed under
|
||||
// the University of Illinois Open Source License. See LICENSE.TXT for details.
|
||||
//
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// This file defines a simple object which can be used to let the user know what
|
||||
|
@ -38,13 +38,13 @@ namespace llvm {
|
|||
class SlowOperationInformer {
|
||||
std::string OperationName;
|
||||
unsigned LastPrintAmount;
|
||||
|
||||
|
||||
SlowOperationInformer(const SlowOperationInformer&); // DO NOT IMPLEMENT
|
||||
void operator=(const SlowOperationInformer&); // DO NOT IMPLEMENT
|
||||
public:
|
||||
SlowOperationInformer(const std::string &Name);
|
||||
~SlowOperationInformer();
|
||||
|
||||
|
||||
/// progress - Clients should periodically call this method when they are in
|
||||
/// an exception-safe state. The Amount variable should indicate how far
|
||||
/// along the operation is, given in 1/10ths of a percent (in other words,
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
//===- StableBasicBlockNumbering.h - Provide BB identifiers -----*- C++ -*-===//
|
||||
//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file was developed by the LLVM research group and is distributed under
|
||||
// the University of Illinois Open Source License. See LICENSE.TXT for details.
|
||||
//
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// This class provides a *stable* numbering of basic blocks that does not depend
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
//===- SystemUtils.h - Utilities to do low-level system stuff ---*- C++ -*-===//
|
||||
//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file was developed by the LLVM research group and is distributed under
|
||||
// the University of Illinois Open Source License. See LICENSE.TXT for details.
|
||||
//
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// This file contains functions used to do a variety of low-level, often
|
||||
|
@ -19,8 +19,8 @@
|
|||
|
||||
namespace llvm {
|
||||
|
||||
/// Determine if the ostream provided is connected to the std::cout and
|
||||
/// displayed or not (to a console window). If so, generate a warning message
|
||||
/// Determine if the ostream provided is connected to the std::cout and
|
||||
/// displayed or not (to a console window). If so, generate a warning message
|
||||
/// advising against display of bytecode and return true. Otherwise just return
|
||||
/// false
|
||||
/// @brief Check for output written to a console
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
//===-- llvm/Support/ThreadSupport-NoSupport.h - Generic Impl ---*- C++ -*-===//
|
||||
//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file was developed by the LLVM research group and is distributed under
|
||||
// the University of Illinois Open Source License. See LICENSE.TXT for details.
|
||||
//
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// This file defines a generic ThreadSupport implementation used when there is
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
//===-- llvm/Support/ThreadSupport-PThreads.h - PThreads support *- C++ -*-===//
|
||||
//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file was developed by the LLVM research group and is distributed under
|
||||
// the University of Illinois Open Source License. See LICENSE.TXT for details.
|
||||
//
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// This file defines pthreads implementations of the generic threading
|
||||
|
@ -39,7 +39,7 @@ namespace llvm {
|
|||
|
||||
errorcode = pthread_mutexattr_settype(&Attr, PTHREAD_MUTEX_RECURSIVE);
|
||||
assert(errorcode == 0);
|
||||
|
||||
|
||||
errorcode = pthread_mutex_init(&mutex, &Attr);
|
||||
assert(errorcode == 0);
|
||||
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
//===-- llvm/Support/Timer.h - Interval Timing Support ----------*- C++ -*-===//
|
||||
//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file was developed by the LLVM research group and is distributed under
|
||||
// the University of Illinois Open Source License. See LICENSE.TXT for details.
|
||||
//
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// This file defines three classes: Timer, TimeRegion, and TimerGroup,
|
||||
|
@ -74,7 +74,7 @@ public:
|
|||
return Elapsed < T.Elapsed;
|
||||
}
|
||||
bool operator>(const Timer &T) const { return T.operator<(*this); }
|
||||
|
||||
|
||||
/// startTimer - Start the timer running. Time between calls to
|
||||
/// startTimer/stopTimer is counted by the Timer class. Note that these calls
|
||||
/// must be correctly paired.
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
//===-- llvm/Support/ToolRunner.h -------------------------------*- C++ -*-===//
|
||||
//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file was developed by the LLVM research group and is distributed under
|
||||
// the University of Illinois Open Source License. See LICENSE.TXT for details.
|
||||
//
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// This file exposes an abstraction around a platform C compiler, used to
|
||||
|
@ -63,7 +63,7 @@ public:
|
|||
FileType fileType,
|
||||
const std::string &InputFile,
|
||||
const std::string &OutputFile,
|
||||
const std::vector<std::string> &SharedLibs =
|
||||
const std::vector<std::string> &SharedLibs =
|
||||
std::vector<std::string>(), unsigned Timeout = 0);
|
||||
|
||||
/// MakeSharedObject - This compiles the specified file (which is either a .c
|
||||
|
@ -110,7 +110,7 @@ public:
|
|||
const std::vector<std::string> &Args,
|
||||
const std::string &InputFile,
|
||||
const std::string &OutputFile,
|
||||
const std::vector<std::string> &SharedLibs =
|
||||
const std::vector<std::string> &SharedLibs =
|
||||
std::vector<std::string>(),
|
||||
unsigned Timeout = 0) = 0;
|
||||
};
|
||||
|
@ -140,7 +140,7 @@ public:
|
|||
const std::vector<std::string> &Args,
|
||||
const std::string &InputFile,
|
||||
const std::string &OutputFile,
|
||||
const std::vector<std::string> &SharedLibs =
|
||||
const std::vector<std::string> &SharedLibs =
|
||||
std::vector<std::string>(),
|
||||
unsigned Timeout = 0);
|
||||
|
||||
|
@ -177,7 +177,7 @@ public:
|
|||
const std::vector<std::string> &Args,
|
||||
const std::string &InputFile,
|
||||
const std::string &OutputFile,
|
||||
const std::vector<std::string> &SharedLibs =
|
||||
const std::vector<std::string> &SharedLibs =
|
||||
std::vector<std::string>(),
|
||||
unsigned Timeout = 0);
|
||||
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
//===- llvm/Support/TypeInfo.h - Support for type_info objects -*- C++ -*-===//
|
||||
//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file was developed by the LLVM research group and is distributed under
|
||||
// the University of Illinois Open Source License. See LICENSE.TXT for details.
|
||||
//
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// This class makes std::type_info objects behave like first class objects that
|
||||
|
@ -45,7 +45,7 @@ struct TypeInfo {
|
|||
private:
|
||||
const std::type_info *Info;
|
||||
};
|
||||
|
||||
|
||||
// Comparison operators
|
||||
inline bool operator==(const TypeInfo &lhs, const TypeInfo &rhs) {
|
||||
return lhs.get() == rhs.get();
|
||||
|
@ -62,11 +62,11 @@ inline bool operator!=(const TypeInfo &lhs, const TypeInfo &rhs) {
|
|||
inline bool operator>(const TypeInfo &lhs, const TypeInfo &rhs) {
|
||||
return rhs < lhs;
|
||||
}
|
||||
|
||||
|
||||
inline bool operator<=(const TypeInfo &lhs, const TypeInfo &rhs) {
|
||||
return !(lhs > rhs);
|
||||
}
|
||||
|
||||
|
||||
inline bool operator>=(const TypeInfo &lhs, const TypeInfo &rhs) {
|
||||
return !(lhs < rhs);
|
||||
}
|
||||
|
|
|
@ -1,16 +1,16 @@
|
|||
//===- llvm/Support/type_traits.h - Simplfied type traits -------*- C++ -*-===//
|
||||
//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file was developed by the LLVM research group and is distributed under
|
||||
// the University of Illinois Open Source License. See LICENSE.TXT for details.
|
||||
//
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// This file provides a template class that determines if a type is a class or
|
||||
// not. The basic mechanism, based on using the pointer to member function of
|
||||
// a zero argument to a function was "boosted" from the boost type_traits
|
||||
// library. See http://www.boost.org/ for all the gory details.
|
||||
// a zero argument to a function was "boosted" from the boost type_traits
|
||||
// library. See http://www.boost.org/ for all the gory details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
|
@ -27,13 +27,13 @@ namespace llvm {
|
|||
namespace dont_use
|
||||
{
|
||||
// These two functions should never be used. They are helpers to
|
||||
// the is_class template below. They cannot be located inside
|
||||
// the is_class template below. They cannot be located inside
|
||||
// is_class because doing so causes at least GCC to think that
|
||||
// the value of the "value" enumerator is not constant. Placing
|
||||
// them out here (for some strange reason) allows the sizeof
|
||||
// them out here (for some strange reason) allows the sizeof
|
||||
// operator against them to magically be constant. This is
|
||||
// important to make the is_class<T>::value idiom zero cost. it
|
||||
// evaluates to a constant 1 or 0 depending on whether the
|
||||
// evaluates to a constant 1 or 0 depending on whether the
|
||||
// parameter T is a class or not (respectively).
|
||||
template<typename T> char is_class_helper(void(T::*)(void));
|
||||
template<typename T> double is_class_helper(...);
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
//===-- llvm/System/DynamicLibrary.h - Portable Dynamic Library -*- C++ -*-===//
|
||||
//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file was developed by Reid Spencer and is distributed under the
|
||||
// This file was developed by Reid Spencer and is distributed under the
|
||||
// University of Illinois Open Source License. See LICENSE.TXT for details.
|
||||
//
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// This file declares the sys::DynamicLibrary class.
|
||||
|
@ -21,10 +21,10 @@ namespace llvm {
|
|||
namespace sys {
|
||||
|
||||
/// This class provides a portable interface to dynamic libraries which also
|
||||
/// might be known as shared libraries, shared objects, dynamic shared
|
||||
/// might be known as shared libraries, shared objects, dynamic shared
|
||||
/// objects, or dynamic link libraries. Regardless of the terminology or the
|
||||
/// operating system interface, this class provides a portable interface that
|
||||
/// allows dynamic libraries to be loaded and and searched for externally
|
||||
/// allows dynamic libraries to be loaded and and searched for externally
|
||||
/// defined symbols. This is typically used to provide "plug-in" support.
|
||||
/// @since 1.4
|
||||
/// @brief Portable dynamic library abstraction.
|
||||
|
@ -34,7 +34,7 @@ namespace sys {
|
|||
public:
|
||||
/// Construct a DynamicLibrary that represents the currently executing
|
||||
/// program. The program must have been linked with -export-dynamic or
|
||||
/// -dlopen self for this to work. Any symbols retrieved with the
|
||||
/// -dlopen self for this to work. Any symbols retrieved with the
|
||||
/// GetAddressOfSymbol function will refer to the program not to any
|
||||
/// library.
|
||||
/// @throws std::string indicating why the program couldn't be opened.
|
||||
|
@ -49,8 +49,8 @@ namespace sys {
|
|||
|
||||
/// After destruction, the symbols of the library will no longer be
|
||||
/// available to the program. It is important to make sure the lifespan
|
||||
/// of a DynamicLibrary exceeds the lifetime of the pointers returned
|
||||
/// by the GetAddressOfSymbol otherwise the program may walk off into
|
||||
/// of a DynamicLibrary exceeds the lifetime of the pointers returned
|
||||
/// by the GetAddressOfSymbol otherwise the program may walk off into
|
||||
/// uncharted territory.
|
||||
/// @see GetAddressOfSymbol.
|
||||
/// @brief Closes the DynamicLibrary
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
//===- llvm/System/MappedFile.h - MappedFile OS Concept ---------*- C++ -*-===//
|
||||
//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file was developed by Reid Spencer and is distributed under the
|
||||
// This file was developed by Reid Spencer and is distributed under the
|
||||
// University of Illinois Open Source License. See LICENSE.TXT for details.
|
||||
//
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// This file declares the llvm::sys::MappedFile class.
|
||||
|
@ -20,14 +20,14 @@ namespace llvm {
|
|||
namespace sys {
|
||||
|
||||
/// Forward declare a class used for holding platform specific information
|
||||
/// that needs to be
|
||||
/// that needs to be
|
||||
struct MappedFileInfo;
|
||||
|
||||
/// This class provides an abstraction for a memory mapped file in the
|
||||
/// This class provides an abstraction for a memory mapped file in the
|
||||
/// operating system's filesystem. It provides platform independent operations
|
||||
/// for mapping a file into memory for both read and write access. This class
|
||||
/// does not provide facilities for finding the file or operating on paths to
|
||||
/// files. The sys::Path class is used for that.
|
||||
/// files. The sys::Path class is used for that.
|
||||
/// @since 1.4
|
||||
/// @brief An abstraction for memory mapped files.
|
||||
class MappedFile {
|
||||
|
@ -85,14 +85,14 @@ namespace sys {
|
|||
char* charBase() const { return reinterpret_cast<char*>(base_); }
|
||||
|
||||
/// This function returns a reference to the sys::Path object kept by the
|
||||
/// MappedFile object. This contains the path to the file that is or
|
||||
/// MappedFile object. This contains the path to the file that is or
|
||||
/// will be mapped.
|
||||
/// @returns sys::Path containing the path name.
|
||||
/// @brief Returns the mapped file's path as a sys::Path
|
||||
/// @throws nothing
|
||||
const sys::Path& path() const { return path_; }
|
||||
|
||||
/// This function returns the number of bytes in the file.
|
||||
/// This function returns the number of bytes in the file.
|
||||
/// @throws std::string if an error occurs
|
||||
size_t size() const;
|
||||
|
||||
|
@ -106,15 +106,15 @@ namespace sys {
|
|||
/// @brief Remove the file mapping from memory.
|
||||
void unmap();
|
||||
|
||||
/// The mapped file is put into memory.
|
||||
/// The mapped file is put into memory.
|
||||
/// @returns The base memory address of the mapped file.
|
||||
/// @brief Map the file into memory.
|
||||
void* map();
|
||||
|
||||
/// This method causes the size of the file, and consequently the size
|
||||
/// of the mapping to be set. This is logically the same as unmap(),
|
||||
/// adjust size of the file, map(). Consequently, when calling this
|
||||
/// function, the caller should not rely on previous results of the
|
||||
/// of the mapping to be set. This is logically the same as unmap(),
|
||||
/// adjust size of the file, map(). Consequently, when calling this
|
||||
/// function, the caller should not rely on previous results of the
|
||||
/// map(), base(), or baseChar() members as they may point to invalid
|
||||
/// areas of memory after this call.
|
||||
/// @throws std::string if an error occurs
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
//===- llvm/System/Memory.h - Memory Support --------------------*- C++ -*-===//
|
||||
//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file was developed by Reid Spencer and is distributed under the
|
||||
// This file was developed by Reid Spencer and is distributed under the
|
||||
// University of Illinois Open Source License. See LICENSE.TXT for details.
|
||||
//
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// This file declares the llvm::sys::Memory class.
|
||||
|
@ -42,13 +42,13 @@ namespace sys {
|
|||
public:
|
||||
/// This method allocates a block of Read/Write/Execute memory that is
|
||||
/// suitable for executing dynamically generated code (e.g. JIT). An
|
||||
/// attempt to allocate \p NumBytes bytes of virtual memory is made.
|
||||
/// attempt to allocate \p NumBytes bytes of virtual memory is made.
|
||||
/// @throws std::string if an error occurred.
|
||||
/// @brief Allocate Read/Write/Execute memory.
|
||||
static MemoryBlock AllocateRWX(unsigned NumBytes);
|
||||
|
||||
/// This method releases a block of Read/Write/Execute memory that was
|
||||
/// allocated with the AllocateRWX method. It should not be used to
|
||||
/// allocated with the AllocateRWX method. It should not be used to
|
||||
/// release any memory block allocated any other way.
|
||||
/// @throws std::string if an error occurred.
|
||||
/// @brief Release Read/Write/Execute memory.
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
//===- llvm/System/Path.h - Path Operating System Concept -------*- C++ -*-===//
|
||||
//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file was developed by Reid Spencer and is distributed under the
|
||||
// This file was developed by Reid Spencer and is distributed under the
|
||||
// University of Illinois Open Source License. See LICENSE.TXT for details.
|
||||
//
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// This file declares the llvm::sys::Path class.
|
||||
|
@ -23,24 +23,24 @@
|
|||
namespace llvm {
|
||||
namespace sys {
|
||||
|
||||
/// This class provides an abstraction for the path to a file or directory
|
||||
/// This class provides an abstraction for the path to a file or directory
|
||||
/// in the operating system's filesystem and provides various basic operations
|
||||
/// on it. Note that this class only represents the name of a path to a file
|
||||
/// or directory which may or may not be valid for a given machine's file
|
||||
/// or directory which may or may not be valid for a given machine's file
|
||||
/// system. A Path ensures that the name it encapsulates is syntactical valid
|
||||
/// for the operating system it is running on but does not ensure correctness
|
||||
/// for any particular file system. A Path either references a file or a
|
||||
/// for any particular file system. A Path either references a file or a
|
||||
/// directory and the distinction is consistently maintained. Most operations
|
||||
/// on the class have invariants that require the Path object to be either a
|
||||
/// file path or a directory path, but not both. Those operations will also
|
||||
/// leave the object as either a file path or object path. There is exactly
|
||||
/// file path or a directory path, but not both. Those operations will also
|
||||
/// leave the object as either a file path or object path. There is exactly
|
||||
/// one invalid Path which is the empty path. The class should never allow any
|
||||
/// other syntactically invalid non-empty path name to be assigned. Empty
|
||||
/// paths are required in order to indicate an error result. If the path is
|
||||
/// empty, the isValid operation will return false. All operations will fail
|
||||
/// if isValid is false. Operations that change the path will either return
|
||||
/// false if it would cause a syntactically invalid path name (in which case
|
||||
/// the Path object is left unchanged) or throw an std::string exception
|
||||
/// if isValid is false. Operations that change the path will either return
|
||||
/// false if it would cause a syntactically invalid path name (in which case
|
||||
/// the Path object is left unchanged) or throw an std::string exception
|
||||
/// indicating the error.
|
||||
/// @since 1.4
|
||||
/// @brief An abstraction for operating system paths.
|
||||
|
@ -54,11 +54,11 @@ namespace sys {
|
|||
/// However, to support llvm-ar, the mode, user, and group fields are
|
||||
/// retained. These pertain to unix security and may not have a meaningful
|
||||
/// value on non-Unix platforms. However, the fileSize and modTime fields
|
||||
/// should always be applicabe on all platforms. The structure is
|
||||
/// should always be applicabe on all platforms. The structure is
|
||||
/// filled in by the getStatusInfo method.
|
||||
/// @brief File status structure
|
||||
struct StatusInfo {
|
||||
StatusInfo() : fileSize(0), modTime(0,0), mode(0777), user(999),
|
||||
StatusInfo() : fileSize(0), modTime(0,0), mode(0777), user(999),
|
||||
group(999), isDir(false) { }
|
||||
size_t fileSize; ///< Size of the file in bytes
|
||||
TimeValue modTime; ///< Time of file's modification
|
||||
|
@ -73,7 +73,7 @@ namespace sys {
|
|||
/// @{
|
||||
public:
|
||||
/// Construct a path to the root directory of the file system. The root
|
||||
/// directory is a top level directory above which there are no more
|
||||
/// directory is a top level directory above which there are no more
|
||||
/// directories. For example, on UNIX, the root directory is /. On Windows
|
||||
/// it is C:\. Other operating systems may have different notions of
|
||||
/// what the root directory is.
|
||||
|
@ -81,8 +81,8 @@ namespace sys {
|
|||
static Path GetRootDirectory();
|
||||
|
||||
/// Construct a path to a unique temporary directory that is created in
|
||||
/// a "standard" place for the operating system. The directory is
|
||||
/// guaranteed to be created on exit from this function. If the directory
|
||||
/// a "standard" place for the operating system. The directory is
|
||||
/// guaranteed to be created on exit from this function. If the directory
|
||||
/// cannot be created, the function will throw an exception.
|
||||
/// @throws std::string indicating why the directory could not be created.
|
||||
/// @brief Constrct a path to an new, unique, existing temporary
|
||||
|
@ -100,7 +100,7 @@ namespace sys {
|
|||
/// Construct a vector of sys::Path that contains the "standard" bytecode
|
||||
/// library paths suitable for linking into an llvm program. This function
|
||||
/// *must* return the value of LLVM_LIB_SEARCH_PATH as well as the value
|
||||
/// of LLVM_LIBDIR. It also must provide the System library paths as
|
||||
/// of LLVM_LIBDIR. It also must provide the System library paths as
|
||||
/// returned by GetSystemLibraryPaths.
|
||||
/// @see GetSystemLibraryPaths
|
||||
/// @brief Construct a list of directories in which bytecode could be
|
||||
|
@ -112,9 +112,9 @@ namespace sys {
|
|||
/// @brief Find a library.
|
||||
static Path FindLibrary(std::string& short_name);
|
||||
|
||||
/// Construct a path to the default LLVM configuration directory. The
|
||||
/// Construct a path to the default LLVM configuration directory. The
|
||||
/// implementation must ensure that this is a well-known (same on many
|
||||
/// systems) directory in which llvm configuration files exist. For
|
||||
/// systems) directory in which llvm configuration files exist. For
|
||||
/// example, on Unix, the /etc/llvm directory has been selected.
|
||||
/// @throws nothing
|
||||
/// @brief Construct a path to the default LLVM configuration directory
|
||||
|
@ -130,8 +130,8 @@ namespace sys {
|
|||
|
||||
/// Construct a path to the current user's home directory. The
|
||||
/// implementation must use an operating system specific mechanism for
|
||||
/// determining the user's home directory. For example, the environment
|
||||
/// variable "HOME" could be used on Unix. If a given operating system
|
||||
/// determining the user's home directory. For example, the environment
|
||||
/// variable "HOME" could be used on Unix. If a given operating system
|
||||
/// does not have the concept of a user's home directory, this static
|
||||
/// constructor must provide the same result as GetRootDirectory.
|
||||
/// @throws nothing
|
||||
|
@ -139,9 +139,9 @@ namespace sys {
|
|||
static Path GetUserHomeDirectory();
|
||||
|
||||
/// Return the suffix commonly used on file names that contain a shared
|
||||
/// object, shared archive, or dynamic link library. Such files are
|
||||
/// linked at runtime into a process and their code images are shared
|
||||
/// between processes.
|
||||
/// object, shared archive, or dynamic link library. Such files are
|
||||
/// linked at runtime into a process and their code images are shared
|
||||
/// between processes.
|
||||
/// @returns The dynamic link library suffix for the current platform.
|
||||
/// @brief Return the dynamic link library suffix.
|
||||
static std::string GetDLLSuffix();
|
||||
|
@ -201,8 +201,8 @@ namespace sys {
|
|||
/// @returns true if \p this path is lexicographically less than \p that.
|
||||
/// @throws nothing
|
||||
/// @brief Less Than Operator
|
||||
bool operator< (const Path& that) const {
|
||||
return 0 > path.compare( that.path );
|
||||
bool operator< (const Path& that) const {
|
||||
return 0 > path.compare( that.path );
|
||||
}
|
||||
|
||||
/// @}
|
||||
|
@ -213,8 +213,8 @@ namespace sys {
|
|||
/// determine if the current value of \p this is a syntactically valid
|
||||
/// path name for the operating system. The path name does not need to
|
||||
/// exist, validity is simply syntactical. Empty paths are always invalid.
|
||||
/// @returns true iff the path name is syntactically legal for the
|
||||
/// host operating system.
|
||||
/// @returns true iff the path name is syntactically legal for the
|
||||
/// host operating system.
|
||||
/// @brief Determine if a path is syntactically valid or not.
|
||||
bool isValid() const;
|
||||
|
||||
|
@ -244,12 +244,12 @@ namespace sys {
|
|||
/// This function determines if the path name in this object references
|
||||
/// the root (top level directory) of the file system. The details of what
|
||||
/// is considered the "root" may vary from system to system so this method
|
||||
/// will do the necessary checking.
|
||||
/// will do the necessary checking.
|
||||
/// @returns true iff the path name references the root directory.
|
||||
/// @brief Determines if the path references the root directory.
|
||||
bool isRootDirectory() const;
|
||||
|
||||
/// This function opens the file associated with the path name provided by
|
||||
/// This function opens the file associated with the path name provided by
|
||||
/// the Path object and reads its magic number. If the magic number at the
|
||||
/// start of the file matches \p magic, true is returned. In all other
|
||||
/// cases (file not found, file not accessible, etc.) it returns false.
|
||||
|
@ -274,7 +274,7 @@ namespace sys {
|
|||
|
||||
/// This function determines if the path name in the object references an
|
||||
/// LLVM Bytecode file by looking at its magic number.
|
||||
/// @returns true if the file starts with the magic number for LLVM
|
||||
/// @returns true if the file starts with the magic number for LLVM
|
||||
/// bytecode files.
|
||||
/// @brief Determine if the path references a bytecode file.
|
||||
bool isBytecodeFile() const;
|
||||
|
@ -282,7 +282,7 @@ namespace sys {
|
|||
/// This function determines if the path name in the object references a
|
||||
/// native Dynamic Library (shared library, shared object) by looking at
|
||||
/// the file's magic number. The Path object must reference a file, not a
|
||||
/// directory.
|
||||
/// directory.
|
||||
/// @return strue if the file starts with the magid number for a native
|
||||
/// shared library.
|
||||
/// @brief Determine if the path reference a dynamic library.
|
||||
|
@ -297,7 +297,7 @@ namespace sys {
|
|||
bool exists() const;
|
||||
|
||||
/// This function determines if the path name references a readable file
|
||||
/// or directory in the file system. Unlike isFile and isDirectory, this
|
||||
/// or directory in the file system. Unlike isFile and isDirectory, this
|
||||
/// function actually checks for the existence and readability (by the
|
||||
/// current program) of the file or directory.
|
||||
/// @returns true if the pathname references a readable file.
|
||||
|
@ -306,7 +306,7 @@ namespace sys {
|
|||
bool readable() const;
|
||||
|
||||
/// This function determines if the path name references a writable file
|
||||
/// or directory in the file system. Unlike isFile and isDirectory, this
|
||||
/// or directory in the file system. Unlike isFile and isDirectory, this
|
||||
/// function actually checks for the existence and writability (by the
|
||||
/// current program) of the file or directory.
|
||||
/// @returns true if the pathname references a writable file.
|
||||
|
@ -314,12 +314,12 @@ namespace sys {
|
|||
/// in the file system.
|
||||
bool writable() const;
|
||||
|
||||
/// This function determines if the path name references an executable
|
||||
/// file in the file system. Unlike isFile and isDirectory, this
|
||||
/// function actually checks for the existence and executability (by
|
||||
/// This function determines if the path name references an executable
|
||||
/// file in the file system. Unlike isFile and isDirectory, this
|
||||
/// function actually checks for the existence and executability (by
|
||||
/// the current program) of the file.
|
||||
/// @returns true if the pathname references an executable file.
|
||||
/// @brief Determines if the path is an executable file in the file
|
||||
/// @brief Determines if the path is an executable file in the file
|
||||
/// system.
|
||||
bool executable() const;
|
||||
|
||||
|
@ -353,26 +353,26 @@ namespace sys {
|
|||
/// @brief Build a list of directory's contents.
|
||||
bool getDirectoryContents(std::set<Path>& paths) const;
|
||||
|
||||
/// This method attempts to destroy the directory named by the last in
|
||||
/// the Path name. If \p remove_contents is false, an attempt will be
|
||||
/// made to remove just the directory that this Path object refers to
|
||||
/// This method attempts to destroy the directory named by the last in
|
||||
/// the Path name. If \p remove_contents is false, an attempt will be
|
||||
/// made to remove just the directory that this Path object refers to
|
||||
/// (the final Path component). If \p remove_contents is true, an attempt
|
||||
/// will be made to remove the entire contents of the directory,
|
||||
/// recursively.
|
||||
/// will be made to remove the entire contents of the directory,
|
||||
/// recursively.
|
||||
/// @param destroy_contents Indicates whether the contents of a destroyed
|
||||
/// directory should also be destroyed (recursively).
|
||||
/// @returns false if the Path does not refer to a directory, true
|
||||
/// directory should also be destroyed (recursively).
|
||||
/// @returns false if the Path does not refer to a directory, true
|
||||
/// otherwise.
|
||||
/// @throws std::string if there is an error.
|
||||
/// @brief Removes the file or directory from the filesystem.
|
||||
bool destroyDirectory( bool destroy_contents = false ) const;
|
||||
|
||||
/// This method attempts to destroy the file named by the last item in the
|
||||
/// Path name.
|
||||
/// Path name.
|
||||
/// @returns false if the Path does not refer to a file, true otherwise.
|
||||
/// @throws std::string if there is an error.
|
||||
/// @brief Destroy the file this Path refers to.
|
||||
bool destroyFile() const;
|
||||
bool destroyFile() const;
|
||||
|
||||
/// Obtain a 'C' string for the path name.
|
||||
/// @returns a 'C' string containing the path name.
|
||||
|
@ -385,20 +385,20 @@ namespace sys {
|
|||
public:
|
||||
/// The path name is cleared and becomes empty. This is an invalid
|
||||
/// path name but is the *only* invalid path name. This is provided
|
||||
/// so that path objects can be used to indicate the lack of a
|
||||
/// so that path objects can be used to indicate the lack of a
|
||||
/// valid path being found.
|
||||
void clear() { path.clear(); }
|
||||
|
||||
/// This function returns status information about the file. The type of
|
||||
/// path (file or directory) is updated to reflect the actual contents
|
||||
/// of the file system. If the file does not exist, false is returned.
|
||||
/// path (file or directory) is updated to reflect the actual contents
|
||||
/// of the file system. If the file does not exist, false is returned.
|
||||
/// For other (hard I/O) errors, a std::string is throwing indicating the
|
||||
/// problem.
|
||||
/// @throws std::string if an error occurs.
|
||||
/// @brief Get file status.
|
||||
void getStatusInfo(StatusInfo& info) const;
|
||||
|
||||
/// This function returns the last modified time stamp for the file
|
||||
/// This function returns the last modified time stamp for the file
|
||||
/// referenced by this path. The Path may reference a file or a directory.
|
||||
/// If the file does not exist, a ZeroTime timestamp is returned.
|
||||
/// @returns last modified timestamp of the file/directory or ZeroTime
|
||||
|
@ -407,7 +407,7 @@ namespace sys {
|
|||
StatusInfo info; getStatusInfo(info); return info.modTime;
|
||||
}
|
||||
|
||||
/// This function returns the size of the file referenced by this path.
|
||||
/// This function returns the size of the file referenced by this path.
|
||||
/// @brief Get file size.
|
||||
inline size_t getSize() const {
|
||||
StatusInfo info; getStatusInfo(info); return info.fileSize;
|
||||
|
@ -424,14 +424,14 @@ namespace sys {
|
|||
void makeWriteable();
|
||||
|
||||
/// This method attempts to make the file referenced by the Path object
|
||||
/// available for execution so that the executable() method will return
|
||||
/// available for execution so that the executable() method will return
|
||||
/// true.
|
||||
/// @brief Make the file readable;
|
||||
void makeExecutable();
|
||||
|
||||
/// This method attempts to set the Path object to \p unverified_path
|
||||
/// and interpret the name as a directory name. The \p unverified_path
|
||||
/// is verified. If verification succeeds then \p unverified_path
|
||||
/// and interpret the name as a directory name. The \p unverified_path
|
||||
/// is verified. If verification succeeds then \p unverified_path
|
||||
/// is accepted as a directory and true is returned. Otherwise,
|
||||
/// the Path object remains unchanged and false is returned.
|
||||
/// @returns true if the path was set, false otherwise.
|
||||
|
@ -441,8 +441,8 @@ namespace sys {
|
|||
bool setDirectory(const std::string& unverified_path);
|
||||
|
||||
/// This method attempts to set the Path object to \p unverified_path
|
||||
/// and interpret the name as a file name. The \p unverified_path
|
||||
/// is verified. If verification succeeds then \p unverified_path
|
||||
/// and interpret the name as a file name. The \p unverified_path
|
||||
/// is verified. If verification succeeds then \p unverified_path
|
||||
/// is accepted as a file name and true is returned. Otherwise,
|
||||
/// the Path object remains unchanged and false is returned.
|
||||
/// @returns true if the path was set, false otherwise.
|
||||
|
@ -452,7 +452,7 @@ namespace sys {
|
|||
bool setFile(const std::string& unverified_path);
|
||||
|
||||
/// The \p dirname is added to the end of the Path if it is a legal
|
||||
/// directory name for the operating system. The precondition for this
|
||||
/// directory name for the operating system. The precondition for this
|
||||
/// function is that the Path must reference a directory name (i.e.
|
||||
/// isDirectory() returns true).
|
||||
/// @param dirname A string providing the directory name to
|
||||
|
@ -464,7 +464,7 @@ namespace sys {
|
|||
|
||||
/// One directory component is removed from the Path name. The Path must
|
||||
/// refer to a non-root directory name (i.e. isDirectory() returns true
|
||||
/// but isRootDirectory() returns false). Upon exit, the Path will
|
||||
/// but isRootDirectory() returns false). Upon exit, the Path will
|
||||
/// refer to the directory above it.
|
||||
/// @throws nothing
|
||||
/// @returns false if the directory name could not be removed.
|
||||
|
@ -473,7 +473,7 @@ namespace sys {
|
|||
|
||||
/// The \p filename is added to the end of the Path if it is a legal
|
||||
/// directory name for the operating system. The precondition for this
|
||||
/// function is that the Path reference a directory name (i.e.
|
||||
/// function is that the Path reference a directory name (i.e.
|
||||
/// isDirectory() returns true).
|
||||
/// @throws nothing
|
||||
/// @returns false if the file name could not be added.
|
||||
|
@ -481,7 +481,7 @@ namespace sys {
|
|||
bool appendFile( const std::string& filename );
|
||||
|
||||
/// One file component is removed from the Path name. The Path must
|
||||
/// refer to a file (i.e. isFile() returns true). Upon exit,
|
||||
/// refer to a file (i.e. isFile() returns true). Upon exit,
|
||||
/// the Path will refer to the directory above it.
|
||||
/// @throws nothing
|
||||
/// @returns false if the file name could not be removed
|
||||
|
@ -490,19 +490,19 @@ namespace sys {
|
|||
|
||||
/// A period and the \p suffix are appended to the end of the pathname.
|
||||
/// The precondition for this function is that the Path reference a file
|
||||
/// name (i.e. isFile() returns true). If the Path is not a file, no
|
||||
/// name (i.e. isFile() returns true). If the Path is not a file, no
|
||||
/// action is taken and the function returns false. If the path would
|
||||
/// become invalid for the host operating system, false is returned.
|
||||
/// @returns false if the suffix could not be added, true if it was.
|
||||
/// @throws nothing
|
||||
/// @brief Adds a period and the \p suffix to the end of the pathname.
|
||||
/// @brief Adds a period and the \p suffix to the end of the pathname.
|
||||
bool appendSuffix(const std::string& suffix);
|
||||
|
||||
/// The suffix of the filename is removed. The suffix begins with and
|
||||
/// includes the last . character in the filename after the last directory
|
||||
/// separator and extends until the end of the name. If no . character is
|
||||
/// after the last directory separator, then the file name is left
|
||||
/// unchanged (i.e. it was already without a suffix) but the function
|
||||
/// unchanged (i.e. it was already without a suffix) but the function
|
||||
/// returns false.
|
||||
/// @returns false if there was no suffix to remove, true otherwise.
|
||||
/// @throws nothing
|
||||
|
@ -510,9 +510,9 @@ namespace sys {
|
|||
bool elideSuffix();
|
||||
|
||||
/// The current Path name is made unique in the file system. Upon return,
|
||||
/// the Path will have been changed to make a unique file in the file
|
||||
/// the Path will have been changed to make a unique file in the file
|
||||
/// system or it will not have been changed if the current path name is
|
||||
/// already unique.
|
||||
/// already unique.
|
||||
/// @throws std::string if an unrecoverable error occurs.
|
||||
/// @brief Make the current path name unique in the file system.
|
||||
void makeUnique( bool reuse_current = true );
|
||||
|
@ -522,9 +522,9 @@ namespace sys {
|
|||
/// whether intermediate directories are created or not. if \p
|
||||
/// create_parents is true, then an attempt will be made to create all
|
||||
/// intermediate directories. If \p create_parents is false, then only the
|
||||
/// final directory component of the Path name will be created. The
|
||||
/// created directory will have no entries.
|
||||
/// @returns false if the Path does not reference a directory, true
|
||||
/// final directory component of the Path name will be created. The
|
||||
/// created directory will have no entries.
|
||||
/// @returns false if the Path does not reference a directory, true
|
||||
/// otherwise.
|
||||
/// @param create_parents Determines whether non-existent directory
|
||||
/// components other than the last one (the "parents") are created or not.
|
||||
|
@ -534,7 +534,7 @@ namespace sys {
|
|||
|
||||
/// This method attempts to create a file in the file system with the same
|
||||
/// name as the Path object. The intermediate directories must all exist
|
||||
/// at the time this method is called. Use createDirectories to
|
||||
/// at the time this method is called. Use createDirectories to
|
||||
/// accomplish that. The created file will be empty upon return from this
|
||||
/// function.
|
||||
/// @returns false if the Path does not reference a file, true otherwise.
|
||||
|
@ -542,8 +542,8 @@ namespace sys {
|
|||
/// @brief Create the file this Path refers to.
|
||||
bool createFile();
|
||||
|
||||
/// This is like createFile except that it creates a temporary file. A
|
||||
/// unique temporary file name is generated based on the contents of
|
||||
/// This is like createFile except that it creates a temporary file. A
|
||||
/// unique temporary file name is generated based on the contents of
|
||||
/// \p this before the call. The new name is assigned to \p this and the
|
||||
/// file is created. Note that this will both change the Path object
|
||||
/// *and* create the corresponding file. This function will ensure that
|
||||
|
@ -561,7 +561,7 @@ namespace sys {
|
|||
bool renameFile(const Path& newName);
|
||||
|
||||
/// This method sets the access time, modification time, and permission
|
||||
/// mode of the file associated with \p this as given by \p si.
|
||||
/// mode of the file associated with \p this as given by \p si.
|
||||
/// @returns false if the Path does not refer to a file, true otherwise.
|
||||
/// @throws std::string if the file could not be modified
|
||||
/// @brief Set file times and mode.
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
//===- llvm/System/Process.h ------------------------------------*- C++ -*-===//
|
||||
//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file was developed by Reid Spencer and is distributed under the
|
||||
// This file was developed by Reid Spencer and is distributed under the
|
||||
// University of Illinois Open Source License. See LICENSE.TXT for details.
|
||||
//
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// This file declares the llvm::sys::Process class.
|
||||
|
@ -20,7 +20,7 @@ namespace llvm {
|
|||
namespace sys {
|
||||
|
||||
/// This class provides an abstraction for getting information about the
|
||||
/// currently executing process.
|
||||
/// currently executing process.
|
||||
/// @since 1.4
|
||||
/// @brief An abstraction for operating system processes.
|
||||
class Process {
|
||||
|
@ -36,20 +36,20 @@ namespace sys {
|
|||
|
||||
/// This static function will return the total amount of memory allocated
|
||||
/// by the process. This only counts the memory allocated via the malloc,
|
||||
/// calloc and realloc functions and includes any "free" holes in the
|
||||
/// allocated space.
|
||||
/// calloc and realloc functions and includes any "free" holes in the
|
||||
/// allocated space.
|
||||
/// @throws nothing
|
||||
/// @brief Return process memory usage.
|
||||
static size_t GetMallocUsage();
|
||||
|
||||
/// This static function will return the total memory usage of the
|
||||
/// This static function will return the total memory usage of the
|
||||
/// process. This includes code, data, stack and mapped pages usage. Notei
|
||||
/// that the value returned here is not necessarily the Running Set Size,
|
||||
/// it is the total virtual memory usage, regardless of mapped state of
|
||||
/// that memory.
|
||||
static size_t GetTotalMemoryUsage();
|
||||
|
||||
/// This static function will set \p user_time to the amount of CPU time
|
||||
/// This static function will set \p user_time to the amount of CPU time
|
||||
/// spent in user (non-kernel) mode and \p sys_time to the amount of CPU
|
||||
/// time spent in system (kernel) mode. If the operating system does not
|
||||
/// support collection of these metrics, a zero TimeValue will be for both
|
||||
|
@ -57,24 +57,24 @@ namespace sys {
|
|||
static void GetTimeUsage(
|
||||
TimeValue& elapsed,
|
||||
///< Returns the TimeValue::now() giving current time
|
||||
TimeValue& user_time,
|
||||
TimeValue& user_time,
|
||||
///< Returns the current amount of user time for the process
|
||||
TimeValue& sys_time
|
||||
///< Returns the current amount of system time for the process
|
||||
);
|
||||
|
||||
/// This static function will return the process' current user id number.
|
||||
/// Not all operating systems support this feature. Where it is not
|
||||
/// supported, the function should return 65536 as the value.
|
||||
/// Not all operating systems support this feature. Where it is not
|
||||
/// supported, the function should return 65536 as the value.
|
||||
static int GetCurrentUserId();
|
||||
|
||||
/// This static function will return the process' current group id number.
|
||||
/// Not all operating systems support this feature. Where it is not
|
||||
/// supported, the function should return 65536 as the value.
|
||||
/// Not all operating systems support this feature. Where it is not
|
||||
/// supported, the function should return 65536 as the value.
|
||||
static int GetCurrentGroupId();
|
||||
|
||||
/// This function makes the necessary calls to the operating system to
|
||||
/// prevent core files or any other kind of large memory dumps that can
|
||||
/// This function makes the necessary calls to the operating system to
|
||||
/// prevent core files or any other kind of large memory dumps that can
|
||||
/// occur when a program fails.
|
||||
/// @brief Prevent core file generation.
|
||||
static void PreventCoreFiles();
|
||||
|
@ -84,12 +84,12 @@ namespace sys {
|
|||
/// or pipe.
|
||||
static bool StandardInIsUserInput();
|
||||
|
||||
/// This function determines if the standard output is connected to a
|
||||
/// This function determines if the standard output is connected to a
|
||||
/// "tty" or "console" window. That is, the output would be displayed to
|
||||
/// the user rather than being put on a pipe or stored in a file.
|
||||
static bool StandardOutIsDisplayed();
|
||||
|
||||
/// This function determines if the standard error is connected to a
|
||||
/// This function determines if the standard error is connected to a
|
||||
/// "tty" or "console" window. That is, the output would be displayed to
|
||||
/// the user rather than being put on a pipe or stored in a file.
|
||||
static bool StandardErrIsDisplayed();
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
//===- llvm/System/Program.h ------------------------------------*- C++ -*-===//
|
||||
//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file was developed by Reid Spencer and is distributed under the
|
||||
// This file was developed by Reid Spencer and is distributed under the
|
||||
// University of Illinois Open Source License. See LICENSE.TXT for details.
|
||||
//
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// This file declares the llvm::sys::Program class.
|
||||
|
@ -31,8 +31,8 @@ namespace sys {
|
|||
/// @{
|
||||
public:
|
||||
/// This static constructor (factory) will attempt to locate a program in
|
||||
/// the operating system's file system using some pre-determined set of
|
||||
/// locations to search (e.g. the PATH on Unix).
|
||||
/// the operating system's file system using some pre-determined set of
|
||||
/// locations to search (e.g. the PATH on Unix).
|
||||
/// @returns A Path object initialized to the path of the program or a
|
||||
/// Path object that is empty (invalid) if the program could not be found.
|
||||
/// @throws nothing
|
||||
|
@ -41,11 +41,11 @@ namespace sys {
|
|||
|
||||
/// This function executes the program using the \p arguments provided and
|
||||
/// waits for the program to exit. This function will block the current
|
||||
/// program until the invoked program exits. The invoked program will
|
||||
/// program until the invoked program exits. The invoked program will
|
||||
/// inherit the stdin, stdout, and stderr file descriptors, the
|
||||
/// environment and other configuration settings of the invoking program.
|
||||
/// If Path::executable() does not return true when this function is
|
||||
/// called then a std::string is thrown.
|
||||
/// called then a std::string is thrown.
|
||||
/// @param path A sys::Path object providing the path of the program to be
|
||||
/// executed. It is presumed this is the result of the FindProgramByName
|
||||
/// method.
|
||||
|
@ -56,21 +56,21 @@ namespace sys {
|
|||
/// @brief Executes the program with the given set of \p args.
|
||||
static int ExecuteAndWait(
|
||||
const Path& path, ///< The path to the program to execute
|
||||
const char** args, ///< A vector of strings that are passed to the
|
||||
///< program. The first element should be the name of the program.
|
||||
const char** args, ///< A vector of strings that are passed to the
|
||||
///< program. The first element should be the name of the program.
|
||||
///< The list *must* be terminated by a null char* entry.
|
||||
const char ** env = 0, ///< An optional vector of strings to use for
|
||||
const char ** env = 0, ///< An optional vector of strings to use for
|
||||
///< the program's environment. If not provided, the current program's
|
||||
///< environment will be used.
|
||||
const sys::Path** redirects = 0, ///< An optional array of pointers to
|
||||
///< Paths. If the array is null, no redirection is done. The array
|
||||
const sys::Path** redirects = 0, ///< An optional array of pointers to
|
||||
///< Paths. If the array is null, no redirection is done. The array
|
||||
///< should have a size of at least three. If the pointer in the array
|
||||
///< are not null, then the inferior process's stdin(0), stdout(1),
|
||||
///< and stderr(2) will be redirected to the corresponding Paths.
|
||||
unsigned secondsToWait = 0 ///< If non-zero, this specifies the amount
|
||||
///< of time to wait for the child process to exit. If the time
|
||||
///< expires, the child is killed and this call returns. If zero,
|
||||
///< this function will wait until the child finishes or forever if
|
||||
///< are not null, then the inferior process's stdin(0), stdout(1),
|
||||
///< and stderr(2) will be redirected to the corresponding Paths.
|
||||
unsigned secondsToWait = 0 ///< If non-zero, this specifies the amount
|
||||
///< of time to wait for the child process to exit. If the time
|
||||
///< expires, the child is killed and this call returns. If zero,
|
||||
///< this function will wait until the child finishes or forever if
|
||||
///< it doesn't.
|
||||
);
|
||||
};
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
//===- llvm/System/Signals.h - Signal Handling support ----------*- C++ -*-===//
|
||||
//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file was developed by the LLVM research group and is distributed under
|
||||
// the University of Illinois Open Source License. See LICENSE.TXT for details.
|
||||
//
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// This file defines some helpful functions for dealing with the possibility of
|
||||
|
@ -20,7 +20,7 @@
|
|||
namespace llvm {
|
||||
namespace sys {
|
||||
|
||||
/// This function registers signal handlers to ensure that if a signal gets
|
||||
/// This function registers signal handlers to ensure that if a signal gets
|
||||
/// delivered that the named file is removed.
|
||||
/// @brief Remove a file if a fatal signal occurs.
|
||||
void RemoveFileOnSignal(const Path &Filename);
|
||||
|
@ -31,7 +31,7 @@ namespace sys {
|
|||
/// @brief Remove a directory if a fatal signal occurs.
|
||||
void RemoveDirectoryOnSignal(const Path& path);
|
||||
|
||||
/// When an error signal (such as SIBABRT or SIGSEGV) is delivered to the
|
||||
/// When an error signal (such as SIBABRT or SIGSEGV) is delivered to the
|
||||
/// process, print a stack trace and then exit.
|
||||
/// @brief Print a stack trace if a fatal signal occurs.
|
||||
void PrintStackTraceOnErrorSignal();
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
//===-- TimeValue.h - Declare OS TimeValue Concept --------------*- C++ -*-===//
|
||||
//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file was developed by Reid Spencer and is distributed under the
|
||||
// This file was developed by Reid Spencer and is distributed under the
|
||||
// University of Illinois Open Source License. See LICENSE.TXT for details.
|
||||
//
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// This header file declares the operating system TimeValue concept.
|
||||
|
@ -19,12 +19,12 @@
|
|||
|
||||
namespace llvm {
|
||||
namespace sys {
|
||||
/// This class is used where a precise fixed point in time is required. The
|
||||
/// range of TimeValue spans many hundreds of billions of years both past and
|
||||
/// present. The precision of TimeValue is to the nanosecond. However, the
|
||||
/// actual precision of its values will be determined by the resolution of
|
||||
/// the system clock. The TimeValue class is used in conjunction with several
|
||||
/// other lib/System interfaces to specify the time at which a call should
|
||||
/// This class is used where a precise fixed point in time is required. The
|
||||
/// range of TimeValue spans many hundreds of billions of years both past and
|
||||
/// present. The precision of TimeValue is to the nanosecond. However, the
|
||||
/// actual precision of its values will be determined by the resolution of
|
||||
/// the system clock. The TimeValue class is used in conjunction with several
|
||||
/// other lib/System interfaces to specify the time at which a call should
|
||||
/// timeout, etc.
|
||||
/// @since 1.4
|
||||
/// @brief Provides an abstraction for a fixed point in time.
|
||||
|
@ -82,9 +82,9 @@ namespace sys {
|
|||
/// @name Constructors
|
||||
/// @{
|
||||
public:
|
||||
/// Caller provides the exact value in seconds and nanoseconds. The
|
||||
/// Caller provides the exact value in seconds and nanoseconds. The
|
||||
/// \p nanos argument defaults to zero for convenience.
|
||||
/// @brief Explicit constructor
|
||||
/// @brief Explicit constructor
|
||||
explicit TimeValue (SecondsType seconds, NanoSecondsType nanos = 0)
|
||||
: seconds_( seconds ), nanos_( nanos ) { this->normalize(); }
|
||||
|
||||
|
@ -92,10 +92,10 @@ namespace sys {
|
|||
/// fractional part representing nanoseconds.
|
||||
/// @brief Double Constructor.
|
||||
explicit TimeValue( double new_time )
|
||||
: seconds_( 0 ) , nanos_ ( 0 ) {
|
||||
: seconds_( 0 ) , nanos_ ( 0 ) {
|
||||
SecondsType integer_part = static_cast<SecondsType>( new_time );
|
||||
seconds_ = integer_part;
|
||||
nanos_ = static_cast<NanoSecondsType>( (new_time -
|
||||
nanos_ = static_cast<NanoSecondsType>( (new_time -
|
||||
static_cast<double>(integer_part)) * NANOSECONDS_PER_SECOND );
|
||||
this->normalize();
|
||||
}
|
||||
|
@ -167,7 +167,7 @@ namespace sys {
|
|||
/// @brief True iff *this == that.
|
||||
/// @brief True if this == that.
|
||||
int operator == (const TimeValue &that) const {
|
||||
return (this->seconds_ == that.seconds_) &&
|
||||
return (this->seconds_ == that.seconds_) &&
|
||||
(this->nanos_ == that.nanos_);
|
||||
}
|
||||
|
||||
|
@ -198,14 +198,14 @@ namespace sys {
|
|||
SecondsType seconds() const { return seconds_; }
|
||||
|
||||
/// Returns only the nanoseconds component of the TimeValue. The seconds
|
||||
/// portion is ignored.
|
||||
/// portion is ignored.
|
||||
/// @brief Retrieve the nanoseconds component.
|
||||
NanoSecondsType nanoseconds() const { return nanos_; }
|
||||
|
||||
/// Returns only the fractional portion of the TimeValue rounded down to the
|
||||
/// nearest microsecond (divide by one thousand).
|
||||
/// @brief Retrieve the fractional part as microseconds;
|
||||
uint32_t microseconds() const {
|
||||
uint32_t microseconds() const {
|
||||
return nanos_ / NANOSECONDS_PER_MICROSECOND;
|
||||
}
|
||||
|
||||
|
@ -222,17 +222,17 @@ namespace sys {
|
|||
/// systems and is therefore provided.
|
||||
/// @brief Convert to a number of microseconds (can overflow)
|
||||
uint64_t usec() const {
|
||||
return seconds_ * MICROSECONDS_PER_SECOND +
|
||||
return seconds_ * MICROSECONDS_PER_SECOND +
|
||||
( nanos_ / NANOSECONDS_PER_MICROSECOND );
|
||||
}
|
||||
|
||||
/// Returns the TimeValue as a number of milliseconds. Note that the value
|
||||
/// returned can overflow because the range of a uint64_t is smaller than
|
||||
/// returned can overflow because the range of a uint64_t is smaller than
|
||||
/// the range of a TimeValue. Nevertheless, this is useful on some operating
|
||||
/// systems and is therefore provided.
|
||||
/// @brief Convert to a number of milliseconds (can overflow)
|
||||
uint64_t msec() const {
|
||||
return seconds_ * MILLISECONDS_PER_SECOND +
|
||||
return seconds_ * MILLISECONDS_PER_SECOND +
|
||||
( nanos_ / NANOSECONDS_PER_MILLISECOND );
|
||||
}
|
||||
|
||||
|
@ -245,8 +245,8 @@ namespace sys {
|
|||
return result;
|
||||
}
|
||||
|
||||
/// Converts the TimeValue into the corresponding number of seconds
|
||||
/// since the epoch (00:00:00 Jan 1,1970).
|
||||
/// Converts the TimeValue into the corresponding number of seconds
|
||||
/// since the epoch (00:00:00 Jan 1,1970).
|
||||
uint64_t toEpochTime() const {
|
||||
return seconds_ - PosixZeroTime.seconds_;
|
||||
}
|
||||
|
@ -314,7 +314,7 @@ namespace sys {
|
|||
/// @brief Converts from microsecond format to TimeValue format
|
||||
void usec( int64_t microseconds ) {
|
||||
this->seconds_ = microseconds / MICROSECONDS_PER_SECOND;
|
||||
this->nanos_ = NanoSecondsType(microseconds % MICROSECONDS_PER_SECOND) *
|
||||
this->nanos_ = NanoSecondsType(microseconds % MICROSECONDS_PER_SECOND) *
|
||||
NANOSECONDS_PER_MICROSECOND;
|
||||
this->normalize();
|
||||
}
|
||||
|
@ -322,7 +322,7 @@ namespace sys {
|
|||
/// @brief Converts from millisecond format to TimeValue format
|
||||
void msec( int64_t milliseconds ) {
|
||||
this->seconds_ = milliseconds / MILLISECONDS_PER_SECOND;
|
||||
this->nanos_ = NanoSecondsType(milliseconds % MILLISECONDS_PER_SECOND) *
|
||||
this->nanos_ = NanoSecondsType(milliseconds % MILLISECONDS_PER_SECOND) *
|
||||
NANOSECONDS_PER_MILLISECOND;
|
||||
this->normalize();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue