Add LLVMDumpValue() utility routine
This commit is contained in:
32
llvmutil.cpp
32
llvmutil.cpp
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
Copyright (c) 2010-2011, Intel Corporation
|
Copyright (c) 2010-2012, Intel Corporation
|
||||||
All rights reserved.
|
All rights reserved.
|
||||||
|
|
||||||
Redistribution and use in source and binary forms, with or without
|
Redistribution and use in source and binary forms, with or without
|
||||||
@@ -39,6 +39,7 @@
|
|||||||
#include "ispc.h"
|
#include "ispc.h"
|
||||||
#include "type.h"
|
#include "type.h"
|
||||||
#include <llvm/Instructions.h>
|
#include <llvm/Instructions.h>
|
||||||
|
#include <set>
|
||||||
|
|
||||||
LLVM_TYPE_CONST llvm::Type *LLVMTypes::VoidType = NULL;
|
LLVM_TYPE_CONST llvm::Type *LLVMTypes::VoidType = NULL;
|
||||||
LLVM_TYPE_CONST llvm::PointerType *LLVMTypes::VoidPointerType = NULL;
|
LLVM_TYPE_CONST llvm::PointerType *LLVMTypes::VoidPointerType = NULL;
|
||||||
@@ -752,3 +753,32 @@ LLVMVectorValuesAllEqual(llvm::Value *v, int vectorLength,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
static void
|
||||||
|
lDumpValue(llvm::Value *v, std::set<llvm::Value *> &done) {
|
||||||
|
if (done.find(v) != done.end())
|
||||||
|
return;
|
||||||
|
|
||||||
|
llvm::Instruction *inst = llvm::dyn_cast<llvm::Instruction>(v);
|
||||||
|
if (done.size() > 0 && inst == NULL)
|
||||||
|
return;
|
||||||
|
|
||||||
|
fprintf(stderr, " ");
|
||||||
|
v->dump();
|
||||||
|
done.insert(v);
|
||||||
|
|
||||||
|
if (inst == NULL)
|
||||||
|
return;
|
||||||
|
|
||||||
|
for (unsigned i = 0; i < inst->getNumOperands(); ++i)
|
||||||
|
lDumpValue(inst->getOperand(i), done);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
LLVMDumpValue(llvm::Value *v) {
|
||||||
|
std::set<llvm::Value *> done;
|
||||||
|
lDumpValue(v, done);
|
||||||
|
fprintf(stderr, "----\n");
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
Copyright (c) 2010-2011, Intel Corporation
|
Copyright (c) 2010-2012, Intel Corporation
|
||||||
All rights reserved.
|
All rights reserved.
|
||||||
|
|
||||||
Redistribution and use in source and binary forms, with or without
|
Redistribution and use in source and binary forms, with or without
|
||||||
@@ -234,4 +234,9 @@ extern bool LLVMVectorValuesAllEqual(llvm::Value *v, int vectorLength,
|
|||||||
void LLVMFlattenInsertChain(llvm::InsertElementInst *ie, int vectorWidth,
|
void LLVMFlattenInsertChain(llvm::InsertElementInst *ie, int vectorWidth,
|
||||||
llvm::Value **elements);
|
llvm::Value **elements);
|
||||||
|
|
||||||
|
/** This is a utility routine for debugging that dumps out the given LLVM
|
||||||
|
value as well as (recursively) all of the other values that it depends
|
||||||
|
on. */
|
||||||
|
extern void LLVMDumpValue(llvm::Value *v);
|
||||||
|
|
||||||
#endif // ISPC_LLVMUTIL_H
|
#endif // ISPC_LLVMUTIL_H
|
||||||
|
|||||||
Reference in New Issue
Block a user