diff options
author | Dan Gohman <gohman@apple.com> | 2010-10-20 00:31:05 +0000 |
---|---|---|
committer | Dan Gohman <gohman@apple.com> | 2010-10-20 00:31:05 +0000 |
commit | a94cc6dfe8bf0c561677b17cf5f6ab0dc3382300 (patch) | |
tree | 47631828df15fe4dc5911c70d276e602bd801b64 /llvm/lib/CodeGen/MachineInstr.cpp | |
parent | 67c56217425e4207da3f2f889ed9a51026b8d222 (diff) | |
download | bcm5719-llvm-a94cc6dfe8bf0c561677b17cf5f6ab0dc3382300.tar.gz bcm5719-llvm-a94cc6dfe8bf0c561677b17cf5f6ab0dc3382300.zip |
Make CodeGen TBAA-aware.
llvm-svn: 116890
Diffstat (limited to 'llvm/lib/CodeGen/MachineInstr.cpp')
-rw-r--r-- | llvm/lib/CodeGen/MachineInstr.cpp | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/llvm/lib/CodeGen/MachineInstr.cpp b/llvm/lib/CodeGen/MachineInstr.cpp index af714d56a08..6f0b9719e1a 100644 --- a/llvm/lib/CodeGen/MachineInstr.cpp +++ b/llvm/lib/CodeGen/MachineInstr.cpp @@ -367,9 +367,11 @@ MachinePointerInfo MachinePointerInfo::getStack(int64_t Offset) { } MachineMemOperand::MachineMemOperand(MachinePointerInfo ptrinfo, unsigned f, - uint64_t s, unsigned int a) + uint64_t s, unsigned int a, + const MDNode *TBAAInfo) : PtrInfo(ptrinfo), Size(s), - Flags((f & ((1 << MOMaxBits) - 1)) | ((Log2_32(a) + 1) << MOMaxBits)) { + Flags((f & ((1 << MOMaxBits) - 1)) | ((Log2_32(a) + 1) << MOMaxBits)), + TBAAInfo(TBAAInfo) { assert((PtrInfo.V == 0 || isa<PointerType>(PtrInfo.V->getType())) && "invalid pointer value"); assert(getBaseAlignment() == a && "Alignment is not a power of 2!"); @@ -442,6 +444,16 @@ raw_ostream &llvm::operator<<(raw_ostream &OS, const MachineMemOperand &MMO) { MMO.getBaseAlignment() != MMO.getSize()) OS << "(align=" << MMO.getAlignment() << ")"; + // Print TBAA info. + if (const MDNode *TBAAInfo = MMO.getTBAAInfo()) { + OS << "(tbaa="; + if (TBAAInfo->getNumOperands() > 0) + WriteAsOperand(OS, TBAAInfo->getOperand(0), /*PrintType=*/false); + else + OS << "<unknown>"; + OS << ")"; + } + return OS; } @@ -1198,7 +1210,9 @@ bool MachineInstr::isInvariantLoad(AliasAnalysis *AA) const { if (PSV->isConstant(MFI)) continue; // If we have an AliasAnalysis, ask it whether the memory is constant. - if (AA && AA->pointsToConstantMemory(V)) + if (AA && AA->pointsToConstantMemory( + AliasAnalysis::Location(V, (*I)->getSize(), + (*I)->getTBAAInfo()))) continue; } |