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"
|
2012-03-17 08:33:42 +01:00
|
|
|
#include "ARMBaseInstrInfo.h"
|
2009-06-27 14:16:40 +02:00
|
|
|
#include "ARMSubtarget.h"
|
|
|
|
#include "llvm/Constants.h"
|
|
|
|
#include "llvm/DerivedTypes.h"
|
2009-07-15 01:09:55 +02:00
|
|
|
#include "llvm/Function.h"
|
2009-06-27 14:16:40 +02:00
|
|
|
#include "llvm/CodeGen/MachineConstantPool.h"
|
|
|
|
#include "llvm/CodeGen/MachineFunction.h"
|
|
|
|
#include "llvm/CodeGen/MachineInstrBuilder.h"
|
|
|
|
using namespace llvm;
|
|
|
|
|
2009-07-08 20:31:39 +02:00
|
|
|
Thumb2RegisterInfo::Thumb2RegisterInfo(const ARMBaseInstrInfo &tii,
|
2009-07-03 00:18:33 +02:00
|
|
|
const ARMSubtarget &sti)
|
2009-06-27 14:16:40 +02:00
|
|
|
: ARMBaseRegisterInfo(tii, sti) {
|
|
|
|
}
|
|
|
|
|
|
|
|
/// 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();
|
|
|
|
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
|
|
|
}
|