f785676f2a
all of the features in the current working draft of the upcoming C++ standard, provisionally named C++1y. The code generator's performance is greatly increased, and the loop auto-vectorizer is now enabled at -Os and -O2 in addition to -O3. The PowerPC backend has made several major improvements to code generation quality and compile time, and the X86, SPARC, ARM32, Aarch64 and SystemZ backends have all seen major feature work. Release notes for llvm and clang can be found here: <http://llvm.org/releases/3.4/docs/ReleaseNotes.html> <http://llvm.org/releases/3.4/tools/clang/docs/ReleaseNotes.html> MFC after: 1 month
30 lines
946 B
C++
30 lines
946 B
C++
//===- lib/Support/StringRefMemoryObject.cpp --------------------*- C++ -*-===//
|
|
//
|
|
// The LLVM Compiler Infrastructure
|
|
//
|
|
// This file is distributed under the University of Illinois Open Source
|
|
// License. See LICENSE.TXT for details.
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
#include "llvm/Support/StringRefMemoryObject.h"
|
|
|
|
using namespace llvm;
|
|
|
|
int StringRefMemoryObject::readByte(uint64_t Addr, uint8_t *Byte) const {
|
|
if (Addr >= Base + getExtent() || Addr < Base)
|
|
return -1;
|
|
*Byte = Bytes[Addr - Base];
|
|
return 0;
|
|
}
|
|
|
|
int StringRefMemoryObject::readBytes(uint64_t Addr,
|
|
uint64_t Size,
|
|
uint8_t *Buf) const {
|
|
uint64_t Offset = Addr - Base;
|
|
if (Addr >= Base + getExtent() || Offset + Size > getExtent() || Addr < Base)
|
|
return -1;
|
|
memcpy(Buf, Bytes.data() + Offset, Size);
|
|
return 0;
|
|
}
|