Permalink
Browse files

fixed build for latest llvm 3.2 svn

  • Loading branch information...
1 parent 73641f6 commit 7e1d252dfad1f6ba24e207d6dc7bfcaccf8f1e71 Ralf Karrenberg committed May 16, 2012
View
@@ -7,7 +7,7 @@
# NOTE: If clang++ fails with "fatal error: 'bits/c++config.h' file not found",
# try including /usr/include/c++/4.5/x86_64-linux-gnu/ or sth similar.
# This happened on Ubuntu 11.04 64bit (gcc 4.5) as well as Windows 7 32bit (cygwin).
-# At least for Ubuntu this include solved the issue :).
+# At least for Ubuntu this include once solved the issue :).
# COMMAND LINE VARIABLES WITH DEFAULT VALUES
@@ -107,8 +107,13 @@ endif
# LIBRARIES
#
-all: $(TARGET)
+all: $(TARGET) lib/wfv/wfv.bc
+linux: all wfvTestSuite wfvUnitTests packetizeFunction
+win: all wfvTestSuite.exe wfvUnitTests.exe packetizeFunction.exe
+lib/wfv/wfv.bc: wfvlibsrc/dummy.ll
+ mkdir -p lib/wfv
+ llvm-link -o $@ $^
###############
### WINDOWS ###
@@ -196,7 +201,7 @@ lib/libWFV.so: obj/wfv_dynamic.o
#
# TEST SUITE (requires clang)
-# TODO: adjust linking of dynamic/shared lib, PACKETIZER_STATIC_LIBS etc.
+# TODO: adjust linking of dynamic/shared lib, PACKETIZER_STATIC_LIBS etc.
#
# WINDOWS
@@ -205,16 +210,16 @@ wfvTestSuite.exe: lib/WFV.lib
# UNIX
wfvTestSuite: lib/libWFV.a tools/wfvTestSuite.cpp test/wfvTests.bc test/wfvTests2.bc test/wfvTests3.bc test/wfvTestsAVX.bc
- $(CXX) -o $@ tools/wfvTestSuite.cpp $(UNIXFLAGS) -I src -I include -I $(LLVMINCLUDEDIR) -L$(LLVMLIBDIR) -Llib `$(LLVM_INSTALL_DIR)/bin/llvm-config --cxxflags --ldflags --libs all` lib/libWFV.a -ldl
+ $(CXX) -o $@ tools/wfvTestSuite.cpp $(UNIXFLAGS) -I src -I include -I $(LLVMINCLUDEDIR) -L$(LLVMLIBDIR) -Llib -D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS `$(LLVM_INSTALL_DIR)/bin/llvm-config --ldflags` -lLLVM-3.2svn lib/libWFV.a
test/wfvTests.bc: test/wfvTests.cpp
- $(LLVM_INSTALL_DIR)/bin/clang++ -emit-llvm -c -Wall -msse4.1 -I/usr/include/c++/4.5/x86_64-linux-gnu/ -o $@ $<
+ $(LLVM_INSTALL_DIR)/bin/clang++ -emit-llvm -c -Wall -msse4.1 -o $@ $<
test/wfvTests2.bc: test/wfvTests2.cpp
- $(LLVM_INSTALL_DIR)/bin/clang++ -emit-llvm -c -Wall -msse4.1 -I/usr/include/c++/4.5/x86_64-linux-gnu/ -o $@ $<
+ $(LLVM_INSTALL_DIR)/bin/clang++ -emit-llvm -c -Wall -msse4.1 -o $@ $<
test/wfvTests3.bc: test/wfvTests3.cpp
- $(LLVM_INSTALL_DIR)/bin/clang++ -emit-llvm -c -Wall -msse4.1 -I/usr/include/c++/4.5/x86_64-linux-gnu/ -o $@ $<
+ $(LLVM_INSTALL_DIR)/bin/clang++ -emit-llvm -c -Wall -msse4.1 -o $@ $<
test/wfvTestsAVX.bc: test/wfvTestsAVX.cpp
- $(LLVM_INSTALL_DIR)/bin/clang++ -emit-llvm -c -Wall -mavx -I/usr/include/c++/4.5/x86_64-linux-gnu/ -o $@ $<
+ $(LLVM_INSTALL_DIR)/bin/clang++ -emit-llvm -c -Wall -mavx -o $@ $<
#
@@ -234,11 +239,11 @@ unittests:
$(LLVM_INSTALL_DIR)/bin/llvm-as -o test/unittests/api/test_api_valid.bc test/unittests/api/test_api_valid.ll
wfvUnitTests: lib/libWFV.a lib/libgtest test/wfvUnitTests.cpp unittests
- $(CXX) -o $@ test/wfvUnitTests.cpp $(UNIXFLAGS) -I src -I include -I $(LLVMINCLUDEDIR) -I test/gtest/include -L$(LLVMLIBDIR) -Llib -D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS `$(LLVM_INSTALL_DIR)/bin/llvm-config --ldflags --libs all` -lgtest lib/libWFV.a
+ $(CXX) -o $@ test/wfvUnitTests.cpp $(UNIXFLAGS) -I src -I include -I $(LLVMINCLUDEDIR) -I test/gtest/include -L$(LLVMLIBDIR) -Llib -D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS `$(LLVM_INSTALL_DIR)/bin/llvm-config --ldflags` -lLLVM-3.2svn -lgtest lib/libWFV.a -lpthread
#
# COMMAND-LINE TOOL
-# TODO: adjust linking of dynamic/shared lib, PACKETIZER_STATIC_LIBS etc.
+# TODO: adjust linking of dynamic/shared lib, PACKETIZER_STATIC_LIBS etc.
#
# WINDOWS
@@ -247,7 +252,7 @@ packetizeFunction.exe: lib/WFV.lib tools/packetizeFunction.cpp
# UNIX
packetizeFunction: lib/libWFV.a tools/packetizeFunction.cpp
- $(CXX) -o $@ tools/packetizeFunction.cpp $(UNIXFLAGS) -I include -I src -I $(LLVMINCLUDEDIR) -L$(LLVMLIBDIR) -Llib `$(LLVM_INSTALL_DIR)/bin/llvm-config --cxxflags --ldflags --libs all` lib/libWFV.a
+ $(CXX) -o $@ tools/packetizeFunction.cpp $(UNIXFLAGS) -I include -I src -I $(LLVMINCLUDEDIR) -L$(LLVMLIBDIR) -Llib -D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS `$(LLVM_INSTALL_DIR)/bin/llvm-config --ldflags` -lLLVM-3.2svn lib/libWFV.a
clean:
@@ -128,9 +128,9 @@ class BranchInfoAnalysis : public FunctionPass {
BasicBlock* falsePathEndBlock;
void print(raw_ostream& o) {
- o << " " << source->getNameStr() << " -> ("
- << successorTrue->getNameStr() << ", " << successorFalse->getNameStr()
- << ") -> " << joinBlock->getNameStr() << "\n";
+ o << " " << source->getName() << " -> ("
+ << successorTrue->getName() << ", " << successorFalse->getName()
+ << ") -> " << joinBlock->getName() << "\n";
}
};
typedef std::map<BasicBlock*, BranchMapNode*> BranchMapType;
@@ -113,7 +113,7 @@ class CFGLinearizer : public FunctionPass {
assert (!maskGraph->hasCompoundMasks() && "mask operation insertion not complete!");
DEBUG_PKT( outs() << "\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n"; );
- DEBUG_PKT( outs() << "linearizing CFG of function '" << f.getNameStr() << "'...\n"; );
+ DEBUG_PKT( outs() << "linearizing CFG of function '" << f.getName() << "'...\n"; );
DEBUG_PKT( outs() << "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\n"; );
try {
@@ -119,7 +119,7 @@ class CFGLinearizerNaive : public FunctionPass {
assert (!maskGraph->hasCompoundMasks() && "mask operation insertion not complete!");
DEBUG_PKT( outs() << "\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n"; );
- DEBUG_PKT( outs() << "linearizing CFG of function '" << f.getNameStr() << "'...\n"; );
+ DEBUG_PKT( outs() << "linearizing CFG of function '" << f.getName() << "'...\n"; );
DEBUG_PKT( outs() << "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\n"; );
try {
@@ -264,7 +264,7 @@ class CFGLinearizerNaive : public FunctionPass {
DEBUG_PKT ( outs() << " next block is target block of "
"uniform conditional branch!\n"; );
uniformTargetBlocks.erase(BB2);
-
+#if 0
// Here we know which block is the final join point of the
// uniform conditional branch.
BasicBlock* endBB;
@@ -281,14 +281,15 @@ class CFGLinearizerNaive : public FunctionPass {
endBB = br->getSuccessor(0);
}
//DEBUG_PKT( replaceSelectsByPhiNodes(endBB); );
+#endif
continue;
}
// Otherwise, we have varying control-flow.
// -> Replace branches.
DEBUG_PKT ( outs() << " back-edge-type of block '"
- << BB1->getNameStr() << "': "
+ << BB1->getName() << "': "
<< getBackedgeTypeString(backedgeType) << "\n"; );
switch (backedgeType) {
@@ -349,7 +350,7 @@ class CFGLinearizerNaive : public FunctionPass {
}
}
}
-
+
inline BackedgeType getBackedgeType(BasicBlock* block) {
Loop* loop = loopInfo->getLoopFor(block);
@@ -366,7 +367,7 @@ class CFGLinearizerNaive : public FunctionPass {
std::list<BasicBlock*> findLinearizedBlockOrdering(Function* f) {
DEBUG_PKT( outs() << "\n-----------------------------------------------------\n"; );
- DEBUG_PKT( outs() << "determining linearization of function '" << f->getNameStr() << "'...\n"; );
+ DEBUG_PKT( outs() << "determining linearization of function '" << f->getName() << "'...\n"; );
BasicBlock* returnBlock = findReturnBlock(f);
assert (loopInfo->getLoopDepth(returnBlock) == 0 && "return-block of a function must not be inside a loop!");
@@ -383,7 +384,7 @@ class CFGLinearizerNaive : public FunctionPass {
outs() << "\nprinting list of blocks outside of all loops:\n";
for (std::list<BasicBlock*>::iterator it=list.begin(), E=list.end(); it!=E; ++it) {
BasicBlock* BB = *it;
- outs() << " * " << BB->getNameStr() << " (" << loopInfo->getLoopDepth(BB) << ")\n";
+ outs() << " * " << BB->getName() << " (" << loopInfo->getLoopDepth(BB) << ")\n";
}
outs() << "\n";
);
@@ -416,7 +417,7 @@ class CFGLinearizerNaive : public FunctionPass {
for (std::list<BasicBlock*>::iterator it=list.begin(), E=list.end(); it!=E; ) {
if (loop->getLoopPreheader() == *it) {
assert (!preheaderFound && "loop cannot have more than one pre-header!");
- //DEBUG_PKT ( outs() << " preheader found (1): " << (*it)->getNameStr() << "\n"; );
+ //DEBUG_PKT ( outs() << " preheader found (1): " << (*it)->getName() << "\n"; );
list.insert(++it, loopLists[i].begin(), loopLists[i].end());
preheaderFound = true;
DEBUG_PKT( outs() << "inserted top-level-loop list " << i << "!\n"; );
@@ -435,7 +436,7 @@ class CFGLinearizerNaive : public FunctionPass {
assert (verified && "verification of linearized block ordering failed!");
- DEBUG_PKT( outs() << "linearization determined for function '" << f->getNameStr() << "'.\n"; );
+ DEBUG_PKT( outs() << "linearization determined for function '" << f->getName() << "'.\n"; );
DEBUG_PKT( printLinearizedBlockList(outs(), list); );
DEBUG_PKT( outs() << "-----------------------------------------------------\n"; );
return list;
@@ -457,7 +458,7 @@ class CFGLinearizerNaive : public FunctionPass {
//IFF it does not belong to a loop
if (loopInfo->getLoopDepth(block) == 0) {
list.push_back(block);
- DEBUG_PKT( outs() << " added block: " << block->getNameStr() << "\n"; );
+ DEBUG_PKT( outs() << " added block: " << block->getName() << "\n"; );
}
}
@@ -501,7 +502,7 @@ class CFGLinearizerNaive : public FunctionPass {
for (unsigned i=0; i<loop->getSubLoops().size(); ++i) {
outs() << " sub-loop " << i << "\n";
for (std::list<BasicBlock*>::iterator it=subLoopLists[i].begin(); it!=subLoopLists[i].end(); ++it) {
- outs() << " * " << (*it)->getNameStr() << "\n";
+ outs() << " * " << (*it)->getName() << "\n";
}
}
);
@@ -517,7 +518,7 @@ class CFGLinearizerNaive : public FunctionPass {
bool subLoopEntryFound = false;
for (std::list<BasicBlock*>::iterator it=loopList.begin(), E=loopList.end(); it!=E; ) {
if (subLoop->getLoopPreheader() == *it) {
- //DEBUG_PKT ( outs() << " preheader found: " << (*it)->getNameStr() << "\n"; );
+ //DEBUG_PKT ( outs() << " preheader found: " << (*it)->getName() << "\n"; );
assert (!subLoopEntryFound && "block cannot be preheader of several sub-loops!");
loopList.insert(++it, subLoopLists[j].begin(), subLoopLists[j].end());
subLoopEntryFound = true;
@@ -531,7 +532,7 @@ class CFGLinearizerNaive : public FunctionPass {
DEBUG_PKT(
if (!loopList.empty()) outs() << "\nprinting list of merged loop:\n";
for (std::list<BasicBlock*>::iterator it=loopList.begin(); it!=loopList.end(); ++it) {
- outs() << " * " << (*it)->getNameStr() << "\n";
+ outs() << " * " << (*it)->getName() << "\n";
}
outs() << "\n";
);
@@ -550,7 +551,7 @@ class CFGLinearizerNaive : public FunctionPass {
if (visitedBlocks.find(block) != visitedBlocks.end()) return;
visitedBlocks.insert(block);
- //DEBUG_PKT ( outs() << " recFindLoopLinearization(" << block->getNameStr() << ", " << loop->getLoopDepth() << ")\n"; );
+ //DEBUG_PKT ( outs() << " recFindLoopLinearization(" << block->getName() << ", " << loop->getLoopDepth() << ")\n"; );
//recurse into all predecessors that belong to the same loop
//and are not yet in the list
@@ -565,7 +566,7 @@ class CFGLinearizerNaive : public FunctionPass {
//IFF it belongs to current loop (excluding sub-loops!)
if (loopInfo->getLoopDepth(block) == loop->getLoopDepth()) {
list.push_back(block);
- DEBUG_PKT( outs() << " added loop-block: " << block->getNameStr() << "\n"; );
+ DEBUG_PKT( outs() << " added loop-block: " << block->getName() << "\n"; );
}
}
@@ -577,7 +578,7 @@ class CFGLinearizerNaive : public FunctionPass {
BasicBlock* BB2 = *it2;
if (it2 == it) continue;
if (BB == BB2) {
- errs() << "ERROR: block '" << BB->getNameStr() << "' appears in list more than once!\n";
+ errs() << "ERROR: block '" << BB->getName() << "' appears in list more than once!\n";
verified = false;
}
}
@@ -596,7 +597,7 @@ class CFGLinearizerNaive : public FunctionPass {
BasicBlock* BB2 = *it2;
if (it2 == it) continue;
if (BB == BB2) {
- errs() << "ERROR: block '" << BB->getNameStr() << "' appears in loop-list more than once!\n";
+ errs() << "ERROR: block '" << BB->getName() << "' appears in loop-list more than once!\n";
verified = false;
}
}
@@ -608,7 +609,7 @@ class CFGLinearizerNaive : public FunctionPass {
outs() << "loop->getBlocks().size(): " << loop->getBlocks().size() << "\n";
outs() << "loop-blocks:\n";
for (std::vector<BasicBlock*>::const_iterator it=loop->getBlocks().begin(); it!=loop->getBlocks().end(); ++it) {
- outs() << " * " << (*it)->getNameStr() << "\n";
+ outs() << " * " << (*it)->getName() << "\n";
}
);
verified = false;
@@ -624,7 +625,7 @@ class CFGLinearizerNaive : public FunctionPass {
o << "\nlinearized order of blocks:\n";
for (std::list<BasicBlock*>::const_iterator it=list.begin(), E=list.end(); it!=E; ++it) {
BasicBlock* BB = *it;
- o << " * " << BB->getNameStr() << " (" << loopInfo->getLoopDepth(BB) << ")\n";
+ o << " * " << BB->getName() << " (" << loopInfo->getLoopDepth(BB) << ")\n";
}
o << "\n";
}
@@ -670,7 +671,7 @@ class CFGLinearizerNaive : public FunctionPass {
SelectInst* sel = cast<SelectInst>(I++);
// ignore result selects
- if (std::strstr(sel->getNameStr().c_str(), "result.vec") != 0) continue;
+ if (std::strstr(sel->getName().str().c_str(), "result.vec") != 0) continue;
Value* trueVal = sel->getTrueValue();
@@ -223,13 +223,13 @@ class CoherentMaskBranchGenerator : public FunctionPass {
//match successor and end blocks to first and second path
BasicBlock* firstBlock = firstPath == 1 ? successorTrue : successorFalse;
BasicBlock* secondBlock = firstPath == 1 ? successorFalse : successorTrue;
- DEBUG_PKT( outs() << " firstBlock: " << firstBlock->getNameStr() << "\n"; );
- DEBUG_PKT( outs() << " secondBlock: " << secondBlock->getNameStr() << "\n"; );
+ DEBUG_PKT( outs() << " firstBlock: " << firstBlock->getName() << "\n"; );
+ DEBUG_PKT( outs() << " secondBlock: " << secondBlock->getName() << "\n"; );
BasicBlock* firstPathEndBlock = firstPath == 1 ? truePathEndBlock : falsePathEndBlock;
BasicBlock* secondPathEndBlock = firstPath == 1 ? falsePathEndBlock : truePathEndBlock;
- DEBUG_PKT( outs() << " firstPathEndBlock: " << firstPathEndBlock->getNameStr() << "\n"; );
- DEBUG_PKT( outs() << " secondPathEndBlock: " << secondPathEndBlock->getNameStr() << "\n"; );
+ DEBUG_PKT( outs() << " firstPathEndBlock: " << firstPathEndBlock->getName() << "\n"; );
+ DEBUG_PKT( outs() << " secondPathEndBlock: " << secondPathEndBlock->getName() << "\n"; );
//delete old edges
analysisResults->removeValueInfo(source->getTerminator());
@@ -531,7 +531,6 @@ class CoherentMaskBranchGenerator : public FunctionPass {
case Instruction::Br: cost += 1; break; // weight conditional branches?
case Instruction::Switch: cost += 4; break; // no idea
case Instruction::Invoke: cost += 15; break; // no idea
- case Instruction::Unwind: cost += 0; break; // no idea
case Instruction::Unreachable: cost += 0; break; // no idea
// Standard binary operators...
Oops, something went wrong.

0 comments on commit 7e1d252

Please sign in to comment.