LLVM  3.7.0
Macros | Functions | Variables
SIFixSGPRLiveRanges.cpp File Reference

SALU instructions ignore control flow, so we need to modify the live ranges of the registers they define in some cases. More...

#include "AMDGPU.h"
#include "SIInstrInfo.h"
#include "SIRegisterInfo.h"
#include "llvm/CodeGen/LiveIntervalAnalysis.h"
#include "llvm/CodeGen/MachineFunctionPass.h"
#include "llvm/CodeGen/MachineInstrBuilder.h"
#include "llvm/CodeGen/MachinePostDominators.h"
#include "llvm/CodeGen/MachineRegisterInfo.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm/Target/TargetMachine.h"
Include dependency graph for SIFixSGPRLiveRanges.cpp:

Go to the source code of this file.

Macros

#define DEBUG_TYPE   "si-fix-sgpr-live-ranges"
 

Functions

 INITIALIZE_PASS_BEGIN (SIFixSGPRLiveRanges, DEBUG_TYPE,"SI Fix SGPR Live Ranges", false, false) INITIALIZE_PASS_END(SIFixSGPRLiveRanges
 

Variables

 DEBUG_TYPE
 
SI Fix SGPR Live Ranges
 
SI Fix SGPR Live false
 

Detailed Description

SALU instructions ignore control flow, so we need to modify the live ranges of the registers they define in some cases.

The main case we need to handle is when a def is used in one side of a branch and not another. For example:

def IF ... ... ELSE use ... ENDIF

Here we need the register allocator to avoid assigning any of the defs inside of the IF to the same register as def. In traditional live interval analysis def is not live inside the IF branch, however, since SALU instructions inside of IF will be executed even if the branch is not taken, there is the chance that one of the instructions will overwrite the value of def, so the use in ELSE will see the wrong value.

The strategy we use for solving this is to add an extra use after the ENDIF:

def IF ... ... ELSE use ... ENDIF use

Adding this use will make the def live thoughout the IF branch, which is what we want.

Definition in file SIFixSGPRLiveRanges.cpp.

Macro Definition Documentation

#define DEBUG_TYPE   "si-fix-sgpr-live-ranges"

Definition at line 62 of file SIFixSGPRLiveRanges.cpp.

Function Documentation

INITIALIZE_PASS_BEGIN ( SIFixSGPRLiveRanges  ,
DEBUG_TYPE  ,
"SI Fix SGPR Live Ranges ,
false  ,
false   
)

Variable Documentation

DEBUG_TYPE

Definition at line 95 of file SIFixSGPRLiveRanges.cpp.

SI Fix SGPR Live false

Definition at line 95 of file SIFixSGPRLiveRanges.cpp.

SI Fix SGPR Live Ranges