#include "llvm/Function.h"
#include "llvm/Support/Debug.h"
#include "llvm/ADT/Statistic.h"
+#include <iostream>
using namespace llvm;
namespace {
for (unsigned i = 0, e = BBRefs.size(); i != e; ++i) {
unsigned* Location = (unsigned*)BasicBlockAddrs[BBRefs[i].first];
unsigned* Ref = (unsigned*)BBRefs[i].second;
- intptr_t BranchTargetDisp = (((unsigned char*)Location - (unsigned char*)Ref) >> 2) - 1;
+ intptr_t BranchTargetDisp =
+ (((unsigned char*)Location - (unsigned char*)Ref) >> 2) - 1;
DEBUG(std::cerr << "Fixup @ " << (void*)Ref << " to " << (void*)Location
- << " Disp " << BranchTargetDisp << " using " << (BranchTargetDisp & ((1 << 22)-1)) << "\n");
+ << " Disp " << BranchTargetDisp
+ << " using " << (BranchTargetDisp & ((1 << 22)-1)) << "\n");
*Ref |= (BranchTargetDisp & ((1 << 21)-1));
}
BBRefs.clear();
case Alpha::ALTENT:
case Alpha::PCLABEL:
case Alpha::MEMLABEL:
+ case Alpha::IDEF_I:
+ case Alpha::IDEF_F32:
+ case Alpha::IDEF_F64:
break; //skip these
}
}
MO.getGlobal()->isExternal()) );
unsigned Reloc = 0;
int Offset = 0;
+ bool useGOT = false;
switch (MI.getOpcode()) {
+ case Alpha::BSR:
+ Reloc = Alpha::reloc_bsr;
+ break;
case Alpha::LDLr:
case Alpha::LDQr:
case Alpha::LDBUr:
case Alpha::LDSr:
case Alpha::LDTr:
case Alpha::LDAr:
+ case Alpha::STQr:
+ case Alpha::STLr:
+ case Alpha::STWr:
+ case Alpha::STBr:
+ case Alpha::STSr:
+ case Alpha::STTr:
Reloc = Alpha::reloc_gprellow;
break;
case Alpha::LDAHr:
break;
case Alpha::LDQl:
Reloc = Alpha::reloc_literal;
+ useGOT = true;
break;
case Alpha::LDAg:
case Alpha::LDAHg:
if (MO.isGlobalAddress())
MCE.addRelocation(MachineRelocation((unsigned)MCE.getCurrentPCOffset(),
Reloc, MO.getGlobal(), Offset,
- true, true));
+ false, useGOT));
else if (MO.isExternalSymbol())
MCE.addRelocation(MachineRelocation((unsigned)MCE.getCurrentPCOffset(),
Reloc, MO.getSymbolName(), Offset,