diff options
| author | Chris Lattner <sabre@nondot.org> | 2010-02-11 21:27:18 +0000 |
|---|---|---|
| committer | Chris Lattner <sabre@nondot.org> | 2010-02-11 21:27:18 +0000 |
| commit | 79eb84f5d46fc3b7ac35ecad8c6d1c4b6bf4dae6 (patch) | |
| tree | f9491f19427b17ceb380d54a9de8ff2ae443771b /lib/Target | |
| parent | ebdcf95e6a8836fe0d137d2ac69f9f781734f738 (diff) | |
| download | external_llvm-79eb84f5d46fc3b7ac35ecad8c6d1c4b6bf4dae6.zip external_llvm-79eb84f5d46fc3b7ac35ecad8c6d1c4b6bf4dae6.tar.gz external_llvm-79eb84f5d46fc3b7ac35ecad8c6d1c4b6bf4dae6.tar.bz2 | |
make getFixupKindInfo return a const reference, allowing
the tables to be const. Teach MCCodeEmitter to handle
the target-indep kinds so that we don't crash on them.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95924 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target')
| -rw-r--r-- | lib/Target/X86/X86MCCodeEmitter.cpp | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/lib/Target/X86/X86MCCodeEmitter.cpp b/lib/Target/X86/X86MCCodeEmitter.cpp index 7ec7cec..15510e8 100644 --- a/lib/Target/X86/X86MCCodeEmitter.cpp +++ b/lib/Target/X86/X86MCCodeEmitter.cpp @@ -45,16 +45,19 @@ public: ~X86MCCodeEmitter() {} unsigned getNumFixupKinds() const { - return 1; + return 2; } - MCFixupKindInfo &getFixupKindInfo(MCFixupKind Kind) const { - static MCFixupKindInfo Infos[] = { + const MCFixupKindInfo &getFixupKindInfo(MCFixupKind Kind) const { + const static MCFixupKindInfo Infos[] = { { "reloc_pcrel_4byte", 0, 4 * 8 }, { "reloc_pcrel_1byte", 0, 1 * 8 } }; + + if (Kind < FirstTargetFixupKind) + return MCCodeEmitter::getFixupKindInfo(Kind); - assert(Kind >= FirstTargetFixupKind && Kind < MaxTargetFixupKind && + assert(unsigned(Kind - FirstTargetFixupKind) < getNumFixupKinds() && "Invalid kind!"); return Infos[Kind - FirstTargetFixupKind]; } |
