/// address can be found.
virtual unsigned getRARegister() const = 0;
- /// getStackDirection - This method should return the factor by which stacks
- /// grow. The tyical value is -4 which is the grows negatively in 4 byte
- /// increments.
- virtual int getStackDirection() const;
-
/// getLocation - This method should return the actual location of a frame
/// variable given the frame index. The location is returned in ML.
/// Subclasses should override this method for special handling of frame
#include "llvm/Support/Mangler.h"
#include "llvm/Target/MRegisterInfo.h"
#include "llvm/Target/TargetMachine.h"
+#include "llvm/Target/TargetFrameInfo.h"
#include <iostream>
EmitULEB128Bytes(RI->getDwarfRegNum(Src.getRegister()));
EOL("Register");
}
-
- EmitULEB128Bytes(Src.getOffset() / RI->getStackDirection());
+
+ int stackGrowth =
+ Asm->TM.getFrameInfo()->getStackGrowthDirection() ==
+ TargetFrameInfo::StackGrowsUp ?
+ AddressSize : -AddressSize;
+
+ EmitULEB128Bytes(Src.getOffset() / stackGrowth);
EOL("Offset");
} else {
}
/// EmitInitialDebugFrame - Emit common frame info into a debug frame section.
///
void DwarfWriter::EmitInitialDebugFrame() {
+ int stackGrowth =
+ Asm->TM.getFrameInfo()->getStackGrowthDirection() ==
+ TargetFrameInfo::StackGrowsUp ?
+ AddressSize : -AddressSize;
+
// Start the dwarf frame section.
Asm->SwitchSection(DwarfFrameSection, 0);
EmitInt8(DW_CIE_VERSION); EOL("CIE Version");
EmitString(""); EOL("CIE Augmentation");
EmitULEB128Bytes(1); EOL("CIE Code Alignment Factor");
- EmitSLEB128Bytes(RI->getStackDirection()); EOL("CIE Data Alignment Factor");
+ EmitSLEB128Bytes(stackGrowth); EOL("CIE Data Alignment Factor");
EmitInt8(RI->getDwarfRegNum(RI->getRARegister())); EOL("CIE RA Column");
std::vector<MachineMove *> Moves;
return Allocatable;
}
-/// getStackDirection - This method should return the factor by which stacks
-/// grow. The tyical value is -4 which is the grows negatively in 4 byte
-/// increments.
-int MRegisterInfo::getStackDirection() const {
- return -sizeof(int32_t);
-}
-
/// getLocation - This method should return the actual location of a frame
/// variable given the frame index. The location is returned in ML.
/// Subclasses should override this method for special handling of frame