[llvm-commits] [llvm] r46877 - in /llvm/trunk/lib/Target/X86: X86CodeEmitter.cpp X86ISelLowering.cpp X86RegisterInfo.cpp X86RegisterInfo.h
Dan Gohman
gohman at apple.com
Thu Feb 7 19:29:40 PST 2008
Author: djg
Date: Thu Feb 7 21:29:40 2008
New Revision: 46877
URL: http://llvm.org/viewvc/llvm-project?rev=46877&view=rev
Log:
Avoid needlessly casting away const qualifiers.
Modified:
llvm/trunk/lib/Target/X86/X86CodeEmitter.cpp
llvm/trunk/lib/Target/X86/X86ISelLowering.cpp
llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp
llvm/trunk/lib/Target/X86/X86RegisterInfo.h
Modified: llvm/trunk/lib/Target/X86/X86CodeEmitter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86CodeEmitter.cpp?rev=46877&r1=46876&r2=46877&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86CodeEmitter.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86CodeEmitter.cpp Thu Feb 7 21:29:40 2008
@@ -84,7 +84,7 @@
unsigned Op, unsigned RegOpcodeField,
intptr_t PCAdj = 0);
- unsigned getX86RegNum(unsigned RegNo);
+ unsigned getX86RegNum(unsigned RegNo) const;
bool isX86_64ExtendedReg(const MachineOperand &MO);
unsigned determineREX(const MachineInstr &MI);
@@ -210,8 +210,8 @@
MCE.emitWordLE(0); // The relocated value will be added to the displacement
}
-unsigned Emitter::getX86RegNum(unsigned RegNo) {
- return ((X86RegisterInfo&)II->getRegisterInfo()).getX86RegNum(RegNo);
+unsigned Emitter::getX86RegNum(unsigned RegNo) const {
+ return ((const X86RegisterInfo&)II->getRegisterInfo()).getX86RegNum(RegNo);
}
inline static unsigned char ModRMByte(unsigned Mod, unsigned RegOpcode,
Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.cpp?rev=46877&r1=46876&r2=46877&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Thu Feb 7 21:29:40 2008
@@ -4948,9 +4948,9 @@
const unsigned char MOV64ri = TII->getBaseOpcodeFor(X86::MOV64ri);
const unsigned char N86R10 =
- ((X86RegisterInfo*)RegInfo)->getX86RegNum(X86::R10);
+ ((const X86RegisterInfo*)RegInfo)->getX86RegNum(X86::R10);
const unsigned char N86R11 =
- ((X86RegisterInfo*)RegInfo)->getX86RegNum(X86::R11);
+ ((const X86RegisterInfo*)RegInfo)->getX86RegNum(X86::R11);
const unsigned char REX_WB = 0x40 | 0x08 | 0x01; // REX prefix
@@ -5038,7 +5038,7 @@
const unsigned char MOV32ri = TII->getBaseOpcodeFor(X86::MOV32ri);
const unsigned char N86Reg =
- ((X86RegisterInfo*)RegInfo)->getX86RegNum(NestReg);
+ ((const X86RegisterInfo*)RegInfo)->getX86RegNum(NestReg);
OutChains[0] = DAG.getStore(Root, DAG.getConstant(MOV32ri|N86Reg, MVT::i8),
Trmp, TrmpAddr, 0);
Modified: llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp?rev=46877&r1=46876&r2=46877&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp Thu Feb 7 21:29:40 2008
@@ -82,7 +82,7 @@
// getX86RegNum - This function maps LLVM register identifiers to their X86
// specific numbering, which is used in various places encoding instructions.
//
-unsigned X86RegisterInfo::getX86RegNum(unsigned RegNo) {
+unsigned X86RegisterInfo::getX86RegNum(unsigned RegNo) const {
switch(RegNo) {
case X86::RAX: case X86::EAX: case X86::AX: case X86::AL: return N86::EAX;
case X86::RCX: case X86::ECX: case X86::CX: case X86::CL: return N86::ECX;
Modified: llvm/trunk/lib/Target/X86/X86RegisterInfo.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86RegisterInfo.h?rev=46877&r1=46876&r2=46877&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86RegisterInfo.h (original)
+++ llvm/trunk/lib/Target/X86/X86RegisterInfo.h Thu Feb 7 21:29:40 2008
@@ -71,7 +71,7 @@
/// getX86RegNum - Returns the native X86 register number for the given LLVM
/// register identifier.
- unsigned getX86RegNum(unsigned RegNo);
+ unsigned getX86RegNum(unsigned RegNo) const;
unsigned getStackAlignment() const { return StackAlign; }
More information about the llvm-commits
mailing list