Permalink
Browse files

Merge remote-tracking branch 'predator/master'

  • Loading branch information...
2 parents 110e9eb + 0a18a97 commit 15f99cb6f05973da2e5bea80451add7dde98edd2 @ondrik committed Sep 6, 2012
Showing with 1,363 additions and 680 deletions.
  1. +4 −2 cl/builtins.cc
  2. +10 −5 cl/callgraph.cc
  3. +4 −2 cl/cl_chain.cc
  4. +40 −20 cl/cl_dotgen.cc
  5. +2 −1 cl/cl_easy.cc
  6. +6 −3 cl/cl_factory.cc
  7. +4 −2 cl/cl_locator.cc
  8. +43 −20 cl/cl_pp.cc
  9. +36 −18 cl/cl_storage.cc
  10. +14 −7 cl/cl_typedot.cc
  11. +47 −22 cl/cldebug.cc
  12. +44 −22 cl/clf_intchk.cc
  13. +6 −3 cl/clf_opchk.cc
  14. +8 −4 cl/clf_unilabel.cc
  15. +14 −7 cl/clf_unswitch.cc
  16. +18 −9 cl/clutil.cc
  17. +2 −1 cl/code_listener.cc
  18. +1 −0 cl/gcc/clplug.c
  19. +14 −7 cl/killer.cc
  20. +4 −2 cl/loopscan.cc
  21. +18 −9 cl/ssd.cc
  22. +8 −4 cl/stopwatch.cc
  23. +68 −34 cl/storage.cc
  24. +10 −5 cl/util.hh
  25. +20 −10 fwnull/cl_fwnull.cc
  26. +2 −1 include/cl/cl_msg.hh
  27. +10 −5 include/cl/clutil.hh
  28. +8 −3 include/cl/code_listener.h
  29. +8 −4 sl/cl_symexec.cc
  30. +52 −29 sl/intrange.cc
  31. +22 −11 sl/intrange.hh
  32. +22 −11 sl/memdebug.cc
  33. +2 −1 sl/plotenum.cc
  34. +12 −6 sl/prototype.cc
  35. +10 −5 sl/sigcatch.cc
  36. +22 −11 sl/symabstract.cc
  37. +8 −4 sl/symbin.cc
  38. +28 −14 sl/symbt.cc
  39. +34 −17 sl/symcall.cc
  40. +2 −1 sl/symcmp.hh
  41. +12 −6 sl/symcut.cc
  42. +4 −2 sl/symdiscover.cc
  43. +2 −1 sl/symdiscover.hh
  44. +10 −5 sl/symdump.cc
  45. +14 −7 sl/syments.hh
  46. +50 −25 sl/symexec.cc
  47. +18 −9 sl/symgc.cc
  48. +200 −100 sl/symheap.cc
  49. +16 −8 sl/symheap.hh
  50. +34 −17 sl/symjoin.cc
  51. +2 −1 sl/symjoin.hh
  52. +6 −3 sl/sympath.cc
  53. +54 −27 sl/symplot.cc
  54. +73 −36 sl/symproc.cc
  55. +2 −1 sl/symproc.hh
  56. +12 −6 sl/symseg.cc
  57. +22 −11 sl/symseg.hh
  58. +46 −23 sl/symstate.cc
  59. +70 −35 sl/symtrace.cc
  60. +16 −8 sl/symutil.cc
  61. +12 −6 sl/symutil.hh
  62. +1 −1 tests/forester-regre/test-p0028.err
View
@@ -27,7 +27,8 @@
namespace CodeStorage {
-bool isBuiltInFnc(const struct cl_operand &op) {
+bool isBuiltInFnc(const struct cl_operand &op)
+{
const char *name;
if (!fncNameFromCst(&name, &op))
// likely indirect fuction call
@@ -38,7 +39,8 @@ bool isBuiltInFnc(const struct cl_operand &op) {
|| STREQ("VK_ASSERT", name);
}
-bool isBuiltInCall(const Insn &insn) {
+bool isBuiltInCall(const Insn &insn)
+{
return isBuiltInFnc(insn.operands[/* fnc */ 1]);
}
View
@@ -35,7 +35,8 @@ namespace CallGraph {
typedef const struct cl_operand &TOp;
typedef const Insn *TInsn;
-Node* allocNodeIfNeeded(Graph &cg, Fnc *const fnc) {
+Node* allocNodeIfNeeded(Graph &cg, Fnc *const fnc)
+{
Node *&node = fnc->cgNode;
if (node)
return node;
@@ -46,7 +47,8 @@ Node* allocNodeIfNeeded(Graph &cg, Fnc *const fnc) {
return node;
}
-void handleCallback(Graph &cg, Node *node, const TInsn insn, TOp op) {
+void handleCallback(Graph &cg, Node *node, const TInsn insn, TOp op)
+{
int uid;
if (!fncUidFromOperand(&uid, &op))
// not a function
@@ -70,7 +72,8 @@ void handleCallback(Graph &cg, Node *node, const TInsn insn, TOp op) {
cg.hasCallback = true;
}
-void handleCall(Graph &cg, Node *node, const TInsn insn) {
+void handleCall(Graph &cg, Node *node, const TInsn insn)
+{
// if there is a call, it is no longer a leaf node
cg.leaves.erase(node);
@@ -92,7 +95,8 @@ void handleCall(Graph &cg, Node *node, const TInsn insn) {
cg.roots.erase(targetNode);
}
-void handleFnc(Fnc *const fnc) {
+void handleFnc(Fnc *const fnc)
+{
Graph &cg = fnc->stor->callGraph;
Node *const node = allocNodeIfNeeded(cg, fnc);
@@ -114,7 +118,8 @@ void handleFnc(Fnc *const fnc) {
}
}
-void buildCallGraph(const Storage &stor) {
+void buildCallGraph(const Storage &stor)
+{
StopWatch watch;
BOOST_FOREACH(Fnc *fnc, stor.fncs)
View
@@ -103,11 +103,13 @@ class ClChain: public ICodeListener {
} \
} while (0)
-ClChain::~ClChain() {
+ClChain::~ClChain()
+{
CL_CHAIN_FOREACH(destroy);
}
-void ClChain::append(cl_code_listener *item) {
+void ClChain::append(cl_code_listener *item)
+{
list_.push_back(item);
}
View
@@ -228,11 +228,13 @@ void ClDotGenerator::createDotFile(std::ofstream &str, std::string fileName,
CL_ERROR("unable to create file '" << fileName << "'");
}
-void ClDotGenerator::closeSub(std::ofstream &str) {
+void ClDotGenerator::closeSub(std::ofstream &str)
+{
str << "}" << std::endl;
}
-void ClDotGenerator::closeDot(std::ofstream &str) {
+void ClDotGenerator::closeDot(std::ofstream &str)
+{
ClDotGenerator::closeSub(str);
if (!str)
@@ -253,21 +255,25 @@ ClDotGenerator::ClDotGenerator(const char *glDotFile):
}
}
-ClDotGenerator::~ClDotGenerator() {
+ClDotGenerator::~ClDotGenerator()
+{
if (hasGlDotFile_)
this->closeDot(glOut_);
}
-void ClDotGenerator::acknowledge() {
+void ClDotGenerator::acknowledge()
+{
// we haven't been waiting for acknowledge anyway, sorry...
}
-void ClDotGenerator::gobbleEdge(std::string dst, EdgeType type) {
+void ClDotGenerator::gobbleEdge(std::string dst, EdgeType type)
+{
perBbEdgeMap_[dst] = type;
perFncEdgeMap_[dst] = type;
}
-void ClDotGenerator::emitEdge(std::string dst, EdgeType type) {
+void ClDotGenerator::emitEdge(std::string dst, EdgeType type)
+{
switch (type) {
case ET_LC_CALL:
case ET_LC_CALL_INDIR:
@@ -291,7 +297,8 @@ void ClDotGenerator::emitEdge(std::string dst, EdgeType type) {
<< " [color=" << EtColors[type] << "];" << std::endl;
}
-void ClDotGenerator::emitBb() {
+void ClDotGenerator::emitBb()
+{
// colorize current BB node
perFileOut_ << "\t" << SL_QUOTE_BB(bb_)
<< " [color=" << NtColors[nodeType_]
@@ -321,7 +328,8 @@ void ClDotGenerator::emitCallSet(std::ofstream &str, TCallSet &cs,
}
}
-void ClDotGenerator::emitPendingCalls() {
+void ClDotGenerator::emitPendingCalls()
+{
TCallMultiMap::iterator i;
for (i = perFncCalls_.begin(); i != perFncCalls_.end(); ++i) {
const string &dst = i->first;
@@ -351,7 +359,8 @@ void ClDotGenerator::emitPendingCalls() {
perFncEdgeMap_.clear();
}
-void ClDotGenerator::emitFncEntry(const char *label) {
+void ClDotGenerator::emitFncEntry(const char *label)
+{
FILE_FNC_STREAM(SL_SUBGRAPH(fnc_ << "." << label, fnc_
<< "() at " << loc_.file << ":" << loc_.line)
<< "\tcolor=blue;" << std::endl
@@ -368,7 +377,8 @@ void ClDotGenerator::emitFncEntry(const char *label) {
perFileOut_ << "\tURL=" << SL_QUOTE_URL(fnc_) << ";" << std::endl;
}
-void ClDotGenerator::emitInsnJmp(const char *label) {
+void ClDotGenerator::emitInsnJmp(const char *label)
+{
perFncOut_ << "\t" << SL_QUOTE_BB(bb_ << SL_BB_POS_SUFFIX)
<< " [shape=box, color=black, fontcolor=black,"
<< " style=bold, label=goto];" << std::endl;
@@ -396,7 +406,8 @@ void ClDotGenerator::emitInsnCond(const char *then_label,
<< " [color=green];" << std::endl;
}
-void ClDotGenerator::emitOpIfNeeded() {
+void ClDotGenerator::emitOpIfNeeded()
+{
switch (lastInsn_) {
case CL_INSN_UNOP:
case CL_INSN_BINOP:
@@ -417,7 +428,8 @@ void ClDotGenerator::emitOpIfNeeded() {
<< std::endl;
}
-void ClDotGenerator::emitInsnCall() {
+void ClDotGenerator::emitInsnCall()
+{
perFncOut_ << "\t" << SL_QUOTE_BB(bb_ << SL_BB_POS_SUFFIX)
<< " [shape=box, color=blue, fontcolor=blue, style=dashed,"
<< " label=call];" << std::endl;
@@ -429,7 +441,8 @@ void ClDotGenerator::emitInsnCall() {
<< std::endl;
}
-void ClDotGenerator::checkForFncRef(const struct cl_operand *op) {
+void ClDotGenerator::checkForFncRef(const struct cl_operand *op)
+{
if (CL_OPERAND_CST != op->code)
return;
@@ -447,7 +460,8 @@ void ClDotGenerator::checkForFncRef(const struct cl_operand *op) {
perBbCalls_[name].insert(str.str());
}
-void ClDotGenerator::file_open(const char *file_name) {
+void ClDotGenerator::file_open(const char *file_name)
+{
CL_LOC_SET_FILE(loc_, file_name);
ClDotGenerator::createDotFile(perFileOut_, file_name, true);
perFileOut_ << SL_GRAPH(file_name);
@@ -483,7 +497,8 @@ void ClDotGenerator::fnc_open(const struct cl_operand *fnc)
<< std::endl;
}
-void ClDotGenerator::fnc_arg_decl(int, const struct cl_operand *) {
+void ClDotGenerator::fnc_arg_decl(int, const struct cl_operand *)
+{
}
void ClDotGenerator::fnc_close()
@@ -500,7 +515,8 @@ void ClDotGenerator::fnc_close()
bb_.clear();
}
-void ClDotGenerator::bb_open(const char *bb_name) {
+void ClDotGenerator::bb_open(const char *bb_name)
+{
if (!bb_.empty())
// emit last BB
this->emitBb();
@@ -516,7 +532,8 @@ void ClDotGenerator::bb_open(const char *bb_name) {
<< "\tURL=\"\";" << std::endl;
}
-void ClDotGenerator::insn(const struct cl_insn *cli) {
+void ClDotGenerator::insn(const struct cl_insn *cli)
+{
switch (cli->code) {
case CL_INSN_NOP:
case CL_INSN_LABEL:
@@ -626,7 +643,8 @@ void ClDotGenerator::insn_call_open(const struct cl_loc *loc,
CL_INSN_JMP;
}
-void ClDotGenerator::insn_call_arg(int, const struct cl_operand *arg_src) {
+void ClDotGenerator::insn_call_arg(int, const struct cl_operand *arg_src)
+{
this->checkForFncRef(arg_src);
}
@@ -655,14 +673,16 @@ void ClDotGenerator::insn_switch_case(const struct cl_loc *,
<< " [color=yellow];" << std::endl;
}
-void ClDotGenerator::insn_switch_close() {
+void ClDotGenerator::insn_switch_close()
+{
lastInsn_ =
/* FIXME: we have no CL_INSN_SWITCH in enum cl_insn_e */
CL_INSN_JMP;
}
// /////////////////////////////////////////////////////////////////////////////
// public interface, see cl_dotgen.hh for more details
-ICodeListener* createClDotGenerator(const char *args) {
+ICodeListener* createClDotGenerator(const char *args)
+{
return new ClDotGenerator(args);
}
View
@@ -80,6 +80,7 @@ class ClEasy: public ClStorageBuilder {
// /////////////////////////////////////////////////////////////////////////////
// interface, see cl_easy.hh for details
-ICodeListener* createClEasy(const char *configString) {
+ICodeListener* createClEasy(const char *configString)
+{
return new ClEasy(configString);
}
View
@@ -224,7 +224,8 @@ namespace {
}
}
-ClfChainFactory::ClfChainFactory() {
+ClfChainFactory::ClfChainFactory()
+{
map_["unify_labels_gl"] = createClfUniLabelGl;
map_["unify_labels_static"] = createClfUniLabelStatic;
map_["unify_labels_fnc"] = createClfUniLabelFnc;
@@ -302,11 +303,13 @@ ClFactory::ClFactory():
d->map["typedot"] = &createClTypeDotGenerator;
}
-ClFactory::~ClFactory() {
+ClFactory::~ClFactory()
+{
delete d;
}
-ICodeListener* ClFactory::create(const char *config_string) {
+ICodeListener* ClFactory::create(const char *config_string)
+{
CL_FACTORY_DEBUG("ClFactory: config_string: " << config_string);
TStringMap args;
View
@@ -98,13 +98,15 @@ ClLocator::ClLocator():
{
}
-void ClLocator::printLocation(const struct cl_loc *loc) {
+void ClLocator::printLocation(const struct cl_loc *loc)
+{
CL_DEBUG_MSG(cl_loc_fallback(loc, &lastLoc_),
"linearized code follows...");
}
// /////////////////////////////////////////////////////////////////////////////
// public interface, see cl_locator.hh for more details
-ICodeListener* createClLocator(const char *) {
+ICodeListener* createClLocator(const char *)
+{
return new ClLocator;
}
Oops, something went wrong.

0 comments on commit 15f99cb

Please sign in to comment.