summaryrefslogtreecommitdiffstats
path: root/include/llvm
diff options
context:
space:
mode:
Diffstat (limited to 'include/llvm')
-rw-r--r--include/llvm/ADT/APInt.h2
-rw-r--r--include/llvm/ADT/FoldingSet.h2
-rw-r--r--include/llvm/ADT/PointerUnion.h2
-rw-r--r--include/llvm/ADT/Statistic.h4
-rw-r--r--include/llvm/ADT/Triple.h3
-rw-r--r--include/llvm/Analysis/DebugInfo.h46
-rw-r--r--include/llvm/Analysis/Dominators.h5
-rw-r--r--include/llvm/Analysis/IVUsers.h2
-rw-r--r--include/llvm/Analysis/LoopDependenceAnalysis.h13
-rw-r--r--include/llvm/Analysis/LoopInfo.h52
-rw-r--r--include/llvm/Analysis/ScalarEvolution.h36
-rw-r--r--include/llvm/Analysis/ScalarEvolutionExpander.h32
-rw-r--r--include/llvm/Analysis/ScalarEvolutionExpressions.h12
-rw-r--r--include/llvm/Assembly/Parser.h60
-rw-r--r--include/llvm/Bitcode/Archive.h9
-rw-r--r--include/llvm/Bitcode/BitstreamReader.h4
-rw-r--r--include/llvm/Bitcode/ReaderWriter.h5
-rw-r--r--include/llvm/CodeGen/AsmPrinter.h10
-rw-r--r--include/llvm/CodeGen/BinaryObject.h2
-rw-r--r--include/llvm/CodeGen/LiveIntervalAnalysis.h4
-rw-r--r--include/llvm/CodeGen/MachineFunction.h14
-rw-r--r--include/llvm/CodeGen/MachineInstrBuilder.h18
-rw-r--r--include/llvm/CodeGen/MachineLoopInfo.h48
-rw-r--r--include/llvm/CodeGen/MachineOperand.h41
-rw-r--r--include/llvm/CodeGen/RegisterScavenging.h15
-rw-r--r--include/llvm/CodeGen/SelectionDAG.h4
-rw-r--r--include/llvm/CodeGen/SelectionDAGNodes.h11
-rw-r--r--include/llvm/CodeGen/ValueTypes.h100
-rw-r--r--include/llvm/CodeGen/ValueTypes.td38
-rw-r--r--include/llvm/CompilerDriver/Main.inc149
-rw-r--r--include/llvm/Config/config.h.cmake7
-rw-r--r--include/llvm/Config/config.h.in3
-rw-r--r--include/llvm/Debugger/Debugger.h3
-rw-r--r--include/llvm/DerivedTypes.h15
-rw-r--r--include/llvm/Function.h5
-rw-r--r--include/llvm/Intrinsics.td22
-rw-r--r--include/llvm/LLVMContext.h225
-rw-r--r--include/llvm/LinkAllPasses.h1
-rw-r--r--include/llvm/LinkAllVMCore.h3
-rw-r--r--include/llvm/Linker.h3
-rw-r--r--include/llvm/MC/MCContext.h2
-rw-r--r--include/llvm/MC/MCInst.h18
-rw-r--r--include/llvm/MC/MCSection.h15
-rw-r--r--include/llvm/MC/MCStreamer.h16
-rw-r--r--include/llvm/MC/MCSymbol.h42
-rw-r--r--include/llvm/MC/MCValue.h24
-rw-r--r--include/llvm/Module.h9
-rw-r--r--include/llvm/Pass.h16
-rw-r--r--include/llvm/Support/SourceMgr.h59
-rw-r--r--include/llvm/Support/TypeBuilder.h6
-rw-r--r--include/llvm/System/Errno.h34
-rw-r--r--include/llvm/Target/TargetCallingConv.td4
-rw-r--r--include/llvm/Target/TargetELFWriterInfo.h4
-rw-r--r--include/llvm/Target/TargetLowering.h13
-rw-r--r--include/llvm/Transforms/Scalar.h6
-rw-r--r--include/llvm/Transforms/Utils/Cloning.h1
-rw-r--r--include/llvm/Transforms/Utils/Local.h7
-rw-r--r--include/llvm/Transforms/Utils/SSI.h102
58 files changed, 979 insertions, 429 deletions
diff --git a/include/llvm/ADT/APInt.h b/include/llvm/ADT/APInt.h
index 63bf4f6..56cd3cc 100644
--- a/include/llvm/ADT/APInt.h
+++ b/include/llvm/ADT/APInt.h
@@ -1426,6 +1426,8 @@ inline raw_ostream &operator<<(raw_ostream &OS, const APInt &I) {
return OS;
}
+std::ostream &operator<<(std::ostream &o, const APInt &I);
+
namespace APIntOps {
/// @brief Determine the smaller of two APInts considered to be signed.
diff --git a/include/llvm/ADT/FoldingSet.h b/include/llvm/ADT/FoldingSet.h
index e31e112..1bcff3d 100644
--- a/include/llvm/ADT/FoldingSet.h
+++ b/include/llvm/ADT/FoldingSet.h
@@ -51,7 +51,7 @@ namespace llvm {
/// public:
/// MyNode(const char *N, unsigned V) : Name(N), Value(V) {}
/// ...
-/// void Profile(FoldingSetNodeID &ID) {
+/// void Profile(FoldingSetNodeID &ID) const {
/// ID.AddString(Name);
/// ID.AddInteger(Value);
/// }
diff --git a/include/llvm/ADT/PointerUnion.h b/include/llvm/ADT/PointerUnion.h
index b3baec1..1b36aee 100644
--- a/include/llvm/ADT/PointerUnion.h
+++ b/include/llvm/ADT/PointerUnion.h
@@ -89,7 +89,7 @@ namespace llvm {
int is() const {
int TyNo = ::llvm::getPointerUnionTypeNum<PT1, PT2>((T*)0);
assert(TyNo != -1 && "Type query could never succeed on PointerUnion!");
- return Val.getInt() == TyNo;
+ return static_cast<int>(Val.getInt()) == TyNo;
}
/// get<T>() - Return the value of the specified pointer type. If the
diff --git a/include/llvm/ADT/Statistic.h b/include/llvm/ADT/Statistic.h
index 484ff5f..1a4833c 100644
--- a/include/llvm/ADT/Statistic.h
+++ b/include/llvm/ADT/Statistic.h
@@ -34,10 +34,10 @@ class Statistic {
public:
const char *Name;
const char *Desc;
- unsigned Value;
+ volatile llvm::sys::cas_flag Value;
bool Initialized;
- unsigned getValue() const { return Value; }
+ llvm::sys::cas_flag getValue() const { return Value; }
const char *getName() const { return Name; }
const char *getDesc() const { return Desc; }
diff --git a/include/llvm/ADT/Triple.h b/include/llvm/ADT/Triple.h
index b3f742e..96c0357 100644
--- a/include/llvm/ADT/Triple.h
+++ b/include/llvm/ADT/Triple.h
@@ -53,7 +53,8 @@ public:
Darwin,
DragonFly,
FreeBSD,
- Linux
+ Linux,
+ OpenBSD
};
private:
diff --git a/include/llvm/Analysis/DebugInfo.h b/include/llvm/Analysis/DebugInfo.h
index 20de3a4..06110d0 100644
--- a/include/llvm/Analysis/DebugInfo.h
+++ b/include/llvm/Analysis/DebugInfo.h
@@ -33,6 +33,11 @@ namespace llvm {
class Value;
struct DbgStopPointInst;
struct DbgDeclareInst;
+ struct DbgFuncStartInst;
+ struct DbgRegionStartInst;
+ struct DbgRegionEndInst;
+ class DebugLoc;
+ class DebugLocTracker;
class Instruction;
class DIDescriptor {
@@ -548,6 +553,47 @@ namespace llvm {
SmallVector<GlobalVariable *, 4> &GlobalVars,
SmallVector<GlobalVariable *, 4> &Subprograms);
+ /// isValidDebugInfoIntrinsic - Return true if SPI is a valid debug
+ /// info intrinsic.
+ bool isValidDebugInfoIntrinsic(DbgStopPointInst &SPI,
+ CodeGenOpt::Level OptLev);
+
+ /// isValidDebugInfoIntrinsic - Return true if FSI is a valid debug
+ /// info intrinsic.
+ bool isValidDebugInfoIntrinsic(DbgFuncStartInst &FSI,
+ CodeGenOpt::Level OptLev);
+
+ /// isValidDebugInfoIntrinsic - Return true if RSI is a valid debug
+ /// info intrinsic.
+ bool isValidDebugInfoIntrinsic(DbgRegionStartInst &RSI,
+ CodeGenOpt::Level OptLev);
+
+ /// isValidDebugInfoIntrinsic - Return true if REI is a valid debug
+ /// info intrinsic.
+ bool isValidDebugInfoIntrinsic(DbgRegionEndInst &REI,
+ CodeGenOpt::Level OptLev);
+
+ /// isValidDebugInfoIntrinsic - Return true if DI is a valid debug
+ /// info intrinsic.
+ bool isValidDebugInfoIntrinsic(DbgDeclareInst &DI,
+ CodeGenOpt::Level OptLev);
+
+ /// ExtractDebugLocation - Extract debug location information
+ /// from llvm.dbg.stoppoint intrinsic.
+ DebugLoc ExtractDebugLocation(DbgStopPointInst &SPI,
+ DebugLocTracker &DebugLocInfo);
+
+ /// ExtractDebugLocation - Extract debug location information
+ /// from llvm.dbg.func_start intrinsic.
+ DebugLoc ExtractDebugLocation(DbgFuncStartInst &FSI,
+ DebugLocTracker &DebugLocInfo);
+
+ /// isInlinedFnStart - Return true if FSI is starting an inlined function.
+ bool isInlinedFnStart(DbgFuncStartInst &FSI, const Function *CurrentFn);
+
+ /// isInlinedFnEnd - Return true if REI is ending an inlined function.
+ bool isInlinedFnEnd(DbgRegionEndInst &REI, const Function *CurrentFn);
+
} // end namespace llvm
#endif
diff --git a/include/llvm/Analysis/Dominators.h b/include/llvm/Analysis/Dominators.h
index 347e239..366d492 100644
--- a/include/llvm/Analysis/Dominators.h
+++ b/include/llvm/Analysis/Dominators.h
@@ -618,8 +618,9 @@ protected:
}
DomTreeNodeBase<NodeT> *getNodeForBlock(NodeT *BB) {
- if (DomTreeNodeBase<NodeT> *BBNode = this->DomTreeNodes[BB])
- return BBNode;
+ typename DomTreeNodeMapType::iterator I = this->DomTreeNodes.find(BB);
+ if (I != this->DomTreeNodes.end() && I->second)
+ return I->second;
// Haven't calculated this node yet? Get or calculate the node for the
// immediate dominator.
diff --git a/include/llvm/Analysis/IVUsers.h b/include/llvm/Analysis/IVUsers.h
index 30a457a..40396e2 100644
--- a/include/llvm/Analysis/IVUsers.h
+++ b/include/llvm/Analysis/IVUsers.h
@@ -17,7 +17,7 @@
#include "llvm/Analysis/LoopPass.h"
#include "llvm/Analysis/ScalarEvolution.h"
-#include <llvm/ADT/SmallVector.h>
+#include "llvm/ADT/SmallVector.h"
#include <map>
namespace llvm {
diff --git a/include/llvm/Analysis/LoopDependenceAnalysis.h b/include/llvm/Analysis/LoopDependenceAnalysis.h
index c69bc60..67da2e7 100644
--- a/include/llvm/Analysis/LoopDependenceAnalysis.h
+++ b/include/llvm/Analysis/LoopDependenceAnalysis.h
@@ -21,24 +21,35 @@
#define LLVM_ANALYSIS_LOOP_DEPENDENCE_ANALYSIS_H
#include "llvm/Analysis/LoopPass.h"
+#include "llvm/Support/raw_ostream.h"
+#include <iosfwd>
namespace llvm {
+ class AliasAnalysis;
class AnalysisUsage;
- class LoopPass;
class ScalarEvolution;
+ class Value;
class LoopDependenceAnalysis : public LoopPass {
Loop *L;
+ AliasAnalysis *AA;
ScalarEvolution *SE;
public:
static char ID; // Class identification, replacement for typeinfo
LoopDependenceAnalysis() : LoopPass(&ID) {}
+ /// TODO: docs
+ bool isDependencePair(const Value*, const Value*) const;
+ bool depends(Value*, Value*);
+
bool runOnLoop(Loop*, LPPassManager&);
virtual void getAnalysisUsage(AnalysisUsage&) const;
+
+ void print(raw_ostream&, const Module* = 0) const;
+ virtual void print(std::ostream&, const Module* = 0) const;
}; // class LoopDependenceAnalysis
diff --git a/include/llvm/Analysis/LoopInfo.h b/include/llvm/Analysis/LoopInfo.h
index 9e5f57e..8b293cb 100644
--- a/include/llvm/Analysis/LoopInfo.h
+++ b/include/llvm/Analysis/LoopInfo.h
@@ -662,7 +662,9 @@ class LoopInfoBase {
std::map<BlockT*, LoopBase<BlockT>*> BBMap;
std::vector<LoopBase<BlockT>*> TopLevelLoops;
friend class LoopBase<BlockT>;
-
+
+ void operator=(const LoopInfoBase &); // do not implement
+ LoopInfoBase(const LoopInfo &); // do not implement
public:
LoopInfoBase() { }
~LoopInfoBase() { releaseMemory(); }
@@ -962,61 +964,59 @@ public:
};
class LoopInfo : public FunctionPass {
- LoopInfoBase<BasicBlock>* LI;
+ LoopInfoBase<BasicBlock> LI;
friend class LoopBase<BasicBlock>;
-
+
+ void operator=(const LoopInfo &); // do not implement
+ LoopInfo(const LoopInfo &); // do not implement
public:
static char ID; // Pass identification, replacement for typeid
- LoopInfo() : FunctionPass(&ID) {
- LI = new LoopInfoBase<BasicBlock>();
- }
-
- ~LoopInfo() { delete LI; }
+ LoopInfo() : FunctionPass(&ID) {}
- LoopInfoBase<BasicBlock>& getBase() { return *LI; }
+ LoopInfoBase<BasicBlock>& getBase() { return LI; }
/// iterator/begin/end - The interface to the top-level loops in the current
/// function.
///
- typedef std::vector<Loop*>::const_iterator iterator;
- inline iterator begin() const { return LI->begin(); }
- inline iterator end() const { return LI->end(); }
- bool empty() const { return LI->empty(); }
+ typedef LoopInfoBase<BasicBlock>::iterator iterator;
+ inline iterator begin() const { return LI.begin(); }
+ inline iterator end() const { return LI.end(); }
+ bool empty() const { return LI.empty(); }
/// getLoopFor - Return the inner most loop that BB lives in. If a basic
/// block is in no loop (for example the entry node), null is returned.
///
inline Loop *getLoopFor(const BasicBlock *BB) const {
- return LI->getLoopFor(BB);
+ return LI.getLoopFor(BB);
}
/// operator[] - same as getLoopFor...
///
inline const Loop *operator[](const BasicBlock *BB) const {
- return LI->getLoopFor(BB);
+ return LI.getLoopFor(BB);
}
/// getLoopDepth - Return the loop nesting level of the specified block. A
/// depth of 0 means the block is not inside any loop.
///
inline unsigned getLoopDepth(const BasicBlock *BB) const {
- return LI->getLoopDepth(BB);
+ return LI.getLoopDepth(BB);
}
// isLoopHeader - True if the block is a loop header node
inline bool isLoopHeader(BasicBlock *BB) const {
- return LI->isLoopHeader(BB);
+ return LI.isLoopHeader(BB);
}
/// runOnFunction - Calculate the natural loop information.
///
virtual bool runOnFunction(Function &F);
- virtual void releaseMemory() { LI->releaseMemory(); }
+ virtual void releaseMemory() { LI.releaseMemory(); }
virtual void print(std::ostream &O, const Module* M = 0) const {
- if (O) LI->print(O, M);
+ LI.print(O, M);
}
virtual void getAnalysisUsage(AnalysisUsage &AU) const;
@@ -1024,32 +1024,32 @@ public:
/// removeLoop - This removes the specified top-level loop from this loop info
/// object. The loop is not deleted, as it will presumably be inserted into
/// another loop.
- inline Loop *removeLoop(iterator I) { return LI->removeLoop(I); }
+ inline Loop *removeLoop(iterator I) { return LI.removeLoop(I); }
/// changeLoopFor - Change the top-level loop that contains BB to the
/// specified loop. This should be used by transformations that restructure
/// the loop hierarchy tree.
inline void changeLoopFor(BasicBlock *BB, Loop *L) {
- LI->changeLoopFor(BB, L);
+ LI.changeLoopFor(BB, L);
}
/// changeTopLevelLoop - Replace the specified loop in the top-level loops
/// list with the indicated loop.
inline void changeTopLevelLoop(Loop *OldLoop, Loop *NewLoop) {
- LI->changeTopLevelLoop(OldLoop, NewLoop);
+ LI.changeTopLevelLoop(OldLoop, NewLoop);
}
/// addTopLevelLoop - This adds the specified loop to the collection of
/// top-level loops.
inline void addTopLevelLoop(Loop *New) {
- LI->addTopLevelLoop(New);
+ LI.addTopLevelLoop(New);
}
/// removeBlock - This method completely removes BB from all data structures,
/// including all of the Loop objects it is nested in and our mapping from
/// BasicBlocks to loops.
void removeBlock(BasicBlock *BB) {
- LI->removeBlock(BB);
+ LI.removeBlock(BB);
}
};
@@ -1057,7 +1057,7 @@ public:
// Allow clients to walk the list of nested loops...
template <> struct GraphTraits<const Loop*> {
typedef const Loop NodeType;
- typedef std::vector<Loop*>::const_iterator ChildIteratorType;
+ typedef LoopInfo::iterator ChildIteratorType;
static NodeType *getEntryNode(const Loop *L) { return L; }
static inline ChildIteratorType child_begin(NodeType *N) {
@@ -1070,7 +1070,7 @@ template <> struct GraphTraits<const Loop*> {
template <> struct GraphTraits<Loop*> {
typedef Loop NodeType;
- typedef std::vector<Loop*>::const_iterator ChildIteratorType;
+ typedef LoopInfo::iterator ChildIteratorType;
static NodeType *getEntryNode(Loop *L) { return L; }
static inline ChildIteratorType child_begin(NodeType *N) {
diff --git a/include/llvm/Analysis/ScalarEvolution.h b/include/llvm/Analysis/ScalarEvolution.h
index d699775..9da5c59 100644
--- a/include/llvm/Analysis/ScalarEvolution.h
+++ b/include/llvm/Analysis/ScalarEvolution.h
@@ -25,6 +25,8 @@
#include "llvm/Analysis/LoopInfo.h"
#include "llvm/Support/DataTypes.h"
#include "llvm/Support/ValueHandle.h"
+#include "llvm/Support/Allocator.h"
+#include "llvm/ADT/FoldingSet.h"
#include "llvm/ADT/DenseMap.h"
#include <iosfwd>
@@ -34,20 +36,12 @@ namespace llvm {
class Type;
class ScalarEvolution;
class TargetData;
- class SCEVConstant;
- class SCEVTruncateExpr;
- class SCEVZeroExtendExpr;
- class SCEVCommutativeExpr;
- class SCEVUDivExpr;
- class SCEVSignExtendExpr;
- class SCEVAddRecExpr;
- class SCEVUnknown;
/// SCEV - This class represents an analyzed expression in the program. These
/// are opaque objects that the client is not allowed to do much with
/// directly.
///
- class SCEV {
+ class SCEV : public FoldingSetNode {
const unsigned SCEVType; // The SCEV baseclass this node corresponds to
SCEV(const SCEV &); // DO NOT IMPLEMENT
@@ -58,6 +52,8 @@ namespace llvm {
explicit SCEV(unsigned SCEVTy) :
SCEVType(SCEVTy) {}
+ virtual void Profile(FoldingSetNodeID &ID) const = 0;
+
unsigned getSCEVType() const { return SCEVType; }
/// isLoopInvariant - Return true if the value of this SCEV is unchanging in
@@ -132,6 +128,7 @@ namespace llvm {
SCEVCouldNotCompute();
// None of these methods are valid for this object.
+ virtual void Profile(FoldingSetNodeID &ID) const;
virtual bool isLoopInvariant(const Loop *L) const;
virtual const Type *getType() const;
virtual bool hasComputableLoopEvolution(const Loop *L) const;
@@ -182,7 +179,7 @@ namespace llvm {
/// CouldNotCompute - This SCEV is used to represent unknown trip
/// counts and things.
- const SCEV* CouldNotCompute;
+ SCEVCouldNotCompute CouldNotCompute;
/// Scalars - This is a cache of the scalars we have analyzed so far.
///
@@ -566,23 +563,10 @@ namespace llvm {
void print(std::ostream *OS, const Module* M = 0) const {
if (OS) print(*OS, M);
}
-
+
private:
- // Uniquing tables.
- std::map<ConstantInt*, SCEVConstant*> SCEVConstants;
- std::map<std::pair<const SCEV*, const Type*>,
- SCEVTruncateExpr*> SCEVTruncates;
- std::map<std::pair<const SCEV*, const Type*>,
- SCEVZeroExtendExpr*> SCEVZeroExtends;
- std::map<std::pair<unsigned, std::vector<const SCEV*> >,
- SCEVCommutativeExpr*> SCEVCommExprs;
- std::map<std::pair<const SCEV*, const SCEV*>,
- SCEVUDivExpr*> SCEVUDivs;
- std::map<std::pair<const SCEV*, const Type*>,
- SCEVSignExtendExpr*> SCEVSignExtends;
- std::map<std::pair<const Loop *, std::vector<const SCEV*> >,
- SCEVAddRecExpr*> SCEVAddRecExprs;
- std::map<Value*, SCEVUnknown*> SCEVUnknowns;
+ FoldingSet<SCEV> UniqueSCEVs;
+ BumpPtrAllocator SCEVAllocator;
};
}
diff --git a/include/llvm/Analysis/ScalarEvolutionExpander.h b/include/llvm/Analysis/ScalarEvolutionExpander.h
index 90dba8b..60a23c5 100644
--- a/include/llvm/Analysis/ScalarEvolutionExpander.h
+++ b/include/llvm/Analysis/ScalarEvolutionExpander.h
@@ -14,10 +14,9 @@
#ifndef LLVM_ANALYSIS_SCALAREVOLUTION_EXPANDER_H
#define LLVM_ANALYSIS_SCALAREVOLUTION_EXPANDER_H
-#include "llvm/Instructions.h"
-#include "llvm/Type.h"
-#include "llvm/Analysis/ScalarEvolution.h"
#include "llvm/Analysis/ScalarEvolutionExpressions.h"
+#include "llvm/Support/IRBuilder.h"
+#include "llvm/Support/TargetFolder.h"
namespace llvm {
/// SCEVExpander - This class uses information about analyze scalars to
@@ -32,12 +31,13 @@ namespace llvm {
InsertedExpressions;
std::set<Value*> InsertedValues;
- BasicBlock::iterator InsertPt;
+ typedef IRBuilder<true, TargetFolder> BuilderType;
+ BuilderType Builder;
friend struct SCEVVisitor<SCEVExpander, Value*>;
public:
explicit SCEVExpander(ScalarEvolution &se)
- : SE(se) {}
+ : SE(se), Builder(TargetFolder(se.TD)) {}
/// clear - Erase the contents of the InsertedExpressions map so that users
/// trying to expand the same expression into multiple BasicBlocks or
@@ -53,27 +53,21 @@ namespace llvm {
/// expandCodeFor - Insert code to directly compute the specified SCEV
/// expression into the program. The inserted code is inserted into the
/// specified block.
- Value *expandCodeFor(const SCEV* SH, const Type *Ty,
- BasicBlock::iterator IP) {
- InsertPt = IP;
+ Value *expandCodeFor(const SCEV* SH, const Type *Ty, Instruction *IP) {
+ Builder.SetInsertPoint(IP->getParent(), IP);
return expandCodeFor(SH, Ty);
}
- /// InsertCastOfTo - Insert a cast of V to the specified type, doing what
- /// we can to share the casts.
- Value *InsertCastOfTo(Instruction::CastOps opcode, Value *V,
- const Type *Ty);
+ private:
+ /// InsertBinop - Insert the specified binary operator, doing a small amount
+ /// of work to avoid inserting an obviously redundant operation.
+ Value *InsertBinop(Instruction::BinaryOps Opcode, Value *LHS, Value *RHS);
/// InsertNoopCastOfTo - Insert a cast of V to the specified type,
- /// which must be possible with a noop cast.
+ /// which must be possible with a noop cast, doing what we can to
+ /// share the casts.
Value *InsertNoopCastOfTo(Value *V, const Type *Ty);
- /// InsertBinop - Insert the specified binary operator, doing a small amount
- /// of work to avoid inserting an obviously redundant operation.
- Value *InsertBinop(Instruction::BinaryOps Opcode, Value *LHS,
- Value *RHS, BasicBlock::iterator InsertPt);
-
- private:
/// expandAddToGEP - Expand a SCEVAddExpr with a pointer type into a GEP
/// instead of using ptrtoint+arithmetic+inttoptr.
Value *expandAddToGEP(const SCEV* const *op_begin,
diff --git a/include/llvm/Analysis/ScalarEvolutionExpressions.h b/include/llvm/Analysis/ScalarEvolutionExpressions.h
index 8be1a93..c54c865 100644
--- a/include/llvm/Analysis/ScalarEvolutionExpressions.h
+++ b/include/llvm/Analysis/ScalarEvolutionExpressions.h
@@ -39,6 +39,8 @@ namespace llvm {
explicit SCEVConstant(ConstantInt *v) :
SCEV(scConstant), V(v) {}
public:
+ virtual void Profile(FoldingSetNodeID &ID) const;
+
ConstantInt *getValue() const { return V; }
virtual bool isLoopInvariant(const Loop *L) const {
@@ -81,6 +83,8 @@ namespace llvm {
SCEVCastExpr(unsigned SCEVTy, const SCEV* op, const Type *ty);
public:
+ virtual void Profile(FoldingSetNodeID &ID) const;
+
const SCEV* getOperand() const { return Op; }
virtual const Type *getType() const { return Ty; }
@@ -200,6 +204,8 @@ namespace llvm {
: SCEV(T), Operands(ops.begin(), ops.end()) {}
public:
+ virtual void Profile(FoldingSetNodeID &ID) const;
+
unsigned getNumOperands() const { return (unsigned)Operands.size(); }
const SCEV* getOperand(unsigned i) const {
assert(i < Operands.size() && "Operand index out of range!");
@@ -330,6 +336,8 @@ namespace llvm {
: SCEV(scUDivExpr), LHS(lhs), RHS(rhs) {}
public:
+ virtual void Profile(FoldingSetNodeID &ID) const;
+
const SCEV* getLHS() const { return LHS; }
const SCEV* getRHS() const { return RHS; }
@@ -389,6 +397,8 @@ namespace llvm {
}
public:
+ virtual void Profile(FoldingSetNodeID &ID) const;
+
const SCEV* getStart() const { return Operands[0]; }
const Loop *getLoop() const { return L; }
@@ -505,6 +515,8 @@ namespace llvm {
SCEV(scUnknown), V(v) {}
public:
+ virtual void Profile(FoldingSetNodeID &ID) const;
+
Value *getValue() const { return V; }
virtual bool isLoopInvariant(const Loop *L) const;
diff --git a/include/llvm/Assembly/Parser.h b/include/llvm/Assembly/Parser.h
index e4a38e4..966abaa 100644
--- a/include/llvm/Assembly/Parser.h
+++ b/include/llvm/Assembly/Parser.h
@@ -19,8 +19,9 @@
namespace llvm {
class Module;
-class ParseError;
+class SMDiagnostic;
class raw_ostream;
+class LLVMContext;
/// This function is the main interface to the LLVM Assembly Parser. It parses
/// an ASCII file that (presumably) contains LLVM Assembly code. It returns a
@@ -30,7 +31,8 @@ class raw_ostream;
/// @brief Parse LLVM Assembly from a file
Module *ParseAssemblyFile(
const std::string &Filename, ///< The name of the file to parse
- ParseError &Error ///< If not null, an object to return errors in.
+ SMDiagnostic &Error, ///< Error result info.
+ LLVMContext &Context ///< Context in which to allocate globals info.
);
/// The function is a secondary interface to the LLVM Assembly Parser. It parses
@@ -42,60 +44,10 @@ Module *ParseAssemblyFile(
Module *ParseAssemblyString(
const char *AsmString, ///< The string containing assembly
Module *M, ///< A module to add the assembly too.
- ParseError &Error ///< If not null, an object to return errors in.
+ SMDiagnostic &Error, ///< Error result info.
+ LLVMContext &Context
);
-//===------------------------------------------------------------------------===
-// Helper Classes
-//===------------------------------------------------------------------------===
-
-/// An instance of this class can be passed to ParseAssemblyFile or
-/// ParseAssemblyString functions in order to capture error information from
-/// the parser. It provides a standard way to print out the error message
-/// including the file name and line number where the error occurred.
-/// @brief An LLVM Assembly Parsing Error Object
-class ParseError {
-public:
- ParseError() : Filename("unknown"), Message("none"), LineNo(0), ColumnNo(0) {}
- ParseError(const ParseError &E);
-
- void setFilename(const std::string &F) { Filename = F; }
-
- inline const std::string &getRawMessage() const { // Just the raw message.
- return Message;
- }
-
- inline const std::string &getFilename() const {
- return Filename;
- }
-
- void setError(const std::string &message, int lineNo = -1, int ColNo = -1,
- const std::string &FileContents = "") {
- Message = message;
- LineNo = lineNo; ColumnNo = ColNo;
- LineContents = FileContents;
- }
-
- // getErrorLocation - Return the line and column number of the error in the
- // input source file. The source filename can be derived from the
- // ParserOptions in effect. If positional information is not applicable,
- // these will return a value of -1.
- //
- inline void getErrorLocation(int &Line, int &Column) const {
- Line = LineNo; Column = ColumnNo;
- }
-
- void PrintError(const char *ProgName, raw_ostream &S);
-
-private :
- std::string Filename;
- std::string Message;
- int LineNo, ColumnNo; // -1 if not relevant
- std::string LineContents;
-
- void operator=(const ParseError &E); // DO NOT IMPLEMENT
-};
-
} // End llvm namespace
#endif
diff --git a/include/llvm/Bitcode/Archive.h b/include/llvm/Bitcode/Archive.h
index a3631ac..13583c0 100644
--- a/include/llvm/Bitcode/Archive.h
+++ b/include/llvm/Bitcode/Archive.h
@@ -32,6 +32,7 @@ class ModuleProvider; // From VMCore
class Module; // From VMCore
class Archive; // Declared below
class ArchiveMemberHeader; // Internal implementation class
+class LLVMContext; // Global data
/// This class is the main class manipulated by users of the Archive class. It
/// holds information about one member of the Archive. It is also the element
@@ -278,7 +279,8 @@ class Archive {
/// @returns An Archive* that represents the new archive file.
/// @brief Create an empty Archive.
static Archive* CreateEmpty(
- const sys::Path& Filename ///< Name of the archive to (eventually) create.
+ const sys::Path& Filename,///< Name of the archive to (eventually) create.
+ LLVMContext& C ///< Context to use for global information
);
/// Open an existing archive and load its contents in preparation for
@@ -289,6 +291,7 @@ class Archive {
/// @brief Open and load an archive file
static Archive* OpenAndLoad(
const sys::Path& filePath, ///< The file path to open and load
+ LLVMContext& C, ///< The context to use for global information
std::string* ErrorMessage ///< An optional error string
);
@@ -310,6 +313,7 @@ class Archive {
/// @brief Open an existing archive and load its symbols.
static Archive* OpenAndLoadSymbols(
const sys::Path& Filename, ///< Name of the archive file to open
+ LLVMContext& C, ///< The context to use for global info
std::string* ErrorMessage=0 ///< An optional error string
);
@@ -449,7 +453,7 @@ class Archive {
protected:
/// @brief Construct an Archive for \p filename and optionally map it
/// into memory.
- explicit Archive(const sys::Path& filename);
+ explicit Archive(const sys::Path& filename, LLVMContext& C);
/// @param data The symbol table data to be parsed
/// @param len The length of the symbol table data
@@ -530,6 +534,7 @@ class Archive {
unsigned firstFileOffset; ///< Offset to first normal file.
ModuleMap modules; ///< The modules loaded via symbol lookup.
ArchiveMember* foreignST; ///< This holds the foreign symbol table.
+ LLVMContext& Context; ///< This holds global data.
/// @}
/// @name Hidden
/// @{
diff --git a/include/llvm/Bitcode/BitstreamReader.h b/include/llvm/Bitcode/BitstreamReader.h
index b7ae47d..28249ee 100644
--- a/include/llvm/Bitcode/BitstreamReader.h
+++ b/include/llvm/Bitcode/BitstreamReader.h
@@ -324,7 +324,7 @@ public:
uint64_t ReadVBR64(unsigned NumBits) {
uint64_t Piece = Read(NumBits);
- if ((Piece & (1U << (NumBits-1))) == 0)
+ if ((Piece & (uint64_t(1) << (NumBits-1))) == 0)
return Piece;
uint64_t Result = 0;
@@ -332,7 +332,7 @@ public:
while (1) {
Result |= (Piece & ((1U << (NumBits-1))-1)) << NextBit;
- if ((Piece & (1U << (NumBits-1))) == 0)
+ if ((Piece & (uint64_t(1) << (NumBits-1))) == 0)
return Result;
NextBit += NumBits-1;
diff --git a/include/llvm/Bitcode/ReaderWriter.h b/include/llvm/Bitcode/ReaderWriter.h
index abdd5d3..3d33d75 100644
--- a/include/llvm/Bitcode/ReaderWriter.h
+++ b/include/llvm/Bitcode/ReaderWriter.h
@@ -23,6 +23,7 @@ namespace llvm {
class MemoryBuffer;
class ModulePass;
class BitstreamWriter;
+ class LLVMContext;
class raw_ostream;
/// getBitcodeModuleProvider - Read the header of the specified bitcode buffer
@@ -31,12 +32,14 @@ namespace llvm {
/// error, this returns null, *does not* take ownership of Buffer, and fills
/// in *ErrMsg with an error description if ErrMsg is non-null.
ModuleProvider *getBitcodeModuleProvider(MemoryBuffer *Buffer,
+ LLVMContext& Context,
std::string *ErrMsg = 0);
/// ParseBitcodeFile - Read the specified bitcode file, returning the module.
/// If an error occurs, this returns null and fills in *ErrMsg if it is
/// non-null. This method *never* takes ownership of Buffer.
- Module *ParseBitcodeFile(MemoryBuffer *Buffer, std::string *ErrMsg = 0);
+ Module *ParseBitcodeFile(MemoryBuffer *Buffer, LLVMContext& Context,
+ std::string *ErrMsg = 0);
/// WriteBitcodeToFile - Write the specified module to the specified output
/// stream.
diff --git a/include/llvm/CodeGen/AsmPrinter.h b/include/llvm/CodeGen/AsmPrinter.h
index f3ca306..ef609e4 100644
--- a/include/llvm/CodeGen/AsmPrinter.h
+++ b/include/llvm/CodeGen/AsmPrinter.h
@@ -65,8 +65,6 @@ namespace llvm {
/// DW - If available, this is a pointer to the current dwarf writer.
DwarfWriter *DW;
- /// OptLevel - Generating code at a specific optimization level.
- CodeGenOpt::Level OptLevel;
public:
/// Output stream on which we're printing assembly code.
///
@@ -120,7 +118,7 @@ namespace llvm {
protected:
explicit AsmPrinter(raw_ostream &o, TargetMachine &TM,
- const TargetAsmInfo *T, CodeGenOpt::Level OL, bool V);
+ const TargetAsmInfo *T, bool V);
public:
virtual ~AsmPrinter();
@@ -139,7 +137,8 @@ namespace llvm {
///
/// This method is used when about to emit executable code.
///
- void SwitchToTextSection(const char *NewSection, const GlobalValue *GV = NULL);
+ void SwitchToTextSection(const char *NewSection,
+ const GlobalValue *GV = NULL);
/// SwitchToDataSection - Switch to the specified section of the executable
/// if we are not already in it! If GV is non-null and if the global has an
@@ -153,7 +152,8 @@ namespace llvm {
/// is the same as the SwitchToTextSection method, but not all assemblers
/// are the same.
///
- void SwitchToDataSection(const char *NewSection, const GlobalValue *GV = NULL);
+ void SwitchToDataSection(const char *NewSection,
+ const GlobalValue *GV = NULL);
/// SwitchToSection - Switch to the specified section of the executable if
/// we are not already in it!
diff --git a/include/llvm/CodeGen/BinaryObject.h b/include/llvm/CodeGen/BinaryObject.h
index 4b66fe8..ce0c07a 100644
--- a/include/llvm/CodeGen/BinaryObject.h
+++ b/include/llvm/CodeGen/BinaryObject.h
@@ -15,6 +15,8 @@
#ifndef LLVM_CODEGEN_BINARYOBJECT_H
#define LLVM_CODEGEN_BINARYOBJECT_H
+#include "llvm/Support/DataTypes.h"
+
#include <string>
#include <vector>
diff --git a/include/llvm/CodeGen/LiveIntervalAnalysis.h b/include/llvm/CodeGen/LiveIntervalAnalysis.h
index 7c44cc7..7ae98bb 100644
--- a/include/llvm/CodeGen/LiveIntervalAnalysis.h
+++ b/include/llvm/CodeGen/LiveIntervalAnalysis.h
@@ -390,6 +390,10 @@ namespace llvm {
unsigned getNumConflictsWithPhysReg(const LiveInterval &li,
unsigned PhysReg) const;
+ /// processImplicitDefs - Process IMPLICIT_DEF instructions. Add isUndef
+ /// marker to implicit_def defs and their uses.
+ void processImplicitDefs();
+
/// computeNumbering - Compute the index numbering.
void computeNumbering();
diff --git a/include/llvm/CodeGen/MachineFunction.h b/include/llvm/CodeGen/MachineFunction.h
index 0074f1a..ea6a384 100644
--- a/include/llvm/CodeGen/MachineFunction.h
+++ b/include/llvm/CodeGen/MachineFunction.h
@@ -111,6 +111,9 @@ class MachineFunction : private Annotation {
// Tracks debug locations.
DebugLocTracker DebugLocInfo;
+ // The alignment of the function.
+ unsigned Alignment;
+
public:
MachineFunction(const Function *Fn, const TargetMachine &TM);
~MachineFunction();
@@ -148,6 +151,14 @@ public:
MachineConstantPool *getConstantPool() { return ConstantPool; }
const MachineConstantPool *getConstantPool() const { return ConstantPool; }
+ /// getAlignment - Return the alignment (log2, not bytes) of the function.
+ ///
+ unsigned getAlignment() const { return Alignment; }
+
+ /// setAlignment - Set the alignment (log2, not bytes) of the function.
+ ///
+ void setAlignment(unsigned A) { Alignment = A; }
+
/// MachineFunctionInfo - Keep track of various per-function pieces of
/// information for backends that would like to do so.
///
@@ -345,6 +356,9 @@ public:
/// setDefaultDebugLoc - Get the default debug location for the machine
/// function.
void setDefaultDebugLoc(DebugLoc DL) { DefaultDebugLoc = DL; }
+
+ /// getDebugLocInfo - Get the debug info location tracker.
+ DebugLocTracker &getDebugLocInfo() { return DebugLocInfo; }
};
//===--------------------------------------------------------------------===//
diff --git a/include/llvm/CodeGen/MachineInstrBuilder.h b/include/llvm/CodeGen/MachineInstrBuilder.h
index 3f30de5..c6a6679 100644
--- a/include/llvm/CodeGen/MachineInstrBuilder.h
+++ b/include/llvm/CodeGen/MachineInstrBuilder.h
@@ -29,7 +29,8 @@ namespace RegState {
Implicit = 0x4,
Kill = 0x8,
Dead = 0x10,
- EarlyClobber = 0x20,
+ Undef = 0x20,
+ EarlyClobber = 0x40,
ImplicitDefine = Implicit | Define,
ImplicitKill = Implicit | Kill
};
@@ -57,8 +58,9 @@ public:
flags & RegState::Implicit,
flags & RegState::Kill,
flags & RegState::Dead,
- SubReg,
- flags & RegState::EarlyClobber));
+ flags & RegState::Undef,
+ flags & RegState::EarlyClobber,
+ SubReg));
return *this;
}
@@ -105,6 +107,13 @@ public:
return *this;
}
+ const MachineInstrBuilder &addMetadata(MDNode *N,
+ int64_t Offset = 0,
+ unsigned char TargetFlags = 0) const {
+ MI->addOperand(MachineOperand::CreateMDNode(N, Offset, TargetFlags));
+ return *this;
+ }
+
const MachineInstrBuilder &addExternalSymbol(const char *FnName,
int64_t Offset = 0,
unsigned char TargetFlags = 0) const {
@@ -203,6 +212,9 @@ inline unsigned getKillRegState(bool B) {
inline unsigned getDeadRegState(bool B) {
return B ? RegState::Dead : 0;
}
+inline unsigned getUndefRegState(bool B) {
+ return B ? RegState::Undef : 0;
+}
} // End llvm namespace
diff --git a/include/llvm/CodeGen/MachineLoopInfo.h b/include/llvm/CodeGen/MachineLoopInfo.h
index 8c96308..2d19d7a 100644
--- a/include/llvm/CodeGen/MachineLoopInfo.h
+++ b/include/llvm/CodeGen/MachineLoopInfo.h
@@ -70,88 +70,88 @@ inline bool LoopBase<MachineBasicBlock>::isLCSSAForm() const {
typedef LoopBase<MachineBasicBlock> MachineLoop;
class MachineLoopInfo : public MachineFunctionPass {
- LoopInfoBase<MachineBasicBlock>* LI;
+ LoopInfoBase<MachineBasicBlock> LI;
friend class LoopBase<MachineBasicBlock>;
-
- LoopInfoBase<MachineBasicBlock>& getBase() { return *LI; }
+
+ void operator=(const MachineLoopInfo &); // do not implement
+ MachineLoopInfo(const MachineLoopInfo &); // do not implement
+
+ LoopInfoBase<MachineBasicBlock>& getBase() { return LI; }
+
public:
static char ID; // Pass identification, replacement for typeid
- MachineLoopInfo() : MachineFunctionPass(&ID) {
- LI = new LoopInfoBase<MachineBasicBlock>();
- }
-
- ~MachineLoopInfo() { delete LI; }
+ MachineLoopInfo() : MachineFunctionPass(&ID) {}
/// iterator/begin/end - The interface to the top-level loops in the current
/// function.
///
- typedef std::vector<MachineLoop*>::const_iterator iterator;
- inline iterator begin() const { return LI->begin(); }
- inline iterator end() const { return LI->end(); }
- bool empty() const { return LI->empty(); }
+ typedef LoopInfoBase<MachineBasicBlock>::iterator iterator;
+ inline iterator begin() const { return LI.begin(); }
+ inline iterator end() const { return LI.end(); }
+ bool empty() const { return LI.empty(); }
/// getLoopFor - Return the inner most loop that BB lives in. If a basic
/// block is in no loop (for example the entry node), null is returned.
///
inline MachineLoop *getLoopFor(const MachineBasicBlock *BB) const {
- return LI->getLoopFor(BB);
+ return LI.getLoopFor(BB);
}
/// operator[] - same as getLoopFor...
///
inline const MachineLoop *operator[](const MachineBasicBlock *BB) const {
- return LI->getLoopFor(BB);
+ return LI.getLoopFor(BB);
}
/// getLoopDepth - Return the loop nesting level of the specified block...
///
inline unsigned getLoopDepth(const MachineBasicBlock *BB) const {
- return LI->getLoopDepth(BB);
+ return LI.getLoopDepth(BB);
}
// isLoopHeader - True if the block is a loop header node
inline bool isLoopHeader(MachineBasicBlock *BB) const {
- return LI->isLoopHeader(BB);
+ return LI.isLoopHeader(BB);
}
/// runOnFunction - Calculate the natural loop information.
///
virtual bool runOnMachineFunction(MachineFunction &F);
- virtual void releaseMemory() { LI->releaseMemory(); }
+ virtual void releaseMemory() { LI.releaseMemory(); }
virtual void getAnalysisUsage(AnalysisUsage &AU) const;
/// removeLoop - This removes the specified top-level loop from this loop info
/// object. The loop is not deleted, as it will presumably be inserted into
/// another loop.
- inline MachineLoop *removeLoop(iterator I) { return LI->removeLoop(I); }
+ inline MachineLoop *removeLoop(iterator I) { return LI.removeLoop(I); }
/// changeLoopFor - Change the top-level loop that contains BB to the
/// specified loop. This should be used by transformations that restructure
/// the loop hierarchy tree.
inline void changeLoopFor(MachineBasicBlock *BB, MachineLoop *L) {
- LI->changeLoopFor(BB, L);
+ LI.changeLoopFor(BB, L);
}
/// changeTopLevelLoop - Replace the specified loop in the top-level loops
/// list with the indicated loop.
inline void changeTopLevelLoop(MachineLoop *OldLoop, MachineLoop *NewLoop) {
- LI->changeTopLevelLoop(OldLoop, NewLoop);
+ LI.changeTopLevelLoop(OldLoop, NewLoop);
}
/// addTopLevelLoop - This adds the specified loop to the collection of
/// top-level loops.
inline void addTopLevelLoop(MachineLoop *New) {
- LI->addTopLevelLoop(New);
+ LI.addTopLevelLoop(New);
}
/// removeBlock - This method completely removes BB from all data structures,
/// including all of the Loop objects it is nested in and our mapping from
/// MachineBasicBlocks to loops.
void removeBlock(MachineBasicBlock *BB) {
- LI->removeBlock(BB);
+ LI.removeBlock(BB);
}
};
@@ -159,7 +159,7 @@ public:
// Allow clients to walk the list of nested loops...
template <> struct GraphTraits<const MachineLoop*> {
typedef const MachineLoop NodeType;
- typedef std::vector<MachineLoop*>::const_iterator ChildIteratorType;
+ typedef MachineLoopInfo::iterator ChildIteratorType;
static NodeType *getEntryNode(const MachineLoop *L) { return L; }
static inline ChildIteratorType child_begin(NodeType *N) {
@@ -172,7 +172,7 @@ template <> struct GraphTraits<const MachineLoop*> {
template <> struct GraphTraits<MachineLoop*> {
typedef MachineLoop NodeType;
- typedef std::vector<MachineLoop*>::const_iterator ChildIteratorType;
+ typedef MachineLoopInfo::iterator ChildIteratorType;
static NodeType *getEntryNode(MachineLoop *L) { return L; }
static inline ChildIteratorType child_begin(NodeType *N) {
diff --git a/include/llvm/CodeGen/MachineOperand.h b/include/llvm/CodeGen/MachineOperand.h
index 5a7f76b..26ec239 100644
--- a/include/llvm/CodeGen/MachineOperand.h
+++ b/include/llvm/CodeGen/MachineOperand.h
@@ -23,6 +23,7 @@ namespace llvm {
class ConstantFP;
class MachineBasicBlock;
class GlobalValue;
+class MDNode;
class MachineInstr;
class TargetMachine;
class MachineRegisterInfo;
@@ -41,7 +42,8 @@ public:
MO_ConstantPoolIndex, ///< Address of indexed Constant in Constant Pool
MO_JumpTableIndex, ///< Address of indexed Jump Table for switch
MO_ExternalSymbol, ///< Name of external global symbol
- MO_GlobalAddress ///< Address of a global value
+ MO_GlobalAddress, ///< Address of a global value
+ MO_Metadata ///< Metadata info
};
private:
@@ -75,6 +77,10 @@ private:
/// This is only valid on definitions of registers.
bool IsDead : 1;
+ /// IsUndef - True if this is a register def / use of "undef", i.e. register
+ /// defined by an IMPLICIT_DEF. This is only valid on registers.
+ bool IsUndef : 1;
+
/// IsEarlyClobber - True if this MO_Register 'def' operand is written to
/// by the MachineInstr before all input registers are read. This is used to
/// model the GCC inline asm '&' constraint modifier.
@@ -103,6 +109,7 @@ private:
int Index; // For MO_*Index - The index itself.
const char *SymbolName; // For MO_ExternalSymbol.
GlobalValue *GV; // For MO_GlobalAddress.
+ MDNode *Node; // For MO_Metadata.
} Val;
int64_t Offset; // An offset from the object.
} OffsetedInfo;
@@ -198,6 +205,11 @@ public:
return IsKill;
}
+ bool isUndef() const {
+ assert(isReg() && "Wrong MachineOperand accessor");
+ return IsUndef;
+ }
+
bool isEarlyClobber() const {
assert(isReg() && "Wrong MachineOperand accessor");
return IsEarlyClobber;
@@ -248,6 +260,11 @@ public:
IsDead = Val;
}
+ void setIsUndef(bool Val = true) {
+ assert(isReg() && "Wrong MachineOperand accessor");
+ IsUndef = Val;
+ }
+
void setIsEarlyClobber(bool Val = true) {
assert(isReg() && IsDef && "Wrong MachineOperand accessor");
IsEarlyClobber = Val;
@@ -283,6 +300,10 @@ public:
return Contents.OffsetedInfo.Val.GV;
}
+ MDNode *getMDNode() const {
+ return Contents.OffsetedInfo.Val.Node;
+ }
+
int64_t getOffset() const {
assert((isGlobal() || isSymbol() || isCPI()) &&
"Wrong MachineOperand accessor");
@@ -337,7 +358,8 @@ public:
/// the specified value. If an operand is known to be an register already,
/// the setReg method should be used.
void ChangeToRegister(unsigned Reg, bool isDef, bool isImp = false,
- bool isKill = false, bool isDead = false);
+ bool isKill = false, bool isDead = false,
+ bool isUndef = false);
//===--------------------------------------------------------------------===//
// Construction methods.
@@ -357,13 +379,15 @@ public:
static MachineOperand CreateReg(unsigned Reg, bool isDef, bool isImp = false,
bool isKill = false, bool isDead = false,
- unsigned SubReg = 0,
- bool isEarlyClobber = false) {
+ bool isUndef = false,
+ bool isEarlyClobber = false,
+ unsigned SubReg = 0) {
MachineOperand Op(MachineOperand::MO_Register);
Op.IsDef = isDef;
Op.IsImp = isImp;
Op.IsKill = isKill;
Op.IsDead = isDead;
+ Op.IsUndef = isUndef;
Op.IsEarlyClobber = isEarlyClobber;
Op.Contents.Reg.RegNo = Reg;
Op.Contents.Reg.Prev = 0;
@@ -406,6 +430,14 @@ public:
Op.setTargetFlags(TargetFlags);
return Op;
}
+ static MachineOperand CreateMDNode(MDNode *N, int64_t Offset,
+ unsigned char TargetFlags = 0) {
+ MachineOperand Op(MachineOperand::MO_Metadata);
+ Op.Contents.OffsetedInfo.Val.Node = N;
+ Op.setOffset(Offset);
+ Op.setTargetFlags(TargetFlags);
+ return Op;
+ }
static MachineOperand CreateES(const char *SymName, int64_t Offset = 0,
unsigned char TargetFlags = 0) {
MachineOperand Op(MachineOperand::MO_ExternalSymbol);
@@ -420,6 +452,7 @@ public:
IsImp = MO.IsImp;
IsKill = MO.IsKill;
IsDead = MO.IsDead;
+ IsUndef = MO.IsUndef;
IsEarlyClobber = MO.IsEarlyClobber;
SubReg = MO.SubReg;
ParentMI = MO.ParentMI;
diff --git a/include/llvm/CodeGen/RegisterScavenging.h b/include/llvm/CodeGen/RegisterScavenging.h
index a4ed012..458c2e4 100644
--- a/include/llvm/CodeGen/RegisterScavenging.h
+++ b/include/llvm/CodeGen/RegisterScavenging.h
@@ -69,10 +69,6 @@ class RegScavenger {
/// available, unset means the register is currently being used.
BitVector RegsAvailable;
- /// ImplicitDefed - If bit is set that means the register is defined by an
- /// implicit_def instructions. That means it can be clobbered at will.
- BitVector ImplicitDefed;
-
/// CurrDist - Distance from MBB entry to the current instruction MBBI.
///
unsigned CurrDist;
@@ -117,25 +113,18 @@ public:
bool isUsed(unsigned Reg) const { return !RegsAvailable[Reg]; }
bool isUnused(unsigned Reg) const { return RegsAvailable[Reg]; }
- bool isImplicitlyDefined(unsigned Reg) const { return ImplicitDefed[Reg]; }
-
/// getRegsUsed - return all registers currently in use in used.
void getRegsUsed(BitVector &used, bool includeReserved);
/// setUsed / setUnused - Mark the state of one or a number of registers.
///
- void setUsed(unsigned Reg, bool ImpDef = false);
- void setUsed(BitVector &Regs, bool ImpDef = false) {
+ void setUsed(unsigned Reg);
+ void setUsed(BitVector &Regs) {
RegsAvailable &= ~Regs;
- if (ImpDef)
- ImplicitDefed |= Regs;
- else
- ImplicitDefed &= ~Regs;
}
void setUnused(unsigned Reg, const MachineInstr *MI);
void setUnused(BitVector &Regs) {
RegsAvailable |= Regs;
- ImplicitDefed &= ~Regs;
}
/// FindUnusedReg - Find a unused register of the specified register class
diff --git a/include/llvm/CodeGen/SelectionDAG.h b/include/llvm/CodeGen/SelectionDAG.h
index bac3eec..8abd78d 100644
--- a/include/llvm/CodeGen/SelectionDAG.h
+++ b/include/llvm/CodeGen/SelectionDAG.h
@@ -17,7 +17,6 @@
#include "llvm/ADT/ilist.h"
#include "llvm/ADT/DenseSet.h"
-#include "llvm/ADT/FoldingSet.h"
#include "llvm/ADT/StringMap.h"
#include "llvm/CodeGen/SelectionDAGNodes.h"
#include "llvm/Target/TargetMachine.h"
@@ -537,7 +536,8 @@ public:
///
SDValue getCall(unsigned CallingConv, DebugLoc dl, bool IsVarArgs,
bool IsTailCall, bool isInreg, SDVTList VTs,
- const SDValue *Operands, unsigned NumOperands);
+ const SDValue *Operands, unsigned NumOperands,
+ unsigned NumFixedArgs);
/// getLoad - Loads are not normal binary operators: their result type is not
/// determined by their operands, and they produce a value AND a token chain.
diff --git a/include/llvm/CodeGen/SelectionDAGNodes.h b/include/llvm/CodeGen/SelectionDAGNodes.h
index adf0478..9752537 100644
--- a/include/llvm/CodeGen/SelectionDAGNodes.h
+++ b/include/llvm/CodeGen/SelectionDAGNodes.h
@@ -2257,6 +2257,7 @@ class CallSDNode : public SDNode {
unsigned CallingConv;
bool IsVarArg;
bool IsTailCall;
+ unsigned NumFixedArgs;
// We might eventually want a full-blown Attributes for the result; that
// will expand the size of the representation. At the moment we only
// need Inreg.
@@ -2264,10 +2265,10 @@ class CallSDNode : public SDNode {
friend class SelectionDAG;
CallSDNode(unsigned cc, DebugLoc dl, bool isvararg, bool istailcall,
bool isinreg, SDVTList VTs, const SDValue *Operands,
- unsigned numOperands)
+ unsigned numOperands, unsigned numFixedArgs)
: SDNode(ISD::CALL, dl, VTs, Operands, numOperands),
CallingConv(cc), IsVarArg(isvararg), IsTailCall(istailcall),
- Inreg(isinreg) {}
+ NumFixedArgs(numFixedArgs), Inreg(isinreg) {}
public:
unsigned getCallingConv() const { return CallingConv; }
unsigned isVarArg() const { return IsVarArg; }
@@ -2284,6 +2285,12 @@ public:
SDValue getCallee() const { return getOperand(1); }
unsigned getNumArgs() const { return (getNumOperands() - 2) / 2; }
+ unsigned getNumFixedArgs() const {
+ if (isVarArg())
+ return NumFixedArgs;
+ else
+ return getNumArgs();
+ }
SDValue getArg(unsigned i) const { return getOperand(2+2*i); }
SDValue getArgFlagsVal(unsigned i) const {
return getOperand(3+2*i);
diff --git a/include/llvm/CodeGen/ValueTypes.h b/include/llvm/CodeGen/ValueTypes.h
index bf8b19c..e661c58 100644
--- a/include/llvm/CodeGen/ValueTypes.h
+++ b/include/llvm/CodeGen/ValueTypes.h
@@ -1,4 +1,3 @@
-
//===- CodeGen/ValueTypes.h - Low-Level Target independ. types --*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
@@ -52,29 +51,34 @@ namespace llvm {
v2i8 = 14, // 2 x i8
v4i8 = 15, // 4 x i8
- v2i16 = 16, // 2 x i16
- v8i8 = 17, // 8 x i8
- v4i16 = 18, // 4 x i16
- v2i32 = 19, // 2 x i32
- v1i64 = 20, // 1 x i64
- v16i8 = 21, // 16 x i8
- v8i16 = 22, // 8 x i16
- v3i32 = 23, // 3 x i32
- v4i32 = 24, // 4 x i32
- v2i64 = 25, // 2 x i64
-
- v2f32 = 26, // 2 x f32
- v3f32 = 27, // 3 x f32
- v4f32 = 28, // 4 x f32
- v2f64 = 29, // 2 x f64
-
+ v8i8 = 16, // 8 x i8
+ v16i8 = 17, // 16 x i8
+ v32i8 = 18, // 32 x i8
+ v2i16 = 19, // 2 x i16
+ v4i16 = 20, // 4 x i16
+ v8i16 = 21, // 8 x i16
+ v16i16 = 22, // 16 x i16
+ v2i32 = 23, // 2 x i32
+ v3i32 = 24, // 3 x i32
+ v4i32 = 25, // 4 x i32
+ v8i32 = 26, // 8 x i32
+ v1i64 = 27, // 1 x i64
+ v2i64 = 28, // 2 x i64
+ v4i64 = 29, // 4 x i64
+
+ v2f32 = 30, // 2 x f32
+ v3f32 = 31, // 3 x f32
+ v4f32 = 32, // 4 x f32
+ v8f32 = 33, // 8 x f32
+ v2f64 = 34, // 2 x f64
+ v4f64 = 35, // 4 x f64
+
FIRST_VECTOR_VALUETYPE = v2i8,
- LAST_VECTOR_VALUETYPE = v2f64,
+ LAST_VECTOR_VALUETYPE = v4f64,
- LAST_VALUETYPE = 30, // This always remains at the end of the list.
+ LAST_VALUETYPE = 36, // This always remains at the end of the list.
// This is the current maximum for LAST_VALUETYPE.
- // Affects ValueTypeActions in TargetLowering.h.
// MVT::MAX_ALLOWED_VALUETYPE is used for asserts and to size bit vectors
// This value must be a multiple of 32.
MAX_ALLOWED_VALUETYPE = 64,
@@ -179,28 +183,34 @@ namespace llvm {
if (NumElements == 4) return v4i8;
if (NumElements == 8) return v8i8;
if (NumElements == 16) return v16i8;
+ if (NumElements == 32) return v32i8;
break;
case i16:
if (NumElements == 2) return v2i16;
if (NumElements == 4) return v4i16;
if (NumElements == 8) return v8i16;
+ if (NumElements == 16) return v16i16;
break;
case i32:
if (NumElements == 2) return v2i32;
if (NumElements == 3) return v3i32;
if (NumElements == 4) return v4i32;
+ if (NumElements == 8) return v8i32;
break;
case i64:
if (NumElements == 1) return v1i64;
if (NumElements == 2) return v2i64;
+ if (NumElements == 4) return v4i64;
break;
case f32:
if (NumElements == 2) return v2f32;
if (NumElements == 3) return v3f32;
if (NumElements == 4) return v4f32;
+ if (NumElements == 8) return v8f32;
break;
case f64:
if (NumElements == 2) return v2f64;
+ if (NumElements == 4) return v4f64;
break;
}
return getExtendedVectorVT(VT, NumElements);
@@ -235,15 +245,15 @@ namespace llvm {
/// isFloatingPoint - Return true if this is a FP, or a vector FP type.
bool isFloatingPoint() const {
return isSimple() ?
- ((V >= f32 && V <= ppcf128) || (V >= v2f32 && V <= v2f64)) :
- isExtendedFloatingPoint();
+ ((V >= f32 && V <= ppcf128) ||
+ (V >= v2f32 && V <= v4f64)) : isExtendedFloatingPoint();
}
/// isInteger - Return true if this is an integer, or a vector integer type.
bool isInteger() const {
return isSimple() ?
((V >= FIRST_INTEGER_VALUETYPE && V <= LAST_INTEGER_VALUETYPE) ||
- (V >= v2i8 && V <= v2i64)) : isExtendedInteger();
+ (V >= v2i8 && V <= v4i64)) : isExtendedInteger();
}
/// isVector - Return true if this is a vector value type.
@@ -268,6 +278,13 @@ namespace llvm {
isExtended128BitVector();
}
+ /// is256BitVector - Return true if this is a 256-bit vector type.
+ inline bool is256BitVector() const {
+ return isSimple() ?
+ (V==v8f32 || V==v4f64 || V==v32i8 || V==v16i16 || V==v8i32 ||
+ V==v4i64) : isExtended256BitVector();
+ }
+
/// isByteSized - Return true if the bit size is a multiple of 8.
bool isByteSized() const {
return (getSizeInBits() & 7) == 0;
@@ -322,19 +339,25 @@ namespace llvm {
case v2i8 :
case v4i8 :
case v8i8 :
- case v16i8: return i8;
+ case v16i8:
+ case v32i8: return i8;
case v2i16:
case v4i16:
- case v8i16: return i16;
+ case v8i16:
+ case v16i16: return i16;
case v2i32:
case v3i32:
- case v4i32: return i32;
+ case v4i32:
+ case v8i32: return i32;
case v1i64:
- case v2i64: return i64;
+ case v2i64:
+ case v4i64: return i64;
case v2f32:
case v3f32:
- case v4f32: return f32;
- case v2f64: return f64;
+ case v4f32:
+ case v8f32: return f32;
+ case v2f64:
+ case v4f64: return f64;
}
}
@@ -345,13 +368,19 @@ namespace llvm {
switch (V) {
default:
return getExtendedVectorNumElements();
- case v16i8: return 16;
+ case v32i8: return 32;
+ case v16i8:
+ case v16i16: return 16;
case v8i8 :
- case v8i16: return 8;
+ case v8i16:
+ case v8i32:
+ case v8f32: return 8;
case v4i8:
case v4i16:
case v4i32:
- case v4f32: return 4;
+ case v4i64:
+ case v4f32:
+ case v4f64: return 4;
case v3i32:
case v3f32: return 3;
case v2i8:
@@ -402,6 +431,12 @@ namespace llvm {
case v2i64:
case v4f32:
case v2f64: return 128;
+ case v32i8:
+ case v16i16:
+ case v8i32:
+ case v4i64:
+ case v8f32:
+ case v4f64: return 256;
}
}
@@ -478,6 +513,7 @@ namespace llvm {
bool isExtendedVector() const;
bool isExtended64BitVector() const;
bool isExtended128BitVector() const;
+ bool isExtended256BitVector() const;
MVT getExtendedVectorElementType() const;
unsigned getExtendedVectorNumElements() const;
unsigned getExtendedSizeInBits() const;
diff --git a/include/llvm/CodeGen/ValueTypes.td b/include/llvm/CodeGen/ValueTypes.td
index 53ed0be..7f6728b 100644
--- a/include/llvm/CodeGen/ValueTypes.td
+++ b/include/llvm/CodeGen/ValueTypes.td
@@ -33,25 +33,31 @@ def f128 : ValueType<128, 10>; // 128-bit floating point value
def ppcf128: ValueType<128, 11>; // PPC 128-bit floating point value
def FlagVT : ValueType<0 , 12>; // Condition code or machine flag
def isVoid : ValueType<0 , 13>; // Produces no value
+
def v2i8 : ValueType<16 , 14>; // 2 x i8 vector value
def v4i8 : ValueType<32 , 15>; // 4 x i8 vector value
-def v2i16 : ValueType<32 , 16>; // 2 x i16 vector value
-def v8i8 : ValueType<64 , 17>; // 8 x i8 vector value
-def v4i16 : ValueType<64 , 18>; // 4 x i16 vector value
-def v2i32 : ValueType<64 , 19>; // 2 x i32 vector value
-def v1i64 : ValueType<64 , 20>; // 1 x i64 vector value
-
-def v16i8 : ValueType<128, 21>; // 16 x i8 vector value
-def v8i16 : ValueType<128, 22>; // 8 x i16 vector value
-def v3i32 : ValueType<96 , 23>; // 3 x i32 vector value
-def v4i32 : ValueType<128, 24>; // 4 x i32 vector value
-def v2i64 : ValueType<128, 25>; // 2 x i64 vector value
-
-def v2f32 : ValueType<64, 26>; // 2 x f32 vector value
-def v3f32 : ValueType<96 , 27>; // 3 x f32 vector value
-def v4f32 : ValueType<128, 28>; // 4 x f32 vector value
-def v2f64 : ValueType<128, 29>; // 2 x f64 vector value
+def v8i8 : ValueType<64 , 16>; // 8 x i8 vector value
+def v16i8 : ValueType<128, 17>; // 16 x i8 vector value
+def v32i8 : ValueType<256, 18>; // 32 x i8 vector value
+def v2i16 : ValueType<32 , 19>; // 2 x i16 vector value
+def v4i16 : ValueType<64 , 20>; // 4 x i16 vector value
+def v8i16 : ValueType<128, 21>; // 8 x i16 vector value
+def v16i16 : ValueType<256, 22>; // 16 x i16 vector value
+def v2i32 : ValueType<64 , 23>; // 2 x i32 vector value
+def v3i32 : ValueType<96 , 24>; // 3 x i32 vector value
+def v4i32 : ValueType<128, 25>; // 4 x i32 vector value
+def v8i32 : ValueType<256, 26>; // 8 x f32 vector value
+def v1i64 : ValueType<64 , 27>; // 1 x i64 vector value
+def v2i64 : ValueType<128, 28>; // 2 x i64 vector value
+def v4i64 : ValueType<256, 29>; // 4 x f64 vector value
+def v2f32 : ValueType<64, 30>; // 2 x f32 vector value
+def v3f32 : ValueType<96 , 31>; // 3 x f32 vector value
+def v4f32 : ValueType<128, 32>; // 4 x f32 vector value
+def v8f32 : ValueType<256, 33>; // 8 x f32 vector value
+def v2f64 : ValueType<128, 34>; // 2 x f64 vector value
+def v4f64 : ValueType<256, 35>; // 4 x f64 vector value
+
// Pseudo valuetype mapped to the current pointer size to any address space.
// Should only be used in TableGen.
def iPTRAny : ValueType<0, 252>;
diff --git a/include/llvm/CompilerDriver/Main.inc b/include/llvm/CompilerDriver/Main.inc
index 4a83d56..fc8b503 100644
--- a/include/llvm/CompilerDriver/Main.inc
+++ b/include/llvm/CompilerDriver/Main.inc
@@ -12,159 +12,22 @@
// supported please refer to the tools' manual page or run the tool
// with the --help option.
//
+// This file provides the default entry point for the driver executable.
+//
//===----------------------------------------------------------------------===//
#ifndef LLVM_INCLUDE_COMPILER_DRIVER_MAIN_INC
#define LLVM_INCLUDE_COMPILER_DRIVER_MAIN_INC
-#include "llvm/CompilerDriver/BuiltinOptions.h"
-#include "llvm/CompilerDriver/CompilationGraph.h"
-#include "llvm/CompilerDriver/Error.h"
#include "llvm/CompilerDriver/ForceLinkage.h"
-#include "llvm/CompilerDriver/Plugin.h"
-
-#include "llvm/System/Path.h"
-#include "llvm/Support/CommandLine.h"
-#include "llvm/Support/PluginLoader.h"
-
-#include <iostream>
-#include <stdexcept>
-#include <string>
-
-namespace cl = llvm::cl;
-namespace sys = llvm::sys;
-using namespace llvmc;
-
-// Built-in command-line options.
-// External linkage here is intentional.
-
-cl::list<std::string> InputFilenames(cl::Positional, cl::desc("<input file>"),
- cl::ZeroOrMore);
-cl::opt<std::string> OutputFilename("o", cl::desc("Output file name"),
- cl::value_desc("file"), cl::Prefix);
-cl::list<std::string> Languages("x",
- cl::desc("Specify the language of the following input files"),
- cl::ZeroOrMore);
-cl::opt<bool> DryRun("dry-run",
- cl::desc("Only pretend to run commands"));
-cl::opt<bool> VerboseMode("v",
- cl::desc("Enable verbose mode"));
-
-cl::opt<bool> CheckGraph("check-graph",
- cl::desc("Check the compilation graph for errors"),
- cl::Hidden);
-cl::opt<bool> WriteGraph("write-graph",
- cl::desc("Write compilation-graph.dot file"),
- cl::Hidden);
-cl::opt<bool> ViewGraph("view-graph",
- cl::desc("Show compilation graph in GhostView"),
- cl::Hidden);
-
-cl::opt<SaveTempsEnum::Values> SaveTemps
-("save-temps", cl::desc("Keep temporary files"),
- cl::init(SaveTempsEnum::Unset),
- cl::values(clEnumValN(SaveTempsEnum::Obj, "obj",
- "Save files in the directory specified with -o"),
- clEnumValN(SaveTempsEnum::Cwd, "cwd",
- "Use current working directory"),
- clEnumValN(SaveTempsEnum::Obj, "", "Same as 'cwd'"),
- clEnumValEnd),
- cl::ValueOptional);
-
-namespace {
-
- sys::Path getTempDir() {
- sys::Path tempDir;
-
- // GCC 4.5-style -save-temps handling.
- if (SaveTemps == SaveTempsEnum::Unset) {
- tempDir = sys::Path::GetTemporaryDirectory();
- }
- else if (SaveTemps == SaveTempsEnum::Obj && !OutputFilename.empty()) {
- tempDir = OutputFilename;
-
- if (!tempDir.exists()) {
- std::string ErrMsg;
- if (tempDir.createDirectoryOnDisk(true, &ErrMsg))
- throw std::runtime_error(ErrMsg);
- }
- }
- // else if (SaveTemps == Cwd) -> use current dir (leave tempDir empty)
- return tempDir;
- }
-
- /// BuildTargets - A small wrapper for CompilationGraph::Build.
- int BuildTargets(CompilationGraph& graph, const LanguageMap& langMap) {
- int ret;
- const sys::Path& tempDir = getTempDir();
-
- try {
- ret = graph.Build(tempDir, langMap);
- }
- catch(...) {
- if (SaveTemps == SaveTempsEnum::Unset)
- tempDir.eraseFromDisk(true);
- throw;
- }
-
- if (SaveTemps == SaveTempsEnum::Unset)
- tempDir.eraseFromDisk(true);
- return ret;
- }
+namespace llvmc {
+ int Main(int argc, char** argv);
}
int main(int argc, char** argv) {
- try {
- ForceLinkage();
-
- LanguageMap langMap;
- CompilationGraph graph;
-
- cl::ParseCommandLineOptions
- (argc, argv, "LLVM Compiler Driver (Work In Progress)", true);
-
- PluginLoader Plugins;
- Plugins.PopulateLanguageMap(langMap);
- Plugins.PopulateCompilationGraph(graph);
-
- if (CheckGraph) {
- int ret = graph.Check();
- if (!ret)
- std::cerr << "check-graph: no errors found.\n";
-
- return ret;
- }
-
- if (ViewGraph) {
- graph.viewGraph();
- if (!WriteGraph)
- return 0;
- }
-
- if (WriteGraph) {
- graph.writeGraph(OutputFilename.empty()
- ? std::string("compilation-graph.dot")
- : OutputFilename);
- return 0;
- }
-
- if (InputFilenames.empty()) {
- throw std::runtime_error("no input files");
- }
-
- return BuildTargets(graph, langMap);
- }
- catch(llvmc::error_code& ec) {
- return ec.code();
- }
- catch(const std::exception& ex) {
- std::cerr << argv[0] << ": " << ex.what() << '\n';
- }
- catch(...) {
- std::cerr << argv[0] << ": unknown error!\n";
- }
- return 1;
+ llvmc::ForceLinkage();
+ return llvmc::Main(argc, argv);
}
#endif // LLVM_INCLUDE_COMPILER_DRIVER_MAIN_INC
diff --git a/include/llvm/Config/config.h.cmake b/include/llvm/Config/config.h.cmake
index 27ef440..180e8c5 100644
--- a/include/llvm/Config/config.h.cmake
+++ b/include/llvm/Config/config.h.cmake
@@ -364,10 +364,13 @@
#undef HAVE_STRDUP
/* Define to 1 if you have the `strerror' function. */
-#undef HAVE_STRERROR
+#cmakedefine HAVE_STRERROR
/* Define to 1 if you have the `strerror_r' function. */
-#undef HAVE_STRERROR_R
+#cmakedefine HAVE_STRERROR_R
+
+/* Define to 1 if you have the `strerror_s' function. */
+#cmakedefine HAVE_STRERROR_S
/* Define to 1 if you have the <strings.h> header file. */
#undef HAVE_STRINGS_H
diff --git a/include/llvm/Config/config.h.in b/include/llvm/Config/config.h.in
index 9452ce7..4dd1345 100644
--- a/include/llvm/Config/config.h.in
+++ b/include/llvm/Config/config.h.in
@@ -369,6 +369,9 @@
/* Define to 1 if you have the `strerror_r' function. */
#undef HAVE_STRERROR_R
+/* Define to 1 if you have the `strerror_s' function. */
+#undef HAVE_STRERROR_S
+
/* Define to 1 if you have the <strings.h> header file. */
#undef HAVE_STRINGS_H
diff --git a/include/llvm/Debugger/Debugger.h b/include/llvm/Debugger/Debugger.h
index 5b0b97a..42de356 100644
--- a/include/llvm/Debugger/Debugger.h
+++ b/include/llvm/Debugger/Debugger.h
@@ -20,6 +20,7 @@
namespace llvm {
class Module;
class InferiorProcess;
+ class LLVMContext;
/// Debugger class - This class implements the LLVM source-level debugger.
/// This allows clients to handle the user IO processing without having to
@@ -95,7 +96,7 @@ namespace llvm {
/// the PATH for the specified program, loading it when found. If the
/// specified program cannot be found, an exception is thrown to indicate
/// the error.
- void loadProgram(const std::string &Path);
+ void loadProgram(const std::string &Path, LLVMContext& Context);
/// unloadProgram - If a program is running, kill it, then unload all traces
/// of the current program. If no program is loaded, this method silently
diff --git a/include/llvm/DerivedTypes.h b/include/llvm/DerivedTypes.h
index b5824f8..053091b 100644
--- a/include/llvm/DerivedTypes.h
+++ b/include/llvm/DerivedTypes.h
@@ -159,6 +159,15 @@ public:
bool isVarArg ///< Whether this is a variable argument length function
);
+ /// FunctionType::get - Create a FunctionType taking no parameters.
+ ///
+ static FunctionType *get(
+ const Type *Result, ///< The result type
+ bool isVarArg ///< Whether this is a variable argument length function
+ ) {
+ return get(Result, std::vector<const Type *>(), isVarArg);
+ }
+
/// isValidReturnType - Return true if the specified type is valid as a return
/// type.
static bool isValidReturnType(const Type *RetTy);
@@ -234,6 +243,12 @@ public:
static StructType *get(const std::vector<const Type*> &Params,
bool isPacked=false);
+ /// StructType::get - Create an empty structure type.
+ ///
+ static StructType *get(bool isPacked=false) {
+ return get(std::vector<const Type*>(), isPacked);
+ }
+
/// StructType::get - This static method is a convenience method for
/// creating structure types by specifying the elements as arguments.
/// Note that this method always returns a non-packed struct. To get
diff --git a/include/llvm/Function.h b/include/llvm/Function.h
index 228ef94..34ced97 100644
--- a/include/llvm/Function.h
+++ b/include/llvm/Function.h
@@ -27,6 +27,7 @@
namespace llvm {
class FunctionType;
+class LLVMContext;
// Traits for intrusive list of basic blocks...
template<> struct ilist_traits<BasicBlock>
@@ -126,6 +127,10 @@ public:
const Type *getReturnType() const; // Return the type of the ret val
const FunctionType *getFunctionType() const; // Return the FunctionType for me
+ /// getContext - Return a pointer to the LLVMContext associated with this
+ /// function, or NULL if this function is not bound to a context yet.
+ LLVMContext* getContext();
+
/// isVarArg - Return true if this function takes a variable number of
/// arguments.
bool isVarArg() const;
diff --git a/include/llvm/Intrinsics.td b/include/llvm/Intrinsics.td
index 5ed2f77..c036151 100644
--- a/include/llvm/Intrinsics.td
+++ b/include/llvm/Intrinsics.td
@@ -110,22 +110,32 @@ def llvm_anyptr_ty : LLVMAnyPointerType<llvm_i8_ty>; // (space)i8*
def llvm_empty_ty : LLVMType<OtherVT>; // { }
def llvm_descriptor_ty : LLVMPointerType<llvm_empty_ty>; // { }*
+def llvm_v2i8_ty : LLVMType<v2i8>; // 2 x i8
+def llvm_v4i8_ty : LLVMType<v4i8>; // 4 x i8
+def llvm_v8i8_ty : LLVMType<v8i8>; // 8 x i8
def llvm_v16i8_ty : LLVMType<v16i8>; // 16 x i8
+def llvm_v32i8_ty : LLVMType<v32i8>; // 32 x i8
+def llvm_v2i16_ty : LLVMType<v2i16>; // 4 x i16
+def llvm_v4i16_ty : LLVMType<v4i16>; // 4 x i16
def llvm_v8i16_ty : LLVMType<v8i16>; // 8 x i16
-def llvm_v2i64_ty : LLVMType<v2i64>; // 2 x i64
+def llvm_v16i16_ty : LLVMType<v16i16>; // 16 x i16
def llvm_v2i32_ty : LLVMType<v2i32>; // 2 x i32
-def llvm_v1i64_ty : LLVMType<v1i64>; // 1 x i64
def llvm_v4i32_ty : LLVMType<v4i32>; // 4 x i32
+def llvm_v8i32_ty : LLVMType<v8i32>; // 8 x i32
+def llvm_v1i64_ty : LLVMType<v1i64>; // 1 x i64
+def llvm_v2i64_ty : LLVMType<v2i64>; // 2 x i64
+def llvm_v4i64_ty : LLVMType<v4i64>; // 4 x i64
+
def llvm_v2f32_ty : LLVMType<v2f32>; // 2 x float
+def llvm_v3f32_ty : LLVMType<v3f32>; // 3 x float
def llvm_v4f32_ty : LLVMType<v4f32>; // 4 x float
+def llvm_v8f32_ty : LLVMType<v8f32>; // 8 x float
def llvm_v2f64_ty : LLVMType<v2f64>; // 2 x double
-
-// MMX Vector Types
-def llvm_v8i8_ty : LLVMType<v8i8>; // 8 x i8
-def llvm_v4i16_ty : LLVMType<v4i16>; // 4 x i16
+def llvm_v4f64_ty : LLVMType<v4f64>; // 4 x double
def llvm_vararg_ty : LLVMType<isVoid>; // this means vararg here
+
//===----------------------------------------------------------------------===//
// Intrinsic Definitions.
//===----------------------------------------------------------------------===//
diff --git a/include/llvm/LLVMContext.h b/include/llvm/LLVMContext.h
new file mode 100644
index 0000000..efe12cc
--- /dev/null
+++ b/include/llvm/LLVMContext.h
@@ -0,0 +1,225 @@
+//===-- llvm/LLVMContext.h - Class for managing "global" state --*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// This file declares LLVMContext, a container of "global" state in LLVM, such
+// as the global type and constant uniquing tables.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_LLVMCONTEXT_H
+#define LLVM_LLVMCONTEXT_H
+
+#include "llvm/Support/DataTypes.h"
+#include <vector>
+#include <string>
+
+namespace llvm {
+
+class LLVMContextImpl;
+class Constant;
+class ConstantInt;
+class ConstantPointerNull;
+class ConstantStruct;
+class ConstantAggregateZero;
+class ConstantArray;
+class ConstantFP;
+class ConstantVector;
+class UndefValue;
+class MDNode;
+class MDString;
+class IntegerType;
+class PointerType;
+class StructType;
+class ArrayType;
+class VectorType;
+class OpaqueType;
+class FunctionType;
+class Type;
+class APInt;
+class APFloat;
+class Value;
+
+/// This is an important class for using LLVM in a threaded context. It
+/// (opaquely) owns and manages the core "global" data of LLVM's core
+/// infrastructure, including the type and constant uniquing tables.
+/// LLVMContext itself provides no locking guarantees, so you should be careful
+/// to have one context per thread.
+class LLVMContext {
+ LLVMContextImpl* pImpl;
+public:
+ LLVMContext();
+ ~LLVMContext();
+
+ // Constant accessors
+ Constant* getNullValue(const Type* Ty);
+ Constant* getAllOnesValue(const Type* Ty);
+
+ // UndefValue accessors
+ UndefValue* getUndef(const Type* Ty);
+
+ // ConstantInt accessors
+ ConstantInt* getConstantIntTrue();
+ ConstantInt* getConstantIntFalse();
+ Constant* getConstantInt(const Type* Ty, uint64_t V,
+ bool isSigned = false);
+ ConstantInt* getConstantInt(const IntegerType* Ty, uint64_t V,
+ bool isSigned = false);
+ ConstantInt* getConstantIntSigned(const IntegerType* Ty, int64_t V);
+ ConstantInt* getConstantInt(const APInt& V);
+ Constant* getConstantInt(const Type* Ty, const APInt& V);
+ ConstantInt* getConstantIntAllOnesValue(const Type* Ty);
+
+ // ConstantPointerNull accessors
+ ConstantPointerNull* getConstantPointerNull(const PointerType* T);
+
+ // ConstantStruct accessors
+ Constant* getConstantStruct(const StructType* T,
+ const std::vector<Constant*>& V);
+ Constant* getConstantStruct(const std::vector<Constant*>& V,
+ bool Packed = false);
+ Constant* getConstantStruct(Constant* const *Vals, unsigned NumVals,
+ bool Packed = false);
+
+ // ConstantAggregateZero accessors
+ ConstantAggregateZero* getConstantAggregateZero(const Type* Ty);
+
+ // ConstantArray accessors
+ Constant* getConstantArray(const ArrayType* T,
+ const std::vector<Constant*>& V);
+ Constant* getConstantArray(const ArrayType* T, Constant* const* Vals,
+ unsigned NumVals);
+ Constant* getConstantArray(const std::string& Initializer,
+ bool AddNull = false);
+
+ // ConstantExpr accessors
+ Constant* getConstantExpr(unsigned Opcode, Constant* C1, Constant* C2);
+ Constant* getConstantExprTrunc(Constant* C, const Type* Ty);
+ Constant* getConstantExprSExt(Constant* C, const Type* Ty);
+ Constant* getConstantExprZExt(Constant* C, const Type* Ty);
+ Constant* getConstantExprFPTrunc(Constant* C, const Type* Ty);
+ Constant* getConstantExprFPExtend(Constant* C, const Type* Ty);
+ Constant* getConstantExprUIToFP(Constant* C, const Type* Ty);
+ Constant* getConstantExprSIToFP(Constant* C, const Type* Ty);
+ Constant* getConstantExprFPToUI(Constant* C, const Type* Ty);
+ Constant* getConstantExprFPToSI(Constant* C, const Type* Ty);
+ Constant* getConstantExprPtrToInt(Constant* C, const Type* Ty);
+ Constant* getConstantExprIntToPtr(Constant* C, const Type* Ty);
+ Constant* getConstantExprBitCast(Constant* C, const Type* Ty);
+ Constant* getConstantExprCast(unsigned ops, Constant* C, const Type* Ty);
+ Constant* getConstantExprZExtOrBitCast(Constant* C, const Type* Ty);
+ Constant* getConstantExprSExtOrBitCast(Constant* C, const Type* Ty);
+ Constant* getConstantExprTruncOrBitCast(Constant* C, const Type* Ty);
+ Constant* getConstantExprPointerCast(Constant* C, const Type* Ty);
+ Constant* getConstantExprIntegerCast(Constant* C, const Type* Ty,
+ bool isSigned);
+ Constant* getConstantExprFPCast(Constant* C, const Type* Ty);
+ Constant* getConstantExprSelect(Constant* C, Constant* V1, Constant* V2);
+ Constant* getConstantExprAlignOf(const Type* Ty);
+ Constant* getConstantExprCompare(unsigned short pred,
+ Constant* C1, Constant* C2);
+ Constant* getConstantExprNeg(Constant* C);
+ Constant* getConstantExprFNeg(Constant* C);
+ Constant* getConstantExprNot(Constant* C);
+ Constant* getConstantExprAdd(Constant* C1, Constant* C2);
+ Constant* getConstantExprFAdd(Constant* C1, Constant* C2);
+ Constant* getConstantExprSub(Constant* C1, Constant* C2);
+ Constant* getConstantExprFSub(Constant* C1, Constant* C2);
+ Constant* getConstantExprMul(Constant* C1, Constant* C2);
+ Constant* getConstantExprFMul(Constant* C1, Constant* C2);
+ Constant* getConstantExprUDiv(Constant* C1, Constant* C2);
+ Constant* getConstantExprSDiv(Constant* C1, Constant* C2);
+ Constant* getConstantExprFDiv(Constant* C1, Constant* C2);
+ Constant* getConstantExprURem(Constant* C1, Constant* C2);
+ Constant* getConstantExprSRem(Constant* C1, Constant* C2);
+ Constant* getConstantExprFRem(Constant* C1, Constant* C2);
+ Constant* getConstantExprAnd(Constant* C1, Constant* C2);
+ Constant* getConstantExprOr(Constant* C1, Constant* C2);
+ Constant* getConstantExprXor(Constant* C1, Constant* C2);
+ Constant* getConstantExprICmp(unsigned short pred, Constant* LHS,
+ Constant* RHS);
+ Constant* getConstantExprFCmp(unsigned short pred, Constant* LHS,
+ Constant* RHS);
+ Constant* getConstantExprVICmp(unsigned short pred, Constant* LHS,
+ Constant* RHS);
+ Constant* getConstantExprVFCmp(unsigned short pred, Constant* LHS,
+ Constant* RHS);
+ Constant* getConstantExprShl(Constant* C1, Constant* C2);
+ Constant* getConstantExprLShr(Constant* C1, Constant* C2);
+ Constant* getConstantExprAShr(Constant* C1, Constant* C2);
+ Constant* getConstantExprGetElementPtr(Constant* C, Constant* const* IdxList,
+ unsigned NumIdx);
+ Constant* getConstantExprGetElementPtr(Constant* C, Value* const* IdxList,
+ unsigned NumIdx);
+ Constant* getConstantExprExtractElement(Constant* Vec, Constant* Idx);
+ Constant* getConstantExprInsertElement(Constant* Vec, Constant* Elt,
+ Constant* Idx);
+ Constant* getConstantExprShuffleVector(Constant* V1, Constant* V2,
+ Constant* Mask);
+ Constant* getConstantExprExtractValue(Constant* Agg, const unsigned* IdxList,
+ unsigned NumIdx);
+ Constant* getConstantExprInsertValue(Constant* Agg, Constant* Val,
+ const unsigned* IdxList,
+ unsigned NumIdx);
+ Constant* getZeroValueForNegation(const Type* Ty);
+
+ // ConstantFP accessors
+ ConstantFP* getConstantFP(const APFloat& V);
+ Constant* getConstantFP(const Type* Ty, double V);
+ ConstantFP* getConstantFPNegativeZero(const Type* Ty);
+
+ // ConstantVector accessors
+ Constant* getConstantVector(const VectorType* T,
+ const std::vector<Constant*>& V);
+ Constant* getConstantVector(const std::vector<Constant*>& V);
+ Constant* getConstantVector(Constant* const* Vals, unsigned NumVals);
+ ConstantVector* getConstantVectorAllOnesValue(const VectorType* Ty);
+
+ // MDNode accessors
+ MDNode* getMDNode(Value* const* Vals, unsigned NumVals);
+
+ // MDString accessors
+ MDString* getMDString(const char *StrBegin, const char *StrEnd);
+ MDString* getMDString(const std::string &Str);
+
+ // FunctionType accessors
+ FunctionType* getFunctionType(const Type* Result,
+ const std::vector<const Type*>& Params,
+ bool isVarArg);
+
+ // IntegerType accessors
+ const IntegerType* getIntegerType(unsigned NumBits);
+
+ // OpaqueType accessors
+ OpaqueType* getOpaqueType();
+
+ // StructType accessors
+ StructType* getStructType(bool isPacked=false);
+ StructType* getStructType(const std::vector<const Type*>& Params,
+ bool isPacked = false);
+
+ // ArrayType accessors
+ ArrayType* getArrayType(const Type* ElementType, uint64_t NumElements);
+
+ // PointerType accessors
+ PointerType* getPointerType(const Type* ElementType, unsigned AddressSpace);
+ PointerType* getPointerTypeUnqual(const Type* ElementType);
+
+ // VectorType accessors
+ VectorType* getVectorType(const Type* ElementType, unsigned NumElements);
+ VectorType* getVectorTypeInteger(const VectorType* VTy);
+ VectorType* getVectorTypeExtendedElement(const VectorType* VTy);
+ VectorType* getVectorTypeTruncatedElement(const VectorType* VTy);
+};
+
+/// FOR BACKWARDS COMPATIBILITY - Returns a global context.
+extern LLVMContext& getGlobalContext();
+
+}
+
+#endif
diff --git a/include/llvm/LinkAllPasses.h b/include/llvm/LinkAllPasses.h
index 22d6aeb..e199758 100644
--- a/include/llvm/LinkAllPasses.h
+++ b/include/llvm/LinkAllPasses.h
@@ -129,6 +129,7 @@ namespace {
(void) llvm::createPrintFunctionPass("", 0);
(void) llvm::createDbgInfoPrinterPass();
(void) llvm::createPartialInliningPass();
+ (void) llvm::createSSIPass();
(void)new llvm::IntervalPartition();
(void)new llvm::FindUsedTypes();
diff --git a/include/llvm/LinkAllVMCore.h b/include/llvm/LinkAllVMCore.h
index 4c428a0..e5a5197 100644
--- a/include/llvm/LinkAllVMCore.h
+++ b/include/llvm/LinkAllVMCore.h
@@ -16,6 +16,7 @@
#ifndef LLVM_LINKALLVMCORE_H
#define LLVM_LINKALLVMCORE_H
+#include "llvm/LLVMContext.h"
#include "llvm/Module.h"
#include "llvm/Instructions.h"
#include "llvm/IntrinsicInst.h"
@@ -44,7 +45,7 @@ namespace {
// to know that getenv() never returns -1, this will do the job.
if (std::getenv("bar") != (char*) -1)
return;
- llvm::Module* M = new llvm::Module("");
+ llvm::Module* M = new llvm::Module("", llvm::getGlobalContext());
(void)new llvm::UnreachableInst();
(void) llvm::createVerifierPass();
(void) new llvm::Mangler(*M,"");
diff --git a/include/llvm/Linker.h b/include/llvm/Linker.h
index 884e872..2d0c2cd 100644
--- a/include/llvm/Linker.h
+++ b/include/llvm/Linker.h
@@ -21,6 +21,7 @@
namespace llvm {
class Module;
+class LLVMContext;
/// This class provides the core functionality of linking in LLVM. It retains a
/// Module object which is the composite of the modules and libraries linked
@@ -66,6 +67,7 @@ class Linker {
Linker(
const std::string& progname, ///< name of tool running linker
const std::string& modulename, ///< name of linker's end-result module
+ LLVMContext& C, ///< Context for global info
unsigned Flags = 0 ///< ControlFlags (one or more |'d together)
);
@@ -283,6 +285,7 @@ class Linker {
/// @name Data
/// @{
private:
+ LLVMContext& Context; ///< The context for global information
Module* Composite; ///< The composite module linked together
std::vector<sys::Path> LibPaths; ///< The library search paths
unsigned Flags; ///< Flags to control optional behavior.
diff --git a/include/llvm/MC/MCContext.h b/include/llvm/MC/MCContext.h
index 13180e8..846e195 100644
--- a/include/llvm/MC/MCContext.h
+++ b/include/llvm/MC/MCContext.h
@@ -31,6 +31,8 @@ namespace llvm {
StringMap<MCSymbol*> Symbols;
/// SymbolValues - Bindings of symbols to values.
+ //
+ // FIXME: Is there a good reason to not just put this in the MCSymbol?
DenseMap<MCSymbol*, MCValue> SymbolValues;
/// Allocator - Allocator object used for creating machine code objects.
diff --git a/include/llvm/MC/MCInst.h b/include/llvm/MC/MCInst.h
index 3108985..8b638d4 100644
--- a/include/llvm/MC/MCInst.h
+++ b/include/llvm/MC/MCInst.h
@@ -31,7 +31,7 @@ class MCOperand {
kRegister, ///< Register operand.
kImmediate, ///< Immediate operand.
kMBBLabel, ///< Basic block label.
- kMCValue
+ kMCValue ///< Relocatable immediate operand.
};
unsigned char Kind;
@@ -49,9 +49,11 @@ public:
MCOperand() : Kind(kInvalid) {}
MCOperand(const MCOperand &RHS) { *this = RHS; }
+ bool isValid() const { return Kind != kInvalid; }
bool isReg() const { return Kind == kRegister; }
bool isImm() const { return Kind == kImmediate; }
bool isMBBLabel() const { return Kind == kMBBLabel; }
+ bool isMCValue() const { return Kind == kMCValue; }
/// getReg - Returns the register number.
unsigned getReg() const {
@@ -82,6 +84,15 @@ public:
assert(isMBBLabel() && "Wrong accessor");
return MBBLabel.BlockNo;
}
+
+ const MCValue &getMCValue() const {
+ assert(isMCValue() && "This is not an MCValue");
+ return MCValueVal;
+ }
+ void setMCValue(const MCValue &Val) {
+ assert(isMCValue() && "This is not an MCValue");
+ MCValueVal = Val;
+ }
void MakeReg(unsigned Reg) {
Kind = kRegister;
@@ -96,6 +107,10 @@ public:
MBBLabel.FunctionNo = Fn;
MBBLabel.BlockNo = MBB;
}
+ void MakeMCValue(const MCValue &Val) {
+ Kind = kMCValue;
+ MCValueVal = Val;
+ }
};
@@ -119,7 +134,6 @@ public:
void addOperand(const MCOperand &Op) {
Operands.push_back(Op);
}
-
};
diff --git a/include/llvm/MC/MCSection.h b/include/llvm/MC/MCSection.h
index 341f7f0..1b127b5 100644
--- a/include/llvm/MC/MCSection.h
+++ b/include/llvm/MC/MCSection.h
@@ -6,6 +6,10 @@
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
+//
+// This file declares the MCSection class.
+//
+//===----------------------------------------------------------------------===//
#ifndef LLVM_MC_MCSECTION_H
#define LLVM_MC_MCSECTION_H
@@ -14,11 +18,18 @@
namespace llvm {
+ /// MCSection - Instances of this class represent a uniqued identifier for a
+ /// section in the current translation unit. The MCContext class uniques and
+ /// creates these.
class MCSection {
std::string Name;
-
- public:
+ private:
+ friend class MCContext;
MCSection(const char *_Name) : Name(_Name) {}
+
+ MCSection(const MCSection&); // DO NOT IMPLEMENT
+ void operator=(const MCSection&); // DO NOT IMPLEMENT
+ public:
const std::string &getName() const { return Name; }
};
diff --git a/include/llvm/MC/MCStreamer.h b/include/llvm/MC/MCStreamer.h
index bb85d2d..54de8a3 100644
--- a/include/llvm/MC/MCStreamer.h
+++ b/include/llvm/MC/MCStreamer.h
@@ -6,6 +6,10 @@
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
+//
+// This file declares the MCStreamer class.
+//
+//===----------------------------------------------------------------------===//
#ifndef LLVM_MC_MCSTREAMER_H
#define LLVM_MC_MCSTREAMER_H
@@ -20,7 +24,15 @@ namespace llvm {
class MCSymbol;
class raw_ostream;
- /// MCStreamer - Streaming machine code generation interface.
+ /// MCStreamer - Streaming machine code generation interface. This interface
+ /// is intended to provide a programatic interface that is very similar to the
+ /// level that an assembler .s file provides. It has callbacks to emit bytes,
+ /// "emit directives", etc. The implementation of this interface retains
+ /// state to know what the current section is etc.
+ ///
+ /// There are multiple implementations of this interface: one for writing out
+ /// a .s file, and implementations that write out .o files of various formats.
+ ///
class MCStreamer {
public:
enum SymbolAttr {
@@ -135,7 +147,7 @@ namespace llvm {
/// This used to implement the .align assembler directive.
///
/// @param ByteAlignment - The alignment to reach. This must be a power of
- /// two.
+ /// two on some targets.
/// @param Value - The value to use when filling bytes.
/// @param Size - The size of the integer (in bytes) to emit for @param
/// Value. This must match a native machine width.
diff --git a/include/llvm/MC/MCSymbol.h b/include/llvm/MC/MCSymbol.h
index 06f50ae..235e661 100644
--- a/include/llvm/MC/MCSymbol.h
+++ b/include/llvm/MC/MCSymbol.h
@@ -6,6 +6,10 @@
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
+//
+// This file contains the declaration of the MCSymbol class.
+//
+//===----------------------------------------------------------------------===//
#ifndef LLVM_MC_MCSYMBOL_H
#define LLVM_MC_MCSYMBOL_H
@@ -13,18 +17,48 @@
#include <string>
namespace llvm {
+ class MCSection;
+ class MCContext;
+
+ /// MCSymbol - Instances of this class represent a symbol name in the MC file,
+ /// and MCSymbols are created and unique'd by the MCContext class.
+ ///
+ /// If the symbol is defined/emitted into the current translation unit, the
+ /// Section member is set to indicate what section it lives in. Otherwise, if
+ /// it is a reference to an external entity, it has a null section.
+ ///
class MCSymbol {
- MCSection *Section;
+ /// Name - The name of the symbol.
std::string Name;
+ /// Section - The section the symbol is defined in, or null if the symbol
+ /// has not been defined in the associated translation unit.
+ MCSection *Section;
+
+ /// IsTemporary - True if this is an assembler temporary label, which
+ /// typically does not survive in the .o file's symbol table. Usually
+ /// "Lfoo" or ".foo".
unsigned IsTemporary : 1;
+
+ /// IsExternal - True if this symbol has been implicitly defined as an
+ /// external, for example by using it in an expression without ever emitting
+ /// it as a label. The @var Section for an external symbol is always null.
+ unsigned IsExternal : 1;
- public:
+ private: // MCContext creates and uniques these.
+ friend class MCContext;
MCSymbol(const char *_Name, bool _IsTemporary)
- : Section(0), Name(_Name), IsTemporary(_IsTemporary) {}
-
+ : Name(_Name), Section(0), IsTemporary(_IsTemporary), IsExternal(false) {}
+
+ MCSymbol(const MCSymbol&); // DO NOT IMPLEMENT
+ void operator=(const MCSymbol&); // DO NOT IMPLEMENT
+ public:
+
MCSection *getSection() const { return Section; }
void setSection(MCSection *Value) { Section = Value; }
+ bool isExternal() const { return IsExternal; }
+ void setExternal(bool Value) { IsExternal = Value; }
+
const std::string &getName() const { return Name; }
};
diff --git a/include/llvm/MC/MCValue.h b/include/llvm/MC/MCValue.h
index 7df12da..d032f17 100644
--- a/include/llvm/MC/MCValue.h
+++ b/include/llvm/MC/MCValue.h
@@ -15,6 +15,8 @@
#define LLVM_MC_MCVALUE_H
#include "llvm/Support/DataTypes.h"
+#include "llvm/MC/MCSymbol.h"
+#include <cassert>
namespace llvm {
class MCSymbol;
@@ -23,6 +25,10 @@ class MCSymbol;
/// form, this can hold "SymbolA - SymbolB + imm64". Not all targets supports
/// relocations of this general form, but we need to represent this anyway.
///
+/// In the general form, SymbolB can only be defined if SymbolA is, and both
+/// must be in the same (non-external) section. The latter constraint is not
+/// enforced, since a symbol's section may not be known at construction.
+///
/// Note that this class must remain a simple POD value class, because we need
/// it to live in unions etc.
class MCValue {
@@ -30,13 +36,25 @@ class MCValue {
int64_t Cst;
public:
- int64_t getCst() const { return Cst; }
+ int64_t getConstant() const { return Cst; }
MCSymbol *getSymA() const { return SymA; }
MCSymbol *getSymB() const { return SymB; }
-
-
+
+ /// isAbsolute - Is this an absolute (as opposed to relocatable) value.
+ bool isAbsolute() const { return !SymA && !SymB; }
+
+ /// getAssociatedSection - For relocatable values, return the section the
+ /// value is associated with.
+ ///
+ /// @result - The value's associated section, or null for external or constant
+ /// values.
+ MCSection *getAssociatedSection() const {
+ return SymA ? SymA->getSection() : 0;
+ }
+
static MCValue get(MCSymbol *SymA, MCSymbol *SymB = 0, int64_t Val = 0) {
MCValue R;
+ assert((!SymB || SymA) && "Invalid relocatable MCValue!");
R.Cst = Val;
R.SymA = SymA;
R.SymB = SymB;
diff --git a/include/llvm/Module.h b/include/llvm/Module.h
index 9c8607a..7a139cc 100644
--- a/include/llvm/Module.h
+++ b/include/llvm/Module.h
@@ -25,6 +25,7 @@ namespace llvm {
class GlobalValueRefMap; // Used by ConstantVals.cpp
class FunctionType;
+class LLVMContext;
template<> struct ilist_traits<Function>
: public SymbolTableListTraits<Function, Module> {
@@ -109,6 +110,8 @@ public:
/// @name Member Variables
/// @{
private:
+ LLVMContext& Context; ///< The LLVMContext from which types and
+ ///< constants are allocated.
GlobalListType GlobalList; ///< The Global Variables in the module
FunctionListType FunctionList; ///< The Functions in the module
AliasListType AliasList; ///< The Aliases in the module
@@ -128,7 +131,7 @@ private:
public:
/// The Module constructor. Note that there is no default constructor. You
/// must provide a name for the module upon construction.
- explicit Module(const std::string &ModuleID);
+ explicit Module(const std::string &ModuleID, LLVMContext& C);
/// The module destructor. This will dropAllReferences.
~Module();
@@ -157,6 +160,10 @@ public:
/// @returns PointerSize - an enumeration for the size of the target's pointer
PointerSize getPointerSize() const;
+ /// Get the global data context.
+ /// @returns LLVMContext - a container for LLVM's global information
+ LLVMContext& getContext() const { return Context; }
+
/// Get any module-scope inline assembly blocks.
/// @returns a string containing the module-scope inline assembly blocks.
const std::string &getModuleInlineAsm() const { return GlobalScopeAsm; }
diff --git a/include/llvm/Pass.h b/include/llvm/Pass.h
index 923de65..eea99e0 100644
--- a/include/llvm/Pass.h
+++ b/include/llvm/Pass.h
@@ -29,6 +29,7 @@
#ifndef LLVM_PASS_H
#define LLVM_PASS_H
+#include "llvm/Module.h"
#include "llvm/Support/DataTypes.h"
#include "llvm/Support/Streams.h"
#include <cassert>
@@ -47,6 +48,7 @@ class ImmutablePass;
class PMStack;
class AnalysisResolver;
class PMDataManager;
+class LLVMContext;
// AnalysisID - Use the PassInfo to identify a pass...
typedef const PassInfo* AnalysisID;
@@ -75,6 +77,10 @@ class Pass {
void operator=(const Pass&); // DO NOT IMPLEMENT
Pass(const Pass &); // DO NOT IMPLEMENT
+
+protected:
+ LLVMContext* Context;
+
public:
explicit Pass(intptr_t pid) : Resolver(0), PassID(pid) {
assert(pid && "pid cannot be 0");
@@ -275,7 +281,10 @@ public:
/// doInitialization - Virtual method overridden by subclasses to do
/// any necessary per-module initialization.
///
- virtual bool doInitialization(Module &) { return false; }
+ virtual bool doInitialization(Module &M) {
+ Context = &M.getContext();
+ return false;
+ }
/// runOnFunction - Virtual method overriden by subclasses to do the
/// per-function processing of the pass.
@@ -327,7 +336,10 @@ public:
/// doInitialization - Virtual method overridden by subclasses to do
/// any necessary per-module initialization.
///
- virtual bool doInitialization(Module &) { return false; }
+ virtual bool doInitialization(Module &M) {
+ Context = &M.getContext();
+ return false;
+ }
/// doInitialization - Virtual method overridden by BasicBlockPass subclasses
/// to do any necessary per-function initialization.
diff --git a/include/llvm/Support/SourceMgr.h b/include/llvm/Support/SourceMgr.h
index 25775cb..7c8a139 100644
--- a/include/llvm/Support/SourceMgr.h
+++ b/include/llvm/Support/SourceMgr.h
@@ -7,9 +7,9 @@
//
//===----------------------------------------------------------------------===//
//
-// This file declares the SourceMgr class. This class is used as a simple
-// substrate for diagnostics, #include handling, and other low level things for
-// simple parsers.
+// This file declares the SMLoc, SMDiagnostic and SourceMgr classes. This
+// provides a simple substrate for diagnostics, #include handling, and other low
+// level things for simple parsers.
//
//===----------------------------------------------------------------------===//
@@ -23,6 +23,8 @@
namespace llvm {
class MemoryBuffer;
class SourceMgr;
+ class SMDiagnostic;
+ class raw_ostream;
class SMLoc {
const char *Ptr;
@@ -30,6 +32,8 @@ public:
SMLoc() : Ptr(0) {}
SMLoc(const SMLoc &RHS) : Ptr(RHS.Ptr) {}
+ bool isValid() const { return Ptr != 0; }
+
bool operator==(const SMLoc &RHS) const { return RHS.Ptr == Ptr; }
bool operator!=(const SMLoc &RHS) const { return RHS.Ptr != Ptr; }
@@ -42,8 +46,8 @@ public:
}
};
-/// SourceMgr - This owns the files read by tblgen, handles include stacks,
-/// and handles printing of diagnostics.
+/// SourceMgr - This owns the files read by a parser, handles include stacks,
+/// and handles diagnostic wrangling.
class SourceMgr {
struct SrcBuffer {
/// Buffer - The memory buffer for the file.
@@ -109,10 +113,51 @@ public:
/// PrintMessage - Emit a message about the specified location with the
/// specified string.
- void PrintMessage(SMLoc Loc, const std::string &Msg) const;
+ ///
+ /// @param Type - If non-null, the kind of message (e.g., "error") which is
+ /// prefixed to the message.
+ void PrintMessage(SMLoc Loc, const std::string &Msg, const char *Type) const;
+
+
+ /// GetMessage - Return an SMDiagnostic at the specified location with the
+ /// specified string.
+ ///
+ /// @param Type - If non-null, the kind of message (e.g., "error") which is
+ /// prefixed to the message.
+ SMDiagnostic GetMessage(SMLoc Loc,
+ const std::string &Msg, const char *Type) const;
+
private:
- void PrintIncludeStack(SMLoc IncludeLoc) const;
+ void PrintIncludeStack(SMLoc IncludeLoc, raw_ostream &OS) const;
+};
+
+
+/// SMDiagnostic - Instances of this class encapsulate one diagnostic report,
+/// allowing printing to a raw_ostream as a caret diagnostic.
+class SMDiagnostic {
+ std::string Filename;
+ int LineNo, ColumnNo;
+ std::string Message, LineContents;
+public:
+ SMDiagnostic() : LineNo(0), ColumnNo(0) {}
+ SMDiagnostic(const std::string &FN, int Line, int Col,
+ const std::string &Msg, const std::string &LineStr)
+ : Filename(FN), LineNo(Line), ColumnNo(Col), Message(Msg),
+ LineContents(LineStr) {}
+ SMDiagnostic(const SMDiagnostic &RHS) {
+ operator=(RHS);
+ }
+
+ void operator=(const SMDiagnostic &E) {
+ Filename = E.Filename;
+ LineNo = E.LineNo;
+ ColumnNo = E.ColumnNo;
+ Message = E.Message;
+ LineContents = E.LineContents;
+ }
+
+ void Print(const char *ProgName, raw_ostream &S);
};
} // end llvm namespace
diff --git a/include/llvm/Support/TypeBuilder.h b/include/llvm/Support/TypeBuilder.h
index 5198c81..b0ae516 100644
--- a/include/llvm/Support/TypeBuilder.h
+++ b/include/llvm/Support/TypeBuilder.h
@@ -253,8 +253,7 @@ public:
private:
static const FunctionType *create() {
- std::vector<const Type*> params;
- return FunctionType::get(TypeBuilder<R, cross>::get(), params, false);
+ return FunctionType::get(TypeBuilder<R, cross>::get(), false);
}
};
template<typename R, typename A1, bool cross> class TypeBuilder<R(A1), cross> {
@@ -360,8 +359,7 @@ public:
private:
static const FunctionType *create() {
- std::vector<const Type*> params;
- return FunctionType::get(TypeBuilder<R, cross>::get(), params, true);
+ return FunctionType::get(TypeBuilder<R, cross>::get(), true);
}
};
template<typename R, typename A1, bool cross>
diff --git a/include/llvm/System/Errno.h b/include/llvm/System/Errno.h
new file mode 100644
index 0000000..6e292ba
--- /dev/null
+++ b/include/llvm/System/Errno.h
@@ -0,0 +1,34 @@
+//===- llvm/System/Errno.h - Portable+convenient errno handling -*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// This file declares some portable and convenient functions to deal with errno.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_SYSTEM_ERRNO_H
+#define LLVM_SYSTEM_ERRNO_H
+
+#include <string>
+
+namespace llvm {
+namespace sys {
+
+/// Returns a string representation of the errno value, using whatever
+/// thread-safe variant of strerror() is available. Be sure to call this
+/// immediately after the function that set errno, or errno may have been
+/// overwritten by an intervening call.
+std::string StrError();
+
+/// Like the no-argument version above, but uses \p errnum instead of errno.
+std::string StrError(int errnum);
+
+} // namespace sys
+} // namespace llvm
+
+#endif // LLVM_SYSTEM_ERRNO_H
diff --git a/include/llvm/Target/TargetCallingConv.td b/include/llvm/Target/TargetCallingConv.td
index 224c08e..da3cbd2 100644
--- a/include/llvm/Target/TargetCallingConv.td
+++ b/include/llvm/Target/TargetCallingConv.td
@@ -54,6 +54,10 @@ class CCIfInReg<CCAction A> : CCIf<"ArgFlags.isInReg()", A> {}
/// the specified action.
class CCIfNest<CCAction A> : CCIf<"ArgFlags.isNest()", A> {}
+/// CCIfSplit - If this argument is marked with the 'split' attribute, apply
+/// the specified action.
+class CCIfSplit<CCAction A> : CCIf<"ArgFlags.isSplit()", A> {}
+
/// CCIfNotVarArg - If the current function is not vararg - apply the action
class CCIfNotVarArg<CCAction A> : CCIf<"!State.isVarArg()", A> {}
diff --git a/include/llvm/Target/TargetELFWriterInfo.h b/include/llvm/Target/TargetELFWriterInfo.h
index c1f54d2..a5b30c4 100644
--- a/include/llvm/Target/TargetELFWriterInfo.h
+++ b/include/llvm/Target/TargetELFWriterInfo.h
@@ -89,10 +89,6 @@ namespace llvm {
: (hasRelocationAddend() ? 12 : 8);
}
- /// getFunctionAlignment - Returns the alignment for function 'F', targets
- /// with different alignment constraints should overload this method
- virtual unsigned getFunctionAlignment(const Function *F) const;
-
/// getRelocationType - Returns the target specific ELF Relocation type.
/// 'MachineRelTy' contains the object code independent relocation type
virtual unsigned getRelocationType(unsigned MachineRelTy) const = 0;
diff --git a/include/llvm/Target/TargetLowering.h b/include/llvm/Target/TargetLowering.h
index 02451c2..d24ca67 100644
--- a/include/llvm/Target/TargetLowering.h
+++ b/include/llvm/Target/TargetLowering.h
@@ -256,7 +256,7 @@ public:
return getTypeAction(NVT) == Promote ? getTypeToTransformTo(NVT) : NVT;
}
assert(0 && "Unsupported extended type!");
- return MVT(); // Not reached
+ return MVT(MVT::Other); // Not reached
}
/// getTypeToExpandTo - For types supported by the target, this is an
@@ -557,7 +557,7 @@ public:
return getRegisterType(getTypeToTransformTo(VT));
}
assert(0 && "Unsupported extended type!");
- return MVT(); // Not reached
+ return MVT(MVT::Other); // Not reached
}
/// getNumRegisters - Return the number of registers that this ValueType will
@@ -736,6 +736,9 @@ public:
/// PIC relocation models.
virtual bool isOffsetFoldingLegal(const GlobalAddressSDNode *GA) const;
+ /// getFunctionAlignment - Return the Log2 alignment of this function.
+ virtual unsigned getFunctionAlignment(const Function *) const = 0;
+
//===--------------------------------------------------------------------===//
// TargetLowering Optimization Methods
//
@@ -1119,9 +1122,9 @@ public:
typedef std::vector<ArgListEntry> ArgListTy;
virtual std::pair<SDValue, SDValue>
LowerCallTo(SDValue Chain, const Type *RetTy, bool RetSExt, bool RetZExt,
- bool isVarArg, bool isInreg, unsigned CallingConv,
- bool isTailCall, SDValue Callee, ArgListTy &Args,
- SelectionDAG &DAG, DebugLoc dl);
+ bool isVarArg, bool isInreg, unsigned NumFixedArgs,
+ unsigned CallingConv, bool isTailCall, SDValue Callee,
+ ArgListTy &Args, SelectionDAG &DAG, DebugLoc dl);
/// EmitTargetCodeForMemcpy - Emit target-specific code that performs a
/// memcpy. This can be used by targets to provide code sequences for cases
diff --git a/include/llvm/Transforms/Scalar.h b/include/llvm/Transforms/Scalar.h
index 971baee..29cd3e3 100644
--- a/include/llvm/Transforms/Scalar.h
+++ b/include/llvm/Transforms/Scalar.h
@@ -337,6 +337,12 @@ FunctionPass *createCodeGenPreparePass(const TargetLowering *TLI = 0);
FunctionPass *createInstructionNamerPass();
extern const PassInfo *const InstructionNamerID;
+//===----------------------------------------------------------------------===//
+//
+// SSI - This pass converts to Static Single Information form.
+//
+FunctionPass *createSSIPass();
+
} // End llvm namespace
#endif
diff --git a/include/llvm/Transforms/Utils/Cloning.h b/include/llvm/Transforms/Utils/Cloning.h
index 1e2bbaa..840d970 100644
--- a/include/llvm/Transforms/Utils/Cloning.h
+++ b/include/llvm/Transforms/Utils/Cloning.h
@@ -37,6 +37,7 @@ class Trace;
class CallGraph;
class TargetData;
class LoopInfo;
+class LLVMContext;
template<class N> class LoopBase;
typedef LoopBase<BasicBlock> Loop;
diff --git a/include/llvm/Transforms/Utils/Local.h b/include/llvm/Transforms/Utils/Local.h
index 98a68f6..dd423fa 100644
--- a/include/llvm/Transforms/Utils/Local.h
+++ b/include/llvm/Transforms/Utils/Local.h
@@ -19,6 +19,7 @@ namespace llvm {
class User;
class BasicBlock;
+class BranchInst;
class Instruction;
class Value;
class Pass;
@@ -94,6 +95,12 @@ void MergeBasicBlockIntoOnlyPred(BasicBlock *BB);
///
bool SimplifyCFG(BasicBlock *BB);
+/// FoldBranchToCommonDest - If this basic block is ONLY a setcc and a branch,
+/// and if a predecessor branches to us and one of our successors, fold the
+/// setcc into the predecessor and use logical operations to pick the right
+/// destination.
+bool FoldBranchToCommonDest(BranchInst *BI);
+
/// DemoteRegToStack - This function takes a virtual register computed by an
/// Instruction and replaces it with a slot in the stack frame, allocated via
/// alloca. This allows the CFG to be changed around without fear of
diff --git a/include/llvm/Transforms/Utils/SSI.h b/include/llvm/Transforms/Utils/SSI.h
new file mode 100644
index 0000000..59dd6d0
--- /dev/null
+++ b/include/llvm/Transforms/Utils/SSI.h
@@ -0,0 +1,102 @@
+//===------------------- SSI.h - Creates SSI Representation -----*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// This pass converts a list of variables to the Static Single Information
+// form. This is a program representation described by Scott Ananian in his
+// Master Thesis: "The Static Single Information Form (1999)".
+// We are building an on-demand representation, that is, we do not convert
+// every single variable in the target function to SSI form. Rather, we receive
+// a list of target variables that must be converted. We also do not
+// completely convert a target variable to the SSI format. Instead, we only
+// change the variable in the points where new information can be attached
+// to its live range, that is, at branch points.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_TRANSFORMS_UTILS_SSI_H
+#define LLVM_TRANSFORMS_UTILS_SSI_H
+
+#include "llvm/Pass.h"
+#include "llvm/ADT/BitVector.h"
+#include "llvm/ADT/DenseMap.h"
+#include "llvm/ADT/SmallPtrSet.h"
+#include "llvm/ADT/SmallVector.h"
+
+namespace llvm {
+
+ class DominatorTree;
+ class PHINode;
+ class Instruction;
+ class CmpInst;
+
+ class SSI : public FunctionPass {
+ public:
+ static char ID; // Pass identification, replacement for typeid.
+ SSI() :
+ FunctionPass(&ID) {
+ }
+
+ void getAnalysisUsage(AnalysisUsage &AU) const;
+
+ /// runOnMachineFunction - pass entry point
+ bool runOnFunction(Function&);
+
+ void createSSI(SmallVectorImpl<Instruction *> &value);
+
+ private:
+ // Variables always live
+ DominatorTree *DT_;
+
+ // Stores variables created by SSI
+ SmallPtrSet<Instruction *, 16> created;
+
+ // These variables are only live for each creation
+ unsigned num_values;
+
+ // Has a bit for each variable, true if it needs to be created
+ // and false otherwise
+ BitVector needConstruction;
+
+ // Phis created by SSI
+ DenseMap<PHINode *, unsigned> phis;
+
+ // Sigmas created by SSI
+ DenseMap<PHINode *, unsigned> sigmas;
+
+ // Phi nodes that have a phi as operand and has to be fixed
+ SmallPtrSet<PHINode *, 1> phisToFix;
+
+ // List of definition points for every variable
+ SmallVector<SmallVector<BasicBlock *, 1>, 0> defsites;
+
+ // Basic Block of the original definition of each variable
+ SmallVector<BasicBlock *, 0> value_original;
+
+ // Stack of last seen definition of a variable
+ SmallVector<SmallVector<Instruction *, 1>, 0> value_stack;
+
+ void insertSigmaFunctions(SmallVectorImpl<Instruction *> &value);
+ void insertPhiFunctions(SmallVectorImpl<Instruction *> &value);
+ void renameInit(SmallVectorImpl<Instruction *> &value);
+ void rename(BasicBlock *BB);
+
+ void substituteUse(Instruction *I);
+ bool dominateAny(BasicBlock *BB, Instruction *value);
+ void fixPhis();
+
+ unsigned getPositionPhi(PHINode *PN);
+ unsigned getPositionSigma(PHINode *PN);
+
+ unsigned isUsedInTerminator(CmpInst *CI);
+
+ void init(SmallVectorImpl<Instruction *> &value);
+ void clean();
+ };
+} // end namespace
+#endif
OpenPOWER on IntegriCloud