Skip to content

Commit

Permalink
Improve LLVM TBAA hierachy (#5567).
Browse files Browse the repository at this point in the history
  • Loading branch information
David Terei committed Jan 13, 2012
1 parent 38e897c commit e10589a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
4 changes: 2 additions & 2 deletions compiler/llvmGen/LlvmCodeGen/CodeGen.hs
Original file line number Diff line number Diff line change
Expand Up @@ -550,7 +550,7 @@ genStore env addr@(CmmMachOp (MO_Sub _) [
= genStore_fast env addr r (negate $ fromInteger n) val

-- generic case
genStore env addr val = genStore_slow env addr val [top]
genStore env addr val = genStore_slow env addr val [other]

-- | CmmStore operation
-- This is a special case for storing to a global register pointer
Expand Down Expand Up @@ -1032,7 +1032,7 @@ genLoad env e@(CmmMachOp (MO_Sub _) [
= genLoad_fast env e r (negate $ fromInteger n) ty

-- generic case
genLoad env e ty = genLoad_slow env e ty [top]
genLoad env e ty = genLoad_slow env e ty [other]

-- | Handle CmmLoad expression.
-- This is a special case for loading from a global register pointer
Expand Down
9 changes: 8 additions & 1 deletion compiler/llvmGen/LlvmCodeGen/Regs.hs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

module LlvmCodeGen.Regs (
lmGlobalRegArg, lmGlobalRegVar, alwaysLive,
stgTBAA, top, base, stack, heap, rx, tbaa, getTBAA
stgTBAA, top, base, stack, heap, rx, other, tbaa, getTBAA
) where

#include "HsVersions.h"
Expand Down Expand Up @@ -70,6 +70,11 @@ stgTBAA
, MetaUnamed heapN [MetaStr (fsLit "heap"), MetaNode topN]
, MetaUnamed rxN [MetaStr (fsLit "rx"), MetaNode heapN]
, MetaUnamed baseN [MetaStr (fsLit "base"), MetaNode topN]
-- FIX: Not 100% sure about 'others' place. Might need to be under 'heap'.
-- OR I think the big thing is Sp is never aliased, so might want
-- to change the hieracy to have Sp on its own branch that is never
-- aliased (e.g never use top as a TBAA node).
, MetaUnamed otherN [MetaStr (fsLit "other"), MetaNode topN]
]

-- | Id values
Expand All @@ -79,6 +84,7 @@ stackN = LMMetaUnamed 1
heapN = LMMetaUnamed 2
rxN = LMMetaUnamed 3
baseN = LMMetaUnamed 4
otherN = LMMetaUnamed 5

-- | The various TBAA types
top, heap, stack, rx, base :: MetaData
Expand All @@ -87,6 +93,7 @@ heap = (tbaa, heapN)
stack = (tbaa, stackN)
rx = (tbaa, rxN)
base = (tbaa, baseN)
other = (tbaa, otherN)

-- | The TBAA metadata identifier
tbaa :: LMString
Expand Down

0 comments on commit e10589a

Please sign in to comment.