summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen
diff options
context:
space:
mode:
authorEvan Cheng <evan.cheng@apple.com>2008-12-10 02:32:19 +0000
committerEvan Cheng <evan.cheng@apple.com>2008-12-10 02:32:19 +0000
commit0b77319742c954e8a79bacf3f280242a06f59dbe (patch)
treed8b5f1d54539a1be6ac65188e026b9c819b54d3d /llvm/lib/CodeGen
parenta726c1763a44098710c6d4819abac3f148158ba8 (diff)
downloadbcm5719-llvm-0b77319742c954e8a79bacf3f280242a06f59dbe.tar.gz
bcm5719-llvm-0b77319742c954e8a79bacf3f280242a06f59dbe.zip
Fix MachineCodeEmitter to use uintptr_t instead of intptr_t. This avoids some overflow issues. Patch by Thomas Jablin.
llvm-svn: 60828
Diffstat (limited to 'llvm/lib/CodeGen')
-rw-r--r--llvm/lib/CodeGen/ELFWriter.cpp8
-rw-r--r--llvm/lib/CodeGen/MachOWriter.cpp14
2 files changed, 11 insertions, 11 deletions
diff --git a/llvm/lib/CodeGen/ELFWriter.cpp b/llvm/lib/CodeGen/ELFWriter.cpp
index ea12d503a50..001bad98324 100644
--- a/llvm/lib/CodeGen/ELFWriter.cpp
+++ b/llvm/lib/CodeGen/ELFWriter.cpp
@@ -85,21 +85,21 @@ namespace llvm {
virtual void StartMachineBasicBlock(MachineBasicBlock *MBB) {
}
- virtual intptr_t getConstantPoolEntryAddress(unsigned Index) const {
+ virtual uintptr_t getConstantPoolEntryAddress(unsigned Index) const {
assert(0 && "CP not implementated yet!");
return 0;
}
- virtual intptr_t getJumpTableEntryAddress(unsigned Index) const {
+ virtual uintptr_t getJumpTableEntryAddress(unsigned Index) const {
assert(0 && "JT not implementated yet!");
return 0;
}
- virtual intptr_t getMachineBasicBlockAddress(MachineBasicBlock *MBB) const {
+ virtual uintptr_t getMachineBasicBlockAddress(MachineBasicBlock *MBB) const {
assert(0 && "JT not implementated yet!");
return 0;
}
- virtual intptr_t getLabelAddress(uint64_t Label) const {
+ virtual uintptr_t getLabelAddress(uint64_t Label) const {
assert(0 && "Label address not implementated yet!");
abort();
return 0;
diff --git a/llvm/lib/CodeGen/MachOWriter.cpp b/llvm/lib/CodeGen/MachOWriter.cpp
index 613f680bc79..a34204f4e81 100644
--- a/llvm/lib/CodeGen/MachOWriter.cpp
+++ b/llvm/lib/CodeGen/MachOWriter.cpp
@@ -75,7 +75,7 @@ namespace llvm {
/// CPLocations - This is a map of constant pool indices to offsets from the
/// start of the section for that constant pool index.
- std::vector<intptr_t> CPLocations;
+ std::vector<uintptr_t> CPLocations;
/// CPSections - This is a map of constant pool indices to the MachOSection
/// containing the constant pool entry for that index.
@@ -83,12 +83,12 @@ namespace llvm {
/// JTLocations - This is a map of jump table indices to offsets from the
/// start of the section for that jump table index.
- std::vector<intptr_t> JTLocations;
+ std::vector<uintptr_t> JTLocations;
/// MBBLocations - This vector is a mapping from MBB ID's to their address.
/// It is filled in by the StartMachineBasicBlock callback and queried by
/// the getMachineBasicBlockAddress callback.
- std::vector<intptr_t> MBBLocations;
+ std::vector<uintptr_t> MBBLocations;
public:
MachOCodeEmitter(MachOWriter &mow) : MOW(mow), TM(MOW.TM) {
@@ -106,11 +106,11 @@ namespace llvm {
void emitConstantPool(MachineConstantPool *MCP);
void emitJumpTables(MachineJumpTableInfo *MJTI);
- virtual intptr_t getConstantPoolEntryAddress(unsigned Index) const {
+ virtual uintptr_t getConstantPoolEntryAddress(unsigned Index) const {
assert(CPLocations.size() > Index && "CP not emitted!");
return CPLocations[Index];
}
- virtual intptr_t getJumpTableEntryAddress(unsigned Index) const {
+ virtual uintptr_t getJumpTableEntryAddress(unsigned Index) const {
assert(JTLocations.size() > Index && "JT not emitted!");
return JTLocations[Index];
}
@@ -121,13 +121,13 @@ namespace llvm {
MBBLocations[MBB->getNumber()] = getCurrentPCOffset();
}
- virtual intptr_t getMachineBasicBlockAddress(MachineBasicBlock *MBB) const {
+ virtual uintptr_t getMachineBasicBlockAddress(MachineBasicBlock *MBB) const {
assert(MBBLocations.size() > (unsigned)MBB->getNumber() &&
MBBLocations[MBB->getNumber()] && "MBB not emitted!");
return MBBLocations[MBB->getNumber()];
}
- virtual intptr_t getLabelAddress(uint64_t Label) const {
+ virtual uintptr_t getLabelAddress(uint64_t Label) const {
assert(0 && "get Label not implemented");
abort();
return 0;
OpenPOWER on IntegriCloud