SlideShare a Scribd company logo
GENERIC
Kai
• The purpose of GENERIC is simply to provide a
language-independent way of representing an
entire function in trees.
• A statement is defined as any expression whose
value is ignored.
• A statement will always have TREE_SIDE_EFFECTS
set
• You can tell what kind of node a particular tree is
by using the TREE_CODE macro.
• All GENERIC trees have two fields in common.
• TREE_CHAIN
• a pointer be used as a singly-linked list
• TREE_TYPE
code & flags
tree type
tree chain
struct tree_base
struct tree_typed
struct tree_common
typedef union tree_node *tree
typedef const union tree_node *const_tree
union tree_node
IDENTIFIER_NODE
• There are never two distinct IDENTIFIER_NODEs
representing the same identifier.
• IDENTIFIER_POINTER
• IDENTIFIER_LENGTH
Container
• Two kinds of container
• TREE_LIST
• TREE_PURPOSE
• TREE_VALUE
• The next node is found by following the TREE_CHAIN
• TREE_VEC
• TREE_VEC_LENGTH
• TREE_VEC_ELT
code & flags
tree type
tree chain
struct tree_base
struct tree_typed
struct tree_common
tree_list
purposetree
valuetree
code & flags
tree type
tree chain
purpose
value
tree_list
NULL_TREE
code & flags
tree type
tree chain
struct tree_base
struct tree_typed
struct tree_common
tree_vec
a[1]tree
TYPE
• INTEGER_TYPE
• REAL_TYPE
• FIXED_POINT_TYPE
• COMPLEX_TYPE
• ENUMERAL_TYPE
• BOOLEAN_TYPE
• POINTER_TYPE
• REFERENCE_TYPE
• FUNCTION_TYPE
• METHOD_TYPE
• ARRAY_TYPE
• RECORD_TYPE
• UNION_TYPE
• QUAL_UNION_TYPE
• LANG_TYPE
• OFFSET_TYPE
Declarations
• LABEL_DECL
• CONST_DECL
• enumeration constants
• RESULT_DECL
• the value returned by a function
• TYPE_DECL
• typedef declarations
• VAR_DECL
• variables with namespace or block scope
• static data members
• PARM_DECL
• a parameter to a function
• DEBUG_EXPR_DECL
• FIELD_DECL
• non-static data members
• NAMESPACE_DECL
VAR_DECL
• DECL_SIZE
• DECL_ALIGN
• DECL_THIS_STATIC
• static variable
• DECL_THIS_EXTERN
• extern variable
• DECL_INITIAL
• an expression for the initialiser
PARM_DECL
• DECL_ARGUMENTS
• DECL_ARG_TYPE
• the type that will actually be used when a value is
passed to this function
Attributes
• TREE_LIST
• TREE_PURPOSE
• the name of the attribute
• TREE_VALUE
• TREE_LIST of the arguments of the attribute
• TREE_CHAIN
• next attribute
• DECL_ATTRIBUTES (tree decl)
• DECL_ATTRIBUTES (tree type)
Statements
• ASM_EXPR
• inline assembly
• DECL_EXPR
• a local declaration
• LABEL_EXPR
• GOTO_EXPR
• goto statement
• RETURN_EXPR
• return statement
• LOOP_EXPR
• infinite loop
• EXIT_EXPR
• conditional exit from the nearest LOOP_EXPR
• SWITCH_EXPR
• switch statement
• CASE_LABEL_EXPR
• a case label
Blocks
• BIND_EXPR
• BIND_EXPR_VARS
• variables in a block
Statement Sequences
• STATEMENT_LIST
FUNCTION_DECL
BIND_EXPR
saved_tree
gimplify_stmt
int test_gimple(int param_a, char param_b, float param_c)
{
int local;
local = param_a + param_b;
local = (int)((float)local * param_c);
return local;
}
locus
VOID_TYPE
type
VAR_DECL
operands[0]
INTEGER_TYPE
type
BLOCK
operands[2]
STATEMENT_LIST
operands[1]
DECL_EXPR
head
VAR_DECL
operands[0]
INTEGER_TYPE
type
MODIFY_EXPR
VAR_DECL PLUS_EXPR
operands[0] operands[1]
INTEGER_TYPE
type
NOP_EXPR PARM_DECL
operands[0] operands[1]
PARM_DECL
operands[0]
Functions
• A function is represented by a FUNCTION_DECL node.
• DECL_NAME
• DECL_ASSEMBLER_NAME
• DECL_ARGUMENTS
• PARM_DECL for the first argument
• Subsequent PARM_DECL nodes can be obtained by following the TREE_CHAIN links.
• DECL_RESULT
• RESULT_DECL
• DECL_SAVED_TREE
• the complete body of the function
• TREE_TYPE
• FUNCTION_TYPE
• METHOD_TYPE
FUNCTION_DECL
FUNCTION_TYPE
PARM_DECL RESULT_DECL
INTEGER_TYPEPARM_DECL
PARM_DECL
type
type arguments result
chain
chain
vec<tree> fnargs
INTEGER_TYPE
initial
gimplify_parameters
INTEGER_TYPE
size_unit
REAL_TYPE
type
REAL_TYPE
initial
int test_gimple(int param_a, char param_b, float param_c)
{
int local;
local = param_a + param_b;
local = (int)((float)local * param_c);
return local;
}

More Related Content

Viewers also liked

Safer IoT using functional language
Safer IoT using functional languageSafer IoT using functional language
Safer IoT using functional language
Kiwamu Okabe
 
SecureAssist Enterprise Portal 導入ガイド
SecureAssist Enterprise Portal 導入ガイドSecureAssist Enterprise Portal 導入ガイド
SecureAssist Enterprise Portal 導入ガイド
Asterisk Research, Inc.
 
SecureAssist Eclipse Plug-in 導入ガイド
SecureAssist Eclipse Plug-in 導入ガイドSecureAssist Eclipse Plug-in 導入ガイド
SecureAssist Eclipse Plug-in 導入ガイド
Asterisk Research, Inc.
 
SecureAssist Visual Studio Package 導入ガイド
SecureAssist Visual Studio Package 導入ガイドSecureAssist Visual Studio Package 導入ガイド
SecureAssist Visual Studio Package 導入ガイド
Asterisk Research, Inc.
 
SecureAssist Enterprise Portal APIガイド
SecureAssist Enterprise Portal APIガイドSecureAssist Enterprise Portal APIガイド
SecureAssist Enterprise Portal APIガイド
Asterisk Research, Inc.
 
SecureAssist IntelliJ Plug-in 導入ガイド
SecureAssist IntelliJ Plug-in 導入ガイドSecureAssist IntelliJ Plug-in 導入ガイド
SecureAssist IntelliJ Plug-in 導入ガイド
Asterisk Research, Inc.
 
Hot potato Privilege Escalation
Hot potato Privilege EscalationHot potato Privilege Escalation
Hot potato Privilege Escalation
Sunny Neo
 
Hands-on VeriFast with STM32 microcontroller
Hands-on VeriFast with STM32 microcontrollerHands-on VeriFast with STM32 microcontroller
Hands-on VeriFast with STM32 microcontroller
Kiwamu Okabe
 
Something About Dynamic Linking
Something About Dynamic LinkingSomething About Dynamic Linking
Something About Dynamic Linking
Wang Hsiangkai
 
Poster: Comparing ATS and VeriFast on RTOS system state
Poster: Comparing ATS and VeriFast on RTOS system statePoster: Comparing ATS and VeriFast on RTOS system state
Poster: Comparing ATS and VeriFast on RTOS system state
Kiwamu Okabe
 

Viewers also liked (10)

Safer IoT using functional language
Safer IoT using functional languageSafer IoT using functional language
Safer IoT using functional language
 
SecureAssist Enterprise Portal 導入ガイド
SecureAssist Enterprise Portal 導入ガイドSecureAssist Enterprise Portal 導入ガイド
SecureAssist Enterprise Portal 導入ガイド
 
SecureAssist Eclipse Plug-in 導入ガイド
SecureAssist Eclipse Plug-in 導入ガイドSecureAssist Eclipse Plug-in 導入ガイド
SecureAssist Eclipse Plug-in 導入ガイド
 
SecureAssist Visual Studio Package 導入ガイド
SecureAssist Visual Studio Package 導入ガイドSecureAssist Visual Studio Package 導入ガイド
SecureAssist Visual Studio Package 導入ガイド
 
SecureAssist Enterprise Portal APIガイド
SecureAssist Enterprise Portal APIガイドSecureAssist Enterprise Portal APIガイド
SecureAssist Enterprise Portal APIガイド
 
SecureAssist IntelliJ Plug-in 導入ガイド
SecureAssist IntelliJ Plug-in 導入ガイドSecureAssist IntelliJ Plug-in 導入ガイド
SecureAssist IntelliJ Plug-in 導入ガイド
 
Hot potato Privilege Escalation
Hot potato Privilege EscalationHot potato Privilege Escalation
Hot potato Privilege Escalation
 
Hands-on VeriFast with STM32 microcontroller
Hands-on VeriFast with STM32 microcontrollerHands-on VeriFast with STM32 microcontroller
Hands-on VeriFast with STM32 microcontroller
 
Something About Dynamic Linking
Something About Dynamic LinkingSomething About Dynamic Linking
Something About Dynamic Linking
 
Poster: Comparing ATS and VeriFast on RTOS system state
Poster: Comparing ATS and VeriFast on RTOS system statePoster: Comparing ATS and VeriFast on RTOS system state
Poster: Comparing ATS and VeriFast on RTOS system state
 

Similar to GCC GENERIC

First Class Variables as AST Annotations
First Class Variables as AST AnnotationsFirst Class Variables as AST Annotations
First Class Variables as AST Annotations
Marcus Denker
 
First Class Variables as AST Annotations
 First Class Variables as AST Annotations First Class Variables as AST Annotations
First Class Variables as AST Annotations
ESUG
 
Variables in Pharo
Variables in PharoVariables in Pharo
Variables in Pharo
Marcus Denker
 
NSCoder Swift - An Introduction to Swift
NSCoder Swift - An Introduction to SwiftNSCoder Swift - An Introduction to Swift
NSCoder Swift - An Introduction to SwiftAndreas Blick
 
Introduction to Swift 2
Introduction to Swift 2Introduction to Swift 2
Introduction to Swift 2
Joris Timmerman
 
Introduction to c converted-converted
Introduction to c converted-convertedIntroduction to c converted-converted
Introduction to c converted-converted
NabishaAK
 
TypeScript
TypeScriptTypeScript

Similar to GCC GENERIC (7)

First Class Variables as AST Annotations
First Class Variables as AST AnnotationsFirst Class Variables as AST Annotations
First Class Variables as AST Annotations
 
First Class Variables as AST Annotations
 First Class Variables as AST Annotations First Class Variables as AST Annotations
First Class Variables as AST Annotations
 
Variables in Pharo
Variables in PharoVariables in Pharo
Variables in Pharo
 
NSCoder Swift - An Introduction to Swift
NSCoder Swift - An Introduction to SwiftNSCoder Swift - An Introduction to Swift
NSCoder Swift - An Introduction to Swift
 
Introduction to Swift 2
Introduction to Swift 2Introduction to Swift 2
Introduction to Swift 2
 
Introduction to c converted-converted
Introduction to c converted-convertedIntroduction to c converted-converted
Introduction to c converted-converted
 
TypeScript
TypeScriptTypeScript
TypeScript
 

More from Wang Hsiangkai

Debug Line Issues After Relaxation.
Debug Line Issues After Relaxation.Debug Line Issues After Relaxation.
Debug Line Issues After Relaxation.
Wang Hsiangkai
 
Machine Trace Metrics
Machine Trace MetricsMachine Trace Metrics
Machine Trace Metrics
Wang Hsiangkai
 
Instruction Combine in LLVM
Instruction Combine in LLVMInstruction Combine in LLVM
Instruction Combine in LLVM
Wang Hsiangkai
 
GCC LTO
GCC LTOGCC LTO
LTO plugin
LTO pluginLTO plugin
LTO plugin
Wang Hsiangkai
 
DWARF Data Representation
DWARF Data RepresentationDWARF Data Representation
DWARF Data Representation
Wang Hsiangkai
 
Effective Modern C++
Effective Modern C++Effective Modern C++
Effective Modern C++
Wang Hsiangkai
 
LLVM Register Allocation (2nd Version)
LLVM Register Allocation (2nd Version)LLVM Register Allocation (2nd Version)
LLVM Register Allocation (2nd Version)
Wang Hsiangkai
 
Perf File Format
Perf File FormatPerf File Format
Perf File Format
Wang Hsiangkai
 
LLVM Register Allocation
LLVM Register AllocationLLVM Register Allocation
LLVM Register Allocation
Wang Hsiangkai
 
Introduction to Perf
Introduction to PerfIntroduction to Perf
Introduction to Perf
Wang Hsiangkai
 
SSA - PHI-functions Placements
SSA - PHI-functions PlacementsSSA - PHI-functions Placements
SSA - PHI-functions Placements
Wang Hsiangkai
 

More from Wang Hsiangkai (12)

Debug Line Issues After Relaxation.
Debug Line Issues After Relaxation.Debug Line Issues After Relaxation.
Debug Line Issues After Relaxation.
 
Machine Trace Metrics
Machine Trace MetricsMachine Trace Metrics
Machine Trace Metrics
 
Instruction Combine in LLVM
Instruction Combine in LLVMInstruction Combine in LLVM
Instruction Combine in LLVM
 
GCC LTO
GCC LTOGCC LTO
GCC LTO
 
LTO plugin
LTO pluginLTO plugin
LTO plugin
 
DWARF Data Representation
DWARF Data RepresentationDWARF Data Representation
DWARF Data Representation
 
Effective Modern C++
Effective Modern C++Effective Modern C++
Effective Modern C++
 
LLVM Register Allocation (2nd Version)
LLVM Register Allocation (2nd Version)LLVM Register Allocation (2nd Version)
LLVM Register Allocation (2nd Version)
 
Perf File Format
Perf File FormatPerf File Format
Perf File Format
 
LLVM Register Allocation
LLVM Register AllocationLLVM Register Allocation
LLVM Register Allocation
 
Introduction to Perf
Introduction to PerfIntroduction to Perf
Introduction to Perf
 
SSA - PHI-functions Placements
SSA - PHI-functions PlacementsSSA - PHI-functions Placements
SSA - PHI-functions Placements
 

Recently uploaded

Using IESVE for Room Loads Analysis - Australia & New Zealand
Using IESVE for Room Loads Analysis - Australia & New ZealandUsing IESVE for Room Loads Analysis - Australia & New Zealand
Using IESVE for Room Loads Analysis - Australia & New Zealand
IES VE
 
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital TransformationWSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2
 
First Steps with Globus Compute Multi-User Endpoints
First Steps with Globus Compute Multi-User EndpointsFirst Steps with Globus Compute Multi-User Endpoints
First Steps with Globus Compute Multi-User Endpoints
Globus
 
De mooiste recreatieve routes ontdekken met RouteYou en FME
De mooiste recreatieve routes ontdekken met RouteYou en FMEDe mooiste recreatieve routes ontdekken met RouteYou en FME
De mooiste recreatieve routes ontdekken met RouteYou en FME
Jelle | Nordend
 
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, BetterWebinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
XfilesPro
 
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoamOpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
takuyayamamoto1800
 
Globus Connect Server Deep Dive - GlobusWorld 2024
Globus Connect Server Deep Dive - GlobusWorld 2024Globus Connect Server Deep Dive - GlobusWorld 2024
Globus Connect Server Deep Dive - GlobusWorld 2024
Globus
 
Advanced Flow Concepts Every Developer Should Know
Advanced Flow Concepts Every Developer Should KnowAdvanced Flow Concepts Every Developer Should Know
Advanced Flow Concepts Every Developer Should Know
Peter Caitens
 
Enhancing Research Orchestration Capabilities at ORNL.pdf
Enhancing Research Orchestration Capabilities at ORNL.pdfEnhancing Research Orchestration Capabilities at ORNL.pdf
Enhancing Research Orchestration Capabilities at ORNL.pdf
Globus
 
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
Juraj Vysvader
 
Into the Box 2024 - Keynote Day 2 Slides.pdf
Into the Box 2024 - Keynote Day 2 Slides.pdfInto the Box 2024 - Keynote Day 2 Slides.pdf
Into the Box 2024 - Keynote Day 2 Slides.pdf
Ortus Solutions, Corp
 
Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024
Globus
 
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Globus
 
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Globus
 
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Shahin Sheidaei
 
Corporate Management | Session 3 of 3 | Tendenci AMS
Corporate Management | Session 3 of 3 | Tendenci AMSCorporate Management | Session 3 of 3 | Tendenci AMS
Corporate Management | Session 3 of 3 | Tendenci AMS
Tendenci - The Open Source AMS (Association Management Software)
 
Designing for Privacy in Amazon Web Services
Designing for Privacy in Amazon Web ServicesDesigning for Privacy in Amazon Web Services
Designing for Privacy in Amazon Web Services
KrzysztofKkol1
 
How Recreation Management Software Can Streamline Your Operations.pptx
How Recreation Management Software Can Streamline Your Operations.pptxHow Recreation Management Software Can Streamline Your Operations.pptx
How Recreation Management Software Can Streamline Your Operations.pptx
wottaspaceseo
 
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
informapgpstrackings
 
How Does XfilesPro Ensure Security While Sharing Documents in Salesforce?
How Does XfilesPro Ensure Security While Sharing Documents in Salesforce?How Does XfilesPro Ensure Security While Sharing Documents in Salesforce?
How Does XfilesPro Ensure Security While Sharing Documents in Salesforce?
XfilesPro
 

Recently uploaded (20)

Using IESVE for Room Loads Analysis - Australia & New Zealand
Using IESVE for Room Loads Analysis - Australia & New ZealandUsing IESVE for Room Loads Analysis - Australia & New Zealand
Using IESVE for Room Loads Analysis - Australia & New Zealand
 
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital TransformationWSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
 
First Steps with Globus Compute Multi-User Endpoints
First Steps with Globus Compute Multi-User EndpointsFirst Steps with Globus Compute Multi-User Endpoints
First Steps with Globus Compute Multi-User Endpoints
 
De mooiste recreatieve routes ontdekken met RouteYou en FME
De mooiste recreatieve routes ontdekken met RouteYou en FMEDe mooiste recreatieve routes ontdekken met RouteYou en FME
De mooiste recreatieve routes ontdekken met RouteYou en FME
 
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, BetterWebinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
 
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoamOpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
 
Globus Connect Server Deep Dive - GlobusWorld 2024
Globus Connect Server Deep Dive - GlobusWorld 2024Globus Connect Server Deep Dive - GlobusWorld 2024
Globus Connect Server Deep Dive - GlobusWorld 2024
 
Advanced Flow Concepts Every Developer Should Know
Advanced Flow Concepts Every Developer Should KnowAdvanced Flow Concepts Every Developer Should Know
Advanced Flow Concepts Every Developer Should Know
 
Enhancing Research Orchestration Capabilities at ORNL.pdf
Enhancing Research Orchestration Capabilities at ORNL.pdfEnhancing Research Orchestration Capabilities at ORNL.pdf
Enhancing Research Orchestration Capabilities at ORNL.pdf
 
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
 
Into the Box 2024 - Keynote Day 2 Slides.pdf
Into the Box 2024 - Keynote Day 2 Slides.pdfInto the Box 2024 - Keynote Day 2 Slides.pdf
Into the Box 2024 - Keynote Day 2 Slides.pdf
 
Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024
 
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
 
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
 
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
 
Corporate Management | Session 3 of 3 | Tendenci AMS
Corporate Management | Session 3 of 3 | Tendenci AMSCorporate Management | Session 3 of 3 | Tendenci AMS
Corporate Management | Session 3 of 3 | Tendenci AMS
 
Designing for Privacy in Amazon Web Services
Designing for Privacy in Amazon Web ServicesDesigning for Privacy in Amazon Web Services
Designing for Privacy in Amazon Web Services
 
How Recreation Management Software Can Streamline Your Operations.pptx
How Recreation Management Software Can Streamline Your Operations.pptxHow Recreation Management Software Can Streamline Your Operations.pptx
How Recreation Management Software Can Streamline Your Operations.pptx
 
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
 
How Does XfilesPro Ensure Security While Sharing Documents in Salesforce?
How Does XfilesPro Ensure Security While Sharing Documents in Salesforce?How Does XfilesPro Ensure Security While Sharing Documents in Salesforce?
How Does XfilesPro Ensure Security While Sharing Documents in Salesforce?
 

GCC GENERIC

  • 2. • The purpose of GENERIC is simply to provide a language-independent way of representing an entire function in trees. • A statement is defined as any expression whose value is ignored. • A statement will always have TREE_SIDE_EFFECTS set
  • 3. • You can tell what kind of node a particular tree is by using the TREE_CODE macro. • All GENERIC trees have two fields in common. • TREE_CHAIN • a pointer be used as a singly-linked list • TREE_TYPE
  • 4. code & flags tree type tree chain struct tree_base struct tree_typed struct tree_common typedef union tree_node *tree typedef const union tree_node *const_tree union tree_node
  • 5. IDENTIFIER_NODE • There are never two distinct IDENTIFIER_NODEs representing the same identifier. • IDENTIFIER_POINTER • IDENTIFIER_LENGTH
  • 6. Container • Two kinds of container • TREE_LIST • TREE_PURPOSE • TREE_VALUE • The next node is found by following the TREE_CHAIN • TREE_VEC • TREE_VEC_LENGTH • TREE_VEC_ELT
  • 7. code & flags tree type tree chain struct tree_base struct tree_typed struct tree_common tree_list purposetree valuetree code & flags tree type tree chain purpose value tree_list NULL_TREE
  • 8. code & flags tree type tree chain struct tree_base struct tree_typed struct tree_common tree_vec a[1]tree
  • 9. TYPE • INTEGER_TYPE • REAL_TYPE • FIXED_POINT_TYPE • COMPLEX_TYPE • ENUMERAL_TYPE • BOOLEAN_TYPE • POINTER_TYPE • REFERENCE_TYPE • FUNCTION_TYPE • METHOD_TYPE • ARRAY_TYPE • RECORD_TYPE • UNION_TYPE • QUAL_UNION_TYPE • LANG_TYPE • OFFSET_TYPE
  • 10. Declarations • LABEL_DECL • CONST_DECL • enumeration constants • RESULT_DECL • the value returned by a function • TYPE_DECL • typedef declarations • VAR_DECL • variables with namespace or block scope • static data members • PARM_DECL • a parameter to a function • DEBUG_EXPR_DECL • FIELD_DECL • non-static data members • NAMESPACE_DECL
  • 11. VAR_DECL • DECL_SIZE • DECL_ALIGN • DECL_THIS_STATIC • static variable • DECL_THIS_EXTERN • extern variable • DECL_INITIAL • an expression for the initialiser
  • 12. PARM_DECL • DECL_ARGUMENTS • DECL_ARG_TYPE • the type that will actually be used when a value is passed to this function
  • 13. Attributes • TREE_LIST • TREE_PURPOSE • the name of the attribute • TREE_VALUE • TREE_LIST of the arguments of the attribute • TREE_CHAIN • next attribute • DECL_ATTRIBUTES (tree decl) • DECL_ATTRIBUTES (tree type)
  • 14. Statements • ASM_EXPR • inline assembly • DECL_EXPR • a local declaration • LABEL_EXPR • GOTO_EXPR • goto statement • RETURN_EXPR • return statement • LOOP_EXPR • infinite loop • EXIT_EXPR • conditional exit from the nearest LOOP_EXPR • SWITCH_EXPR • switch statement • CASE_LABEL_EXPR • a case label
  • 17. FUNCTION_DECL BIND_EXPR saved_tree gimplify_stmt int test_gimple(int param_a, char param_b, float param_c) { int local; local = param_a + param_b; local = (int)((float)local * param_c); return local; } locus VOID_TYPE type VAR_DECL operands[0] INTEGER_TYPE type BLOCK operands[2] STATEMENT_LIST operands[1] DECL_EXPR head VAR_DECL operands[0] INTEGER_TYPE type MODIFY_EXPR VAR_DECL PLUS_EXPR operands[0] operands[1] INTEGER_TYPE type NOP_EXPR PARM_DECL operands[0] operands[1] PARM_DECL operands[0]
  • 18. Functions • A function is represented by a FUNCTION_DECL node. • DECL_NAME • DECL_ASSEMBLER_NAME • DECL_ARGUMENTS • PARM_DECL for the first argument • Subsequent PARM_DECL nodes can be obtained by following the TREE_CHAIN links. • DECL_RESULT • RESULT_DECL • DECL_SAVED_TREE • the complete body of the function • TREE_TYPE • FUNCTION_TYPE • METHOD_TYPE
  • 19. FUNCTION_DECL FUNCTION_TYPE PARM_DECL RESULT_DECL INTEGER_TYPEPARM_DECL PARM_DECL type type arguments result chain chain vec<tree> fnargs INTEGER_TYPE initial gimplify_parameters INTEGER_TYPE size_unit REAL_TYPE type REAL_TYPE initial int test_gimple(int param_a, char param_b, float param_c) { int local; local = param_a + param_b; local = (int)((float)local * param_c); return local; }