LLVM  14.0.0git
Functions | Variables
DataLayout.cpp File Reference
#include "llvm/IR/DataLayout.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/ADT/Triple.h"
#include "llvm/IR/Constants.h"
#include "llvm/IR/DerivedTypes.h"
#include "llvm/IR/GetElementPtrTypeIterator.h"
#include "llvm/IR/GlobalVariable.h"
#include "llvm/IR/Module.h"
#include "llvm/IR/Type.h"
#include "llvm/IR/Value.h"
#include "llvm/Support/Casting.h"
#include "llvm/Support/Error.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/MathExtras.h"
#include "llvm/Support/TypeSize.h"
#include <algorithm>
#include <cassert>
#include <cstdint>
#include <cstdlib>
#include <tuple>
#include <utility>
Include dependency graph for DataLayout.cpp:

Go to the source code of this file.

Functions

static Error reportError (const Twine &Message)
 
static Error split (StringRef Str, char Separator, std::pair< StringRef, StringRef > &Split)
 Checked version of split, to ensure mandatory subparts. More...
 
template<typename IntTy >
static Error getInt (StringRef R, IntTy &Result)
 Get an unsigned integer, including error checks. More...
 
template<typename IntTy >
static Error getIntInBytes (StringRef R, IntTy &Result)
 Get an unsigned integer representing the number of bits and convert it into bytes. More...
 
static Error getAddrSpace (StringRef R, unsigned &AddrSpace)
 
static void addElementIndex (SmallVectorImpl< APInt > &Indices, TypeSize ElemSize, APInt &Offset)
 

Variables

static const LayoutAlignElem DefaultAlignments []
 

Function Documentation

◆ addElementIndex()

static void addElementIndex ( SmallVectorImpl< APInt > &  Indices,
TypeSize  ElemSize,
APInt Offset 
)
static

◆ getAddrSpace()

static Error getAddrSpace ( StringRef  R,
unsigned &  AddrSpace 
)
static

◆ getInt()

template<typename IntTy >
static Error getInt ( StringRef  R,
IntTy &  Result 
)
static

Get an unsigned integer, including error checks.

Definition at line 229 of file DataLayout.cpp.

References error, reportError(), and llvm::Error::success().

Referenced by llvm::PointerIntPair< llvm::IntrusiveBackListNode *, 1 >::getInt().

◆ getIntInBytes()

template<typename IntTy >
static Error getIntInBytes ( StringRef  R,
IntTy &  Result 
)
static

Get an unsigned integer representing the number of bits and convert it into bytes.

Error out of not a byte width multiple.

Definition at line 239 of file DataLayout.cpp.

◆ reportError()

static Error reportError ( const Twine Message)
static

Definition at line 212 of file DataLayout.cpp.

References llvm::createStringError(), and llvm::inconvertibleErrorCode().

Referenced by getInt(), and split().

◆ split()

static Error split ( StringRef  Str,
char  Separator,
std::pair< StringRef, StringRef > &  Split 
)
static

Checked version of split, to ensure mandatory subparts.

Definition at line 217 of file DataLayout.cpp.

References assert(), reportError(), and llvm::Error::success().

Variable Documentation

◆ DefaultAlignments

const LayoutAlignElem DefaultAlignments[]
static
Initial value:
= {
{INTEGER_ALIGN, 1, Align(1), Align(1)},
{INTEGER_ALIGN, 8, Align(1), Align(1)},
{INTEGER_ALIGN, 16, Align(2), Align(2)},
{INTEGER_ALIGN, 32, Align(4), Align(4)},
{INTEGER_ALIGN, 64, Align(4), Align(8)},
{FLOAT_ALIGN, 16, Align(2), Align(2)},
{FLOAT_ALIGN, 32, Align(4), Align(4)},
{FLOAT_ALIGN, 64, Align(8), Align(8)},
{FLOAT_ALIGN, 128, Align(16), Align(16)},
{VECTOR_ALIGN, 64, Align(8), Align(8)},
{VECTOR_ALIGN, 128, Align(16), Align(16)},
{AGGREGATE_ALIGN, 0, Align(1), Align(8)}
}

Definition at line 163 of file DataLayout.cpp.

Referenced by llvm::DataLayout::reset().

Align
uint64_t Align
Definition: ELFObjHandler.cpp:83
llvm::INTEGER_ALIGN
@ INTEGER_ALIGN
Definition: DataLayout.h:54
llvm::FLOAT_ALIGN
@ FLOAT_ALIGN
Definition: DataLayout.h:56
llvm::VECTOR_ALIGN
@ VECTOR_ALIGN
Definition: DataLayout.h:55
llvm::AGGREGATE_ALIGN
@ AGGREGATE_ALIGN
Definition: DataLayout.h:57