summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target/AMDGPU/MCTargetDesc/SIMCCodeEmitter.cpp
diff options
context:
space:
mode:
authorTom Stellard <thomas.stellard@amd.com>2016-06-14 15:11:01 +0000
committerTom Stellard <thomas.stellard@amd.com>2016-06-14 15:11:01 +0000
commit5e6298b0f2b06c1b8c9713d2044576558e3186cb (patch)
tree4d21c72acddc71c7de1eb9ea3b2fbe63890749d2 /llvm/lib/Target/AMDGPU/MCTargetDesc/SIMCCodeEmitter.cpp
parentf8d00d5cac27171abd644c227fc4302a2bdc11c6 (diff)
downloadbcm5719-llvm-5e6298b0f2b06c1b8c9713d2044576558e3186cb.tar.gz
bcm5719-llvm-5e6298b0f2b06c1b8c9713d2044576558e3186cb.zip
AMDGPU/SI: Refactor fixup handling for constant addrspace variables
Summary: We now use a standard fixup type applying the pc-relative address of constant address space variables, and we have the GlobalAddress lowering code add the required 4 byte offset to the global address rather than doing it as part of the fixup. This refactoring will make it easier to use the same code for global address space variables and also simplifies the code. Reviewers: arsenm, kzhuravl Subscribers: arsenm, kzhuravl, llvm-commits Differential Revision: http://reviews.llvm.org/D21154 llvm-svn: 272675
Diffstat (limited to 'llvm/lib/Target/AMDGPU/MCTargetDesc/SIMCCodeEmitter.cpp')
-rw-r--r--llvm/lib/Target/AMDGPU/MCTargetDesc/SIMCCodeEmitter.cpp9
1 files changed, 4 insertions, 5 deletions
diff --git a/llvm/lib/Target/AMDGPU/MCTargetDesc/SIMCCodeEmitter.cpp b/llvm/lib/Target/AMDGPU/MCTargetDesc/SIMCCodeEmitter.cpp
index 533a54c1a8b..52787b64f7e 100644
--- a/llvm/lib/Target/AMDGPU/MCTargetDesc/SIMCCodeEmitter.cpp
+++ b/llvm/lib/Target/AMDGPU/MCTargetDesc/SIMCCodeEmitter.cpp
@@ -248,14 +248,13 @@ uint64_t SIMCCodeEmitter::getMachineOpValue(const MCInst &MI,
return MRI.getEncodingValue(MO.getReg());
if (MO.isExpr()) {
- const MCSymbolRefExpr *Expr = cast<MCSymbolRefExpr>(MO.getExpr());
- const MCSymbol &Sym = Expr->getSymbol();
+ const MCSymbolRefExpr *Expr = dyn_cast<MCSymbolRefExpr>(MO.getExpr());
MCFixupKind Kind;
- if (Sym.isExternal())
+ if (Expr && Expr->getSymbol().isExternal())
Kind = FK_Data_4;
else
- Kind = (MCFixupKind)AMDGPU::fixup_si_rodata;
- Fixups.push_back(MCFixup::create(4, Expr, Kind, MI.getLoc()));
+ Kind = FK_PCRel_4;
+ Fixups.push_back(MCFixup::create(4, MO.getExpr(), Kind, MI.getLoc()));
}
// Figure out the operand number, needed for isSrcOperand check
OpenPOWER on IntegriCloud