2012-02-18 13:03:15 +01:00
|
|
|
//===-- Thumb2RegisterInfo.cpp - Thumb-2 Register Information -------------===//
|
2009-06-27 14:16:40 +02:00
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
2009-10-25 19:55:46 +01:00
|
|
|
// This file contains the Thumb-2 implementation of the TargetRegisterInfo
|
|
|
|
// class.
|
2009-06-27 14:16:40 +02:00
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2012-03-17 08:33:42 +01:00
|
|
|
#include "Thumb2RegisterInfo.h"
|
2009-06-27 14:16:40 +02:00
|
|
|
#include "ARM.h"
|
|
|
|
#include "ARMSubtarget.h"
|
|
|
|
#include "llvm/CodeGen/MachineConstantPool.h"
|
|
|
|
#include "llvm/CodeGen/MachineFunction.h"
|
|
|
|
#include "llvm/CodeGen/MachineInstrBuilder.h"
|
2013-01-02 12:36:10 +01:00
|
|
|
#include "llvm/IR/Constants.h"
|
|
|
|
#include "llvm/IR/DerivedTypes.h"
|
|
|
|
#include "llvm/IR/Function.h"
|
2014-03-23 00:51:00 +01:00
|
|
|
#include "llvm/Target/TargetInstrInfo.h"
|
|
|
|
#include "llvm/Target/TargetMachine.h"
|
2009-06-27 14:16:40 +02:00
|
|
|
using namespace llvm;
|
|
|
|
|
2013-06-07 07:54:19 +02:00
|
|
|
Thumb2RegisterInfo::Thumb2RegisterInfo(const ARMSubtarget &sti)
|
|
|
|
: ARMBaseRegisterInfo(sti) {
|
2009-06-27 14:16:40 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/// emitLoadConstPool - Emits a load from constpool to materialize the
|
|
|
|
/// specified immediate.
|
2011-03-05 19:43:50 +01:00
|
|
|
void
|
|
|
|
Thumb2RegisterInfo::emitLoadConstPool(MachineBasicBlock &MBB,
|
|
|
|
MachineBasicBlock::iterator &MBBI,
|
|
|
|
DebugLoc dl,
|
|
|
|
unsigned DestReg, unsigned SubIdx,
|
|
|
|
int Val,
|
|
|
|
ARMCC::CondCodes Pred, unsigned PredReg,
|
|
|
|
unsigned MIFlags) const {
|
2009-06-27 14:16:40 +02:00
|
|
|
MachineFunction &MF = *MBB.getParent();
|
2014-08-05 04:39:49 +02:00
|
|
|
const TargetInstrInfo &TII = *MF.getSubtarget().getInstrInfo();
|
2009-06-27 14:16:40 +02:00
|
|
|
MachineConstantPool *ConstantPool = MF.getConstantPool();
|
2010-04-15 03:51:59 +02:00
|
|
|
const Constant *C = ConstantInt::get(
|
2009-08-13 23:58:54 +02:00
|
|
|
Type::getInt32Ty(MBB.getParent()->getFunction()->getContext()), Val);
|
2009-06-27 14:16:40 +02:00
|
|
|
unsigned Idx = ConstantPool->getConstantPoolIndex(C, 4);
|
|
|
|
|
2009-07-16 11:20:10 +02:00
|
|
|
BuildMI(MBB, MBBI, dl, TII.get(ARM::t2LDRpci))
|
|
|
|
.addReg(DestReg, getDefRegState(true), SubIdx)
|
2011-03-05 19:43:50 +01:00
|
|
|
.addConstantPoolIndex(Idx).addImm((int64_t)ARMCC::AL).addReg(0)
|
|
|
|
.setMIFlags(MIFlags);
|
2009-06-27 14:16:40 +02:00
|
|
|
}
|