summaryrefslogtreecommitdiffstats
path: root/include/llvm/CodeGen
diff options
context:
space:
mode:
authorrdivacky <rdivacky@FreeBSD.org>2010-01-01 10:31:22 +0000
committerrdivacky <rdivacky@FreeBSD.org>2010-01-01 10:31:22 +0000
commita16c51cee9225a354c999dd1076d5dba2aa79807 (patch)
treedba00119388b84f9f44e6ec5e9129f807fd79ca3 /include/llvm/CodeGen
parent40a6fcdb85efd93fe0e36c9552cfb0b18b5eacd6 (diff)
downloadFreeBSD-src-a16c51cee9225a354c999dd1076d5dba2aa79807.zip
FreeBSD-src-a16c51cee9225a354c999dd1076d5dba2aa79807.tar.gz
Update LLVM to 92395.
Diffstat (limited to 'include/llvm/CodeGen')
-rw-r--r--include/llvm/CodeGen/JITCodeEmitter.h28
-rw-r--r--include/llvm/CodeGen/MachineCodeEmitter.h61
-rw-r--r--include/llvm/CodeGen/MachineModuleInfo.h1
-rw-r--r--include/llvm/CodeGen/MachinePassRegistry.h4
-rw-r--r--include/llvm/CodeGen/SelectionDAG.h64
-rw-r--r--include/llvm/CodeGen/SelectionDAGNodes.h15
-rw-r--r--include/llvm/CodeGen/SlotIndexes.h6
-rw-r--r--include/llvm/CodeGen/ValueTypes.h20
8 files changed, 74 insertions, 125 deletions
diff --git a/include/llvm/CodeGen/JITCodeEmitter.h b/include/llvm/CodeGen/JITCodeEmitter.h
index ea3e59b..9c4e5b9 100644
--- a/include/llvm/CodeGen/JITCodeEmitter.h
+++ b/include/llvm/CodeGen/JITCodeEmitter.h
@@ -68,29 +68,11 @@ public:
///
virtual bool finishFunction(MachineFunction &F) = 0;
- /// startGVStub - This callback is invoked when the JIT needs the address of a
- /// GV (e.g. function) that has not been code generated yet. The StubSize
- /// specifies the total size required by the stub. The BufferState must be
- /// passed to finishGVStub, and start/finish pairs with the same BufferState
- /// must be properly nested.
- ///
- virtual void startGVStub(BufferState &BS, const GlobalValue* GV,
- unsigned StubSize, unsigned Alignment = 1) = 0;
-
- /// startGVStub - This callback is invoked when the JIT needs the address of a
- /// GV (e.g. function) that has not been code generated yet. Buffer points to
- /// memory already allocated for this stub. The BufferState must be passed to
- /// finishGVStub, and start/finish pairs with the same BufferState must be
- /// properly nested.
- ///
- virtual void startGVStub(BufferState &BS, void *Buffer,
- unsigned StubSize) = 0;
-
- /// finishGVStub - This callback is invoked to terminate a GV stub and returns
- /// the start address of the stub. The BufferState must first have been
- /// passed to startGVStub.
- ///
- virtual void *finishGVStub(BufferState &BS) = 0;
+ /// allocIndirectGV - Allocates and fills storage for an indirect
+ /// GlobalValue, and returns the address.
+ virtual void *allocIndirectGV(const GlobalValue *GV,
+ const uint8_t *Buffer, size_t Size,
+ unsigned Alignment) = 0;
/// emitByte - This callback is invoked when a byte needs to be written to the
/// output stream.
diff --git a/include/llvm/CodeGen/MachineCodeEmitter.h b/include/llvm/CodeGen/MachineCodeEmitter.h
index 791db00..d598a93 100644
--- a/include/llvm/CodeGen/MachineCodeEmitter.h
+++ b/include/llvm/CodeGen/MachineCodeEmitter.h
@@ -48,41 +48,16 @@ class Function;
/// occurred, more memory is allocated, and we reemit the code into it.
///
class MachineCodeEmitter {
-public:
- class BufferState {
- friend class MachineCodeEmitter;
- /// BufferBegin/BufferEnd - Pointers to the start and end of the memory
- /// allocated for this code buffer.
- uint8_t *BufferBegin, *BufferEnd;
-
- /// CurBufferPtr - Pointer to the next byte of memory to fill when emitting
- /// code. This is guranteed to be in the range [BufferBegin,BufferEnd]. If
- /// this pointer is at BufferEnd, it will never move due to code emission,
- /// and all code emission requests will be ignored (this is the buffer
- /// overflow condition).
- uint8_t *CurBufferPtr;
- public:
- BufferState() : BufferBegin(NULL), BufferEnd(NULL), CurBufferPtr(NULL) {}
- };
-
protected:
- /// These have the same meanings as the fields in BufferState
- uint8_t *BufferBegin, *BufferEnd, *CurBufferPtr;
-
- /// Save or restore the current buffer state. The BufferState objects must be
- /// used as a stack.
- void SaveStateTo(BufferState &BS) {
- assert(BS.BufferBegin == NULL &&
- "Can't save state into the same BufferState twice.");
- BS.BufferBegin = BufferBegin;
- BS.BufferEnd = BufferEnd;
- BS.CurBufferPtr = CurBufferPtr;
- }
- void RestoreStateFrom(BufferState &BS) {
- BufferBegin = BS.BufferBegin;
- BufferEnd = BS.BufferEnd;
- CurBufferPtr = BS.CurBufferPtr;
- }
+ /// BufferBegin/BufferEnd - Pointers to the start and end of the memory
+ /// allocated for this code buffer.
+ uint8_t *BufferBegin, *BufferEnd;
+ /// CurBufferPtr - Pointer to the next byte of memory to fill when emitting
+ /// code. This is guranteed to be in the range [BufferBegin,BufferEnd]. If
+ /// this pointer is at BufferEnd, it will never move due to code emission, and
+ /// all code emission requests will be ignored (this is the buffer overflow
+ /// condition).
+ uint8_t *CurBufferPtr;
public:
virtual ~MachineCodeEmitter() {}
@@ -113,15 +88,23 @@ public:
///
void emitWordLE(uint32_t W) {
if (4 <= BufferEnd-CurBufferPtr) {
- *CurBufferPtr++ = (uint8_t)(W >> 0);
- *CurBufferPtr++ = (uint8_t)(W >> 8);
- *CurBufferPtr++ = (uint8_t)(W >> 16);
- *CurBufferPtr++ = (uint8_t)(W >> 24);
+ emitWordLEInto(CurBufferPtr, W);
} else {
CurBufferPtr = BufferEnd;
}
}
-
+
+ /// emitWordLEInto - This callback is invoked when a 32-bit word needs to be
+ /// written to an arbitrary buffer in little-endian format. Buf must have at
+ /// least 4 bytes of available space.
+ ///
+ static void emitWordLEInto(uint8_t *&Buf, uint32_t W) {
+ *Buf++ = (uint8_t)(W >> 0);
+ *Buf++ = (uint8_t)(W >> 8);
+ *Buf++ = (uint8_t)(W >> 16);
+ *Buf++ = (uint8_t)(W >> 24);
+ }
+
/// emitWordBE - This callback is invoked when a 32-bit word needs to be
/// written to the output stream in big-endian format.
///
diff --git a/include/llvm/CodeGen/MachineModuleInfo.h b/include/llvm/CodeGen/MachineModuleInfo.h
index bac9fce..e9b645b 100644
--- a/include/llvm/CodeGen/MachineModuleInfo.h
+++ b/include/llvm/CodeGen/MachineModuleInfo.h
@@ -43,6 +43,7 @@
#include "llvm/GlobalValue.h"
#include "llvm/Pass.h"
#include "llvm/Metadata.h"
+#include "llvm/Support/ValueHandle.h"
namespace llvm {
diff --git a/include/llvm/CodeGen/MachinePassRegistry.h b/include/llvm/CodeGen/MachinePassRegistry.h
index 680d2b8..6ee2e90 100644
--- a/include/llvm/CodeGen/MachinePassRegistry.h
+++ b/include/llvm/CodeGen/MachinePassRegistry.h
@@ -129,9 +129,9 @@ public:
// Add existing passes to option.
for (RegistryClass *Node = RegistryClass::getList();
Node; Node = Node->getNext()) {
- addLiteralOption(Node->getName(),
+ this->addLiteralOption(Node->getName(),
(typename RegistryClass::FunctionPassCtor)Node->getCtor(),
- Node->getDescription());
+ Node->getDescription());
}
// Make sure we listen for list changes.
diff --git a/include/llvm/CodeGen/SelectionDAG.h b/include/llvm/CodeGen/SelectionDAG.h
index c09c634..d55dd7f 100644
--- a/include/llvm/CodeGen/SelectionDAG.h
+++ b/include/llvm/CodeGen/SelectionDAG.h
@@ -29,12 +29,13 @@
namespace llvm {
class AliasAnalysis;
-class TargetLowering;
-class MachineModuleInfo;
class DwarfWriter;
-class MachineFunction;
-class MachineConstantPoolValue;
class FunctionLoweringInfo;
+class MachineConstantPoolValue;
+class MachineFunction;
+class MachineModuleInfo;
+class SDNodeOrdering;
+class TargetLowering;
template<> struct ilist_traits<SDNode> : public ilist_default_traits<SDNode> {
private:
@@ -110,45 +111,9 @@ class SelectionDAG {
/// SelectionDAG.
BumpPtrAllocator Allocator;
- /// NodeOrdering - Assigns a "line number" value to each SDNode that
- /// corresponds to the "line number" of the original LLVM instruction. This
- /// used for turning off scheduling, because we'll forgo the normal scheduling
- /// algorithm and output the instructions according to this ordering.
- class NodeOrdering {
- /// LineNo - The line of the instruction the node corresponds to. A value of
- /// `0' means it's not assigned.
- unsigned LineNo;
- std::map<const SDNode*, unsigned> Order;
-
- void operator=(const NodeOrdering&); // Do not implement.
- NodeOrdering(const NodeOrdering&); // Do not implement.
- public:
- NodeOrdering() : LineNo(0) {}
-
- void add(const SDNode *Node) {
- assert(LineNo && "Invalid line number!");
- Order[Node] = LineNo;
- }
- void remove(const SDNode *Node) {
- std::map<const SDNode*, unsigned>::iterator Itr = Order.find(Node);
- if (Itr != Order.end())
- Order.erase(Itr);
- }
- void clear() {
- Order.clear();
- LineNo = 1;
- }
- unsigned getLineNo(const SDNode *Node) {
- unsigned LN = Order[Node];
- assert(LN && "Node isn't in ordering map!");
- return LN;
- }
- void newInst() {
- ++LineNo;
- }
-
- void dump() const;
- } *Ordering;
+ /// SDNodeOrdering - The ordering of the SDNodes. It roughly corresponds to
+ /// the ordering of the original LLVM instructions.
+ SDNodeOrdering *Ordering;
/// VerifyNode - Sanity check the given node. Aborts if it is invalid.
void VerifyNode(SDNode *N);
@@ -242,13 +207,6 @@ public:
return Root = N;
}
- /// NewInst - Tell the ordering object that we're processing a new
- /// instruction.
- void NewInst() {
- if (Ordering)
- Ordering->newInst();
- }
-
/// Combine - This iterates over the nodes in the SelectionDAG, folding
/// certain types of nodes together, or eliminating superfluous nodes. The
/// Level argument controls whether Combine is allowed to produce nodes and
@@ -873,6 +831,12 @@ public:
}
}
+ /// AssignOrdering - Assign an order to the SDNode.
+ void AssignOrdering(SDNode *SD, unsigned Order);
+
+ /// GetOrdering - Get the order for the SDNode.
+ unsigned GetOrdering(const SDNode *SD) const;
+
void dump() const;
/// CreateStackTemporary - Create a stack temporary, suitable for holding the
diff --git a/include/llvm/CodeGen/SelectionDAGNodes.h b/include/llvm/CodeGen/SelectionDAGNodes.h
index 571db47..7b1931a 100644
--- a/include/llvm/CodeGen/SelectionDAGNodes.h
+++ b/include/llvm/CodeGen/SelectionDAGNodes.h
@@ -414,12 +414,13 @@ namespace ISD {
/// X = FP_EXTEND(Y) - Extend a smaller FP type into a larger FP type.
FP_EXTEND,
- // BIT_CONVERT - Theis operator converts between integer and FP values, as
- // if one was stored to memory as integer and the other was loaded from the
- // same address (or equivalently for vector format conversions, etc). The
- // source and result are required to have the same bit size (e.g.
- // f32 <-> i32). This can also be used for int-to-int or fp-to-fp
- // conversions, but that is a noop, deleted by getNode().
+ // BIT_CONVERT - This operator converts between integer, vector and FP
+ // values, as if the value was stored to memory with one type and loaded
+ // from the same address with the other type (or equivalently for vector
+ // format conversions, etc). The source and result are required to have
+ // the same bit size (e.g. f32 <-> i32). This can also be used for
+ // int-to-int or fp-to-fp conversions, but that is a noop, deleted by
+ // getNode().
BIT_CONVERT,
// CONVERT_RNDSAT - This operator is used to support various conversions
@@ -1227,7 +1228,7 @@ public:
SDVTList getVTList() const {
SDVTList X = { ValueList, NumValues };
return X;
- };
+ }
/// getFlaggedNode - If this node has a flag operand, return the node
/// to which the flag operand points. Otherwise return NULL.
diff --git a/include/llvm/CodeGen/SlotIndexes.h b/include/llvm/CodeGen/SlotIndexes.h
index 9a85ee1..163642a 100644
--- a/include/llvm/CodeGen/SlotIndexes.h
+++ b/include/llvm/CodeGen/SlotIndexes.h
@@ -176,7 +176,7 @@ namespace llvm {
// Construct a new slot index from the given one, set the phi flag on the
// new index to the value of the phi parameter.
SlotIndex(const SlotIndex &li, bool phi)
- : lie(&li.entry(), phi ? PHI_BIT & li.getSlot() : (unsigned)li.getSlot()){
+ : lie(&li.entry(), phi ? PHI_BIT | li.getSlot() : (unsigned)li.getSlot()){
assert(lie.getPointer() != 0 &&
"Attempt to construct index with 0 pointer.");
}
@@ -184,7 +184,7 @@ namespace llvm {
// Construct a new slot index from the given one, set the phi flag on the
// new index to the value of the phi parameter, and the slot to the new slot.
SlotIndex(const SlotIndex &li, bool phi, Slot s)
- : lie(&li.entry(), phi ? PHI_BIT & s : (unsigned)s) {
+ : lie(&li.entry(), phi ? PHI_BIT | s : (unsigned)s) {
assert(lie.getPointer() != 0 &&
"Attempt to construct index with 0 pointer.");
}
@@ -579,7 +579,7 @@ namespace llvm {
(I == idx2MBBMap.end() && idx2MBBMap.size()>0)) ? (I-1): I;
assert(J != idx2MBBMap.end() && J->first <= index &&
- index <= getMBBEndIdx(J->second) &&
+ index < getMBBEndIdx(J->second) &&
"index does not correspond to an MBB");
return J->second;
}
diff --git a/include/llvm/CodeGen/ValueTypes.h b/include/llvm/CodeGen/ValueTypes.h
index 06e07f3..9dc4c7b 100644
--- a/include/llvm/CodeGen/ValueTypes.h
+++ b/include/llvm/CodeGen/ValueTypes.h
@@ -589,7 +589,25 @@ namespace llvm {
return getIntegerVT(Context, 1 << Log2_32_Ceil(BitWidth));
}
- /// isPow2VectorType - Retuns true if the given vector is a power of 2.
+ /// getHalfSizedIntegerVT - Finds the smallest simple value type that is
+ /// greater than or equal to half the width of this EVT. If no simple
+ /// value type can be found, an extended integer value type of half the
+ /// size (rounded up) is returned.
+ EVT getHalfSizedIntegerVT(LLVMContext &Context) const {
+ assert(isInteger() && !isVector() && "Invalid integer type!");
+ unsigned EVTSize = getSizeInBits();
+ for (unsigned IntVT = MVT::FIRST_INTEGER_VALUETYPE;
+ IntVT <= MVT::LAST_INTEGER_VALUETYPE;
+ ++IntVT) {
+ EVT HalfVT = EVT((MVT::SimpleValueType)IntVT);
+ if(HalfVT.getSizeInBits() * 2 >= EVTSize) {
+ return HalfVT;
+ }
+ }
+ return getIntegerVT(Context, (EVTSize + 1) / 2);
+ }
+
+ /// isPow2VectorType - Returns true if the given vector is a power of 2.
bool isPow2VectorType() const {
unsigned NElts = getVectorNumElements();
return !(NElts & (NElts - 1));
OpenPOWER on IntegriCloud