2009-10-25 18:55:46 +00:00
|
|
|
//===- Thumb2RegisterInfo.cpp - Thumb-2 Register Information ----*- C++ -*-===//
|
2009-06-27 12:16:40 +00: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 18:55:46 +00:00
|
|
|
// This file contains the Thumb-2 implementation of the TargetRegisterInfo
|
|
|
|
// class.
|
2009-06-27 12:16:40 +00:00
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#include "ARM.h"
|
|
|
|
#include "ARMSubtarget.h"
|
2009-07-02 22:18:33 +00:00
|
|
|
#include "Thumb2InstrInfo.h"
|
|
|
|
#include "Thumb2RegisterInfo.h"
|
2009-06-27 12:16:40 +00:00
|
|
|
#include "llvm/Constants.h"
|
|
|
|
#include "llvm/DerivedTypes.h"
|
2009-07-14 23:09:55 +00:00
|
|
|
#include "llvm/Function.h"
|
2009-06-27 12:16:40 +00:00
|
|
|
#include "llvm/CodeGen/MachineConstantPool.h"
|
|
|
|
#include "llvm/CodeGen/MachineFunction.h"
|
|
|
|
#include "llvm/CodeGen/MachineInstrBuilder.h"
|
|
|
|
using namespace llvm;
|
|
|
|
|
2009-07-08 18:31:39 +00:00
|
|
|
Thumb2RegisterInfo::Thumb2RegisterInfo(const ARMBaseInstrInfo &tii,
|
2009-07-02 22:18:33 +00:00
|
|
|
const ARMSubtarget &sti)
|
2009-06-27 12:16:40 +00:00
|
|
|
: ARMBaseRegisterInfo(tii, sti) {
|
|
|
|
}
|
|
|
|
|
|
|
|
/// emitLoadConstPool - Emits a load from constpool to materialize the
|
|
|
|
/// specified immediate.
|
2011-03-05 18:43:50 +00: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 12:16:40 +00:00
|
|
|
MachineFunction &MF = *MBB.getParent();
|
|
|
|
MachineConstantPool *ConstantPool = MF.getConstantPool();
|
2010-04-15 01:51:59 +00:00
|
|
|
const Constant *C = ConstantInt::get(
|
2009-08-13 21:58:54 +00:00
|
|
|
Type::getInt32Ty(MBB.getParent()->getFunction()->getContext()), Val);
|
2009-06-27 12:16:40 +00:00
|
|
|
unsigned Idx = ConstantPool->getConstantPoolIndex(C, 4);
|
|
|
|
|
2009-07-16 09:20:10 +00:00
|
|
|
BuildMI(MBB, MBBI, dl, TII.get(ARM::t2LDRpci))
|
|
|
|
.addReg(DestReg, getDefRegState(true), SubIdx)
|
2011-03-05 18:43:50 +00:00
|
|
|
.addConstantPoolIndex(Idx).addImm((int64_t)ARMCC::AL).addReg(0)
|
|
|
|
.setMIFlags(MIFlags);
|
2009-06-27 12:16:40 +00:00
|
|
|
}
|