aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVikram S. Adve <vadve@cs.uiuc.edu>2002-07-08 23:07:26 +0000
committerVikram S. Adve <vadve@cs.uiuc.edu>2002-07-08 23:07:26 +0000
commitc9a0ca5171f8244270310a757a13190d5555c6bf (patch)
treee868841887c5232ebcb43bb0b16a88a5681d07a9
parent45c3877b5c7a42454e78c35b24f973508cfa3738 (diff)
downloadexternal_llvm-c9a0ca5171f8244270310a757a13190d5555c6bf.zip
external_llvm-c9a0ca5171f8244270310a757a13190d5555c6bf.tar.gz
external_llvm-c9a0ca5171f8244270310a757a13190d5555c6bf.tar.bz2
MachineInstr* in vector are not const (and never really were)
because operands may be modified directly to set register. Also, class MachineCodeForBasicBlock is now an annotation on BasicBlock. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2832 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/CodeGen/RegAlloc/LiveRangeInfo.cpp19
-rw-r--r--lib/Target/SparcV9/RegAlloc/LiveRangeInfo.cpp19
2 files changed, 20 insertions, 18 deletions
diff --git a/lib/CodeGen/RegAlloc/LiveRangeInfo.cpp b/lib/CodeGen/RegAlloc/LiveRangeInfo.cpp
index 4bbd36f..6a992b1 100644
--- a/lib/CodeGen/RegAlloc/LiveRangeInfo.cpp
+++ b/lib/CodeGen/RegAlloc/LiveRangeInfo.cpp
@@ -1,6 +1,7 @@
#include "llvm/CodeGen/LiveRangeInfo.h"
#include "llvm/CodeGen/RegClass.h"
#include "llvm/CodeGen/MachineInstr.h"
+#include "llvm/CodeGen/MachineCodeForBasicBlock.h"
#include "llvm/Target/TargetMachine.h"
#include "llvm/Function.h"
#include "llvm/BasicBlock.h"
@@ -107,19 +108,19 @@ void LiveRangeInfo::constructLiveRanges() {
// Now find speical LLVM instructions (CALL, RET) and LRs in machine
// instructions.
//
- for (Function::const_iterator BBI = Meth->begin(); BBI != Meth->end(); ++BBI){
+ for (Function::const_iterator BBI=Meth->begin(); BBI != Meth->end(); ++BBI){
// Now find all LRs for machine the instructions. A new LR will be created
// only for defs in the machine instr since, we assume that all Values are
// defined before they are used. However, there can be multiple defs for
// the same Value in machine instructions.
// get the iterator for machine instructions
- const MachineCodeForBasicBlock& MIVec = BBI->getMachineInstrVec();
-
+ MachineCodeForBasicBlock& MIVec = MachineCodeForBasicBlock::get(BBI);
+
// iterate over all the machine instructions in BB
- for(MachineCodeForBasicBlock::const_iterator MInstIterator = MIVec.begin();
+ for(MachineCodeForBasicBlock::iterator MInstIterator = MIVec.begin();
MInstIterator != MIVec.end(); ++MInstIterator) {
- const MachineInstr *MInst = *MInstIterator;
+ MachineInstr *MInst = *MInstIterator;
// Now if the machine instruction is a call/return instruction,
// add it to CallRetInstrList for processing its implicit operands
@@ -130,7 +131,7 @@ void LiveRangeInfo::constructLiveRanges() {
// iterate over MI operands to find defs
- for (MachineInstr::const_val_op_iterator OpI = MInst->begin(),
+ for (MachineInstr::val_op_iterator OpI = MInst->begin(),
OpE = MInst->end(); OpI != OpE; ++OpI) {
if(DEBUG_RA) {
MachineOperand::MachineOperandType OpTyp =
@@ -220,10 +221,10 @@ void LiveRangeInfo::constructLiveRanges() {
//---------------------------------------------------------------------------
void LiveRangeInfo::suggestRegs4CallRets()
{
- CallRetInstrListType::const_iterator It = CallRetInstrList.begin();
+ CallRetInstrListType::iterator It = CallRetInstrList.begin();
for( ; It != CallRetInstrList.end(); ++It ) {
- const MachineInstr *MInst = *It;
+ MachineInstr *MInst = *It;
MachineOpCode OpCode = MInst->getOpCode();
if( (TM.getInstrInfo()).isReturn(OpCode) )
@@ -266,7 +267,7 @@ void LiveRangeInfo::coalesceLRs()
BBI != BBE; ++BBI) {
// get the iterator for machine instructions
- const MachineCodeForBasicBlock& MIVec = BBI->getMachineInstrVec();
+ const MachineCodeForBasicBlock& MIVec = MachineCodeForBasicBlock::get(BBI);
MachineCodeForBasicBlock::const_iterator MInstIterator = MIVec.begin();
// iterate over all the machine instructions in BB
diff --git a/lib/Target/SparcV9/RegAlloc/LiveRangeInfo.cpp b/lib/Target/SparcV9/RegAlloc/LiveRangeInfo.cpp
index 4bbd36f..6a992b1 100644
--- a/lib/Target/SparcV9/RegAlloc/LiveRangeInfo.cpp
+++ b/lib/Target/SparcV9/RegAlloc/LiveRangeInfo.cpp
@@ -1,6 +1,7 @@
#include "llvm/CodeGen/LiveRangeInfo.h"
#include "llvm/CodeGen/RegClass.h"
#include "llvm/CodeGen/MachineInstr.h"
+#include "llvm/CodeGen/MachineCodeForBasicBlock.h"
#include "llvm/Target/TargetMachine.h"
#include "llvm/Function.h"
#include "llvm/BasicBlock.h"
@@ -107,19 +108,19 @@ void LiveRangeInfo::constructLiveRanges() {
// Now find speical LLVM instructions (CALL, RET) and LRs in machine
// instructions.
//
- for (Function::const_iterator BBI = Meth->begin(); BBI != Meth->end(); ++BBI){
+ for (Function::const_iterator BBI=Meth->begin(); BBI != Meth->end(); ++BBI){
// Now find all LRs for machine the instructions. A new LR will be created
// only for defs in the machine instr since, we assume that all Values are
// defined before they are used. However, there can be multiple defs for
// the same Value in machine instructions.
// get the iterator for machine instructions
- const MachineCodeForBasicBlock& MIVec = BBI->getMachineInstrVec();
-
+ MachineCodeForBasicBlock& MIVec = MachineCodeForBasicBlock::get(BBI);
+
// iterate over all the machine instructions in BB
- for(MachineCodeForBasicBlock::const_iterator MInstIterator = MIVec.begin();
+ for(MachineCodeForBasicBlock::iterator MInstIterator = MIVec.begin();
MInstIterator != MIVec.end(); ++MInstIterator) {
- const MachineInstr *MInst = *MInstIterator;
+ MachineInstr *MInst = *MInstIterator;
// Now if the machine instruction is a call/return instruction,
// add it to CallRetInstrList for processing its implicit operands
@@ -130,7 +131,7 @@ void LiveRangeInfo::constructLiveRanges() {
// iterate over MI operands to find defs
- for (MachineInstr::const_val_op_iterator OpI = MInst->begin(),
+ for (MachineInstr::val_op_iterator OpI = MInst->begin(),
OpE = MInst->end(); OpI != OpE; ++OpI) {
if(DEBUG_RA) {
MachineOperand::MachineOperandType OpTyp =
@@ -220,10 +221,10 @@ void LiveRangeInfo::constructLiveRanges() {
//---------------------------------------------------------------------------
void LiveRangeInfo::suggestRegs4CallRets()
{
- CallRetInstrListType::const_iterator It = CallRetInstrList.begin();
+ CallRetInstrListType::iterator It = CallRetInstrList.begin();
for( ; It != CallRetInstrList.end(); ++It ) {
- const MachineInstr *MInst = *It;
+ MachineInstr *MInst = *It;
MachineOpCode OpCode = MInst->getOpCode();
if( (TM.getInstrInfo()).isReturn(OpCode) )
@@ -266,7 +267,7 @@ void LiveRangeInfo::coalesceLRs()
BBI != BBE; ++BBI) {
// get the iterator for machine instructions
- const MachineCodeForBasicBlock& MIVec = BBI->getMachineInstrVec();
+ const MachineCodeForBasicBlock& MIVec = MachineCodeForBasicBlock::get(BBI);
MachineCodeForBasicBlock::const_iterator MInstIterator = MIVec.begin();
// iterate over all the machine instructions in BB