LLVM API Documentation

ARMWinEH.cpp
Go to the documentation of this file.
00001 //===-- ARMWinEH.cpp - Windows on ARM EH Support Functions ------*- C++ -*-===//
00002 //
00003 //                     The LLVM Compiler Infrastructure
00004 //
00005 // This file is distributed under the University of Illinois Open Source
00006 // License. See LICENSE.TXT for details.
00007 //
00008 //===----------------------------------------------------------------------===//
00009 
00010 #include "llvm/Support/ARMWinEH.h"
00011 #include "llvm/Support/raw_ostream.h"
00012 
00013 namespace llvm {
00014 namespace ARM {
00015 namespace WinEH {
00016 std::pair<uint16_t, uint32_t> SavedRegisterMask(const RuntimeFunction &RF) {
00017   uint8_t NumRegisters = RF.Reg();
00018   uint8_t RegistersVFP = RF.R();
00019   uint8_t LinkRegister = RF.L();
00020   uint8_t ChainedFrame = RF.C();
00021 
00022   uint16_t GPRMask = (ChainedFrame << 11) | (LinkRegister << 14);
00023   uint32_t VFPMask = 0;
00024 
00025   if (RegistersVFP)
00026     VFPMask |= (((1 << ((NumRegisters + 1) % 8)) - 1) << 8);
00027   else
00028     GPRMask |= (((1 << (NumRegisters + 1)) - 1) << 4);
00029 
00030   if (PrologueFolding(RF))
00031     GPRMask |= (((1 << (NumRegisters + 1)) - 1) << (~RF.StackAdjust() & 0x3));
00032 
00033   return std::make_pair(GPRMask, VFPMask);
00034 }
00035 }
00036 }
00037 }
00038