MC: Allow modifiers in MCSymbolRefExpr, and eliminate X86MCTargetExpr.

- Although it would be nice to allow this decoupling, the assembler needs to be able to reason about MCSymbolRefExprs in too many places to make this viable. We can use a target specific encoding of the variant if this becomes an issue.
 - This patch also extends llvm-mc to support parsing of the modifiers, as opposed to lumping them in with the symbol.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98592 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Daniel Dunbar
2010-03-15 23:51:06 +00:00
parent 1bbf72b069
commit 4e815f8a8c
10 changed files with 124 additions and 134 deletions
+2 -2
View File
@@ -7,11 +7,11 @@
//
//===----------------------------------------------------------------------===//
#include "X86MCTargetExpr.h"
#include "X86TargetObjectFile.h"
#include "X86TargetMachine.h"
#include "llvm/CodeGen/MachineModuleInfoImpls.h"
#include "llvm/MC/MCContext.h"
#include "llvm/MC/MCExpr.h"
#include "llvm/MC/MCSectionMachO.h"
#include "llvm/Target/Mangler.h"
#include "llvm/ADT/SmallString.h"
@@ -29,7 +29,7 @@ getExprForDwarfGlobalReference(const GlobalValue *GV, Mangler *Mang,
if (Encoding & (DW_EH_PE_indirect | DW_EH_PE_pcrel)) {
const MCSymbol *Sym = Mang->getSymbol(GV);
const MCExpr *Res =
X86MCTargetExpr::Create(Sym, X86MCTargetExpr::GOTPCREL, getContext());
MCSymbolRefExpr::Create(Sym, MCSymbolRefExpr::VK_GOTPCREL, getContext());
const MCExpr *Four = MCConstantExpr::Create(4, getContext());
return MCBinaryExpr::CreateAdd(Res, Four, getContext());
}