Skip to content

Commit

Permalink
Merge pull request #38 from jackanth/LLVM-6
Browse files Browse the repository at this point in the history
Update for LLVM 6.0.0
  • Loading branch information
yuleisui authored Mar 20, 2018
2 parents 3170e83 + 5099b99 commit 9b5c540
Show file tree
Hide file tree
Showing 11 changed files with 31 additions and 29 deletions.
20 changes: 10 additions & 10 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,32 +4,32 @@ os: linux
addons:
apt:
sources:
- llvm-toolchain-trusty-4.0
- llvm-toolchain-trusty-6.0
packages:
- llvm-4.0
- llvm-4.0-dev
- clang-4.0
- llvm-6.0
- llvm-6.0-dev
- clang-6.0
matrix:
include:
- os: osx
env:
- CXX=clang++ PATH=/usr/local/opt/llvm@4/bin:$PATH LLVM_DIR=/usr/local/opt/llvm@4 LDFLAGS:=-L/usr/local/opt/llvm@4/lib CPPFLAGS=-I/usr/local/opt/llvm@4/include
- CXX=clang++ PATH=/usr/local/opt/llvm@6/bin:$PATH LLVM_DIR=/usr/local/opt/llvm@6 LDFLAGS:=-L/usr/local/opt/llvm@6/lib CPPFLAGS=-I/usr/local/opt/llvm@6/include
- CONFIG_ARGS="-DCMAKE_BUILD_TYPE:STRING=Debug -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++"
install: brew install llvm@4
install: brew install llvm@6
cache:
directories: ~/Library/Caches/Homebrew/
- os: osx
env:
- CXX=clang++ PATH=/usr/local/opt/llvm@4/bin:$PATH LLVM_DIR=/usr/local/opt/llvm@4 LDFLAGS:=-L/usr/local/opt/llvm@4/lib CPPFLAGS=-I/usr/local/opt/llvm@4/include
- CXX=clang++ PATH=/usr/local/opt/llvm@6/bin:$PATH LLVM_DIR=/usr/local/opt/llvm@6 LDFLAGS:=-L/usr/local/opt/llvm@6/lib CPPFLAGS=-I/usr/local/opt/llvm@6/include
- CONFIG_ARGS="-DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++"
install: brew install llvm@4
install: brew install llvm@6
cache:
directories: ~/Library/Caches/Homebrew/
env:
global:
- CC=clang-4.0 CXX=clang++-4.0
- CC=clang-6.0 CXX=clang++-6.0
- PATH=$TRAVIS_BUILD_DIR/cmake-3.8.1-Linux-x86_64/bin:$PATH
- LLVM_DIR=/usr/lib/llvm-4.0
- LLVM_DIR=/usr/lib/llvm-6.0
matrix:
- CONFIG_ARGS="-DCMAKE_BUILD_TYPE:STRING=Debug"
- CONFIG_ARGS=
Expand Down
4 changes: 2 additions & 2 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
#########
# Please change the following home directories of your LLVM builds
########
LLVMRELEASE=/home/ysui/llvm-4.0.0/llvm-4.0.0.obj
LLVMDEBUG=/home/ysui/llvm-4.0.0/llvm-4.0.0.dbg
LLVMRELEASE=/home/ysui/llvm-6.0.0/llvm-6.0.0.obj
LLVMDEBUG=/home/ysui/llvm-6.0.0/llvm-6.0.0.dbg

if [[ $1 == 'debug' ]]
then
Expand Down
2 changes: 1 addition & 1 deletion include/MemoryModel/PointsToDFDS.h
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ class DFPTData : public PTData<Key,Data> {
PTData<Key,Data>::dumpPts(this->ptsMap);
/// dump points-to of address-taken variables
std::error_code ErrInfo;
llvm::tool_output_file F("svfg_pts.data", ErrInfo, llvm::sys::fs::F_None);
llvm::ToolOutputFile F("svfg_pts.data", ErrInfo, llvm::sys::fs::F_None);
if (!ErrInfo) {
llvm::raw_fd_ostream & osm = F.os();
NodeBS locs;
Expand Down
4 changes: 2 additions & 2 deletions include/Util/DataFlowUtil.h
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ class PTACFInfoBuilder {
/*!
* Iterated dominance frontier
*/
class IteratedDominanceFrontier: public llvm::DominanceFrontierBase<llvm::BasicBlock> {
class IteratedDominanceFrontier: public llvm::DominanceFrontierBase<llvm::BasicBlock, false> {

private:
const llvm::DominanceFrontier *DF;
Expand All @@ -218,7 +218,7 @@ class IteratedDominanceFrontier: public llvm::DominanceFrontierBase<llvm::BasicB
static char ID;

IteratedDominanceFrontier() :
llvm::DominanceFrontierBase<llvm::BasicBlock>(false), DF(NULL) {
llvm::DominanceFrontierBase<llvm::BasicBlock, false>(), DF(NULL) {
}

virtual ~IteratedDominanceFrontier() {
Expand Down
2 changes: 1 addition & 1 deletion include/Util/GraphUtil.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ class GraphPrinter {
std::string Filename = GraphName + ".dot";
O << "Writing '" << Filename << "'...";
std::error_code ErrInfo;
tool_output_file F(Filename.c_str(), ErrInfo, sys::fs::F_None);
ToolOutputFile F(Filename.c_str(), ErrInfo, sys::fs::F_None);

if (!ErrInfo) {
// dump the ValueFlowGraph here
Expand Down
6 changes: 3 additions & 3 deletions lib/MSSA/MemSSA.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -236,13 +236,13 @@ void MemSSA::insertPHI(const Function& fun) {
while (!bbs.empty()) {
const BasicBlock* bb = bbs.back();
bbs.pop_back();
DominanceFrontierBase<BasicBlock>::const_iterator it = df->find(const_cast<BasicBlock*>(bb));
DominanceFrontierBase<BasicBlock, false>::const_iterator it = df->find(const_cast<BasicBlock*>(bb));
if(it == df->end()) {
wrnMsg("bb not in the dominance frontier map??");
continue;
}
const DominanceFrontierBase<BasicBlock>::DomSetType& domSet = it->second;
for (DominanceFrontierBase<BasicBlock>::DomSetType::const_iterator bit =
const DominanceFrontierBase<BasicBlock, false>::DomSetType& domSet = it->second;
for (DominanceFrontierBase<BasicBlock, false>::DomSetType::const_iterator bit =
domSet.begin(); bit != domSet.end(); ++bit) {
const BasicBlock* pbb = *bit;
// if we never insert this phi node before
Expand Down
4 changes: 2 additions & 2 deletions lib/MemoryModel/PAGBuilder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -985,7 +985,7 @@ void PAGBuilder::handleExtCall(CallSite cs, const Function *callee) {
/// apr_thread_create has 2 arg.
assert((forkedFun->arg_size() <= 2) && "Size of formal parameter of start routine should be one");
if(forkedFun->arg_size() <= 2 && forkedFun->arg_size() >= 1) {
const Argument* formalParm = &(forkedFun->getArgumentList().front());
const Argument* formalParm = &(*forkedFun->arg_begin());
/// Connect actual parameter to formal parameter of the start routine
if(isa<PointerType>(actualParm->getType()) && isa<PointerType>(formalParm->getType()) )
pag->addThreadForkEdge(pag->getValueNode(actualParm), pag->getValueNode(formalParm),inst);
Expand All @@ -1008,7 +1008,7 @@ void PAGBuilder::handleExtCall(CallSite cs, const Function *callee) {
/// The task function of hare_parallel_for has 3 args.
assert((taskFunc->arg_size() == 3) && "Size of formal parameter of hare_parallel_for's task routine should be 3");
const Value* actualParm = getTaskDataAtHareParForSite(inst);
const Argument* formalParm = &(taskFunc->getArgumentList().front());
const Argument* formalParm = &(*taskFunc->arg_begin());
/// Connect actual parameter to formal parameter of the start routine
if(isa<PointerType>(actualParm->getType()) && isa<PointerType>(formalParm->getType()) )
pag->addThreadForkEdge(pag->getValueNode(actualParm), pag->getValueNode(formalParm),inst);
Expand Down
2 changes: 1 addition & 1 deletion lib/MemoryModel/PointerAnalysis.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@ void BVDataPTAImpl::writeToFile(const string& filename) {
outs() << "Storing pointer analysis results to '" << filename << "'...";

error_code err;
tool_output_file F(filename.c_str(), err, sys::fs::F_None);
ToolOutputFile F(filename.c_str(), err, sys::fs::F_None);
if (err) {
outs() << " error opening file for writing!\n";
F.os().clear_error();
Expand Down
12 changes: 7 additions & 5 deletions lib/Util/AnalysisUtil.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@

#include "Util/AnalysisUtil.h"

#include <llvm/Transforms/Utils/Local.h> // for FindAllocaDbgDeclare
#include <llvm/Transforms/Utils/Local.h> // for FindDbgAddrUses
#include <llvm/IR/GlobalVariable.h> // for GlobalVariable
#include <llvm/IR/Module.h> // for Module
#include <llvm/IR/InstrTypes.h> // for TerminatorInst
Expand Down Expand Up @@ -300,10 +300,12 @@ std::string analysisUtil::getSourceLoc(const Value* val) {
raw_string_ostream rawstr(str);
if (const Instruction *inst = dyn_cast<Instruction>(val)) {
if (isa<AllocaInst>(inst)) {
DbgDeclareInst* DDI = llvm::FindAllocaDbgDeclare(const_cast<Instruction*>(inst));
if (DDI) {
DIVariable *DIVar = cast<DIVariable>(DDI->getVariable());
rawstr << "ln: " << DIVar->getLine() << " fl: " << DIVar->getFilename();
for (DbgInfoIntrinsic *DII : FindDbgAddrUses(const_cast<Instruction*>(inst))) {
if (DbgDeclareInst *DDI = dyn_cast<DbgDeclareInst>(DII)) {
DIVariable *DIVar = cast<DIVariable>(DDI->getVariable());
rawstr << "ln: " << DIVar->getLine() << " fl: " << DIVar->getFilename();
break;
}
}
}
else if (MDNode *N = inst->getMetadata("dbg")) { // Here I is an LLVM instruction
Expand Down
2 changes: 1 addition & 1 deletion lib/Util/DataFlowUtil.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ void IteratedDominanceFrontier::calculate(llvm::BasicBlock * bb,

DomSetType worklist;

DominanceFrontierBase<llvm::BasicBlock>::const_iterator it = DF.find(bb);
DominanceFrontierBase<llvm::BasicBlock, false>::const_iterator it = DF.find(bb);
assert(it != DF.end());

worklist.insert(it->second.begin(), it->second.end());
Expand Down
2 changes: 1 addition & 1 deletion tests/runtest.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
################################################

##remember to run ./setup script before running testings
CLANGFLAG='-g -c -emit-llvm -I.'
CLANGFLAG='-Xclang -disable-O0-optnone -g -c -emit-llvm -I.'
LLVMOPTFLAG='-mem2reg -mergereturn'

TESTWITHOPT=$1
Expand Down

0 comments on commit 9b5c540

Please sign in to comment.