aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Support/MemoryBuffer.cpp
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2011-04-28 20:34:18 +0000
committerTed Kremenek <kremenek@apple.com>2011-04-28 20:34:18 +0000
commite203bbb47e259a08612340291592db13d226462b (patch)
tree6f7781f42ac1e8245b5370c4805e666c7618226e /llvm/lib/Support/MemoryBuffer.cpp
parent72aa1a8a68130a94a161224e8037a0f8c54ddfa8 (diff)
downloadllvm-e203bbb47e259a08612340291592db13d226462b.zip
llvm-e203bbb47e259a08612340291592db13d226462b.tar.gz
llvm-e203bbb47e259a08612340291592db13d226462b.tar.bz2
Add MemoryBuffer::getBufferKind() to report whether a memory buffer uses malloc'ed or mmap'ed memory. This is for performance analysis.
llvm-svn: 130432
Diffstat (limited to 'llvm/lib/Support/MemoryBuffer.cpp')
-rw-r--r--llvm/lib/Support/MemoryBuffer.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/llvm/lib/Support/MemoryBuffer.cpp b/llvm/lib/Support/MemoryBuffer.cpp
index ea72720..e2b5b7a 100644
--- a/llvm/lib/Support/MemoryBuffer.cpp
+++ b/llvm/lib/Support/MemoryBuffer.cpp
@@ -86,6 +86,10 @@ public:
// The name is stored after the class itself.
return reinterpret_cast<const char*>(this + 1);
}
+
+ virtual BufferKind getBufferKind() const {
+ return MemoryBuffer_Malloc;
+ }
};
}
@@ -191,6 +195,10 @@ public:
sys::Path::UnMapFilePages(reinterpret_cast<const char*>(RealStart),
RealSize);
}
+
+ virtual BufferKind getBufferKind() const {
+ return MemoryBuffer_MMap;
+ }
};
}