Files
acceptance-tests
data
docs
external
Newtonsoft.Json
api-doc-tools
api-snapshot
aspnetwebstack
binary-reference-assemblies
bockbuild
boringssl
cecil
cecil-legacy
corefx
corert
helix-binaries
ikdasm
ikvm
illinker-test-assets
linker
llvm
bindings
cmake
docs
examples
include
lib
Analysis
AsmParser
BinaryFormat
Bitcode
CodeGen
DebugInfo
Demangle
ExecutionEngine
FuzzMutate
Fuzzer
IR
IRReader
LTO
LineEditor
Linker
MC
Object
ObjectYAML
Option
Passes
ProfileData
Support
TableGen
Target
AArch64
AMDGPU
ARC
ARM
AsmParser
Disassembler
InstPrinter
MCTargetDesc
TargetInfo
Utils
A15SDOptimizer.cpp
ARM.h
ARM.td
ARMAsmPrinter.cpp
ARMAsmPrinter.h
ARMBaseInstrInfo.cpp.REMOVED.git-id
ARMBaseInstrInfo.h
ARMBaseRegisterInfo.cpp
ARMBaseRegisterInfo.h
ARMBasicBlockInfo.h
ARMCallLowering.cpp
ARMCallLowering.h
ARMCallingConv.h
ARMCallingConv.td
ARMComputeBlockSize.cpp
ARMConstantIslandPass.cpp
ARMConstantPoolValue.cpp
ARMConstantPoolValue.h
ARMExpandPseudoInsts.cpp
ARMFastISel.cpp.REMOVED.git-id
ARMFeatures.h
ARMFrameLowering.cpp
ARMFrameLowering.h
ARMHazardRecognizer.cpp
ARMHazardRecognizer.h
ARMISelDAGToDAG.cpp.REMOVED.git-id
ARMISelLowering.cpp.REMOVED.git-id
ARMISelLowering.h
ARMInstrFormats.td
ARMInstrInfo.cpp
ARMInstrInfo.h
ARMInstrInfo.td.REMOVED.git-id
ARMInstrNEON.td.REMOVED.git-id
ARMInstrThumb.td
ARMInstrThumb2.td.REMOVED.git-id
ARMInstrVFP.td
ARMInstructionSelector.cpp
ARMLegalizerInfo.cpp
ARMLegalizerInfo.h
ARMLoadStoreOptimizer.cpp
ARMMCInstLower.cpp
ARMMachineFunctionInfo.cpp
ARMMachineFunctionInfo.h
ARMMacroFusion.cpp
ARMMacroFusion.h
ARMOptimizeBarriersPass.cpp
ARMPerfectShuffle.h.REMOVED.git-id
ARMRegisterBankInfo.cpp
ARMRegisterBankInfo.h
ARMRegisterBanks.td
ARMRegisterInfo.cpp
ARMRegisterInfo.h
ARMRegisterInfo.td
ARMSchedule.td
ARMScheduleA57.td
ARMScheduleA57WriteRes.td
ARMScheduleA8.td
ARMScheduleA9.td.REMOVED.git-id
ARMScheduleM3.td
ARMScheduleR52.td
ARMScheduleSwift.td
ARMScheduleV6.td
ARMSelectionDAGInfo.cpp
ARMSelectionDAGInfo.h
ARMSubtarget.cpp
ARMSubtarget.h
ARMSystemRegister.td
ARMTargetMachine.cpp
ARMTargetMachine.h
ARMTargetObjectFile.cpp
ARMTargetObjectFile.h
ARMTargetTransformInfo.cpp
ARMTargetTransformInfo.h
CMakeLists.txt
LICENSE.TXT
LLVMBuild.txt
MLxExpansionPass.cpp
README-Thumb.txt
README-Thumb2.txt
README.txt
Thumb1FrameLowering.cpp
Thumb1FrameLowering.h
Thumb1InstrInfo.cpp
Thumb1InstrInfo.h
Thumb2ITBlockPass.cpp
Thumb2InstrInfo.cpp
Thumb2InstrInfo.h
Thumb2SizeReduction.cpp
ThumbRegisterInfo.cpp
ThumbRegisterInfo.h
AVR
BPF
Hexagon
Lanai
MSP430
Mips
NVPTX
Nios2
PowerPC
RISCV
Sparc
SystemZ
WebAssembly
X86
XCore
CMakeLists.txt
LLVMBuild.txt
README.txt
Target.cpp
TargetIntrinsicInfo.cpp
TargetLoweringObjectFile.cpp
TargetMachine.cpp
TargetMachineC.cpp
Testing
ToolDrivers
Transforms
WindowsManifest
XRay
CMakeLists.txt
LLVMBuild.txt
projects
resources
runtimes
scripts
test
tools
unittests
utils
.arcconfig
.clang-format
.clang-tidy
.gitattributes
.gitignore
CMakeLists.txt
CODE_OWNERS.TXT
CREDITS.TXT
LICENSE.TXT
LLVMBuild.txt
README.txt
RELEASE_TESTERS.TXT
configure
llvm.spec.in
nuget-buildtasks
nunit-lite
roslyn-binaries
rx
xunit-binaries
ikvm-native
libgc
llvm
m4
man
mcs
mk
mono
msvc
po
runtime
samples
scripts
support
tools
COPYING.LIB
LICENSE
Makefile.am
Makefile.in
NEWS
README.md
acinclude.m4
aclocal.m4
autogen.sh
code_of_conduct.md
compile
config.guess
config.h.in
config.rpath
config.sub
configure.REMOVED.git-id
configure.ac.REMOVED.git-id
depcomp
install-sh
ltmain.sh.REMOVED.git-id
missing
mkinstalldirs
mono-uninstalled.pc.in
test-driver
winconfig.h
linux-packaging-mono/external/llvm/lib/Target/ARM/ARMBasicBlockInfo.h

110 lines
3.9 KiB
C
Raw Normal View History

//===-- ARMBasicBlockInfo.h - Basic Block Information -----------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// Utility functions and data structure for computing block size.
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_LIB_TARGET_ARM_ARMBASICBLOCKINFO_H
#define LLVM_LIB_TARGET_ARM_ARMBASICBLOCKINFO_H
#include "llvm/Support/MathExtras.h"
#include <algorithm>
#include <cstdint>
namespace llvm {
/// UnknownPadding - Return the worst case padding that could result from
/// unknown offset bits. This does not include alignment padding caused by
/// known offset bits.
///
/// @param LogAlign log2(alignment)
/// @param KnownBits Number of known low offset bits.
inline unsigned UnknownPadding(unsigned LogAlign, unsigned KnownBits) {
if (KnownBits < LogAlign)
return (1u << LogAlign) - (1u << KnownBits);
return 0;
}
/// BasicBlockInfo - Information about the offset and size of a single
/// basic block.
struct BasicBlockInfo {
/// Offset - Distance from the beginning of the function to the beginning
/// of this basic block.
///
/// Offsets are computed assuming worst case padding before an aligned
/// block. This means that subtracting basic block offsets always gives a
/// conservative estimate of the real distance which may be smaller.
///
/// Because worst case padding is used, the computed offset of an aligned
/// block may not actually be aligned.
unsigned Offset = 0;
/// Size - Size of the basic block in bytes. If the block contains
/// inline assembly, this is a worst case estimate.
///
/// The size does not include any alignment padding whether from the
/// beginning of the block, or from an aligned jump table at the end.
unsigned Size = 0;
/// KnownBits - The number of low bits in Offset that are known to be
/// exact. The remaining bits of Offset are an upper bound.
uint8_t KnownBits = 0;
/// Unalign - When non-zero, the block contains instructions (inline asm)
/// of unknown size. The real size may be smaller than Size bytes by a
/// multiple of 1 << Unalign.
uint8_t Unalign = 0;
/// PostAlign - When non-zero, the block terminator contains a .align
/// directive, so the end of the block is aligned to 1 << PostAlign
/// bytes.
uint8_t PostAlign = 0;
BasicBlockInfo() = default;
/// Compute the number of known offset bits internally to this block.
/// This number should be used to predict worst case padding when
/// splitting the block.
unsigned internalKnownBits() const {
unsigned Bits = Unalign ? Unalign : KnownBits;
// If the block size isn't a multiple of the known bits, assume the
// worst case padding.
if (Size & ((1u << Bits) - 1))
Bits = countTrailingZeros(Size);
return Bits;
}
/// Compute the offset immediately following this block. If LogAlign is
/// specified, return the offset the successor block will get if it has
/// this alignment.
unsigned postOffset(unsigned LogAlign = 0) const {
unsigned PO = Offset + Size;
unsigned LA = std::max(unsigned(PostAlign), LogAlign);
if (!LA)
return PO;
// Add alignment padding from the terminator.
return PO + UnknownPadding(LA, internalKnownBits());
}
/// Compute the number of known low bits of postOffset. If this block
/// contains inline asm, the number of known bits drops to the
/// instruction alignment. An aligned terminator may increase the number
/// of know bits.
/// If LogAlign is given, also consider the alignment of the next block.
unsigned postKnownBits(unsigned LogAlign = 0) const {
return std::max(std::max(unsigned(PostAlign), LogAlign),
internalKnownBits());
}
};
} // end namespace llvm
#endif // LLVM_LIB_TARGET_ARM_ARMBASICBLOCKINFO_H