mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-19 04:32:19 +00:00
Add MemoryBuffer::getBufferKind() to report whether a memory buffer uses malloc'ed or mmap'ed memory. This is for performance analysis.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@130432 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
81ad03c020
commit
5d86759e0f
@ -119,6 +119,21 @@ public:
|
|||||||
static error_code getFileOrSTDIN(const char *Filename,
|
static error_code getFileOrSTDIN(const char *Filename,
|
||||||
OwningPtr<MemoryBuffer> &result,
|
OwningPtr<MemoryBuffer> &result,
|
||||||
int64_t FileSize = -1);
|
int64_t FileSize = -1);
|
||||||
|
|
||||||
|
|
||||||
|
//===--------------------------------------------------------------------===//
|
||||||
|
// Provided for performance analysis.
|
||||||
|
//===--------------------------------------------------------------------===//
|
||||||
|
|
||||||
|
/// The kind of memory backing used to support the MemoryBuffer.
|
||||||
|
enum BufferKind {
|
||||||
|
MemoryBuffer_Malloc,
|
||||||
|
MemoryBuffer_MMap
|
||||||
|
};
|
||||||
|
|
||||||
|
/// Return information on the memory mechanism used to support the
|
||||||
|
/// MemoryBuffer.
|
||||||
|
virtual BufferKind getBufferKind() const = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // end namespace llvm
|
} // end namespace llvm
|
||||||
|
@ -86,6 +86,10 @@ public:
|
|||||||
// The name is stored after the class itself.
|
// The name is stored after the class itself.
|
||||||
return reinterpret_cast<const char*>(this + 1);
|
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),
|
sys::Path::UnMapFilePages(reinterpret_cast<const char*>(RealStart),
|
||||||
RealSize);
|
RealSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
virtual BufferKind getBufferKind() const {
|
||||||
|
return MemoryBuffer_MMap;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user