summaryrefslogtreecommitdiffstats
path: root/include/llvm
diff options
context:
space:
mode:
Diffstat (limited to 'include/llvm')
-rw-r--r--include/llvm/Analysis/Dominators.h9
-rw-r--r--include/llvm/Analysis/ScalarEvolutionExpander.h7
-rw-r--r--include/llvm/Attributes.h6
-rw-r--r--include/llvm/CodeGen/JITCodeEmitter.h66
-rw-r--r--include/llvm/CodeGen/MachineCodeEmitter.h70
-rw-r--r--include/llvm/Config/config.h.cmake10
-rw-r--r--include/llvm/Constants.h4
-rw-r--r--include/llvm/ExecutionEngine/JITMemoryManager.h26
-rw-r--r--include/llvm/InstrTypes.h13
-rw-r--r--include/llvm/Instruction.def113
-rw-r--r--include/llvm/Support/ConstantFolder.h12
-rw-r--r--include/llvm/Support/IRBuilder.h18
-rw-r--r--include/llvm/Support/NoFolder.h9
-rw-r--r--include/llvm/Support/PatternMatch.h47
-rw-r--r--include/llvm/Support/StandardPasses.h10
-rw-r--r--include/llvm/Support/TargetFolder.h12
-rw-r--r--include/llvm/Support/raw_ostream.h31
-rw-r--r--include/llvm/System/Process.h28
-rw-r--r--include/llvm/Target/TargetELFWriterInfo.h18
-rw-r--r--include/llvm/Target/TargetLowering.h13
-rw-r--r--include/llvm/Target/TargetOptions.h10
21 files changed, 353 insertions, 179 deletions
diff --git a/include/llvm/Analysis/Dominators.h b/include/llvm/Analysis/Dominators.h
index b405f5b..347e239 100644
--- a/include/llvm/Analysis/Dominators.h
+++ b/include/llvm/Analysis/Dominators.h
@@ -270,12 +270,17 @@ protected:
NewBBIDom = PredBlocks[i];
break;
}
- assert(i != PredBlocks.size() && "No reachable preds?");
+
+ // It's possible that none of the predecessors of NewBB are reachable;
+ // in that case, NewBB itself is unreachable, so nothing needs to be
+ // changed.
+ if (!NewBBIDom)
+ return;
+
for (i = i + 1; i < PredBlocks.size(); ++i) {
if (DT.isReachableFromEntry(PredBlocks[i]))
NewBBIDom = DT.findNearestCommonDominator(NewBBIDom, PredBlocks[i]);
}
- assert(NewBBIDom && "No immediate dominator found??");
// Create the new dominator tree node... and set the idom of NewBB.
DomTreeNodeBase<NodeT> *NewBBNode = DT.addNewBlock(NewBB, NewBBIDom);
diff --git a/include/llvm/Analysis/ScalarEvolutionExpander.h b/include/llvm/Analysis/ScalarEvolutionExpander.h
index 7e0de47..b40fbf0 100644
--- a/include/llvm/Analysis/ScalarEvolutionExpander.h
+++ b/include/llvm/Analysis/ScalarEvolutionExpander.h
@@ -60,12 +60,7 @@ namespace llvm {
/// canonical induction variable of the specified type for the specified
/// loop (inserting one if there is none). A canonical induction variable
/// starts at zero and steps by one on each iteration.
- Value *getOrInsertCanonicalInductionVariable(const Loop *L, const Type *Ty){
- assert(Ty->isInteger() && "Can only insert integer induction variables!");
- SCEVHandle H = SE.getAddRecExpr(SE.getIntegerSCEV(0, Ty),
- SE.getIntegerSCEV(1, Ty), L);
- return expand(H);
- }
+ Value *getOrInsertCanonicalInductionVariable(const Loop *L, const Type *Ty);
/// addInsertedValue - Remember the specified instruction as being the
/// canonical form for the specified SCEV.
diff --git a/include/llvm/Attributes.h b/include/llvm/Attributes.h
index 972dbfa..a594e32 100644
--- a/include/llvm/Attributes.h
+++ b/include/llvm/Attributes.h
@@ -54,13 +54,17 @@ const Attributes Alignment = 31<<16; ///< Alignment of parameter (5 bits)
// stored as log2 of alignment with +1 bias
// 0 means unaligned different from align 1
const Attributes NoCapture = 1<<21; ///< Function creates no aliases of pointer
+const Attributes NoRedZone = 1<<22; /// disable redzone
+const Attributes NoImplicitFloat = 1<<23; /// disable implicit floating point
+ /// instructions.
/// @brief Attributes that only apply to function parameters.
const Attributes ParameterOnly = ByVal | Nest | StructRet | NoCapture;
/// @brief Attributes that only apply to function.
const Attributes FunctionOnly = NoReturn | NoUnwind | ReadNone | ReadOnly |
- NoInline | AlwaysInline | OptimizeForSize | StackProtect | StackProtectReq;
+ NoInline | AlwaysInline | OptimizeForSize | StackProtect | StackProtectReq |
+ NoRedZone | NoImplicitFloat;
/// @brief Parameter attributes that do not apply to vararg call arguments.
const Attributes VarArgsIncompatible = StructRet;
diff --git a/include/llvm/CodeGen/JITCodeEmitter.h b/include/llvm/CodeGen/JITCodeEmitter.h
index 81a7c60..bf6b76e 100644
--- a/include/llvm/CodeGen/JITCodeEmitter.h
+++ b/include/llvm/CodeGen/JITCodeEmitter.h
@@ -89,7 +89,7 @@ public:
/// emitByte - This callback is invoked when a byte needs to be written to the
/// output stream.
///
- void emitByte(unsigned char B) {
+ void emitByte(uint8_t B) {
if (CurBufferPtr != BufferEnd)
*CurBufferPtr++ = B;
}
@@ -99,10 +99,10 @@ public:
///
void emitWordLE(unsigned W) {
if (4 <= BufferEnd-CurBufferPtr) {
- *CurBufferPtr++ = (unsigned char)(W >> 0);
- *CurBufferPtr++ = (unsigned char)(W >> 8);
- *CurBufferPtr++ = (unsigned char)(W >> 16);
- *CurBufferPtr++ = (unsigned char)(W >> 24);
+ *CurBufferPtr++ = (uint8_t)(W >> 0);
+ *CurBufferPtr++ = (uint8_t)(W >> 8);
+ *CurBufferPtr++ = (uint8_t)(W >> 16);
+ *CurBufferPtr++ = (uint8_t)(W >> 24);
} else {
CurBufferPtr = BufferEnd;
}
@@ -113,10 +113,10 @@ public:
///
void emitWordBE(unsigned W) {
if (4 <= BufferEnd-CurBufferPtr) {
- *CurBufferPtr++ = (unsigned char)(W >> 24);
- *CurBufferPtr++ = (unsigned char)(W >> 16);
- *CurBufferPtr++ = (unsigned char)(W >> 8);
- *CurBufferPtr++ = (unsigned char)(W >> 0);
+ *CurBufferPtr++ = (uint8_t)(W >> 24);
+ *CurBufferPtr++ = (uint8_t)(W >> 16);
+ *CurBufferPtr++ = (uint8_t)(W >> 8);
+ *CurBufferPtr++ = (uint8_t)(W >> 0);
} else {
CurBufferPtr = BufferEnd;
}
@@ -127,14 +127,14 @@ public:
///
void emitDWordLE(uint64_t W) {
if (8 <= BufferEnd-CurBufferPtr) {
- *CurBufferPtr++ = (unsigned char)(W >> 0);
- *CurBufferPtr++ = (unsigned char)(W >> 8);
- *CurBufferPtr++ = (unsigned char)(W >> 16);
- *CurBufferPtr++ = (unsigned char)(W >> 24);
- *CurBufferPtr++ = (unsigned char)(W >> 32);
- *CurBufferPtr++ = (unsigned char)(W >> 40);
- *CurBufferPtr++ = (unsigned char)(W >> 48);
- *CurBufferPtr++ = (unsigned char)(W >> 56);
+ *CurBufferPtr++ = (uint8_t)(W >> 0);
+ *CurBufferPtr++ = (uint8_t)(W >> 8);
+ *CurBufferPtr++ = (uint8_t)(W >> 16);
+ *CurBufferPtr++ = (uint8_t)(W >> 24);
+ *CurBufferPtr++ = (uint8_t)(W >> 32);
+ *CurBufferPtr++ = (uint8_t)(W >> 40);
+ *CurBufferPtr++ = (uint8_t)(W >> 48);
+ *CurBufferPtr++ = (uint8_t)(W >> 56);
} else {
CurBufferPtr = BufferEnd;
}
@@ -145,14 +145,14 @@ public:
///
void emitDWordBE(uint64_t W) {
if (8 <= BufferEnd-CurBufferPtr) {
- *CurBufferPtr++ = (unsigned char)(W >> 56);
- *CurBufferPtr++ = (unsigned char)(W >> 48);
- *CurBufferPtr++ = (unsigned char)(W >> 40);
- *CurBufferPtr++ = (unsigned char)(W >> 32);
- *CurBufferPtr++ = (unsigned char)(W >> 24);
- *CurBufferPtr++ = (unsigned char)(W >> 16);
- *CurBufferPtr++ = (unsigned char)(W >> 8);
- *CurBufferPtr++ = (unsigned char)(W >> 0);
+ *CurBufferPtr++ = (uint8_t)(W >> 56);
+ *CurBufferPtr++ = (uint8_t)(W >> 48);
+ *CurBufferPtr++ = (uint8_t)(W >> 40);
+ *CurBufferPtr++ = (uint8_t)(W >> 32);
+ *CurBufferPtr++ = (uint8_t)(W >> 24);
+ *CurBufferPtr++ = (uint8_t)(W >> 16);
+ *CurBufferPtr++ = (uint8_t)(W >> 8);
+ *CurBufferPtr++ = (uint8_t)(W >> 0);
} else {
CurBufferPtr = BufferEnd;
}
@@ -166,8 +166,8 @@ public:
if(Alignment <= (uintptr_t)(BufferEnd-CurBufferPtr)) {
// Move the current buffer ptr up to the specified alignment.
CurBufferPtr =
- (unsigned char*)(((uintptr_t)CurBufferPtr+Alignment-1) &
- ~(uintptr_t)(Alignment-1));
+ (uint8_t*)(((uintptr_t)CurBufferPtr+Alignment-1) &
+ ~(uintptr_t)(Alignment-1));
} else {
CurBufferPtr = BufferEnd;
}
@@ -178,7 +178,7 @@ public:
/// written to the output stream.
void emitULEB128Bytes(unsigned Value) {
do {
- unsigned char Byte = Value & 0x7f;
+ uint8_t Byte = Value & 0x7f;
Value >>= 7;
if (Value) Byte |= 0x80;
emitByte(Byte);
@@ -187,12 +187,12 @@ public:
/// emitSLEB128Bytes - This callback is invoked when a SLEB128 needs to be
/// written to the output stream.
- void emitSLEB128Bytes(int Value) {
- int Sign = Value >> (8 * sizeof(Value) - 1);
+ void emitSLEB128Bytes(int32_t Value) {
+ int32_t Sign = Value >> (8 * sizeof(Value) - 1);
bool IsMore;
do {
- unsigned char Byte = Value & 0x7f;
+ uint8_t Byte = Value & 0x7f;
Value >>= 7;
IsMore = Value != Sign || ((Byte ^ Sign) & 0x40) != 0;
if (IsMore) Byte |= 0x80;
@@ -205,14 +205,14 @@ public:
void emitString(const std::string &String) {
for (unsigned i = 0, N = static_cast<unsigned>(String.size());
i < N; ++i) {
- unsigned char C = String[i];
+ uint8_t C = String[i];
emitByte(C);
}
emitByte(0);
}
/// emitInt32 - Emit a int32 directive.
- void emitInt32(int Value) {
+ void emitInt32(int32_t Value) {
if (4 <= BufferEnd-CurBufferPtr) {
*((uint32_t*)CurBufferPtr) = Value;
CurBufferPtr += 4;
diff --git a/include/llvm/CodeGen/MachineCodeEmitter.h b/include/llvm/CodeGen/MachineCodeEmitter.h
index 226c4c2..aaa41a4 100644
--- a/include/llvm/CodeGen/MachineCodeEmitter.h
+++ b/include/llvm/CodeGen/MachineCodeEmitter.h
@@ -50,14 +50,14 @@ class MachineCodeEmitter {
protected:
/// BufferBegin/BufferEnd - Pointers to the start and end of the memory
/// allocated for this code buffer.
- unsigned char *BufferBegin, *BufferEnd;
+ 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).
- unsigned char *CurBufferPtr;
+ uint8_t *CurBufferPtr;
public:
virtual ~MachineCodeEmitter() {}
@@ -96,7 +96,7 @@ public:
/// emitByte - This callback is invoked when a byte needs to be written to the
/// output stream.
///
- void emitByte(unsigned char B) {
+ void emitByte(uint8_t B) {
if (CurBufferPtr != BufferEnd)
*CurBufferPtr++ = B;
}
@@ -106,10 +106,10 @@ public:
///
void emitWordLE(unsigned W) {
if (4 <= BufferEnd-CurBufferPtr) {
- *CurBufferPtr++ = (unsigned char)(W >> 0);
- *CurBufferPtr++ = (unsigned char)(W >> 8);
- *CurBufferPtr++ = (unsigned char)(W >> 16);
- *CurBufferPtr++ = (unsigned char)(W >> 24);
+ *CurBufferPtr++ = (uint8_t)(W >> 0);
+ *CurBufferPtr++ = (uint8_t)(W >> 8);
+ *CurBufferPtr++ = (uint8_t)(W >> 16);
+ *CurBufferPtr++ = (uint8_t)(W >> 24);
} else {
CurBufferPtr = BufferEnd;
}
@@ -120,10 +120,10 @@ public:
///
void emitWordBE(unsigned W) {
if (4 <= BufferEnd-CurBufferPtr) {
- *CurBufferPtr++ = (unsigned char)(W >> 24);
- *CurBufferPtr++ = (unsigned char)(W >> 16);
- *CurBufferPtr++ = (unsigned char)(W >> 8);
- *CurBufferPtr++ = (unsigned char)(W >> 0);
+ *CurBufferPtr++ = (uint8_t)(W >> 24);
+ *CurBufferPtr++ = (uint8_t)(W >> 16);
+ *CurBufferPtr++ = (uint8_t)(W >> 8);
+ *CurBufferPtr++ = (uint8_t)(W >> 0);
} else {
CurBufferPtr = BufferEnd;
}
@@ -134,14 +134,14 @@ public:
///
void emitDWordLE(uint64_t W) {
if (8 <= BufferEnd-CurBufferPtr) {
- *CurBufferPtr++ = (unsigned char)(W >> 0);
- *CurBufferPtr++ = (unsigned char)(W >> 8);
- *CurBufferPtr++ = (unsigned char)(W >> 16);
- *CurBufferPtr++ = (unsigned char)(W >> 24);
- *CurBufferPtr++ = (unsigned char)(W >> 32);
- *CurBufferPtr++ = (unsigned char)(W >> 40);
- *CurBufferPtr++ = (unsigned char)(W >> 48);
- *CurBufferPtr++ = (unsigned char)(W >> 56);
+ *CurBufferPtr++ = (uint8_t)(W >> 0);
+ *CurBufferPtr++ = (uint8_t)(W >> 8);
+ *CurBufferPtr++ = (uint8_t)(W >> 16);
+ *CurBufferPtr++ = (uint8_t)(W >> 24);
+ *CurBufferPtr++ = (uint8_t)(W >> 32);
+ *CurBufferPtr++ = (uint8_t)(W >> 40);
+ *CurBufferPtr++ = (uint8_t)(W >> 48);
+ *CurBufferPtr++ = (uint8_t)(W >> 56);
} else {
CurBufferPtr = BufferEnd;
}
@@ -152,14 +152,14 @@ public:
///
void emitDWordBE(uint64_t W) {
if (8 <= BufferEnd-CurBufferPtr) {
- *CurBufferPtr++ = (unsigned char)(W >> 56);
- *CurBufferPtr++ = (unsigned char)(W >> 48);
- *CurBufferPtr++ = (unsigned char)(W >> 40);
- *CurBufferPtr++ = (unsigned char)(W >> 32);
- *CurBufferPtr++ = (unsigned char)(W >> 24);
- *CurBufferPtr++ = (unsigned char)(W >> 16);
- *CurBufferPtr++ = (unsigned char)(W >> 8);
- *CurBufferPtr++ = (unsigned char)(W >> 0);
+ *CurBufferPtr++ = (uint8_t)(W >> 56);
+ *CurBufferPtr++ = (uint8_t)(W >> 48);
+ *CurBufferPtr++ = (uint8_t)(W >> 40);
+ *CurBufferPtr++ = (uint8_t)(W >> 32);
+ *CurBufferPtr++ = (uint8_t)(W >> 24);
+ *CurBufferPtr++ = (uint8_t)(W >> 16);
+ *CurBufferPtr++ = (uint8_t)(W >> 8);
+ *CurBufferPtr++ = (uint8_t)(W >> 0);
} else {
CurBufferPtr = BufferEnd;
}
@@ -173,8 +173,8 @@ public:
if(Alignment <= (uintptr_t)(BufferEnd-CurBufferPtr)) {
// Move the current buffer ptr up to the specified alignment.
CurBufferPtr =
- (unsigned char*)(((uintptr_t)CurBufferPtr+Alignment-1) &
- ~(uintptr_t)(Alignment-1));
+ (uint8_t*)(((uintptr_t)CurBufferPtr+Alignment-1) &
+ ~(uintptr_t)(Alignment-1));
} else {
CurBufferPtr = BufferEnd;
}
@@ -185,7 +185,7 @@ public:
/// written to the output stream.
void emitULEB128Bytes(unsigned Value) {
do {
- unsigned char Byte = Value & 0x7f;
+ uint8_t Byte = Value & 0x7f;
Value >>= 7;
if (Value) Byte |= 0x80;
emitByte(Byte);
@@ -194,12 +194,12 @@ public:
/// emitSLEB128Bytes - This callback is invoked when a SLEB128 needs to be
/// written to the output stream.
- void emitSLEB128Bytes(int Value) {
- int Sign = Value >> (8 * sizeof(Value) - 1);
+ void emitSLEB128Bytes(int32_t Value) {
+ int32_t Sign = Value >> (8 * sizeof(Value) - 1);
bool IsMore;
do {
- unsigned char Byte = Value & 0x7f;
+ uint8_t Byte = Value & 0x7f;
Value >>= 7;
IsMore = Value != Sign || ((Byte ^ Sign) & 0x40) != 0;
if (IsMore) Byte |= 0x80;
@@ -212,14 +212,14 @@ public:
void emitString(const std::string &String) {
for (unsigned i = 0, N = static_cast<unsigned>(String.size());
i < N; ++i) {
- unsigned char C = String[i];
+ uint8_t C = String[i];
emitByte(C);
}
emitByte(0);
}
/// emitInt32 - Emit a int32 directive.
- void emitInt32(int Value) {
+ void emitInt32(int32_t Value) {
if (4 <= BufferEnd-CurBufferPtr) {
*((uint32_t*)CurBufferPtr) = Value;
CurBufferPtr += 4;
diff --git a/include/llvm/Config/config.h.cmake b/include/llvm/Config/config.h.cmake
index caabf07..33e2e00 100644
--- a/include/llvm/Config/config.h.cmake
+++ b/include/llvm/Config/config.h.cmake
@@ -18,17 +18,17 @@
#undef ENABLE_CBE_PRINTF_A
/* Define if position independent code is enabled */
-#undef ENABLE_PIC
+#cmakedefine ENABLE_PIC ${ENABLE_PIC}
/* Define if threads enabled */
#cmakedefine ENABLE_THREADS ${ENABLE_THREADS}
/* Define to 1 if you have `alloca', as a function or macro. */
-#undef HAVE_ALLOCA
+#cmakedefine HAVE_ALLOCA ${HAVE_ALLOCA}
/* Define to 1 if you have <alloca.h> and it should be used (not on Ultrix).
*/
-#undef HAVE_ALLOCA_H
+#cmakedefine HAVE_ALLOCA_H ${HAVE_ALLOCA_H}
/* Define to 1 if you have the `argz_append' function. */
#undef HAVE_ARGZ_APPEND
@@ -228,7 +228,7 @@
#cmakedefine HAVE_MALLOC_MALLOC_H ${HAVE_MALLOC_MALLOC_H}
/* Define to 1 if you have the `malloc_zone_statistics' function. */
-#undef HAVE_MALLOC_ZONE_STATISTICS
+#cmakedefine HAVE_MALLOC_ZONE_STATISTICS ${HAVE_MALLOC_ZONE_STATISTICS}
/* Define to 1 if you have the `memcpy' function. */
#undef HAVE_MEMCPY
@@ -414,7 +414,7 @@
#cmakedefine HAVE_SYS_TYPES_H ${HAVE_SYS_TYPES_H}
/* Define to 1 if you have <sys/wait.h> that is POSIX.1 compatible. */
-#undef HAVE_SYS_WAIT_H
+#cmakedefine HAVE_SYS_WAIT_H ${HAVE_SYS_WAIT_H}
/* Define to 1 if the system has the type `uint64_t'. */
#undef HAVE_UINT64_T
diff --git a/include/llvm/Constants.h b/include/llvm/Constants.h
index 9e95a08..ed0fe27 100644
--- a/include/llvm/Constants.h
+++ b/include/llvm/Constants.h
@@ -704,10 +704,14 @@ public:
/// specify the full Instruction::OPCODE identifier.
///
static Constant *getNeg(Constant *C);
+ static Constant *getFNeg(Constant *C);
static Constant *getNot(Constant *C);
static Constant *getAdd(Constant *C1, Constant *C2);
+ static Constant *getFAdd(Constant *C1, Constant *C2);
static Constant *getSub(Constant *C1, Constant *C2);
+ static Constant *getFSub(Constant *C1, Constant *C2);
static Constant *getMul(Constant *C1, Constant *C2);
+ static Constant *getFMul(Constant *C1, Constant *C2);
static Constant *getUDiv(Constant *C1, Constant *C2);
static Constant *getSDiv(Constant *C1, Constant *C2);
static Constant *getFDiv(Constant *C1, Constant *C2);
diff --git a/include/llvm/ExecutionEngine/JITMemoryManager.h b/include/llvm/ExecutionEngine/JITMemoryManager.h
index 581300e..688a162 100644
--- a/include/llvm/ExecutionEngine/JITMemoryManager.h
+++ b/include/llvm/ExecutionEngine/JITMemoryManager.h
@@ -60,7 +60,7 @@ public:
/// getGOTBase - If this is managing a Global Offset Table, this method should
/// return a pointer to its base.
- virtual unsigned char *getGOTBase() const = 0;
+ virtual uint8_t *getGOTBase() const = 0;
/// SetDlsymTable - If the JIT must be able to relocate stubs after they have
/// been emitted, potentially because they are being copied to a process
@@ -89,8 +89,8 @@ public:
/// emit the function, so it doesn't pass in the size. Instead, this method
/// is required to pass back a "valid size". The JIT will be careful to not
/// write more than the returned ActualSize bytes of memory.
- virtual unsigned char *startFunctionBody(const Function *F,
- uintptr_t &ActualSize) = 0;
+ virtual uint8_t *startFunctionBody(const Function *F,
+ uintptr_t &ActualSize) = 0;
/// allocateStub - This method is called by the JIT to allocate space for a
/// function stub (used to handle limited branch displacements) while it is
@@ -100,9 +100,8 @@ public:
/// thunk for it. The stub should be "close" to the current function body,
/// but should not be included in the 'actualsize' returned by
/// startFunctionBody.
- virtual unsigned char *allocateStub(const GlobalValue* F, unsigned StubSize,
- unsigned Alignment) =0;
-
+ virtual uint8_t *allocateStub(const GlobalValue* F, unsigned StubSize,
+ unsigned Alignment) = 0;
/// endFunctionBody - This method is called when the JIT is done codegen'ing
/// the specified function. At this point we know the size of the JIT
@@ -110,11 +109,11 @@ public:
/// the startFunctionBody method) and FunctionEnd which is a pointer to the
/// actual end of the function. This method should mark the space allocated
/// and remember where it is in case the client wants to deallocate it.
- virtual void endFunctionBody(const Function *F, unsigned char *FunctionStart,
- unsigned char *FunctionEnd) = 0;
+ virtual void endFunctionBody(const Function *F, uint8_t *FunctionStart,
+ uint8_t *FunctionEnd) = 0;
/// allocateSpace - Allocate a memory block of the given size.
- virtual unsigned char *allocateSpace(intptr_t Size, unsigned Alignment) = 0;
+ virtual uint8_t *allocateSpace(intptr_t Size, unsigned Alignment) = 0;
/// deallocateMemForFunction - Free JIT memory for the specified function.
/// This is never called when the JIT is currently emitting a function.
@@ -122,14 +121,13 @@ public:
/// startExceptionTable - When we finished JITing the function, if exception
/// handling is set, we emit the exception table.
- virtual unsigned char* startExceptionTable(const Function* F,
- uintptr_t &ActualSize) = 0;
+ virtual uint8_t* startExceptionTable(const Function* F,
+ uintptr_t &ActualSize) = 0;
/// endExceptionTable - This method is called when the JIT is done emitting
/// the exception table.
- virtual void endExceptionTable(const Function *F, unsigned char *TableStart,
- unsigned char *TableEnd,
- unsigned char* FrameRegister) = 0;
+ virtual void endExceptionTable(const Function *F, uint8_t *TableStart,
+ uint8_t *TableEnd, uint8_t* FrameRegister) = 0;
};
} // end namespace llvm.
diff --git a/include/llvm/InstrTypes.h b/include/llvm/InstrTypes.h
index 3a774d4..1eab983 100644
--- a/include/llvm/InstrTypes.h
+++ b/include/llvm/InstrTypes.h
@@ -204,21 +204,30 @@ public:
Instruction *InsertBefore = 0);
static BinaryOperator *CreateNeg(Value *Op, const std::string &Name,
BasicBlock *InsertAtEnd);
+ static BinaryOperator *CreateFNeg(Value *Op, const std::string &Name = "",
+ Instruction *InsertBefore = 0);
+ static BinaryOperator *CreateFNeg(Value *Op, const std::string &Name,
+ BasicBlock *InsertAtEnd);
static BinaryOperator *CreateNot(Value *Op, const std::string &Name = "",
Instruction *InsertBefore = 0);
static BinaryOperator *CreateNot(Value *Op, const std::string &Name,
BasicBlock *InsertAtEnd);
- /// isNeg, isNot - Check if the given Value is a NEG or NOT instruction.
+ /// isNeg, isFNeg, isNot - Check if the given Value is a
+ /// NEG, FNeg, or NOT instruction.
///
static bool isNeg(const Value *V);
+ static bool isFNeg(const Value *V);
static bool isNot(const Value *V);
/// getNegArgument, getNotArgument - Helper functions to extract the
- /// unary argument of a NEG or NOT operation implemented via Sub or Xor.
+ /// unary argument of a NEG, FNEG or NOT operation implemented via
+ /// Sub, FSub, or Xor.
///
static const Value *getNegArgument(const Value *BinOp);
static Value *getNegArgument( Value *BinOp);
+ static const Value *getFNegArgument(const Value *BinOp);
+ static Value *getFNegArgument( Value *BinOp);
static const Value *getNotArgument(const Value *BinOp);
static Value *getNotArgument( Value *BinOp);
diff --git a/include/llvm/Instruction.def b/include/llvm/Instruction.def
index 66bf2ce..98fda77 100644
--- a/include/llvm/Instruction.def
+++ b/include/llvm/Instruction.def
@@ -105,71 +105,74 @@ HANDLE_TERM_INST ( 6, Unreachable, UnreachableInst)
// Standard binary operators...
FIRST_BINARY_INST( 7)
HANDLE_BINARY_INST( 7, Add , BinaryOperator)
-HANDLE_BINARY_INST( 8, Sub , BinaryOperator)
-HANDLE_BINARY_INST( 9, Mul , BinaryOperator)
-HANDLE_BINARY_INST(10, UDiv , BinaryOperator)
-HANDLE_BINARY_INST(11, SDiv , BinaryOperator)
-HANDLE_BINARY_INST(12, FDiv , BinaryOperator)
-HANDLE_BINARY_INST(13, URem , BinaryOperator)
-HANDLE_BINARY_INST(14, SRem , BinaryOperator)
-HANDLE_BINARY_INST(15, FRem , BinaryOperator)
+HANDLE_BINARY_INST( 8, FAdd , BinaryOperator)
+HANDLE_BINARY_INST( 9, Sub , BinaryOperator)
+HANDLE_BINARY_INST(10, FSub , BinaryOperator)
+HANDLE_BINARY_INST(11, Mul , BinaryOperator)
+HANDLE_BINARY_INST(12, FMul , BinaryOperator)
+HANDLE_BINARY_INST(13, UDiv , BinaryOperator)
+HANDLE_BINARY_INST(14, SDiv , BinaryOperator)
+HANDLE_BINARY_INST(15, FDiv , BinaryOperator)
+HANDLE_BINARY_INST(16, URem , BinaryOperator)
+HANDLE_BINARY_INST(17, SRem , BinaryOperator)
+HANDLE_BINARY_INST(18, FRem , BinaryOperator)
// Logical operators (integer operands)
-HANDLE_BINARY_INST(16, Shl , BinaryOperator) // Shift left (logical)
-HANDLE_BINARY_INST(17, LShr , BinaryOperator) // Shift right (logical)
-HANDLE_BINARY_INST(18, AShr , BinaryOperator) // Shift right (arithmetic)
-HANDLE_BINARY_INST(19, And , BinaryOperator)
-HANDLE_BINARY_INST(20, Or , BinaryOperator)
-HANDLE_BINARY_INST(21, Xor , BinaryOperator)
- LAST_BINARY_INST(21)
+HANDLE_BINARY_INST(19, Shl , BinaryOperator) // Shift left (logical)
+HANDLE_BINARY_INST(20, LShr , BinaryOperator) // Shift right (logical)
+HANDLE_BINARY_INST(21, AShr , BinaryOperator) // Shift right (arithmetic)
+HANDLE_BINARY_INST(22, And , BinaryOperator)
+HANDLE_BINARY_INST(23, Or , BinaryOperator)
+HANDLE_BINARY_INST(24, Xor , BinaryOperator)
+ LAST_BINARY_INST(24)
// Memory operators...
- FIRST_MEMORY_INST(22)
-HANDLE_MEMORY_INST(22, Malloc, MallocInst) // Heap management instructions
-HANDLE_MEMORY_INST(23, Free , FreeInst )
-HANDLE_MEMORY_INST(24, Alloca, AllocaInst) // Stack management
-HANDLE_MEMORY_INST(25, Load , LoadInst ) // Memory manipulation instrs
-HANDLE_MEMORY_INST(26, Store , StoreInst )
-HANDLE_MEMORY_INST(27, GetElementPtr, GetElementPtrInst)
- LAST_MEMORY_INST(27)
+ FIRST_MEMORY_INST(25)
+HANDLE_MEMORY_INST(25, Malloc, MallocInst) // Heap management instructions
+HANDLE_MEMORY_INST(26, Free , FreeInst )
+HANDLE_MEMORY_INST(27, Alloca, AllocaInst) // Stack management
+HANDLE_MEMORY_INST(28, Load , LoadInst ) // Memory manipulation instrs
+HANDLE_MEMORY_INST(29, Store , StoreInst )
+HANDLE_MEMORY_INST(30, GetElementPtr, GetElementPtrInst)
+ LAST_MEMORY_INST(30)
// Cast operators ...
// NOTE: The order matters here because CastInst::isEliminableCastPair
// NOTE: (see Instructions.cpp) encodes a table based on this ordering.
- FIRST_CAST_INST(28)
-HANDLE_CAST_INST(28, Trunc , TruncInst ) // Truncate integers
-HANDLE_CAST_INST(29, ZExt , ZExtInst ) // Zero extend integers
-HANDLE_CAST_INST(30, SExt , SExtInst ) // Sign extend integers
-HANDLE_CAST_INST(31, FPToUI , FPToUIInst ) // floating point -> UInt
-HANDLE_CAST_INST(32, FPToSI , FPToSIInst ) // floating point -> SInt
-HANDLE_CAST_INST(33, UIToFP , UIToFPInst ) // UInt -> floating point
-HANDLE_CAST_INST(34, SIToFP , SIToFPInst ) // SInt -> floating point
-HANDLE_CAST_INST(35, FPTrunc , FPTruncInst ) // Truncate floating point
-HANDLE_CAST_INST(36, FPExt , FPExtInst ) // Extend floating point
-HANDLE_CAST_INST(37, PtrToInt, PtrToIntInst) // Pointer -> Integer
-HANDLE_CAST_INST(38, IntToPtr, IntToPtrInst) // Integer -> Pointer
-HANDLE_CAST_INST(39, BitCast , BitCastInst ) // Type cast
- LAST_CAST_INST(39)
+ FIRST_CAST_INST(31)
+HANDLE_CAST_INST(31, Trunc , TruncInst ) // Truncate integers
+HANDLE_CAST_INST(32, ZExt , ZExtInst ) // Zero extend integers
+HANDLE_CAST_INST(33, SExt , SExtInst ) // Sign extend integers
+HANDLE_CAST_INST(34, FPToUI , FPToUIInst ) // floating point -> UInt
+HANDLE_CAST_INST(35, FPToSI , FPToSIInst ) // floating point -> SInt
+HANDLE_CAST_INST(36, UIToFP , UIToFPInst ) // UInt -> floating point
+HANDLE_CAST_INST(37, SIToFP , SIToFPInst ) // SInt -> floating point
+HANDLE_CAST_INST(38, FPTrunc , FPTruncInst ) // Truncate floating point
+HANDLE_CAST_INST(39, FPExt , FPExtInst ) // Extend floating point
+HANDLE_CAST_INST(40, PtrToInt, PtrToIntInst) // Pointer -> Integer
+HANDLE_CAST_INST(41, IntToPtr, IntToPtrInst) // Integer -> Pointer
+HANDLE_CAST_INST(42, BitCast , BitCastInst ) // Type cast
+ LAST_CAST_INST(42)
// Other operators...
- FIRST_OTHER_INST(40)
-HANDLE_OTHER_INST(40, ICmp , ICmpInst ) // Integer comparison instruction
-HANDLE_OTHER_INST(41, FCmp , FCmpInst ) // Floating point comparison instr.
-HANDLE_OTHER_INST(42, PHI , PHINode ) // PHI node instruction
-HANDLE_OTHER_INST(43, Call , CallInst ) // Call a function
-HANDLE_OTHER_INST(44, Select , SelectInst ) // select instruction
-HANDLE_OTHER_INST(45, UserOp1, Instruction) // May be used internally in a pass
-HANDLE_OTHER_INST(46, UserOp2, Instruction) // Internal to passes only
-HANDLE_OTHER_INST(47, VAArg , VAArgInst ) // vaarg instruction
-HANDLE_OTHER_INST(48, ExtractElement, ExtractElementInst)// extract from vector
-HANDLE_OTHER_INST(49, InsertElement, InsertElementInst) // insert into vector
-HANDLE_OTHER_INST(50, ShuffleVector, ShuffleVectorInst) // shuffle two vectors.
-HANDLE_OTHER_INST(51, ExtractValue, ExtractValueInst)// extract from aggregate
-HANDLE_OTHER_INST(52, InsertValue, InsertValueInst) // insert into aggregate
-HANDLE_OTHER_INST(53, VICmp , VICmpInst ) // Vec Int comparison instruction.
-HANDLE_OTHER_INST(54, VFCmp , VFCmpInst ) // Vec FP point comparison instr.
-
- LAST_OTHER_INST(55)
+ FIRST_OTHER_INST(43)
+HANDLE_OTHER_INST(43, ICmp , ICmpInst ) // Integer comparison instruction
+HANDLE_OTHER_INST(44, FCmp , FCmpInst ) // Floating point comparison instr.
+HANDLE_OTHER_INST(45, PHI , PHINode ) // PHI node instruction
+HANDLE_OTHER_INST(46, Call , CallInst ) // Call a function
+HANDLE_OTHER_INST(47, Select , SelectInst ) // select instruction
+HANDLE_OTHER_INST(48, UserOp1, Instruction) // May be used internally in a pass
+HANDLE_OTHER_INST(49, UserOp2, Instruction) // Internal to passes only
+HANDLE_OTHER_INST(50, VAArg , VAArgInst ) // vaarg instruction
+HANDLE_OTHER_INST(51, ExtractElement, ExtractElementInst)// extract from vector
+HANDLE_OTHER_INST(52, InsertElement, InsertElementInst) // insert into vector
+HANDLE_OTHER_INST(53, ShuffleVector, ShuffleVectorInst) // shuffle two vectors.
+HANDLE_OTHER_INST(54, ExtractValue, ExtractValueInst)// extract from aggregate
+HANDLE_OTHER_INST(55, InsertValue, InsertValueInst) // insert into aggregate
+HANDLE_OTHER_INST(56, VICmp , VICmpInst ) // Vec Int comparison instruction.
+HANDLE_OTHER_INST(57, VFCmp , VFCmpInst ) // Vec FP point comparison instr.
+
+ LAST_OTHER_INST(57)
#undef FIRST_TERM_INST
#undef HANDLE_TERM_INST
diff --git a/include/llvm/Support/ConstantFolder.h b/include/llvm/Support/ConstantFolder.h
index ca8bcae..35065a0 100644
--- a/include/llvm/Support/ConstantFolder.h
+++ b/include/llvm/Support/ConstantFolder.h
@@ -32,12 +32,21 @@ public:
Constant *CreateAdd(Constant *LHS, Constant *RHS) const {
return ConstantExpr::getAdd(LHS, RHS);
}
+ Constant *CreateFAdd(Constant *LHS, Constant *RHS) const {
+ return ConstantExpr::getFAdd(LHS, RHS);
+ }
Constant *CreateSub(Constant *LHS, Constant *RHS) const {
return ConstantExpr::getSub(LHS, RHS);
}
+ Constant *CreateFSub(Constant *LHS, Constant *RHS) const {
+ return ConstantExpr::getFSub(LHS, RHS);
+ }
Constant *CreateMul(Constant *LHS, Constant *RHS) const {
return ConstantExpr::getMul(LHS, RHS);
}
+ Constant *CreateFMul(Constant *LHS, Constant *RHS) const {
+ return ConstantExpr::getFMul(LHS, RHS);
+ }
Constant *CreateUDiv(Constant *LHS, Constant *RHS) const {
return ConstantExpr::getUDiv(LHS, RHS);
}
@@ -87,6 +96,9 @@ public:
Constant *CreateNeg(Constant *C) const {
return ConstantExpr::getNeg(C);
}
+ Constant *CreateFNeg(Constant *C) const {
+ return ConstantExpr::getFNeg(C);
+ }
Constant *CreateNot(Constant *C) const {
return ConstantExpr::getNot(C);
}
diff --git a/include/llvm/Support/IRBuilder.h b/include/llvm/Support/IRBuilder.h
index 9ef14af..7942de7 100644
--- a/include/llvm/Support/IRBuilder.h
+++ b/include/llvm/Support/IRBuilder.h
@@ -175,18 +175,36 @@ public:
return Folder.CreateAdd(LC, RC);
return Insert(BinaryOperator::CreateAdd(LHS, RHS), Name);
}
+ Value *CreateFAdd(Value *LHS, Value *RHS, const char *Name = "") {
+ if (Constant *LC = dyn_cast<Constant>(LHS))
+ if (Constant *RC = dyn_cast<Constant>(RHS))
+ return Folder.CreateFAdd(LC, RC);
+ return Insert(BinaryOperator::CreateFAdd(LHS, RHS), Name);
+ }
Value *CreateSub(Value *LHS, Value *RHS, const char *Name = "") {
if (Constant *LC = dyn_cast<Constant>(LHS))
if (Constant *RC = dyn_cast<Constant>(RHS))
return Folder.CreateSub(LC, RC);
return Insert(BinaryOperator::CreateSub(LHS, RHS), Name);
}
+ Value *CreateFSub(Value *LHS, Value *RHS, const char *Name = "") {
+ if (Constant *LC = dyn_cast<Constant>(LHS))
+ if (Constant *RC = dyn_cast<Constant>(RHS))
+ return Folder.CreateFSub(LC, RC);
+ return Insert(BinaryOperator::CreateFSub(LHS, RHS), Name);
+ }
Value *CreateMul(Value *LHS, Value *RHS, const char *Name = "") {
if (Constant *LC = dyn_cast<Constant>(LHS))
if (Constant *RC = dyn_cast<Constant>(RHS))
return Folder.CreateMul(LC, RC);
return Insert(BinaryOperator::CreateMul(LHS, RHS), Name);
}
+ Value *CreateFMul(Value *LHS, Value *RHS, const char *Name = "") {
+ if (Constant *LC = dyn_cast<Constant>(LHS))
+ if (Constant *RC = dyn_cast<Constant>(RHS))
+ return Folder.CreateMul(LC, RC);
+ return Insert(BinaryOperator::CreateFMul(LHS, RHS), Name);
+ }
Value *CreateUDiv(Value *LHS, Value *RHS, const char *Name = "") {
if (Constant *LC = dyn_cast<Constant>(LHS))
if (Constant *RC = dyn_cast<Constant>(RHS))
diff --git a/include/llvm/Support/NoFolder.h b/include/llvm/Support/NoFolder.h
index 1dce497..a49cf84 100644
--- a/include/llvm/Support/NoFolder.h
+++ b/include/llvm/Support/NoFolder.h
@@ -39,12 +39,21 @@ public:
Value *CreateAdd(Constant *LHS, Constant *RHS) const {
return BinaryOperator::CreateAdd(LHS, RHS);
}
+ Value *CreateFAdd(Constant *LHS, Constant *RHS) const {
+ return BinaryOperator::CreateFAdd(LHS, RHS);
+ }
Value *CreateSub(Constant *LHS, Constant *RHS) const {
return BinaryOperator::CreateSub(LHS, RHS);
}
+ Value *CreateFSub(Constant *LHS, Constant *RHS) const {
+ return BinaryOperator::CreateFSub(LHS, RHS);
+ }
Value *CreateMul(Constant *LHS, Constant *RHS) const {
return BinaryOperator::CreateMul(LHS, RHS);
}
+ Value *CreateFMul(Constant *LHS, Constant *RHS) const {
+ return BinaryOperator::CreateFMul(LHS, RHS);
+ }
Value *CreateUDiv(Constant *LHS, Constant *RHS) const {
return BinaryOperator::CreateUDiv(LHS, RHS);
}
diff --git a/include/llvm/Support/PatternMatch.h b/include/llvm/Support/PatternMatch.h
index d27a7f1..fda925f 100644
--- a/include/llvm/Support/PatternMatch.h
+++ b/include/llvm/Support/PatternMatch.h
@@ -157,18 +157,36 @@ inline BinaryOp_match<LHS, RHS, Instruction::Add> m_Add(const LHS &L,
}
template<typename LHS, typename RHS>
+inline BinaryOp_match<LHS, RHS, Instruction::FAdd> m_FAdd(const LHS &L,
+ const RHS &R) {
+ return BinaryOp_match<LHS, RHS, Instruction::FAdd>(L, R);
+}
+
+template<typename LHS, typename RHS>
inline BinaryOp_match<LHS, RHS, Instruction::Sub> m_Sub(const LHS &L,
const RHS &R) {
return BinaryOp_match<LHS, RHS, Instruction::Sub>(L, R);
}
template<typename LHS, typename RHS>
+inline BinaryOp_match<LHS, RHS, Instruction::FSub> m_FSub(const LHS &L,
+ const RHS &R) {
+ return BinaryOp_match<LHS, RHS, Instruction::FSub>(L, R);
+}
+
+template<typename LHS, typename RHS>
inline BinaryOp_match<LHS, RHS, Instruction::Mul> m_Mul(const LHS &L,
const RHS &R) {
return BinaryOp_match<LHS, RHS, Instruction::Mul>(L, R);
}
template<typename LHS, typename RHS>
+inline BinaryOp_match<LHS, RHS, Instruction::FMul> m_FMul(const LHS &L,
+ const RHS &R) {
+ return BinaryOp_match<LHS, RHS, Instruction::FMul>(L, R);
+}
+
+template<typename LHS, typename RHS>
inline BinaryOp_match<LHS, RHS, Instruction::UDiv> m_UDiv(const LHS &L,
const RHS &R) {
return BinaryOp_match<LHS, RHS, Instruction::UDiv>(L, R);
@@ -494,6 +512,35 @@ template<typename LHS>
inline neg_match<LHS> m_Neg(const LHS &L) { return L; }
+template<typename LHS_t>
+struct fneg_match {
+ LHS_t L;
+
+ fneg_match(const LHS_t &LHS) : L(LHS) {}
+
+ template<typename OpTy>
+ bool match(OpTy *V) {
+ if (Instruction *I = dyn_cast<Instruction>(V))
+ if (I->getOpcode() == Instruction::FSub)
+ return matchIfFNeg(I->getOperand(0), I->getOperand(1));
+ if (ConstantExpr *CE = dyn_cast<ConstantExpr>(V))
+ if (CE->getOpcode() == Instruction::FSub)
+ return matchIfFNeg(CE->getOperand(0), CE->getOperand(1));
+ if (ConstantFP *CF = dyn_cast<ConstantFP>(V))
+ return L.match(ConstantExpr::getFNeg(CF));
+ return false;
+ }
+private:
+ bool matchIfFNeg(Value *LHS, Value *RHS) {
+ return LHS == ConstantExpr::getZeroValueForNegationExpr(LHS->getType()) &&
+ L.match(RHS);
+ }
+};
+
+template<typename LHS>
+inline fneg_match<LHS> m_FNeg(const LHS &L) { return L; }
+
+
//===----------------------------------------------------------------------===//
// Matchers for control flow
//
diff --git a/include/llvm/Support/StandardPasses.h b/include/llvm/Support/StandardPasses.h
index 024c019..5c63034 100644
--- a/include/llvm/Support/StandardPasses.h
+++ b/include/llvm/Support/StandardPasses.h
@@ -60,15 +60,10 @@ namespace llvm {
///
/// Internalize - Run the internalize pass.
/// RunInliner - Use a function inlining pass.
- /// RunSecondGlobalOpt - Run the global optimizer pass twice.
/// VerifyEach - Run the verifier after each pass.
- //
- // FIXME: RunSecondGlobalOpt should go away once we resolve which of LTO or
- // llvm-ld is better.
static inline void createStandardLTOPasses(PassManager *PM,
bool Internalize,
bool RunInliner,
- bool RunSecondGlobalOpt,
bool VerifyEach);
// Implementations
@@ -173,7 +168,6 @@ namespace llvm {
static inline void createStandardLTOPasses(PassManager *PM,
bool Internalize,
bool RunInliner,
- bool RunSecondGlobalOpt,
bool VerifyEach) {
// Now that composite has been compiled, scan through the module, looking
// for a main function. If main is defined, mark all other functions
@@ -207,8 +201,8 @@ namespace llvm {
addOnePass(PM, createFunctionInliningPass(), VerifyEach);
addOnePass(PM, createPruneEHPass(), VerifyEach); // Remove dead EH info.
- // Optimize globals again.
- if (RunSecondGlobalOpt)
+ // Optimize globals again if we ran the inliner.
+ if (RunInliner)
addOnePass(PM, createGlobalOptimizerPass(), VerifyEach);
addOnePass(PM, createGlobalDCEPass(), VerifyEach); // Remove dead functions.
diff --git a/include/llvm/Support/TargetFolder.h b/include/llvm/Support/TargetFolder.h
index 172e4fe..b0700c1 100644
--- a/include/llvm/Support/TargetFolder.h
+++ b/include/llvm/Support/TargetFolder.h
@@ -48,12 +48,21 @@ public:
Constant *CreateAdd(Constant *LHS, Constant *RHS) const {
return Fold(ConstantExpr::getAdd(LHS, RHS));
}
+ Constant *CreateFAdd(Constant *LHS, Constant *RHS) const {
+ return Fold(ConstantExpr::getFAdd(LHS, RHS));
+ }
Constant *CreateSub(Constant *LHS, Constant *RHS) const {
return Fold(ConstantExpr::getSub(LHS, RHS));
}
+ Constant *CreateFSub(Constant *LHS, Constant *RHS) const {
+ return Fold(ConstantExpr::getFSub(LHS, RHS));
+ }
Constant *CreateMul(Constant *LHS, Constant *RHS) const {
return Fold(ConstantExpr::getMul(LHS, RHS));
}
+ Constant *CreateFMul(Constant *LHS, Constant *RHS) const {
+ return Fold(ConstantExpr::getFMul(LHS, RHS));
+ }
Constant *CreateUDiv(Constant *LHS, Constant *RHS) const {
return Fold(ConstantExpr::getUDiv(LHS, RHS));
}
@@ -103,6 +112,9 @@ public:
Constant *CreateNeg(Constant *C) const {
return Fold(ConstantExpr::getNeg(C));
}
+ Constant *CreateFNeg(Constant *C) const {
+ return Fold(ConstantExpr::getFNeg(C));
+ }
Constant *CreateNot(Constant *C) const {
return Fold(ConstantExpr::getNot(C));
}
diff --git a/include/llvm/Support/raw_ostream.h b/include/llvm/Support/raw_ostream.h
index b67d126..8242f04 100644
--- a/include/llvm/Support/raw_ostream.h
+++ b/include/llvm/Support/raw_ostream.h
@@ -45,6 +45,19 @@ private:
bool Unbuffered;
public:
+ // color order matches ANSI escape sequence, don't change
+ enum Colors {
+ BLACK=0,
+ RED,
+ GREEN,
+ YELLOW,
+ BLUE,
+ MAGENTA,
+ CYAN,
+ WHITE,
+ SAVEDCOLOR
+ };
+
explicit raw_ostream(bool unbuffered=false) : Unbuffered(unbuffered) {
// Start out ready to flush.
OutBufStart = OutBufEnd = OutBufCur = 0;
@@ -167,6 +180,20 @@ public:
// Formatted output, see the format() function in Support/Format.h.
raw_ostream &operator<<(const format_object_base &Fmt);
+ /// Changes the foreground color of text that will be output from this point
+ /// forward.
+ /// @param colors ANSI color to use, the special SAVEDCOLOR can be used to
+ /// change only the bold attribute, and keep colors untouched
+ /// @param bold bold/brighter text, default false
+ /// @param bg if true change the background, default: change foreground
+ /// @returns itself so it can be used within << invocations
+ virtual raw_ostream &changeColor(enum Colors colors, bool bold=false,
+ bool bg=false) { return *this; }
+
+ /// Resets the colors to terminal defaults. Call this when you are done
+ /// outputting colored text, or before program exit.
+ virtual raw_ostream &resetColor() { return *this; }
+
//===--------------------------------------------------------------------===//
// Subclass Interface
//===--------------------------------------------------------------------===//
@@ -243,6 +270,10 @@ public:
/// seek - Flushes the stream and repositions the underlying file descriptor
/// positition to the offset specified from the beginning of the file.
uint64_t seek(uint64_t off);
+
+ virtual raw_ostream &changeColor(enum Colors colors, bool bold=false,
+ bool bg=false);
+ virtual raw_ostream &resetColor();
};
/// raw_stdout_ostream - This is a stream that always prints to stdout.
diff --git a/include/llvm/System/Process.h b/include/llvm/System/Process.h
index ce19eb2..11dbf75 100644
--- a/include/llvm/System/Process.h
+++ b/include/llvm/System/Process.h
@@ -107,6 +107,34 @@ namespace sys {
/// console, or if the number of columns cannot be determined,
/// this routine returns zero.
static unsigned StandardErrColumns();
+
+ /// This function determines whether the terminal connected to standard
+ /// output supports colors. If standard output is not connected to a
+ /// terminal, this function returns false.
+ static bool StandardOutHasColors();
+
+ /// This function determines whether the terminal connected to standard
+ /// error supports colors. If standard error is not connected to a
+ /// terminal, this function returns false.
+ static bool StandardErrHasColors();
+
+ /// Whether changing colors requires the output to be flushed.
+ /// This is needed on systems that don't support escape sequences for
+ /// changing colors.
+ static bool ColorNeedsFlush();
+
+ /// This function returns the colorcode escape sequences.
+ /// If ColorNeedsFlush() is true then this function will change the colors
+ /// and return an empty escape sequence. In that case it is the
+ /// responsibility of the client to flush the output stream prior to
+ /// calling this function.
+ static const char *OutputColor(char c, bool bold, bool bg);
+
+ /// Same as OutputColor, but only enables the bold attribute.
+ static const char *OutputBold(bool bg);
+
+ /// Resets the terminals colors, or returns an escape sequence to do so.
+ static const char *ResetColor();
/// @}
};
}
diff --git a/include/llvm/Target/TargetELFWriterInfo.h b/include/llvm/Target/TargetELFWriterInfo.h
index 548cc07..e266a71 100644
--- a/include/llvm/Target/TargetELFWriterInfo.h
+++ b/include/llvm/Target/TargetELFWriterInfo.h
@@ -25,9 +25,23 @@ namespace llvm {
// e_machine member of the ELF header.
unsigned short EMachine;
public:
+
+ // Machine architectures
enum MachineType {
- NoMachine,
- EM_386 = 3
+ EM_NONE = 0, // No machine
+ EM_M32 = 1, // AT&T WE 32100
+ EM_SPARC = 2, // SPARC
+ EM_386 = 3, // Intel 386
+ EM_68K = 4, // Motorola 68000
+ EM_88K = 5, // Motorola 88000
+ EM_486 = 6, // Intel 486 (deprecated)
+ EM_860 = 7, // Intel 80860
+ EM_MIPS = 8, // MIPS R3000
+ EM_PPC = 20, // PowerPC
+ EM_ARM = 40, // ARM
+ EM_ALPHA = 41, // DEC Alpha
+ EM_SPARCV9 = 43, // SPARC V9
+ EM_X86_64 = 62 // AMD64
};
explicit TargetELFWriterInfo(MachineType machine) : EMachine(machine) {}
diff --git a/include/llvm/Target/TargetLowering.h b/include/llvm/Target/TargetLowering.h
index 163f4c5..327af27 100644
--- a/include/llvm/Target/TargetLowering.h
+++ b/include/llvm/Target/TargetLowering.h
@@ -632,7 +632,8 @@ public:
/// It returns MVT::iAny if SelectionDAG should be responsible for
/// determining it.
virtual MVT getOptimalMemOpType(uint64_t Size, unsigned Align,
- bool isSrcConst, bool isSrcStr) const {
+ bool isSrcConst, bool isSrcStr,
+ SelectionDAG &DAG) const {
return MVT::iAny;
}
@@ -825,11 +826,11 @@ public:
virtual bool
isGAPlusOffset(SDNode *N, GlobalValue* &GA, int64_t &Offset) const;
- /// isConsecutiveLoad - Return true if LD (which must be a LoadSDNode) is
- /// loading 'Bytes' bytes from a location that is 'Dist' units away from the
- /// location that the 'Base' load is loading from.
- bool isConsecutiveLoad(SDNode *LD, SDNode *Base, unsigned Bytes, int Dist,
- const MachineFrameInfo *MFI) const;
+ /// isConsecutiveLoad - Return true if LD is loading 'Bytes' bytes from a
+ /// location that is 'Dist' units away from the location that the 'Base' load
+ /// is loading from.
+ bool isConsecutiveLoad(LoadSDNode *LD, LoadSDNode *Base, unsigned Bytes,
+ int Dist, const MachineFrameInfo *MFI) const;
/// PerformDAGCombine - This method will be invoked for all target nodes and
/// for any target-independent nodes that the target has registered with
diff --git a/include/llvm/Target/TargetOptions.h b/include/llvm/Target/TargetOptions.h
index 06d7d79..0c74fa1 100644
--- a/include/llvm/Target/TargetOptions.h
+++ b/include/llvm/Target/TargetOptions.h
@@ -73,12 +73,6 @@ namespace llvm {
/// target FP instructions.
extern bool UseSoftFloat;
- /// NoImplicitFloat - This flag is enabled when the -no-implicit-float flag is
- /// specified on the command line. When this flag is on, the code generator
- /// won't generate any implicit floating point instructions. I.e., no XMM or
- /// x87 or vectorized memcpy/memmove instructions. This is for X86 only.
- extern bool NoImplicitFloat;
-
/// NoZerosInBSS - By default some codegens place zero-initialized data to
/// .bss section. This flag disables such behaviour (necessary, e.g. for
/// crt*.o compiling).
@@ -117,10 +111,6 @@ namespace llvm {
/// wth earlier copy coalescing.
extern bool StrongPHIElim;
- /// DisableRedZone - This flag disables use of the "Red Zone" on
- /// targets which would otherwise have one.
- extern bool DisableRedZone;
-
} // End llvm namespace
#endif
OpenPOWER on IntegriCloud